/* ===== FAQ page (24 Oct): search, category sidebar / dropdown, accordion polish, CTA =====
   Markup: index.html #page-faq → .faq (the live site's 11 categories / 215 questions).
   Behaviour: assets/js/faq.js. The accordion keeps the site-wide .acc look from styles.css
   (bold question, thin separators, blue + / –); this file adds the controls around it.
   Layout: search under the heading, then .faq__grid — from 1024px a sticky category sidebar
   (.faq__nav, left) beside the selected category (.faq__main, right); below 1024px the sidebar
   becomes a dropdown (.faq__pick opens .faq__panel) above full-width questions. */
/* .sub clips its sky decoration with overflow: hidden, which also makes it the scroll container for
   anything sticky inside it (the sidebar would scroll away with the page). clip clips the same without
   creating a scroll container, so the sidebar sticks to the viewport. */
#page-faq .sub {
  overflow: clip;
}
.faq {
  /* the floating nav sits 24px down (home.css .navwrap) and is var(--nav-h) tall: everything that
     sticks or lands under it clears it by 16px (same 100px as html { scroll-padding-top }) */
  --faq-top: calc(env(safe-area-inset-top, 0px) + var(--nav-h, 60px) + 24px + 16px);
  margin-top: 36px;
}

/* ---- search: under the heading, above the categories, as wide as the reading column ---- */
.faq__search {
  position: relative;
  max-width: 720px;
}
.faq__search svg {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  translate: 0 -50%;
  color: var(--ink-2);
  pointer-events: none;
}
.faq__search input {
  font: inherit;
  font-size: 16px; /* 16px: no iOS zoom on focus */
  color: var(--ink);
  width: 100%;
  min-height: 52px;
  padding: 12px 52px 12px 48px;
  border-radius: 999px;
  border: 1.5px solid #c9ccef;
  background: #fff;
  box-shadow: 0 4px 18px rgba(20, 20, 120, 0.05);
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.faq__search input::placeholder {
  color: #6f7394;
  opacity: 1;
}
.faq__search input:hover {
  border-color: #a9aee6;
}
.faq__search input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(43, 43, 245, 0.2);
}
.faq__search input::-webkit-search-cancel-button,
.faq__search input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}
#faq .faq__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  translate: 0 -50%;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  cursor: pointer;
}
#faq .faq__clear:hover {
  background: var(--lav-2);
  color: var(--ink);
}
#faq .faq__clear:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
#faq .faq__clear[hidden] {
  display: none;
}

/* ---- two columns: categories | questions ---- */
.faq__grid {
  display: grid;
  grid-template-columns: clamp(240px, 21vw, 284px) minmax(0, 1fr);
  gap: 24px 48px;
  align-items: start;
  margin-top: 28px;
}
.faq__nav {
  position: sticky;
  top: var(--faq-top);
  max-height: calc(100vh - var(--faq-top) - 24px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.faq__pick {
  display: none;
}
.faq__panel {
  background: #fff;
  border: 1px solid var(--line-d);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 10px 40px rgba(20, 20, 120, 0.06);
}
.sub .faq__side-h {
  margin: 8px 12px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.faq__cats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.faq__cats [role='tab'] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 10px 10px 14px;
  border-radius: 12px;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.3;
  text-align: left;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.faq__cats [role='tab']:hover {
  background: var(--lav);
  color: var(--ink);
}
.faq__cats [role='tab']:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.faq__cats [role='tab'].on,
.faq__cats [role='tab'].on:hover {
  background: var(--blue);
  color: #fff;
}
.faq__n {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  min-width: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--lav);
  color: var(--ink-2);
  text-align: center;
  line-height: 1.2;
}
.faq__cats .on .faq__n {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ---- search status + empty state (top of the questions column) ---- */
.sub .faq__status {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--ink-2);
}
.faq__status:empty {
  display: none;
}
.faq__empty {
  padding: 22px 24px;
  background: #fff;
  border: 1px solid var(--line-d);
  border-radius: 16px;
}
.faq__empty b {
  display: block;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 6px;
}
.sub .faq__empty p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.faq__empty a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.faq__empty[hidden] {
  display: none;
}

/* ---- category panels ---- */
.faq__main {
  min-width: 0;
}
.faq__body {
  max-width: 860px;
}
.faq__cat {
  display: none;
}
.faq__cat.on {
  display: block;
}
.sub .faq__h {
  font-size: clamp(22px, 2.2vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
  padding-top: 6px; /* sits on the sidebar's first row */
  color: var(--ink);
}
.sub .faq__intro {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 70ch;
}
/* the group label carries the line above each run of questions, so no stray top borders
   are left behind once search hides items */
.faq .acc {
  border-top: 0;
}
.sub .faq__grp {
  margin: 26px 0 0;
  padding: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-d);
}
.sub .faq__grp:first-child {
  margin-top: 0;
}

/* ---- accordion: existing .acc look, plus keyboard focus and a soft open / close ---- */
.faq .acc summary {
  line-height: 1.4;
  align-items: flex-start;
  padding: 16px 0;
}
.faq .acc summary::-webkit-details-marker {
  display: none;
}
.faq .acc summary::after {
  flex: 0 0 auto;
  line-height: 1;
  width: 22px;
  text-align: center;
}
.faq .acc summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}
.faq .acc details > .faq__a {
  margin: 0;
  padding: 0 38px 18px 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 72ch;
}
.faq .acc .faq__a a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.faq .acc details[hidden] {
  display: none;
}
/* progressive: browsers with ::details-content (Chrome 131+) slide the answer open and shut;
   the others just fade it in */
.faq .acc {
  interpolate-size: allow-keywords;
}
.faq .acc details::details-content {
  height: 0;
  overflow: clip;
  transition:
    height 0.28s ease,
    content-visibility 0.28s allow-discrete;
}
.faq .acc details[open]::details-content {
  height: auto;
}
.faq .acc .faq__a {
  opacity: 0;
  transition: opacity 0.22s ease 0.05s;
}
.faq .acc details[open] .faq__a {
  opacity: 1;
}

/* ---- search mode: every category with a hit, labelled with its name ---- */
.faq.is-searching .faq__cat {
  display: none;
}
.faq.is-searching .faq__cat.has-hits {
  display: block;
  margin-top: 28px;
}
.faq.is-searching .faq__cat.has-hits:first-child {
  margin-top: 0;
}
.faq.is-searching .faq__intro,
.faq.is-searching .faq__grp {
  display: none;
}
.sub .faq.is-searching .faq__h {
  margin: 0;
  padding: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  border-bottom: 1px solid var(--line-d);
}

/* ---- bottom CTA: centred, light blue, compact ---- */
.faq__cta {
  margin-top: 56px;
  padding: 40px 24px;
  text-align: center;
  border-radius: 24px;
  background: linear-gradient(180deg, #f6f7ff 0%, #e9ebff 100%);
  border: 1px solid #dfe2fb;
}
.sub .faq__cta h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.sub .faq__cta p {
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 48ch;
}
.faq__cta-btns {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.faq__cta .btn--ghost {
  background: #fff;
  border-color: var(--line-d);
}
.faq__cta .btn--ghost:hover {
  border-color: #a9aee6;
}

/* ---- Read next (26 Oct): faq.js ends every category but the last with a button to the following
   one (the sidebar's order). Right-aligned and quiet — white, thin blue border, dark text, blue
   arrow, the site's pill radius — so it never competes with the questions; gone while searching ---- */
.faq__next {
  display: flex;
  justify-content: flex-end;
  margin-top: 28px;
}
#faq .faq__next-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px 0 20px;
  border-radius: 999px;
  border: 1.5px solid #b9bdf5;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}
#faq .faq__next-btn svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--blue);
  transition: transform 0.15s;
}
#faq .faq__next-btn:hover {
  border-color: var(--blue);
  background: #f6f7ff;
  box-shadow: 0 4px 14px rgba(43, 43, 245, 0.1);
  transform: translateY(-1px);
}
#faq .faq__next-btn:hover svg {
  transform: translateX(2px);
}
#faq .faq__next-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.faq.is-searching .faq__next {
  display: none;
}
/* the heading takes focus after Read next (faq.js); a ring only when that came from the keyboard */
.sub .faq__h:focus {
  outline: none;
}
.sub .faq__h:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 4px;
}

/* ---- tablets and phones: the sidebar becomes a dropdown above full-width questions ---- */
@media (max-width: 1023px) {
  .faq__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }
  .faq__nav {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
    z-index: 5;
  }
  #faq .faq__pick {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 720px;
    min-height: 52px;
    padding: 12px 14px 12px 18px;
    border-radius: 999px;
    border: 1.5px solid #c9ccef;
    background: #fff;
    box-shadow: 0 4px 18px rgba(20, 20, 120, 0.05);
    font: inherit;
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    text-align: left;
    color: var(--ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      border-color 0.15s,
      box-shadow 0.15s;
  }
  #faq .faq__pick:hover {
    border-color: #a9aee6;
  }
  #faq .faq__pick:focus-visible {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(43, 43, 245, 0.2);
  }
  .faq__pick-l {
    flex: 1 1 auto;
    min-width: 0;
  }
  .faq__pick .faq__n {
    background: var(--blue);
    color: #fff;
  }
  .faq__pick svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--blue);
    transition: transform 0.2s;
  }
  .faq__nav.open .faq__pick {
    border-color: var(--blue);
  }
  .faq__nav.open .faq__pick svg {
    transform: rotate(180deg);
  }
  .faq__panel {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    max-width: 720px;
    max-height: min(62vh, 560px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(12, 15, 44, 0.16);
  }
  .faq__nav.open .faq__panel {
    display: block;
  }
  .faq__side-h {
    display: none;
  }
  .faq__cats [role='tab'] {
    min-height: 48px;
    font-size: 16px;
  }
  /* 27 Oct (Task 3.4): the × that clears the search is a 44px target on touch screens (36px before);
     the input keeps 48px of right padding, so the glyph never sits over the typed text */
  #faq .faq__clear {
    width: 44px;
    height: 44px;
    right: 4px;
  }
  .faq__body {
    max-width: none;
  }
  .faq__cta {
    margin-top: 48px;
  }
}

/* ---- phones ---- */
@media (max-width: 768px) {
  .faq {
    margin-top: 28px;
  }
  .faq__search {
    max-width: none;
  }
  /* mobile.css's generic phone input rule (input:not(...)) outranks .faq__search input, so the
     room for the magnifier and the × is restated with the id */
  #faq .faq__search input {
    min-height: 50px;
    padding: 12px 48px 12px 46px;
  }
  #faq .faq__pick,
  .faq__panel {
    max-width: none;
  }
  .faq .acc summary {
    font-size: 15px;
    padding: 15px 0;
  }
  .faq .acc details > .faq__a {
    padding-right: 30px;
  }
  .faq__empty {
    padding: 18px;
  }
  .faq__cta {
    margin-top: 40px;
    padding: 32px 20px;
    border-radius: 20px;
  }
}
@media (max-width: 600px) {
  .faq__cta-btns {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .faq__cta-btns .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq .acc details::details-content,
  .faq .acc .faq__a,
  #faq .faq__next-btn,
  #faq .faq__next-btn svg,
  .faq__cats [role='tab'],
  .faq__pick svg,
  .faq__search input {
    transition: none;
  }
}

/* ---- figures (4 Nov): faq-data.js fills every <span data-fig> from /api/rules/figures. When that
   request fails the figures are not shown as current: each is underlined with a dotted line and a
   notice under the search box (.faq__alert, inserted by the script) says so and offers a retry.
   Nothing is blanked and nothing is invented. ---- */
#page-faq .fig--unverified {
  text-decoration: underline dotted currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.faq__alert {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid #e3c98a;
  border-radius: 14px;
  background: #fff8e6;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  max-width: 78ch;
}
.sub .faq__alert p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
}
.faq__alert a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
#faq .faq__alert-retry {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  min-height: 0;
  color: var(--blue);
  background: #fff;
  border: 1px solid #cfd3f7;
  border-radius: 999px;
  padding: 4px 14px;
  cursor: pointer;
}
#faq .faq__alert-retry:hover,
#faq .faq__alert-retry:focus-visible {
  border-color: var(--blue);
}

/* ---- Strix Pro on or off (4 Nov): faq-data.js hides data-pro="only" elements and shows the
   data-pro="off" ones when the figures response says Pro is not on public sale. A question only Pro
   publishes is taken out with .is-out (search owns the hidden attribute on <details>). [hidden] is
   pinned here because the answer paragraphs carry their own display rules. ---- */
#page-faq [hidden] {
  display: none !important;
}
.faq .acc details.is-out {
  display: none !important;
}
