/* ============================================================
   ARECH FAQ Accordion block — front-end styles.
   Port of `site/src/components/product-type/ProductTypeSectionFAQ.astro`
   lines 77-200, BEM-renamed to `.arech-faq__*`.
   Zero JS — uses native <details>/<summary> for accordion behaviour.
   ============================================================ */

.arech-faq {
    /* TDM Design layer: each property consumes a per-instance --tdmx-* var
       (emitted only on operator change, scoped to .tdm-i-<bID>) and falls back
       to the block's original hardcoded value — so default = byte-identical. */
    background: var(--tdmx-bg, var(--paper-1));
    color: var(--ink-2);
    /* New stacking context so the -2/-1 bg pseudo-elements anchor to the root. */
    position: relative;
    isolation: isolate;
    /* S55 D4 — FAQ stays modest (paper surface). Default --space-9
       at base; --space-10 from 768+ keeps adjacent CTA section
       (which steps to --space-11) visually distinct. */
    padding-block: var(--tdmx-pad-top, var(--space-9)) var(--tdmx-pad-bottom, var(--space-9));
    padding-inline: var(--container-px);
    margin-block: var(--tdmx-margin-top, 0px) var(--tdmx-margin-bottom, 0px);
}
/* TDM universal background image + overlay (mirrors tdm_blocks base.css, scoped
   to .arech-faq). Active only when the vars are set; otherwise none/transparent
   → invisible → zero visual change at default. Sit behind the inner content. */
.arech-faq::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: var(--tdmx-bg-image, none);
    background-size: cover;
    background-position: center;
    pointer-events: none;
}
.arech-faq::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--tdmx-overlay, transparent);
    pointer-events: none;
}
@media (min-width: 768px) {
    .arech-faq {
        padding-block: var(--tdmx-pad-top, var(--space-10)) var(--tdmx-pad-bottom, var(--space-10));
    }
}

.arech-faq__inner {
    /* S73 FIX-5 — full container, left-aligned (no longer a narrow centered
       reading column). 70/30 two-column grid from LG-up; single column on
       phone + small tablet with the side image hidden. Caps identically to
       every other section so the FAQ left edge aligns to the container. */
    max-width: var(--tdmx-max-width, var(--container));
    margin-inline: auto;
    /* text-align threaded for parity with the shared Design layer; the 70/30
       grid layout below is unaffected by it (children set their own alignment). */
    text-align: var(--tdmx-align, left);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-7);
    align-items: start;
}
@media (min-width: 1024px) {
    .arech-faq__inner {
        /* 70% FAQ / 30% side image. gap is part of the track sizing via the
           fr units so the columns share the gutter cleanly. */
        grid-template-columns: 7fr 3fr;
        gap: var(--space-8);
    }
}

/* S78b — no side image set (public): collapse the FAQ to a single full-width
   column. Higher specificity than the media-query rule above, so it wins at all
   breakpoints without a media query. The 70/30 grid returns once an image is
   picked (the --noaside modifier is dropped by the view). */
.arech-faq--noaside .arech-faq__inner {
    grid-template-columns: 1fr;
}

/* Left column keeps a comfortable reading measure without forcing the
   accordion items narrow. */
.arech-faq__main {
    min-width: 0;
}

/* ---- Side image (30%) ---- */
.arech-faq__aside {
    /* Hidden on phone + small tablet — FAQ goes full width there. */
    display: none;
}
@media (min-width: 1024px) {
    .arech-faq__aside {
        display: block;
        align-self: start;
        position: sticky;
        top: var(--space-8);
    }
}

.arech-faq__image {
    max-width: 100%;
    height: auto;
    display: block;
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--hairline);
    object-fit: cover;
    aspect-ratio: 3 / 4;
}

.arech-faq__image-tbd {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--paper-2);
    border: 1px dashed var(--hairline);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-5);
}
.arech-faq__image-tbd-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
}

/* ---- Section head ---- */
.arech-faq__head {
    margin-bottom: var(--space-7);
}

.arech-faq__eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--tdmx-accent, var(--orange-text));
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--space-4);
}
.arech-faq__eyebrow::before {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--tdmx-accent, var(--orange-text));
}

.arech-faq__title {
    font-family: var(--font-headline);
    font-weight: 600;
    /* S55 D3 — clamp aligned to prototype global h2 (L391-398). */
    font-size: clamp(42px, 5vw, 72px);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--tdmx-heading, var(--ink-1));
    margin: 0;
    /* S73 FIX-5 — readable measure cap. The block now sits in a 70% column
       (wider than the old 880px narrow container), so 38ch keeps the headline
       from running edge-to-edge while still letting it wrap naturally. */
    max-width: min(38ch, 100%);
}
.arech-faq__accent {
    color: var(--tdmx-accent, var(--orange-text));
}

/* ---- Accordion list ---- */
.arech-faq__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.arech-faq__item {
    background: var(--paper-2);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--motion-fast) var(--ease-standard);
}
.arech-faq__item[open] {
    border-color: var(--orange-link);
}

.arech-faq__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    list-style: none;
    cursor: pointer;
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: 17px;
    line-height: 1.45;
    color: var(--tdmx-text, var(--ink-1));
    user-select: none;
}
.arech-faq__summary::-webkit-details-marker { display: none; }
.arech-faq__summary:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: -2px;
}
.arech-faq__summary > span:first-child {
    flex: 1;
}

.arech-faq__chev {
    display: inline-flex;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--tdmx-accent, var(--orange-link));
    transition: transform var(--motion-fast) var(--ease-standard);
}
.arech-faq__item[open] .arech-faq__chev {
    transform: rotate(180deg);
}
.arech-faq__chev svg {
    width: 100%;
    height: 100%;
}

.arech-faq__body {
    padding: 0 var(--space-6) var(--space-6);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--tdmx-text, var(--ink-3));
}
.arech-faq__body a {
    color: var(--orange-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--motion-fast) var(--ease-standard);
}
.arech-faq__body a:hover {
    color: var(--orange-text);
}

/* ---- Reveal stagger ---- */
.arech-faq .arech-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity var(--motion-reveal) var(--ease-standard),
        transform var(--motion-reveal) var(--ease-standard);
}
.arech-faq .arech-reveal.is-in {
    opacity: 1;
    transform: translateY(0);
}
.arech-faq .arech-reveal--s1 { transition-delay: var(--stagger-1); }
.arech-faq .arech-reveal--s2 { transition-delay: var(--stagger-2); }
.arech-faq .arech-reveal--s3 { transition-delay: var(--stagger-3); }
.arech-faq .arech-reveal--s4 { transition-delay: var(--stagger-4); }
.arech-faq .arech-reveal--s5 { transition-delay: var(--stagger-5); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .arech-faq .arech-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .arech-faq__chev,
    .arech-faq__item {
        transition: none !important;
    }
}

/* ---- Concrete edit-mode shim ---- */
.ccm-edit-mode .arech-faq {
    padding-block: var(--space-6);
}
