/* faq — this component's own styles, put in the head by the renderer where it is drawn.
   Colours and sizes only through var(--*), so the design drives these too.

   The root says the look: faq--accordion | --columns, faq--boxed | --ruled, and faq--side when the groups or
   «Didn't find an answer?» stand beside the questions. */

/* Questions read best in a narrow column, wherever the page puts them; with a column beside, the page's width. */
.faq { max-width: 860px; margin-inline: auto; }

.faq--side { max-width: none; }

/* ---------- beside: the groups and «Didn't find an answer?» ---------- */
.faq--side .faq-body { display: grid; gap: 2rem; }

.faq-side { display: grid; gap: 1.4rem; align-content: start; }

@media (min-width: 900px) {
  .faq--side .faq-body { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 3rem; }
  .faq-side { position: sticky; top: calc(var(--header-sticky-h, 0px) + 1.5rem); order: 0; }
}

.faq-nav { display: grid; gap: .1rem; }

.faq-nav__link { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0 .5rem .9rem; border-left: 2px solid var(--line); color: var(--body-text); text-decoration: none; font-size: .95rem; }

.faq-nav__link:hover { color: var(--ink); border-left-color: var(--ink); }

.faq-nav__link .chip-count { color: var(--muted); font-size: .8rem; }

/* ---------- the search and «Expand all» ---------- */
.faq-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; margin-bottom: 1.6rem; }

.faq-search { position: relative; flex: 1 1 18rem; display: flex; align-items: center; }

.faq-search svg { position: absolute; left: 1rem; width: 1.1rem; height: 1.1rem; color: var(--muted); pointer-events: none; }

.faq-search input { width: 100%; padding: .7rem 1rem .7rem 2.7rem; border: 1px solid var(--line); border-radius: var(--pill); background: var(--surface, var(--bg)); color: var(--ink); font: inherit; }

.faq-search input:focus { outline: 2px solid var(--mark, var(--primary)); outline-offset: 1px; border-color: transparent; }

.faq-tools__toggle { padding: 0; border: 0; background: none; color: var(--mark, var(--primary)); font: inherit; font-size: .92rem; cursor: pointer; }

.faq-none { margin: 0 0 1.6rem; color: var(--body-text); }

.faq-none a { color: var(--mark, var(--primary)); }

/* ---------- the groups ---------- */
.faq-group + .faq-group { margin-top: 2.4rem; }

.faq-group { scroll-margin-top: calc(var(--header-sticky-h, 0px) + 1.5rem); }

.faq-group__title { font-size: 1.3rem; margin: 0 0 .6rem; scroll-margin-top: calc(var(--header-sticky-h, 0px) + 1.5rem); }

/* ---------- a question ---------- */
.faq-item { scroll-margin-top: calc(var(--header-sticky-h, 0px) + 1.5rem); }

.faq-item summary { cursor: pointer; list-style: none; }

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary:focus-visible { outline: 2px solid var(--mark, var(--primary)); outline-offset: 2px; }

.faq-link { display: inline-flex; align-items: center; gap: .4rem; margin-top: .4rem; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; }

.faq-link svg { width: .95rem; height: .95rem; }

.faq-link:hover { color: var(--mark, var(--primary)); }

/* ---------- boxed: each question a card, «+» in its corner ---------- */
.faq--boxed .faq-list { display: grid; gap: .6rem; }

.faq--boxed .faq-item {
  background: var(--surface);
  border: var(--card-border, 1px solid var(--card-line));
  border-radius: var(--radius-small);
  padding: 0 1.3rem;
}

.faq--boxed .faq-item summary {
  padding: 1.05rem 0;
  font-weight: 600;
  color: var(--ink);
  position: relative;
  padding-right: 2rem;
}

.faq--boxed .faq-plus { display: none; }

.faq--boxed .faq-item summary::after {
  content: '+';
  position: absolute;
  right: .2rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--mark, var(--primary));
  transition: transform .2s ease;
}

.faq--boxed .faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }

.faq--boxed .faq-item p { margin: 0; padding: 0 0 1.2rem; color: var(--body-text); font-size: .96rem; }

.faq--boxed .faq-link { margin: -.6rem 0 1rem; }

/* ---------- ruled: lines between the questions, a drawn «+» ---------- */
.faq--ruled .faq-item { border-bottom: 1px solid var(--line); }

.faq--ruled .faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 0; }

.faq--ruled .faq-q { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; line-height: 1.4; color: var(--ink); }

.faq--ruled .faq-item.is-found .faq-q { background: linear-gradient(transparent 62%, color-mix(in srgb, var(--mark, var(--primary)) 18%, transparent) 62%); }

.faq-plus { position: relative; flex: none; width: 1.5rem; height: 1.5rem; color: var(--muted); transition: transform .2s ease, color .2s ease; }

.faq-plus::before, .faq-plus::after { content: ''; position: absolute; left: 50%; top: 50%; width: 1rem; height: 1.5px; border-radius: 1px; background: currentColor; transform: translate(-50%, -50%); }

.faq-plus::after { transform: translate(-50%, -50%) rotate(90deg); }

.faq--ruled .faq-item summary:hover .faq-plus { color: var(--ink); }

.faq--ruled .faq-item[open] .faq-plus { transform: rotate(45deg); color: var(--ink); }

.faq--ruled .faq-answer { padding: 0 2.75rem 1.2rem 0; color: var(--body-text); line-height: 1.65; }

.faq--ruled .faq-answer .prose { max-width: 68ch; }

/* ---------- columns: every answer open. The template renders the `open` attribute for this look: a closed
   <details> cannot be forced open from CSS, and faking it with height tricks breaks the built-in semantics
   screen readers rely on. ---------- */
.faq--columns .faq-item summary { cursor: default; pointer-events: none; }

.faq--columns .faq-item summary::after, .faq--columns .faq-plus { content: none; display: none; }

/* Boxed: a block, not the list's grid — columns do nothing on a grid container. */
.faq--boxed .faq-list--columns { display: block; columns: 2; column-gap: 2.4rem; }

.faq--boxed .faq-list--columns .faq-item { break-inside: avoid; margin-bottom: 1.4rem; }

.faq--ruled .faq-list--columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2.4rem; }

.faq--ruled.faq--columns .faq-item summary { padding-bottom: .5rem; }

.faq--ruled.faq--columns .faq-answer { padding: 0 0 1.1rem; }

@media (max-width: 899px) {
  .faq--side .faq-side { display: contents; }
  .faq-nav { order: 1; display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; }
  .faq-nav__link { flex: none; padding: .4rem .9rem; border: 1px solid var(--card-line); border-radius: var(--pill); font-size: .85rem; }
  .faq--side .faq-main { order: 2; }
  .faq--side .ask-band--card { order: 3; }
  .faq--ruled .faq-list--columns { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .faq--boxed .faq-list--columns { columns: 1; }
}

@media (max-width: 559px) {
  .faq--ruled .faq-answer { padding-right: 0; }
}
