/* =========================================================================
   FAQ (/faq)
   Loaded after tokens.css + system.css. The chrome (.doc-topbar, .doc-back),
   the .input field and every token come from system.css; this file holds the
   page layout, the category rail and the accordion only.

   Normal document flow — no locked viewport. This page is meant to be scrolled,
   linked into (every item has an id) and found by search.
   ========================================================================= */


/* --------------------------------------------------------------------------
   LAYOUT
   Wider than the legal documents' 760px because this is a two-column page
   (rail + list), not a single prose column.
   -------------------------------------------------------------------------- */

.faq-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl) 4rem;   /* .doc-back is its first child */
}

.faq-head { margin-bottom: 2rem; }

.faq-title {
  font-family: var(--heading);
  font-size: var(--text-4xl); font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.faq-sub {
  font-family: var(--body);
  font-size: var(--text-md);
  color: var(--ink-soft);
  margin-bottom: var(--space-lg);
}

/* Search: the icon sits inside the field, so the input carries the left padding
   that clears it. */
.faq-search { position: relative; max-width: 420px; }
.faq-search svg {
  position: absolute; left: var(--space-md); top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-faded);
  pointer-events: none;
}
.faq-search .input { padding-left: 2.4rem; width: 100%; }

/* Rail left, list right. The rail is sticky: with a long list, the filters must
   stay reachable without scrolling back up. */
.faq-lay {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
}


/* --------------------------------------------------------------------------
   CATEGORY RAIL
   Quiet text buttons rather than .chip pills: there is one per category and
   they are a navigation aid, not the subject of the page.
   -------------------------------------------------------------------------- */

.faq-rail {
  position: sticky; top: var(--space-lg);
  display: flex; flex-direction: column; gap: 1px;
}

.faq-cat {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: none; border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--body);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--ink-soft);
  text-align: left; cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast),
              border-color var(--dur-fast);
}
.faq-cat:hover { color: var(--ink); background: var(--paper-2); }
.faq-cat.active {
  background: var(--paper-2);
  border-color: var(--crust);
  color: var(--ink); font-weight: 600;
}
.faq-cat:focus-visible { outline: 2px solid var(--cocoa); outline-offset: 2px; }

/* The count is derived, never written: it must not compete with the label. */
.faq-cat-n {
  font-size: var(--text-2xs);
  color: var(--ink-faded);
  font-variant-numeric: tabular-nums;
}
.faq-cat.active .faq-cat-n { color: var(--cocoa-dk); }


/* --------------------------------------------------------------------------
   ACCORDION
   Native <details>/<summary>: open/close, keyboard access and focus come free,
   and the answer is in the DOM whether open or not — which is what makes it
   indexable. Only the marker and the icon rotation are styled.
   -------------------------------------------------------------------------- */

.faq-list { display: flex; flex-direction: column; }

.faq-item { border-bottom: 1px solid var(--line-soft); }
.faq-item:first-child { border-top: 1px solid var(--line-soft); }
/* Anchored item (a shared link to #q-<id>) must clear nothing fixed, but a
   little breathing room reads better than flush to the viewport edge. */
.faq-item { scroll-margin-top: var(--space-xl); }

.faq-q {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-sm);
  font-family: var(--body);
  font-size: var(--text-md); font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: color var(--dur-fast);
}
.faq-q:hover { color: var(--cocoa-dk); }
.faq-q:focus-visible { outline: 2px solid var(--cocoa); outline-offset: 2px; }
/* Drop the native triangle: the + icon on the right is the affordance. */
.faq-q::-webkit-details-marker { display: none; }
.faq-q { list-style: none; }

.faq-q svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--ink-faded);
  transition: transform var(--dur-base) var(--ease), color var(--dur-fast);
}
.faq-item[open] .faq-q svg { transform: rotate(45deg); color: var(--cocoa); }
.faq-item[open] .faq-q { color: var(--ink); font-weight: 600; }

.faq-a {
  padding: 0 var(--space-sm) var(--space-lg);
  max-width: 68ch;          /* prose measure, as on the legal pages */
}
.faq-a p {
  font-family: var(--body);
  font-size: var(--text-md); line-height: 1.65;
  color: var(--ink-soft);
  margin: 0;
}

.faq-none {
  padding: 2.5rem var(--space-sm);
  font-family: var(--body);
  font-size: var(--text-md);
  color: var(--ink-faded);
  text-align: center;
}


/* --------------------------------------------------------------------------
   RESPONSIVE
   The rail goes horizontal above the list: at this width a sticky sidebar
   would eat the reading column.
   -------------------------------------------------------------------------- */

@media (max-width: 820px) {
  .faq-main { padding: var(--space-md) var(--space-lg) 3rem; }
  .faq-title { font-size: var(--text-3xl); }
  .faq-lay { grid-template-columns: 1fr; gap: var(--space-lg); }
  .faq-rail {
    position: static;
    flex-direction: row; flex-wrap: wrap; gap: var(--space-xs);
  }
  .faq-cat { border: 1px solid var(--line); }
}

@media (max-width: 480px) {
  .faq-main { padding: var(--space-sm) var(--space-md) 2.5rem; }
  .faq-q { font-size: var(--text-base); gap: var(--space-md); }
}
