/* =================================================================
   CSS CUSTOM PROPERTIES
   ================================================================= */
:root {
    /* --- Layout ---
       Change these values here — they cascade everywhere automatically */
    --header-h:      64px;
    --aside-w:       22.5%;
    --col-header-w:  30%;
    /* ^ faq-category-header width within faq-content
         faq-category-body takes the remaining ~70%
         Valid range: 25%–35% */

    --sticky-gap:    1.5rem;
    /* ^ breathing room above sticky faq-category-header
         set to 0rem to remove the gap entirely */

    --sticky-top: calc(var(--header-h) + var(--sticky-gap));

    /* --- Typography --- */
    --font-display: 'Lora', Georgia, serif;
    --font-ui:      'Inter', system-ui, sans-serif;
    --font-body:    'DM Sans', system-ui, sans-serif;

    /* --- Base colors --- */
    --clr-bg:          #fdfdfd;
    --clr-surface:     #f7f8fa;
    --clr-border:      #e2e6ec;
    --clr-border-soft: rgba(0, 0, 0, 0.06);
    --clr-text:        #0f1117;
    --clr-muted:       #64748b;
    --clr-subtle:      #94a3b8;

    /* --- Transition shorthand --- */
    --ease: 0.22s ease;
}

/* -----------------------------------------------------------------
   PER-CATEGORY ACCENT COLORS
   Set via data-category attribute on each .faq-category section.
   --cat-color      → title, topic dash, icon/track on hover, nav active text/border
   --cat-color-soft → nav active background
   ----------------------------------------------------------------- */
.faq-category[data-category="adjusters"]         { --cat-color: #2563eb; --cat-color-soft: #eff4ff; }
.faq-category[data-category="policyholders"]     { --cat-color: #0d9488; --cat-color-soft: #f0fdfa; }
.faq-category[data-category="relocation-agents"] { --cat-color: #7c3aed; --cat-color-soft: #f5f3ff; }
.faq-category[data-category="lease-legal"]       { --cat-color: #b45309; --cat-color-soft: #fffbeb; }
.faq-category[data-category="emergency-support"] { --cat-color: #dc2626; --cat-color-soft: #fef2f2; }


/* =================================================================
   RESET & BASE
   ================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    /* Lenis owns smooth scrolling — keep native scroll instant */
    scroll-behavior: auto;
}

body {
    font-family: var(--font-body);
    background-color: var(--clr-bg);
    color: var(--clr-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }


/* =================================================================
   SITE HEADER — sticky at top, z-index above all content
   ================================================================= */
.site-header {
    height: var(--header-h);
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--clr-bg);
    border-bottom: 1px solid var(--clr-border);
    /* Prevents CSS transitions from conflicting with GSAP if header animates later */
    transition: none !important;
    will-change: transform;
}

.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.site-logo {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.header-nav ul {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-nav a {
    font-size: 0.875rem;
    color: var(--clr-muted);
    transition: color var(--ease);
}

.header-nav a:hover                { color: var(--clr-text); }
.header-nav a[aria-current="page"] { color: var(--clr-text); font-weight: 500; }

.header-cta {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    background: var(--clr-surface);
    color: var(--clr-text) !important;
    font-weight: 500 !important;
    transition: background var(--ease) !important;
}
.header-cta:hover { background: var(--clr-border) !important; }


/* =================================================================
   FAQ PAGE — three-column flex container
   IMPORTANT: Do NOT add overflow: hidden to this element.
   overflow: hidden on any ancestor will break position: sticky
   on .faq-aside-inner and .faq-category-header.
   ================================================================= */
.faq-page {
    display: flex;
    align-items: stretch;   /* aside stretches to full content height — required for sticky */
    max-width: 1440px;
    margin: 0 auto;
    min-height: calc(100vh - var(--header-h));
}


/* =================================================================
   ASIDE — sticky left column for the entire page scroll duration
   ================================================================= */
.faq-aside {
    width: var(--aside-w);
    flex-shrink: 0;
    border-right: 1px solid var(--clr-border);
    /* aside stretches to content height via parent align-items: stretch */
}

/*
   The inner wrapper is what actually sticks.
   The aside is as tall as all FAQ content; the inner sticks within it.
*/
.faq-aside-inner {
    position: sticky;
    top: var(--header-h);                       /* clears the site header */
    height: calc(100vh - var(--header-h));       /* fills remaining viewport height */
    overflow-y: auto;
    padding: 2.5rem 1.25rem 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    /* GPU hint — tells the browser this element will move */
    will-change: transform;
    /* Prevents CSS transitions from fighting GSAP */
    transition: none !important;

    scrollbar-width: thin;
    scrollbar-color: var(--clr-border) transparent;
}

.faq-aside-inner::-webkit-scrollbar       { width: 3px; }
.faq-aside-inner::-webkit-scrollbar-track { background: transparent; }
.faq-aside-inner::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 2px; }


/* "Frequently / Asked / Questions" — stacked typographic heading */
.faq-aside-heading {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--clr-border);
}

.faq-aside-heading span {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.2vw, 2.25rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--clr-text);
}

/* "Asked" — indented and muted, matches the ASCII layout brief */
.faq-aside-heading span:nth-child(2) {
    padding-left: 1rem;
    color: var(--clr-muted);
    font-style: italic;
}

.faq-aside-heading span:nth-child(3) { font-weight: 600; }


/* =================================================================
   FAQ NAV — category links inside the aside
   Active state colors are injected by JS via --active-color / --active-bg
   so each link inherits its category's accent color when active.
   ================================================================= */
.faq-nav ul {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.faq-nav-link {
    display: block;
    padding: 0.5rem 0.875rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--clr-muted);
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.faq-nav-link:hover {
    background: var(--clr-surface);
    color: var(--clr-text);
}

.faq-nav-link.active {
    background: var(--active-bg, #eff4ff);
    color: var(--active-color, #2563eb);
    font-weight: 500;
    border-left-color: var(--active-color, #2563eb);
}


/* =================================================================
   FAQ CONTENT — right of aside, holds all category sections
   IMPORTANT: Do NOT add overflow: hidden — breaks position: sticky
   on .faq-category-header elements inside.
   ================================================================= */
.faq-content {
    flex: 1;
    min-width: 0;       /* prevents flex overflow on narrow viewports */
    padding-top: 2rem;
}


/* =================================================================
   FAQ CATEGORY — one <section> per faqData entry
   Two-column flex row: sticky header (left) + scrolling body (right)
   IMPORTANT: Do NOT add overflow: hidden — breaks position: sticky
   ================================================================= */
.faq-category {
    display: flex;
    align-items: flex-start;    /* CRITICAL: allows sticky on faq-category-header */
    border-bottom: 1px solid var(--clr-border-soft);
    padding: 3.5rem 0;
    /* Scroll margin accounts for sticky site header + small gap */
    scroll-margin-top: calc(var(--header-h) + 1rem);
}

.faq-category:last-child { border-bottom: none; }


/* =================================================================
   FAQ CATEGORY HEADER — sticky left column, ~30% of faq-content
   Sticks within its parent .faq-category — unsticks automatically
   when the section bottom approaches, no JS required.
   ================================================================= */
.faq-category-header {
    width: var(--col-header-w);
    flex-shrink: 0;
    position: sticky;
    top: var(--sticky-top);     /* header-h + sticky-gap — adjust --sticky-gap in :root */
    align-self: flex-start;     /* CRITICAL: without this, sticky won't trigger in flex */
    padding: 0 2rem 0 2rem;
}

.faq-category-title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 1.8vw, 1.875rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    /* Category accent color — set via data-category on parent section */
    color: var(--cat-color, var(--clr-text));
}

.faq-category-desc {
    font-size: 0.875rem;
    color: var(--clr-muted);
    line-height: 1.65;
    max-width: 240px;
}


/* =================================================================
   FAQ CATEGORY BODY — scrolling right column, ~70% of faq-content
   ================================================================= */
.faq-category-body {
    flex: 1;
    min-width: 0;
    padding-right: 3rem;
}


/* =================================================================
   FAQ TOPIC — sub-category group within a body
   ================================================================= */
.faq-topic { margin-top: 2.25rem; }

.faq-topic-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--clr-subtle);
    margin-bottom: 0.875rem;
}

/* The "—" dash from the ASCII layout brief, colored by category */
.faq-topic-title::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 1.5px;
    background: var(--cat-color, var(--clr-subtle));
    border-radius: 1px;
    flex-shrink: 0;
}


/* =================================================================
   FAQ ITEM — individual Q&A accordion unit
   ================================================================= */
.faq-item {
    position: relative;
    cursor: pointer;
    padding-left: 1.5rem;
    margin-bottom: 0.25rem;
}

/* Question row — click target for accordion */
.faq-q {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
}

.faq-question {
    font-family: var(--font-ui);
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    font-weight: 400;
    line-height: 1.5;
    margin: 0;
    transition: color var(--ease);
}

.faq-item:hover .faq-question,
.faq-item[aria-expanded="true"] .faq-question {
    color: var(--cat-color, var(--clr-text));
}

/* Answer wrapper — height controlled by GSAP, set to 0 initially */
.faq-a {
    height: 0;
    overflow: hidden;
}

.faq-answer {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--clr-muted);
    line-height: 1.75;
    margin: 0;
    padding: 0.25rem 0 1.5rem;
}


/* =================================================================
   FAQ ICON — plus / minus toggle
   -----------------------------------------------------------------
   SIMPLIFIED vs. landing page implementation:
   .faq-icon-line.vertical uses height > width so it is naturally
   vertical at rotation: 0. This makes GSAP values intuitive:
     rotation: 0  → vertical   → "+" → CLOSED  (0 = default/closed)
     rotation: 90 → horizontal → "−" → OPEN    (90 = rotated/open)

   Landing page reverses this (pre-rotates in CSS, animates back to 0)
   because .plus-line is naturally horizontal (width > height).
   Same visual result — values just read in the natural direction here.
   ================================================================= */
.faq-icon {
    width: 24px;
    height: 24px;
    border: 1px solid var(--clr-border);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    transition: border-color var(--ease);
}

.faq-item:hover .faq-icon,
.faq-item[aria-expanded="true"] .faq-icon {
    border-color: var(--cat-color, var(--clr-text));
}

.faq-icon-line {
    background-color: var(--clr-subtle);
    border-radius: 2px;
    position: absolute;
    transition: background-color var(--ease);
}

.faq-item:hover .faq-icon-line,
.faq-item[aria-expanded="true"] .faq-icon-line {
    background-color: var(--cat-color, var(--clr-text));
}

/* Horizontal bar — always stays horizontal, never animated */
.faq-icon-line.horizontal {
    width: 10px;
    height: 1.5px;
}

/* Vertical bar — naturally vertical (height > width), no CSS pre-rotation
   GSAP animates: rotation 0 (closed/plus) ↔ rotation 90 (open/minus) */
.faq-icon-line.vertical {
    width: 1.5px;
    height: 10px;
}


/* =================================================================
   FAQ TRACK — thin progress line at the bottom of each item
   Width animated by GSAP on hover and accordion open/close
   ================================================================= */
.faq-track {
    width: 100%;
    height: 1px;
    position: relative;
    margin-top: 0.25rem;
}

.faq-track-line {
    position: absolute;
    inset: 0;
    background: var(--clr-border);
}

.faq-track-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    /* Category accent color — no CSS transition, GSAP handles animation */
    background: var(--cat-color, var(--clr-text));
}


/* =================================================================
   SITE FOOTER
   ================================================================= */
.site-footer {
    border-top: 1px solid var(--clr-border);
    background: var(--clr-surface);
}

.footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--clr-muted);
}

.footer-links         { display: flex; gap: 1.5rem; }
.footer-links a:hover { color: var(--clr-text); }


/* =================================================================
   RESPONSIVE — Tablet (≤ 1024px)
   Aside collapses to horizontal sticky pill nav at top.
   Category header/body stack vertically within each section.
   ================================================================= */
@media (max-width: 1024px) {

    .faq-page {
        flex-direction: column;
    }

    /* Full-width aside, horizontal scroll */
    .faq-aside {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--clr-border);
    }

    .faq-aside-inner {
        position: sticky;
        top: var(--header-h);
        height: auto;
        overflow-x: auto;
        overflow-y: hidden;
        flex-direction: row;
        align-items: center;
        padding: 0.75rem 1.25rem;
        gap: 0;
        z-index: 90;
        scrollbar-width: none;
    }

    .faq-aside-inner::-webkit-scrollbar { display: none; }

    /* Hide the decorative heading — only nav pills show */
    .faq-aside-heading { display: none; }

    .faq-nav ul {
        flex-direction: row;
        gap: 0.375rem;
        white-space: nowrap;
    }

    /* Pill style for nav links */
    .faq-nav-link {
        display: inline-block;
        padding: 0.375rem 1rem;
        border-radius: 99px;
        border-left: none;
        border: 1px solid var(--clr-border);
        font-size: 0.8125rem;
        white-space: nowrap;
    }

    .faq-nav-link.active {
        border-color: transparent;
        border-radius: 99px;
    }

    .faq-content { padding-top: 0; }

    /* Stack header above body within each category */
    .faq-category {
        flex-direction: column;
        padding: 2.5rem 1.5rem;
        /* Extra scroll-margin for horizontal aside nav height (~52px) */
        scroll-margin-top: calc(var(--header-h) + 52px + 1rem);
    }

    /* Category header: remove sticky on tablet/mobile
       (sticky column header only makes sense in the side-by-side layout) */
    .faq-category-header {
        width: 100%;
        position: static;
        padding: 0 0 1.5rem;
        border-bottom: 1px solid var(--clr-border-soft);
        margin-bottom: 1.5rem;
    }

    .faq-category-desc { max-width: 100%; }

    .faq-category-body { padding-right: 0; }
}


/* =================================================================
   RESPONSIVE — Small Mobile (≤ 768px)
   ================================================================= */
@media (max-width: 768px) {

    .header-inner { padding: 0 1rem; }

    /* Keep only the CTA in the header nav */
    .header-nav a:not(.header-cta) { display: none; }

    .faq-category { padding: 2rem 1rem; }

    /* Remove left indent — tighter on small screens */
    .faq-item { padding-left: 0; }

    .faq-question { font-size: clamp(0.9rem, 3.5vw, 1rem); }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }
}
