/* FAQ pages — layered over /styles.css (site chrome, .detail, .price-panel, .rb-symbol). */

.page-faq main.faq-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 220px;
  gap: 28px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.faq-article {
  min-width: 0;
  line-height: 1.7;
  font-size: 16px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.faq-article h1 {
  margin: 4px 0 14px;
  font-size: 32px;
  line-height: 1.2;
  color: #fff;
}

.faq-banner {
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.faq-version {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.faq-version.is-outdated {
  color: #fde68a;
}

.faq-rules-links {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--faint);
}

.faq-rules-links a {
  color: var(--accent-2);
  text-decoration: underline;
}

/* The landing flash is positioned against this box (public/faq/faq-landing.js). */
.faq-body {
  position: relative;
}

.faq-body p {
  margin: 0 0 12px;
}

.faq-body ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

.faq-body li {
  margin: 0 0 6px;
}

.faq-q {
  margin: 34px 0 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 21px;
  line-height: 1.35;
  color: #fff;
  /* .site-header is sticky, so an anchor landing would otherwise park the question underneath it.
     The variable is the header's measured height (faq-landing.js); 64px is the built-in fallback
     for a page that runs no script — 13px padding + a 36px nav row + 13px + a 1px border = 63. */
  scroll-margin-top: calc(var(--faq-header-h, 64px) + 12px);
}

h3.faq-q {
  margin-top: 22px;
  padding-top: 0;
  border-top: 0;
  font-size: 17px;
}

.faq-anchor {
  color: inherit;
}

.faq-anchor:hover::after {
  content: " #";
  color: var(--faint);
}

/* Landing flash: the answer a search result opened, inverted and then let go over five seconds.
   The element is a bare overlay created by public/faq/faq-landing.js; its box is set in JS, its
   whole appearance and lifetime are these rules (it removes itself on animationend). */
.faq-flash {
  position: absolute;
  z-index: 1;
  border-radius: 10px;
  pointer-events: none;
  animation: faq-flash 5s ease-out forwards;
}

@keyframes faq-flash {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* The inversion itself. A reader who asked for reduced motion gets the region outlined instead:
   the same five-second "this is the part you searched for", without the screen turning inside out.
   mix-blend-mode appears nowhere else — inverting is the motion here. */
@media (prefers-reduced-motion: no-preference) {
  .faq-flash {
    background: #fff;
    mix-blend-mode: difference;
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-flash {
    outline: 2px solid var(--accent, #fff);
    outline-offset: 2px;
  }
}

/* Every occurrence of a searched term inside that region, painted through the CSS Custom Highlight
   API — ranges only, so the article's card slots are never wrapped or rewritten. */
::highlight(faq-hit) {
  background: rgb(245 158 11 / 35%);
  color: #fff;
}

.faq-rule {
  font-size: 0.68em;
  line-height: 0;
  margin-left: 1px;
}

.faq-rule a {
  color: var(--faint);
  white-space: nowrap;
}

.faq-rule a:hover {
  color: var(--accent);
}

.faq-term {
  padding: 0 1px;
  border: 0;
  border-bottom: 1px dotted var(--accent-2);
  background: none;
  color: inherit;
  font: inherit;
  cursor: help;
}

.faq-term:hover,
.faq-term[aria-expanded="true"] {
  color: var(--accent-2);
}

.faq-card {
  color: var(--accent);
  font-weight: 700;
  border-bottom: 1px solid rgb(245 158 11 / 45%);
  cursor: pointer;
}

.faq-card:hover {
  border-bottom-color: var(--accent);
}

.faq-card.is-missing {
  color: var(--faint);
  border-bottom-style: dashed;
  cursor: not-allowed;
}

.faq-card-name[lang="en"] {
  font-style: normal;
}

.faq-kw {
  display: inline-block;
  margin: 0 2px;
  padding: 0 7px;
  transform: skewX(-12deg);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.6;
  letter-spacing: 0.02em;
  vertical-align: 0.08em;
  color: #fff;
}

.faq-kw-primary {
  background: #4e9f8b;
}

.faq-kw-secondary {
  background: #9eb149;
  color: #000;
}

.faq-kw-accent {
  background: #b8416d;
}

.faq-kw-tertiary {
  background: #6c7071;
}

.faq-quote {
  quotes: "“" "”";
  color: #fde68a;
  cursor: pointer;
}

.faq-quote.is-stale {
  color: var(--danger);
  text-decoration: underline wavy;
}

.faq-quote-stale {
  font-size: 0.85em;
}

.faq-card-text {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.faq-card-text-name {
  display: block;
  margin-bottom: 4px;
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
}

.faq-card-text .detail-effect {
  margin: 0;
  color: var(--ink);
}

.faq-lang-note,
.faq-loading {
  display: inline-block;
  color: var(--faint);
  font-size: 12px;
}

.faq-loading.is-error {
  color: var(--danger);
}

.faq-callout {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.faq-callout.is-idea {
  border-left: 3px solid var(--accent-2);
}

.faq-callout.is-warn {
  border-left: 3px solid #fde68a;
}

.faq-callout.is-info {
  border-left: 3px solid var(--accent-3);
}

.faq-callout-title {
  font-weight: 800;
  color: #fff;
}

.faq-callout-kind {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 12px;
  color: var(--muted);
}

.faq-callout p:last-child {
  margin-bottom: 0;
}

.faq-steps {
  margin: 8px 0 16px;
  padding-left: 26px;
}

.faq-steps > li {
  margin: 0 0 10px;
  padding-left: 4px;
}

.faq-steps > li::marker {
  color: var(--accent);
  font-weight: 800;
}

.faq-adaptation {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px dashed var(--accent-2);
  border-radius: 10px;
  background: var(--surface);
}

.faq-adaptation-title {
  margin: 0 0 6px;
  font-weight: 800;
  color: var(--accent-2);
}

.faq-card-hero {
  margin: 0 0 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.faq-card-hero .detail {
  grid-template-columns: minmax(200px, 280px) 1fr;
  padding: 18px;
}

.faq-card-hero .detail-copy h2 {
  font-size: 22px;
}

.faq-card-hero .detail-copy {
  padding-right: 0;
}

.faq-footer {
  margin-top: 40px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--faint);
}

.faq-footer a {
  color: var(--muted);
  text-decoration: underline;
}

.faq-footer code {
  font-size: 12px;
}

/* sidebar */
.faq-sidebar {
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

/* sidebar search */
.faq-search {
  position: relative;
  margin-bottom: 12px;
}

/* Clipped, not display:none: the input still needs a label a screen reader can announce. */
.faq-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.faq-search-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  /* 16px exactly: anything smaller makes iOS Safari zoom the page on focus. */
  font-size: 16px;
}

.faq-search-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* The "/" badge: what tells a reader the shortcut exists. It sits on top of the field, so it goes
   the moment the field is in use — and it never appears where there is no key to press. */
.faq-search-kbd {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--faint);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
}

.faq-search:focus-within .faq-search-kbd {
  display: none;
}

@media (hover: none) {
  .faq-search-kbd {
    display: none;
  }
}

/* The hero box on /faq/: the intro page's own search field, full article width under the title. */
.faq-search-hero {
  margin: 0 0 22px;
}

.faq-search-hero .faq-search-input {
  padding: 13px 14px;
  border-radius: 10px;
  font-size: 20px;
}

.faq-search-hero .faq-search-kbd {
  top: 14px;
  right: 14px;
  font-size: 13px;
}

.faq-search-hero .faq-search-results {
  max-height: 60vh;
}

.faq-search-results {
  margin: 6px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  list-style: none;
  max-height: 50vh;
  overflow: auto;
}

.faq-search-results li a {
  display: block;
  padding: 8px 10px;
  color: inherit;
  text-decoration: none;
}

.faq-search-results li[aria-selected="true"] a,
.faq-search-results li a:hover {
  background: var(--panel-2);
}

.faq-search-crumb {
  display: block;
  color: var(--faint);
  font-size: 12px;
}

/* The citation a rule query hit ("812.1.c"): the one part of the row the reader typed. */
.faq-search-rule {
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.faq-search-q {
  display: block;
  font-weight: 700;
}

.faq-search-snip {
  display: block;
  color: var(--faint);
  font-size: 13px;
}

.faq-search-snip mark {
  background: transparent;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}

.faq-search-status {
  padding: 8px 10px;
  color: var(--faint);
  font-size: 13px;
}

/* How many results there are, and what the keyboard does with them. */
/* The hint's key names ("Enter", "Esc") are <kbd> in both languages (.prd/24), set in the hint's own type. */
.faq-search-keys kbd {
  font: inherit;
}

.faq-search-hint {
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
}

.faq-search-count {
  font-weight: 700;
}

/* The box reacts: rows answer the pointer, and the list arrives instead of appearing. All of it is
   transform/opacity/background, and none of it happens for a reader who asked for stillness. */
@media (prefers-reduced-motion: no-preference) {
  .faq-search-results {
    animation: faq-search-open 160ms ease-out;
  }

  .faq-search-results li a {
    transition: background 150ms ease-out, transform 150ms ease-out;
  }

  .faq-search-results li a:active {
    transform: scale(0.985);
  }
}

@keyframes faq-search-open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.faq-nav-summary {
  display: none;
}

.faq-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-nav > ul > li {
  margin: 0 0 6px;
}

.faq-nav-link {
  display: block;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
}

.faq-nav-link:hover {
  background: var(--panel);
  color: var(--ink);
}

.faq-nav-link.is-active {
  background: var(--panel-2);
  color: #fff;
  font-weight: 700;
}

.faq-nav-link.is-disabled {
  color: var(--faint);
  cursor: default;
}

.faq-nav-section summary {
  padding: 5px 8px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.faq-nav-section summary small {
  color: var(--faint);
  font-weight: 400;
}

.faq-nav-section ul {
  padding-left: 10px;
}

/* right column */
.faq-aside {
  position: sticky;
  top: 16px;
  align-self: start;
  font-size: 13px;
}

.faq-toc-title {
  margin: 0 0 6px;
  font-weight: 800;
  color: var(--ink);
}

.faq-toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.faq-toc li {
  margin: 0 0 5px;
}

.faq-toc-l3 {
  padding-left: 12px;
}

.faq-toc a {
  color: var(--muted);
}

.faq-toc a:hover {
  color: var(--accent);
}

.faq-section-list > li {
  margin: 0 0 14px;
  font-weight: 700;
}

.faq-section-list ul {
  font-weight: 400;
  color: var(--muted);
}

/* card popover (hover) and dialog (tap / keyboard) */
.faq-card-popover {
  position: fixed;
  z-index: 40;
  width: min(760px, calc(100vw - 16px));
  max-height: min(70vh, 640px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgb(0 0 0 / 55%);
}

.faq-card-popover .detail {
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 16px;
  padding: 16px;
}

.faq-card-popover .detail-copy {
  padding-right: 0;
}

.faq-card-popover .detail-copy h2 {
  font-size: 22px;
}

.faq-card-dialog {
  width: min(1040px, calc(100vw - 32px));
}

.faq-term-popover {
  position: fixed;
  z-index: 41;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-size: 13.5px;
  line-height: 1.55;
}

.faq-term-title {
  margin: 0 0 4px;
  font-weight: 800;
  color: var(--accent-2);
}

.faq-term-body {
  margin: 0 0 6px;
  color: var(--ink);
}

.faq-term-crd {
  margin: 0;
  color: var(--faint);
  font-size: 12px;
}

.faq-notice h2 {
  margin: 26px 0 8px;
  font-size: 19px;
}

.faq-notice blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.lang-pill {
  background: #2a3440;
  color: #fde68a;
}

.detail-flavor {
  color: var(--faint);
  font-style: italic;
}

.price-chart-error {
  color: var(--danger);
}

@media (max-width: 1080px) {
  .page-faq main.faq-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .faq-aside {
    display: none;
  }
}

@media (max-width: 760px) {
  .page-faq main.faq-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px 48px;
  }

  .faq-sidebar {
    position: static;
    max-height: none;
  }

  .faq-nav-drawer:not([open]) .faq-nav {
    display: none;
  }

  .faq-nav-summary {
    display: block;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    font-weight: 800;
    cursor: pointer;
  }

  .faq-card-popover {
    display: none !important;
  }

  .faq-card-hero .detail,
  .faq-card-dialog .detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .faq-article h1 {
    font-size: 26px;
  }

  .faq-q {
    font-size: 18px;
  }

  /* No arrow keys, no Enter, no Escape: the count is the only half of the hint that means
     anything on a phone. */
  .faq-search-keys {
    display: none;
  }

  .faq-search-hero .faq-search-input {
    padding: 11px 12px;
    font-size: 17px;
  }
}
