/* ===================================
   FAQ Page Specific Styles
   =================================== */

/* Crop transparent side margins and center the mascot's visible artwork. */
.faq-hero-band .faq-mascot-illustration {
    display: block;
    width: 10rem;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: 40% center;
}

@media (min-width: 1024px) {
    .faq-hero-band .faq-mascot-illustration {
        width: 14rem;
    }
}

@media (max-width: 480px) {
    .faq-hero-band .faq-mascot-illustration {
        width: 9rem;
    }
}

/* Breadcrumb Styles */
.breadcrumb-link {
    color: oklch(0.5486 0 0);
    /* muted-foreground */
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-link:hover {
    color: oklch(0.1448 0 0);
    /* foreground */
}

.breadcrumb-current {
    color: oklch(0.6489 0.1370 162.4);
    /* primary */
    font-weight: 600;
    position: relative;
}

.breadcrumb-current::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: oklch(0.6489 0.1370 162.4);
    /* primary */
    border-radius: 1px;
}

/* Navigation Link States (Specific to FAQ page usage) */
.nav-link {
    color: oklch(0.5486 0 0);
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: oklch(0.1448 0 0);
}

.nav-link.active {
    color: oklch(0.6489 0.1370 162.4);
    font-weight: 500;
}

/* FAQ Card Container */
.faq-card {
    background: white;
    border: 1px solid oklch(0.9219 0 0);
    /* border */
    border-radius: 0.75rem;
    /* radius-lg */
    transition: all 0.3s ease;
}

.faq-card:hover {
    border-color: oklch(0.6489 0.1370 162.4);
    /* primary */
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    /* shadow-md */
}

/* Pure CSS Accordion Items */
.faq-item {
    border: 1px solid oklch(0.9219 0 0);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.faq-item:hover {
    border-color: oklch(0.6489 0.1370 162.4);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

input.faq-toggle,
input[type="checkbox"].faq-toggle,
.faq-toggle {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    z-index: -9999 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    border: none !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
}

.faq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
}

.faq-header:hover {
    background: rgba(16, 185, 129, 0.05);
    /* accent/0.5 approx */
}

.faq-question {
    font-size: 1.125rem;
    font-weight: 600;
    color: oklch(0.1448 0 0);
    transition: color 0.2s ease;
}

.faq-chevron {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: oklch(0.9702 0 0);
    /* muted */
    color: oklch(0.5486 0 0);
    /* muted-foreground */
    transition: all 0.3s ease;
    transform: rotate(0deg);
}

/* FAQ Content Transitions */
.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    background: white;
}

.faq-answer {
    padding: 0 1.5rem 1.5rem 1.5rem;
    color: oklch(0.5486 0 0);
    line-height: 1.6;
    border-top: 1px dashed oklch(0.9219 0 0);
    margin-top: 1px;
    padding-top: 1rem;
}

/* Toggle States */
.faq-toggle:checked+.faq-header .faq-question {
    color: oklch(0.6489 0.1370 162.4);
}

.faq-toggle:checked+.faq-header .faq-chevron {
    background: rgba(16, 185, 129, 0.1);
    color: oklch(0.6489 0.1370 162.4);
    transform: rotate(180deg);
}

.faq-toggle:checked~.faq-content {
    max-height: 1000px;
    /* Increased to accommodate longer answers */
    transition: max-height 0.5s ease-in;
}

/* Category Buttons */
.category-btn {
    text-align: left;
    transition: all 0.2s ease;
}

.category-btn.active {
    background: rgba(16, 185, 129, 0.1);
    color: oklch(0.6489 0.1370 162.4);
    font-weight: 600;
    border-right: 3px solid oklch(0.6489 0.1370 162.4);
}

.category-icon {
    transition: color 0.2s ease;
}

.category-btn.active .category-icon {
    color: oklch(0.6489 0.1370 162.4);
}

/* Interactive Background */
#interactive-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background:
        radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(74, 222, 128, 0.1) 0%,
            rgba(59, 130, 246, 0.1) 40%,
            transparent 80%),
        linear-gradient(to bottom right, #ffffff, #f9fafb);
}

/* Helper Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* ===================================
   Mobile Responsive Styles (768px)
   =================================== */
@media (max-width: 768px) {

    /* ----- Performance: Disable Heavy Effects ----- */
    #interactive-background {
        background: linear-gradient(to bottom right, #ffffff, #f9fafb) !important;
    }

    .faq-item:hover {
        box-shadow: none !important;
    }

    .faq-card:hover {
        box-shadow: none !important;
    }

    /* ----- Hero Section Optimization ----- */
    .faq-hero-illustration {
        max-width: 120px !important;
        height: auto !important;
    }

    .faq-hero-title {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.5rem !important;
    }

    .faq-hero-subtitle {
        font-size: 0.875rem !important;
        line-height: 1.5 !important;
    }

    .faq-hero-section {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* ----- Categories Navigation: Horizontal Scroll ----- */
    .faq-categories-container {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow-x: auto !important;
        gap: 0.5rem !important;
        padding-bottom: 0.75rem !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .faq-categories-container::-webkit-scrollbar {
        display: none;
    }

    .faq-categories-container > * + * {
        margin-top: 0 !important;
    }

    .category-btn {
        flex-shrink: 0 !important;
        width: auto !important;
        white-space: nowrap !important;
        padding: 0.5rem 0.875rem !important;
        font-size: 0.8125rem !important;
        border-radius: 9999px !important;
        background: oklch(0.9702 0 0) !important;
        border: 1px solid oklch(0.9219 0 0) !important;
        border-right: 1px solid oklch(0.9219 0 0) !important;
    }

    .category-btn.active {
        background: rgba(16, 185, 129, 0.15) !important;
        border-color: oklch(0.6489 0.1370 162.4) !important;
        border-right-width: 1px !important;
    }

    .category-icon {
        width: 1rem !important;
        height: 1rem !important;
    }

    .faq-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* ----- FAQ List Items: Compact ----- */
    .faq-item {
        margin-bottom: 0.75rem !important;
        border-radius: 0.5rem !important;
    }

    .faq-header {
        padding: 0.875rem 1rem !important;
    }

    .faq-question {
        font-size: 0.9375rem !important;
        line-height: 1.4 !important;
    }

    .faq-chevron {
        width: 1.5rem !important;
        height: 1.5rem !important;
        flex-shrink: 0 !important;
    }

    .faq-chevron svg {
        width: 0.875rem !important;
        height: 0.875rem !important;
    }

    .faq-answer {
        padding: 0.75rem 1rem 1rem 1rem !important;
        font-size: 0.875rem !important;
        line-height: 1.6 !important;
    }

    /* ----- Contact Support Card ----- */
    .faq-support-card {
        padding: 1rem !important;
    }

    .faq-support-card h3 {
        font-size: 0.9375rem !important;
    }

    .faq-support-card p {
        font-size: 0.8125rem !important;
    }

    /* ----- Section Spacing ----- */
    .faq-main-content {
        padding-top: 1rem !important;
        padding-bottom: 1.5rem !important;
    }

    .faq-section-title {
        font-size: 1.125rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* ===================================
   Small Mobile Styles (480px)
   =================================== */
@media (max-width: 480px) {
    .faq-hero-illustration {
        max-width: 100px !important;
    }

    .faq-hero-title {
        font-size: 1.25rem !important;
    }

    .faq-hero-subtitle {
        font-size: 0.8125rem !important;
    }

    .category-btn {
        padding: 0.375rem 0.75rem !important;
        font-size: 0.75rem !important;
    }

    .faq-question {
        font-size: 0.875rem !important;
    }

    .faq-answer {
        font-size: 0.8125rem !important;
    }
}

/* ===================================
   Page Mode: FAQ night / high_contrast
   =================================== */
html[data-kiki-page-mode="night"] #interactive-background {
    background:
        radial-gradient(640px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
            rgba(74, 222, 165, 0.12),
            rgba(14, 165, 233, 0.045) 42%,
            transparent 76%),
        var(--kiki-night-page-bg) !important;
}

html[data-kiki-page-mode="night"] .faq-hero-band {
    background: linear-gradient(145deg, rgba(32, 37, 34, 0.96), rgba(48, 57, 54, 0.84)) !important;
    border-bottom: 1px solid var(--kiki-night-border);
}

html[data-kiki-page-mode="night"] .faq-hero-decoration {
    opacity: 0.2;
}

html[data-kiki-page-mode="night"] .faq-item,
html[data-kiki-page-mode="night"] .faq-card,
html[data-kiki-page-mode="night"] .faq-header,
html[data-kiki-page-mode="night"] .faq-content,
html[data-kiki-page-mode="night"] .bg-white {
    background-color: var(--kiki-night-surface) !important;
    color: var(--kiki-night-text-primary) !important;
    border-color: var(--kiki-night-border) !important;
}

html[data-kiki-page-mode="night"] .faq-item:hover,
html[data-kiki-page-mode="night"] .faq-card:hover {
    border-color: rgba(74, 222, 165, 0.45) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24) !important;
}

html[data-kiki-page-mode="night"] .faq-header:hover {
    background: var(--kiki-night-surface-raised) !important;
}

html[data-kiki-page-mode="night"] .faq-question {
    color: var(--kiki-night-text-primary) !important;
}

html[data-kiki-page-mode="night"] .faq-chevron {
    background: var(--kiki-night-surface-soft) !important;
    color: var(--kiki-night-accent) !important;
}

html[data-kiki-page-mode="night"] .faq-answer {
    border-top-color: var(--kiki-night-border) !important;
}

html[data-kiki-page-mode="night"] .category-btn:hover,
html[data-kiki-page-mode="night"] .category-btn.active {
    background: rgba(74, 222, 165, 0.1) !important;
    color: var(--kiki-night-accent) !important;
    border-color: rgba(74, 222, 165, 0.42) !important;
}

html[data-kiki-page-mode="high_contrast"] #interactive-background,
html[data-kiki-page-mode="high_contrast"] .faq-hero-band {
    background: #000000 !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-hero-band {
    border-bottom: 2px solid #ffffff;
}

html[data-kiki-page-mode="high_contrast"] .faq-hero-decoration {
    display: none !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-item,
html[data-kiki-page-mode="high_contrast"] .faq-card,
html[data-kiki-page-mode="high_contrast"] .faq-header,
html[data-kiki-page-mode="high_contrast"] .faq-content {
    background-color: var(--kiki-hc-surface) !important;
    color: var(--kiki-hc-text-primary) !important;
    border: 2px solid var(--kiki-hc-border) !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-header,
html[data-kiki-page-mode="high_contrast"] .faq-content {
    border: 0 !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-item:hover,
html[data-kiki-page-mode="high_contrast"] .faq-card:hover {
    border-color: var(--kiki-hc-accent) !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-question,
html[data-kiki-page-mode="high_contrast"] .faq-answer {
    color: #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-answer {
    border-top: 2px dashed #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-chevron {
    background: #000000 !important;
    border: 2px solid #ffffff;
    color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-toggle:checked + .faq-header .faq-question {
    color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] .category-btn,
html[data-kiki-page-mode="high_contrast"] .category-btn:hover,
html[data-kiki-page-mode="high_contrast"] .category-btn.active {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .category-btn.active {
    color: var(--kiki-hc-accent) !important;
    border-color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="night"] .faq-answer,
html[data-kiki-page-mode="night"] .text-gray-600,
html[data-kiki-page-mode="night"] .text-slate-600 {
    color: var(--kiki-night-text-secondary) !important;
}

html[data-kiki-page-mode="night"] .category-btn {
    background: var(--kiki-night-surface) !important;
    border-color: var(--kiki-night-border) !important;
    color: var(--kiki-night-text-secondary) !important;
    box-shadow: none !important;
}

html[data-kiki-page-mode="night"] .breadcrumb-link {
    color: var(--kiki-night-text-secondary) !important;
}

html[data-kiki-page-mode="night"] .breadcrumb-link:hover,
html[data-kiki-page-mode="night"] .faq-support-card h4 {
    color: var(--kiki-night-accent) !important;
}

html[data-kiki-page-mode="night"] .faq-support-card p {
    color: var(--kiki-night-text-secondary) !important;
}

html[data-kiki-page-mode="night"] .faq-support-card a {
    background: var(--kiki-night-accent) !important;
    color: #06100d !important;
}

html[data-kiki-page-mode="night"] .faq-footer {
    background: var(--kiki-night-page-bg) !important;
    border-color: var(--kiki-night-border) !important;
    color: var(--kiki-night-text-primary) !important;
}

html[data-kiki-page-mode="night"] .faq-footer a:hover {
    color: var(--kiki-night-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-answer {
    color: var(--kiki-hc-text-primary) !important;
}

html[data-kiki-page-mode="high_contrast"] .breadcrumb-link {
    color: #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .breadcrumb-link:hover,
html[data-kiki-page-mode="high_contrast"] .faq-support-card h4 {
    color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-support-card p {
    color: #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-support-card a {
    background: var(--kiki-hc-accent) !important;
    color: #000000 !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-footer {
    background: #000000 !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
}

html[data-kiki-page-mode="high_contrast"] .faq-footer a:hover {
    color: var(--kiki-hc-accent) !important;
}

html[data-kiki-page-mode="high_contrast"] [aria-current="true"] {
    outline: 3px solid var(--kiki-hc-focus-ring);
    outline-offset: 3px;
}
