/* Shared FAQ component (T12, table layout T16): search + topic chips +
   expand-all + topic grouping, rendered as a three-column table
   (topic | question | chevron) with the answer expanding under the row.
   Used on index.html, pricing.html and every module page.
   Markup: <div class="faq" data-faq><div class="faq-tools">…</div><dl>…</dl></div>
   build.js's faqJsonLd() reads the raw <dl> source for schema — this file
   only changes how the browser renders it, never the markup it depends on.
   That is why the topic cell is a ::before fed by attr(data-topic) rather
   than an element inside the <dt>: a <span> in there would be stripped into
   the FAQPage question name. The "Topic"/"Question" header row above the
   <dl> is built by faq.js for the same reason. */

.faq{ margin-top:clamp(24px,3vw,32px); }

/* ---- tools row: search, topic chips, expand/collapse ---- */
.faq-tools{ display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin-bottom:6px; }
.faq-search{ flex:1 1 220px; min-width:160px; }
.faq-search::-webkit-search-cancel-button{ cursor:pointer; }
.faq-chips{ display:flex; flex-wrap:wrap; gap:8px; }
.faq-chip{
  font-family:var(--sans); font-size:13px; font-weight:700; padding:7px 16px;
  border-radius:100px; border:1px solid var(--line); background:#fff;
  color:var(--ink-soft); cursor:pointer;
  transition:background .15s ease,color .15s ease,border-color .15s ease;
}
.faq-chip:hover{ border-color:var(--blue); color:var(--blue-ink); }
.faq-chip[aria-pressed="true"]{ background:var(--blue); border-color:var(--blue); color:#fff; }
.faq-toggle-all{
  margin-left:auto; background:none; border:none; font-family:var(--sans);
  font-size:13px; font-weight:700; color:var(--blue-ink); cursor:pointer; padding:6px 4px;
}
.faq-toggle-all:hover{ text-decoration:underline; }

/* ---- column header row (built by faq.js, sits directly above the <dl>) ---- */
.faq-head{
  display:grid; grid-template-columns:var(--faq-cols); column-gap:var(--faq-gap);
  align-items:center; margin-top:14px; padding-bottom:9px;
  border-bottom:1px solid var(--line);
}
.faq-sort{
  justify-self:start; display:inline-flex; align-items:center; gap:6px;
  background:none; border:none; padding:2px 0; cursor:pointer;
  font-family:var(--sans); font-size:11px; font-weight:700;
  letter-spacing:.06em; text-transform:uppercase; color:var(--muted);
  transition:color .15s ease;
}
.faq-sort:hover{ color:var(--blue-ink); }
.faq-sort:focus-visible{ outline:2px solid var(--blue); outline-offset:3px; }
.faq-sort-i{
  width:6px; height:6px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor;
  transform:rotate(45deg) translate(-1px,-1px); opacity:.55; transition:transform .2s ease, opacity .2s ease;
}
.faq-sort[aria-pressed="true"]{ color:var(--blue-ink); }
.faq-sort[aria-pressed="true"] .faq-sort-i{ transform:rotate(-135deg) translate(-1px,-1px); opacity:1; }
.faq-head-q{
  font-size:11px; font-weight:700; letter-spacing:.06em;
  text-transform:uppercase; color:var(--muted);
}

/* ---- table rows: topic | question | chevron, answer under the row ---- */
.faq{ --faq-cols:110px 1fr auto; --faq-gap:16px; }
.faq dl{ margin:0; display:grid; grid-template-columns:var(--faq-cols); column-gap:var(--faq-gap); }
.faq-head + dl{ margin-top:0; }
.faq dt{
  grid-column:1 / -1; display:grid; grid-template-columns:subgrid;
  align-items:start; border-top:1px solid var(--line);
}
/* subgrid keeps every row on the <dl>'s own tracks; without it, repeating the
   template gives the same widths because the <dt> spans the full <dl>. */
@supports not (grid-template-columns:subgrid){
  .faq dt{ grid-template-columns:var(--faq-cols); column-gap:var(--faq-gap); }
}
.faq dt:first-of-type{ border-top:none; }
/* the author `display:grid` above outranks the UA [hidden] rule, so the
   search/chip filter needs its own hiding rule. */
.faq dt[hidden]{ display:none; }
.faq dt::before{
  content:attr(data-topic); grid-column:1; padding:21px 0 0;
  font-size:11px; font-weight:700; letter-spacing:.06em; line-height:1.4;
  text-transform:uppercase; color:var(--muted);
}
.faq-q{
  grid-column:2 / -1; display:grid; grid-template-columns:subgrid;
  align-items:center; gap:16px;
  /* `font:inherit` first so the <button> takes the page font, then the one
     question style the whole site shares: 600 at 16px, no heading tracking. */
  width:100%; text-align:left; background:none; border:none; font:inherit;
  font-family:var(--sans); font-size:16px; font-weight:600; letter-spacing:normal;
  line-height:1.4; color:var(--ink); padding:18px 0; cursor:pointer;
}
@supports not (grid-template-columns:subgrid){
  .faq-q{ grid-template-columns:1fr auto; }
}
.faq-q:hover{ color:var(--blue-ink); }
.faq-q:focus-visible{ outline:2px solid var(--blue); outline-offset:2px; }
.faq-chevron{
  flex:none; width:9px; height:9px; margin-top:-4px;
  border-right:2px solid var(--muted); border-bottom:2px solid var(--muted);
  transform:rotate(45deg); transition:transform .25s ease, margin-top .25s ease;
}
.faq-q[aria-expanded="true"] .faq-chevron{ transform:rotate(-135deg); margin-top:3px; }

/* dd is always display:grid so the 0fr/1fr row-track transition can run;
   [hidden] is overridden (default UA rule is display:none) rather than
   toggled via inline style, per the no-JS requirement below. */
.faq dd{ grid-column:2 / -1; margin:0; display:grid; grid-template-rows:1fr; overflow:hidden; transition:grid-template-rows .3s ease; }
.faq dd[hidden]{ display:grid; grid-template-rows:0fr; }
.faq-a{ min-height:0; overflow:hidden; font-size:15px; font-weight:400; line-height:1.7; color:var(--ink-soft); max-width:70ch; padding-bottom:20px; transition:padding-bottom .3s ease; }
/* A grid item's fixed padding still occupies space when its row track is
   sized to 0fr (min-height:0 only frees the content box, not the padding),
   which left a sliver of the first answer line visible — zero it too. */
.faq dd[hidden] .faq-a{ padding-bottom:0; }

.faq-empty{ padding:22px 2px; color:var(--muted); font-size:14.5px; }
.faq-empty a{ color:var(--blue-ink); font-weight:700; }

/* ---- stacked on narrow screens: topic sits above its question ---- */
@media (max-width:640px){
  .faq{ --faq-cols:minmax(0,1fr); --faq-gap:0px; }
  .faq-head-q{ display:none; }
  .faq dt{ display:block; }
  .faq dt::before{ display:block; padding:14px 0 0; }
  .faq-q{ display:flex; justify-content:space-between; padding:3px 0 18px; }
  .faq dd{ grid-column:1 / -1; }
}
