/* FAQ page (#faq in index.html) — loaded after guide.css, whose kbd and .ui styles it shares.
   A big title, a search field, then the questions in groups: each one a <details> row that opens in place. */

.page--faq { overflow-x: clip; }

.faq {
  position: relative; isolation: isolate;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) 0 clamp(64px, 10vw, 120px);
}
/* The same low mint light as the Guide. */
.faq::before {
  content: ""; position: absolute; z-index: -1;
  left: -25%; top: -10%;
  width: 90%; aspect-ratio: 2 / 1;
  background: radial-gradient(closest-side, rgba(89, 214, 160, 0.10), transparent);
  pointer-events: none;
}

.faq__head {
  display: grid; gap: 18px;
  max-width: 820px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.faq__head .hud-label { color: var(--accent); }
.faq__head h1 {
  font-size: clamp(44px, 7.4vw, 88px);
  letter-spacing: -0.045em;
  line-height: 1;
  background: linear-gradient(180deg, #ffffff 30%, #aab5b0);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  text-wrap: balance;
}

/* ---------- Search ---------- */

.faq-search {
  position: relative;
  max-width: 560px;
  margin-bottom: clamp(48px, 7vw, 88px);
}
.faq-search svg {
  position: absolute; z-index: 1; left: 18px; top: 50%;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.faq-search input {
  width: 100%;
  height: 54px;
  padding: 0 20px 0 48px;
  border-radius: 999px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  color: var(--text);
  font: inherit;
  -webkit-appearance: none; appearance: none;
}
.faq-search input::placeholder { color: var(--muted); }
.faq-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.faq-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout: topics on the left, questions on the right ---------- */

.faq__layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: start;
}

.faq-toc {
  position: sticky; top: calc(var(--topbar-h) + 24px);
}
.faq-toc__label { margin: 0 0 12px 10px; }
.faq-toc ol { list-style: none; margin: 0; padding: 0; }
.faq-toc a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.faq-toc a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.faq-toc a span { font-family: var(--mono); font-size: 11px; color: var(--faint); }

/* Always the second column, so the questions stay put when a search hides the topics. */
.faq__content { grid-column: 2; display: grid; gap: clamp(56px, 8vw, 96px); max-width: 780px; }
.faq-toc[hidden] { display: none; }

/* ---------- A topic ---------- */

.faq-group { scroll-margin-top: calc(var(--topbar-h) + 24px); }
.faq-group[hidden] { display: none; }
.faq-group h2 {
  margin-bottom: 20px;
  font-size: clamp(30px, 4vw, 44px);
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #ffffff 30%, #aab5b0);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ---------- A question ---------- */

.faq-item { border-top: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item[hidden] { display: none; }

.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px 2px;
  font-size: clamp(17px, 1.5vw, 19px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
  transition: color 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent-soft); }
.faq-item summary:focus-visible { outline-offset: -2px; border-radius: 8px; }

/* Plus that turns into a cross when the answer is open. */
.faq-item summary::after {
  content: "";
  flex: none;
  width: 14px; height: 14px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.5px 100% no-repeat;
  color: var(--muted);
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), color 0.15s;
}
.faq-item[open] summary::after { transform: rotate(45deg); color: var(--accent); }

.faq-item__answer {
  display: grid; gap: 12px;
  padding: 0 40px 24px 2px;
  max-width: 64ch;
  color: #c3cbc7;
  font-size: 16.5px;
  line-height: 1.6;
}
.faq-item[open] .faq-item__answer { animation: faq-open 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes faq-open { from { opacity: 0; transform: translateY(-6px); } }

.faq-item__answer strong { color: var(--text); font-weight: 600; }
.faq-item__answer code { font-family: var(--mono); font-size: 0.88em; color: var(--text); }
.faq-item__answer ul { margin: 0; padding-left: 1.15em; display: grid; gap: 6px; }
.faq-item__answer li::marker { color: var(--faint); }
.faq-item__answer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(89, 214, 160, 0.35);
}
.faq-item__answer a:hover { border-bottom-color: var(--accent); }

/* ---------- No match, and the way out ---------- */

.faq-empty { color: var(--muted); font-size: 19px; }
.faq-empty[hidden] { display: none; }

.faq-contact {
  display: grid; gap: 10px; justify-items: start;
  padding: clamp(24px, 4vw, 36px);
  border-radius: 22px;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.faq-contact h2 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.03em; }
.faq-contact p { color: var(--muted); }
.faq-contact a {
  margin-top: 6px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.faq-contact a:hover { text-decoration: underline; }

/* ---------- Narrow screens: topics become a row of chips ---------- */

@media (max-width: 900px) {
  .faq__layout { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .faq-toc { position: static; }
  .faq__content { grid-column: auto; }
  .faq-toc__label { display: none; }
  .faq-toc ol {
    display: flex; gap: 8px;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .faq-toc ol::-webkit-scrollbar { display: none; }
  .faq-toc a {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    white-space: nowrap;
  }
  .faq-toc a span { display: none; }
  .faq-item__answer { padding-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .faq-item[open] .faq-item__answer { animation: none; }
  .faq-item summary::after { transition: none; }
}
