/* ============================================================
   FAQ — "Klar, Explained" (brief/faq.md)
   Figma: desktop 3446:1024 (1360, row 440 / 135 / 785: heading + photo · accordion)
          mobile  3446:1112 → 3446:2024 (335, stack: heading + subtitle → accordion, no photo)
   Pattern A: .container on the section (gutter only), no fill, padding 0.
   Accordion template (pipeline/templates/code/accordion/): Variant 1 icon swap +
   accordion-open-first; js/accordion.js untouched. Everything here is scoped to .faq
   so the product section's accordion instance cannot be affected.
   Fluid values per pipeline/components/fluid-formulas.md (brief §2 section-local tokens).
   ============================================================ */

/* ---------- MOBILE (base, anchor 375) ---------- */
.faq {
  --faq-list-gap: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 16px);
  --faq-item-pad: clamp(9px, calc(10px + (var(--max-vw) - 375px) * 0.015), 10px);
  --faq-answer-gap: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 15px);
  --faq-head-gap: clamp(13px, calc(15px + (var(--max-vw) - 375px) * 0.015), 15px);
  --faq-stack-gap: clamp(17px, calc(20px + (var(--max-vw) - 375px) * 0.015), 20px);
  /* arrow SVG box: node 12 (M) / 15 (D) + Figma's stroke overflow → 12.85 / 15.85 */
  --faq-icon-w: clamp(11px, calc(12.85px + (var(--max-vw) - 375px) * 0.015), 15.85px);

  /* FD-18: css/templates/accordion.css (linked page-wide) styles the bare class .faq
     (margin-top 60px; >=1440 margin-top 160px + display:flex + gap 38px). These
     declarations win by source order — do not delete them as "redundant". */
  margin-top: var(--section-gap);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--faq-stack-gap);
}

/* Heading block — mobile: heading → subtitle (gap 15) */
.faq__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--faq-head-gap);
  min-width: 0;
}

.faq__title {
  font-family: var(--font-display);
  font-variation-settings: var(--fv-display);
  font-size: var(--text-h2);
  font-weight: 400;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  color: var(--color-heading);
}

.faq__subtitle {
  font-family: var(--font-body);
  font-size: var(--text-body-fixed);
  font-weight: 400;
  line-height: var(--lh-lead);
  color: var(--color-heading);
}

/* Photo — desktop-only asset (D-faq-4); composed render with the #FBFBFB feather baked in (D-faq-7) */
.faq__media {
  display: none;
  width: 100%;
  height: auto;
  aspect-ratio: 440 / 310;
}

/* ---------- Accordion ---------- */
.faq__list {
  min-width: 0;
}

/* ADAPT 3a / D-faq-5: padding on the item + margin-top between items, never `gap`.
   :first-of-type because the two <template> elements precede the item divs. */
.faq__item {
  padding-top: var(--faq-item-pad);
  /* Figma stroke is INSIDE the 10px padding (strokeAlignment INSIDE, strokeWidths bottom 1):
     the border eats the last pixel of the padding, so the item is exactly pad + row + pad. */
  padding-bottom: calc(var(--faq-item-pad) - 1px);
  border-bottom: 1px solid var(--color-divider-faq);
}

.faq__item:not(:first-of-type) {
  margin-top: var(--faq-list-gap);
}

/* Trigger row: question text (flex 1) + arrow, centred, gap 10 */
.faq__question {
  display: flex;
  align-items: center;
  gap: var(--faq-item-pad);
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-h5);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  color: var(--color-heading);
}

.faq__question-text {
  flex: 1 1 0;
  min-width: 0;
}

/* .accordion-icon is inserted by accordion.js into the button */
.faq__question .accordion-icon {
  display: flex;
  flex: none;
  pointer-events: none;
}

.faq__question .accordion-icon svg {
  width: var(--faq-icon-w);
  height: auto;
  flex: none;
}

/* keep the 1px stroke at every rendered size (D-faq-8) */
.faq__question .accordion-icon path {
  vector-effect: non-scaling-stroke;
}

/* Collapse mechanics (FD-99: the template ships them only on its demo class).
   accordion.js drives the inline height; no vertical padding/margin on this box. */
.faq__answer {
  height: 0;
  overflow: hidden;
  transition: height 0.3s ease;
}

.faq__answer p {
  padding-top: var(--faq-answer-gap);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--lh-ui);
  color: var(--color-text);
}

/* [CONTENT NEEDED] bodies 2–7 (BA-faq-1) — visibly a placeholder, never stripped */
.faq__answer .faq__placeholder {
  color: var(--color-text-muted);
  font-style: italic;
}

/* ---------- PSEUDO-TABLET 768–1023 (no Figma layer) ----------
   desktop-compressed: the split row switches on at 768 (split-row rule);
   subtitle hidden, photo shown; row top-aligned (BA-faq-3, M4). */
@media (min-width: 768px) {
  .faq {
    --faq-list-gap: clamp(15.88px, calc(15.88px + (var(--max-vw) - 768px) * 0.025), 16px);
    --faq-item-pad: clamp(10px, calc(10px + (var(--max-vw) - 768px) * 0.025), 10px);
    --faq-answer-gap: clamp(15px, calc(15px + (var(--max-vw) - 768px) * 0.025), 15px);
    --faq-icon-w: clamp(15.85px, calc(15.85px + (var(--max-vw) - 768px) * 0.025), 15.85px);

    display: grid;
    grid-template-columns: minmax(0, 440fr) minmax(0, 785fr);
    column-gap: 9.926%;   /* 135 / 1360 */
    row-gap: 0;
    align-items: start;
  }

  .faq__head {
    gap: 0;
  }

  .faq__subtitle {
    display: none;
  }

  .faq__media {
    display: block;
    margin-top: 22.05%;   /* 97 / 440 of the left column */
  }
}

/* ---------- DESKTOP 1024+ (scaled from --vw-base 1440, capped at 1920) ---------- */
@media (min-width: 1024px) {
  .faq {
    --faq-list-gap: clamp(11px, calc(16px * (var(--max-vw) / var(--vw-base))), 21px);
    --faq-item-pad: clamp(7px, calc(10px * (var(--max-vw) / var(--vw-base))), 13px);
    --faq-answer-gap: clamp(11px, calc(15px * (var(--max-vw) / var(--vw-base))), 20px);
    --faq-icon-w: clamp(11px, calc(15.85px * (var(--max-vw) / var(--vw-base))), 21px);
  }
}
