/**
 * FAQ Section Styles - GEO-optimiert
 *
 * Styling für Rank Math FAQ Block auf der Startseite
 * Passt zum SLV Transporte Design (Blau/Gelb)
 *
 * FEATURES:
 * - Aufklappbares Accordion (platzsparend)
 * - Smooth Animationen
 * - Vollständige Accessibility (ARIA, Keyboard)
 * - Mobile-optimiert
 *
 * @package SLV_Transporte
 * @since 1.0.0
 * @updated 2025-12-18 - Accordion-Funktionalität hinzugefügt
 */

/* ===========================================
   FAQ SECTION CONTAINER
   =========================================== */

.faq-section {
    padding: var(--wp--preset--spacing--l) 0;
    background-color: var(--wp--preset--color--bg-light, #F9FAFB);
}

/* ===========================================
   RANK MATH FAQ BLOCK
   =========================================== */

/**
 * Main Container
 */
#rank-math-faq,
.rank-math-block {
    max-width: 900px;
    margin: var(--wp--preset--spacing--m) auto 0;
    padding: 0 var(--wp--preset--spacing--s);
}

/**
 * FAQ List
 */
.rank-math-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--wp--preset--spacing--s);
}

/**
 * FAQ Item
 */
.rank-math-list-item {
    background: var(--wp--preset--color--bg-white, #FFFFFF);
    border-radius: 12px;
    padding: var(--wp--preset--spacing--m);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid var(--wp--preset--color--primary-yellow, #FCBC5B);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.rank-math-list-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/**
 * Question (Title) - Accordion Trigger
 * Klickbar zum Öffnen/Schließen der Antwort
 */
.rank-math-question {
    font-family: var(--wp--preset--font-family--heading);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--wp--preset--color--text-dark, #1A1A1A);
    margin: 0;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 2.5rem; /* Platz für Toggle-Icon */
    transition: color 0.2s ease;
}

/* Hover-Effekt auf Frage */
.rank-math-question:hover {
    color: var(--wp--preset--color--primary-blue, #5CB8E9);
}

/* Question Icon (Fragezeichen) */
.rank-math-question::before {
    content: "?";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg,
        var(--wp--preset--color--primary-blue, #5CB8E9) 0%,
        var(--wp--preset--color--blue-dark, #1177A0) 100%
    );
    color: white;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 50%;
}

/* Toggle Icon (Chevron) - SVG-basiert für bessere Sichtbarkeit */
.rank-math-question::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Chevron-Down SVG als Background */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231177A0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
    background-color: var(--wp--preset--color--bg-light, #F0F4F8);
    border-radius: 50%;
    border: 2px solid var(--wp--preset--color--primary-blue, #5CB8E9);
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.3s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* Hover-Effekt auf Toggle Icon */
.rank-math-question:hover::after {
    background-color: var(--wp--preset--color--primary-blue, #5CB8E9);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Toggle Icon im geöffneten Zustand - Chevron rotiert nach oben */
.rank-math-list-item.is-open .rank-math-question::after {
    transform: translateY(-50%) rotate(180deg);
    background-color: var(--wp--preset--color--primary-yellow, #FCBC5B);
    border-color: var(--wp--preset--color--primary-yellow, #FCBC5B);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231A1A1A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/**
 * Answer - Accordion Content
 * Standardmäßig versteckt, wird per JS geöffnet
 */
.rank-math-answer {
    font-family: var(--wp--preset--font-family--body);
    font-size: 1rem;
    color: var(--wp--preset--color--text-muted, #6B6B6B);
    line-height: 1.7;
    padding-left: calc(28px + 0.75rem);
    /* Accordion Animation */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding-top: 0;
    padding-bottom: 0;
}

/* Geöffneter Zustand */
.rank-math-list-item.is-open .rank-math-answer {
    max-height: 500px; /* Ausreichend für lange Antworten */
    opacity: 1;
    padding-top: 0.75rem;
    padding-bottom: 0;
}

.rank-math-answer p {
    margin: 0;
}

.rank-math-answer p + p {
    margin-top: 0.75rem;
}

/* ===========================================
   ERSTES FAQ ITEM OFFEN (Initial State)
   Optional: Erstes Item standardmäßig öffnen
   =========================================== */

/* Falls gewünscht: erstes Item automatisch öffnen
.rank-math-list-item:first-child .rank-math-answer {
    max-height: 500px;
    opacity: 1;
    padding-top: 0.75rem;
}
.rank-math-list-item:first-child .rank-math-question::after {
    content: "−";
    background: var(--wp--preset--color--primary-yellow, #FCBC5B);
    color: var(--wp--preset--color--text-dark, #1A1A1A);
}
*/

/* ===========================================
   RESPONSIVE DESIGN
   =========================================== */

/* Tablet */
@media (max-width: 1023px) {
    .faq-section {
        padding: var(--wp--preset--spacing--m) 0;
    }

    #rank-math-faq,
    .rank-math-block {
        padding: 0 var(--wp--preset--spacing--s);
    }

    .rank-math-list-item {
        padding: 1.25rem;
    }

    .rank-math-question {
        font-size: 1.0625rem;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .faq-section {
        padding: var(--wp--preset--spacing--s) 0;
    }

    #rank-math-faq,
    .rank-math-block {
        padding: 0;
        margin-top: var(--wp--preset--spacing--s);
    }

    .rank-math-list {
        gap: 0.75rem;
    }

    .rank-math-list-item {
        padding: 1rem;
        border-radius: 8px;
        border-left-width: 3px;
    }

    .rank-math-question {
        font-size: 1rem;
        gap: 0.5rem;
        padding-right: 2rem; /* Weniger Platz für Toggle-Icon auf Mobile */
    }

    .rank-math-question::before {
        width: 24px;
        height: 24px;
        font-size: 0.875rem;
    }

    /* Toggle Icon Mobile */
    .rank-math-question::after {
        width: 28px;
        height: 28px;
        background-size: 16px 16px;
        border-width: 2px;
    }

    .rank-math-answer {
        font-size: 0.9375rem;
        padding-left: calc(24px + 0.5rem);
        line-height: 1.6;
    }

    /* Geöffneter Zustand Mobile */
    .rank-math-list-item.is-open .rank-math-answer {
        padding-top: 0.5rem;
    }
}

/* ===========================================
   ACCESSIBILITY
   =========================================== */

/* Focus States für Fragen (Keyboard Navigation) */
.rank-math-question:focus {
    outline: 3px solid var(--wp--preset--color--primary-yellow, #FCBC5B);
    outline-offset: 2px;
    border-radius: 4px;
}

.rank-math-question:focus:not(:focus-visible) {
    outline: none; /* Kein Focus-Ring bei Mausklick */
}

.rank-math-question:focus-visible {
    outline: 3px solid var(--wp--preset--color--primary-yellow, #FCBC5B);
    outline-offset: 2px;
}

/* Fallback für ältere Browser */
.rank-math-list-item:focus-within {
    outline: 3px solid var(--wp--preset--color--primary-yellow, #FCBC5B);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .rank-math-list-item {
        transition: none;
    }

    .rank-math-list-item:hover {
        transform: none;
    }

    /* Accordion ohne Animation */
    .rank-math-answer {
        transition: none;
    }

    .rank-math-question,
    .rank-math-question::after {
        transition: none;
    }
}

/* High Contrast */
@media (prefers-contrast: high) {
    .rank-math-list-item {
        border: 2px solid var(--wp--preset--color--text-dark, #1A1A1A);
        box-shadow: none;
    }

    .rank-math-question::before {
        background: var(--wp--preset--color--text-dark, #1A1A1A);
    }
}

/* ===========================================
   PRINT STYLES
   =========================================== */

@media print {
    .faq-section {
        background: none;
        padding: 1rem 0;
    }

    .rank-math-list-item {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .rank-math-question::before {
        background: #333;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Toggle-Icon beim Drucken ausblenden */
    .rank-math-question::after {
        display: none;
    }

    /* Alle Antworten beim Drucken anzeigen */
    .rank-math-answer {
        max-height: none;
        opacity: 1;
        overflow: visible;
        padding-top: 0.5rem;
    }
}

/* ===========================================
   FAQ SECTION HEADING
   =========================================== */

.faq-section > .wp-block-heading {
    margin-bottom: var(--wp--preset--spacing--xs);
}

.faq-section > .wp-block-heading + p {
    margin-bottom: var(--wp--preset--spacing--m);
}

/* ===========================================
   FAQ ITEMS SCROLL ANIMATION
   Sequenzielles Einblenden beim Scroll
   @since 1.2.0 - Animation Enhancement Phase 3
   =========================================== */

/**
 * FAQ Items Initial State
 * Startet unsichtbar mit leichtem Offset von links
 * Wird durch scroll-animations.js aktiviert
 */
.rank-math-list-item.scroll-reveal {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

/**
 * FAQ Items Visible State
 * Eingeblendet und an Position
 */
.rank-math-list-item.scroll-reveal.is-visible {
    opacity: 1;
    transform: translateX(0);
}

/**
 * Stagger-Delays für sequenzielles Einblenden
 * 80ms Versatz pro Item = sanfte Welle von oben nach unten
 * Gesamtdauer: ~640ms für alle 8 Items
 */
.rank-math-list-item:nth-child(1).scroll-reveal { transition-delay: 0ms; }
.rank-math-list-item:nth-child(2).scroll-reveal { transition-delay: 80ms; }
.rank-math-list-item:nth-child(3).scroll-reveal { transition-delay: 160ms; }
.rank-math-list-item:nth-child(4).scroll-reveal { transition-delay: 240ms; }
.rank-math-list-item:nth-child(5).scroll-reveal { transition-delay: 320ms; }
.rank-math-list-item:nth-child(6).scroll-reveal { transition-delay: 400ms; }
.rank-math-list-item:nth-child(7).scroll-reveal { transition-delay: 480ms; }
.rank-math-list-item:nth-child(8).scroll-reveal { transition-delay: 560ms; }

/**
 * Accessibility: Reduced Motion
 * Deaktiviert Animation für Nutzer mit Bewegungsempfindlichkeit
 */
@media (prefers-reduced-motion: reduce) {
    .rank-math-list-item.scroll-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
