/* ============================================================
   faq.css — editorial accordion
   ============================================================
   Not boxed: each question is a row split by a gradient hairline
   divider; opening a row paints a rounded panel. Built on the
   Bricks Accordion (Nestable).
   IMPORTANT: the FAQ section must sit on --surface-subtle, not
   white — otherwise the open white panel is invisible.
   Conventions: _shared/bricks-builder/css-conventions.md

   Last updated: 2026-10-12 (auto-stamped by the pre-commit hook)
   ============================================================ */

/* Wrapper — rows sit flush; the dividers do the separating, so no gap. */
.faq {
    display: flex;
    flex-direction: column;

    /* Larger right padding to clear the +/- marker, built from parts so
       it's not a magic number. Question + answer both use --faq-pad-end
       to share one right edge. */
    --faq-marker-size: 0.875rem;                              /* width of the marker bars */
    --faq-pad-end: calc(var(--faq-marker-size) + var(--space-s));

    text-align: left;   /* stay left even in a centred section (self-reset, like .card) */
}

/* One row, with a gradient hairline divider along the bottom that
   fades out at both ends. The padding + negative margin pair widens
   the row without moving its content, so the divider spans the same
   width whether the row is open or closed. */
.faq-item {
    padding-inline: var(--space-m);
    margin-inline: calc(-1 * var(--space-m));

    border-block-end: var(--border-width-thin) solid transparent;
    border-image: linear-gradient(to right, transparent, var(--border-divider), transparent) 1;
    transition: background-color var(--transition-base);
}

/* Open row: paint a rounded panel. (The divider can't follow the
   rounded corners, but it's transparent there, so nothing clashes.) */
.faq-item.brx-open {
    background-color: var(--surface-base);
    border-radius: var(--radius-3);
}

/* The row right before an open one drops its divider, so the white
   panel gets a clean top edge. */
.faq-item:has(+ .faq-item.brx-open) {
    border-image: none;
    border-block-end-color: transparent;
}

/* The clickable question row (the accordion Title). Flush sides;
   reserve space only on the end for the +/- marker. */
.faq-header {
    position: relative;
    display: flex;
    align-items: center;
    padding: var(--space-m) 0;
    padding-inline-end: var(--faq-pad-end);   /* clear the marker + a --space-s gap */
    cursor: pointer;
}

/* The +/- marker, drawn in CSS because the Bricks accordion only
   allows one icon (none for the open state). Two bars form a plus;
   on open the vertical bar rotates flat, leaving a minus. Keep the
   Bricks icon on the Title element removed. */
.faq-header::before,
.faq-header::after {
    content: "";
    position: absolute;
    inset-inline-end: 0;
    inset-block-start: 50%;
    inline-size: var(--faq-marker-size);
    block-size: 2px;
    background-color: var(--text-link);
    transition: transform var(--transition-base);
}

.faq-header::before { transform: translateY(-50%); }                /* horizontal bar */
.faq-header::after  { transform: translateY(-50%) rotate(90deg); }  /* vertical bar → plus */

/* Open state (Bricks adds .brx-open to the open item): rotate the
   vertical bar flat so only the horizontal remains → a minus. */
.faq-item.brx-open .faq-header::after {
    transform: translateY(-50%) rotate(0deg);
}

/* Subtle hover affordance on closed rows — keyboard focus gets the same
   tone, so both ways of reaching the row look alike (the house ring of
   §6.5 sits on top). A closed row has exactly one focusable thing, the
   question itself (Bricks gives it role=button), so :has() needs no
   class to aim at. */
.faq-item:not(.brx-open):hover .faq-question,
.faq-item:not(.brx-open):has(:focus-visible) .faq-question {
    color: var(--text-link);
}

/* The h3 question text — keep the semantic h3, just size it down
   (a question shouldn't be as big as a real page heading). */
.faq-question {
    font-size: var(--text-m);      /* 16px — base body size, calm */
    font-weight: 500;              /* medium — a touch of emphasis, not bold */
}

/* The answer panel. Shares the question's right inset so the two line
   up. The double selector must stay — it beats Bricks' default
   accordion-content padding. */
.faq-item .faq-answer {
    padding: 0 var(--faq-pad-end) var(--space-m) 0;
}
