/* ==========================================================================
   FAQs, Forty-Five theme: subtract the doubt
   Every question carries a plus built from two beams; opening it collapses
   the vertical beam and leaves a minus. The rail's large mark loses its
   vertical beam as answers are read. No WebGL.
   Order: page band, layout, hero, rail (mark, count, filter), groups and
   rows, responsive.
   ========================================================================== */

/* Page band
   ========================================================================== */
.faqs {
  --beam-top: #b4b8ff;
  --beam-left: #6d63ff;
  --beam-right: #1b20a6;
  --beam-bottom: #0a0d55;
  --beam-hi: #5d66ff;
  --beam-mid: var(--indigo);
  --beam-sheen: #3d46f2;
  --beam-lo: #1a20b0;
  --beam-deep: #0f1376;
  padding-top: calc(var(--nav-height) + clamp(2rem, 4vw, 3.5rem));
}
.faqs .section-head { margin-bottom: clamp(2rem, 4vw, 3.25rem); }

/* Layout: the rail holds still while the questions scroll
   ========================================================================== */
.faqs-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  grid-template-areas: "rail hero" "rail list";
  column-gap: clamp(2rem, 5vw, 6rem);
}
.faqs-hero { grid-area: hero; margin-bottom: clamp(3rem, 6vw, 5.5rem); }
.faqs-list { grid-area: list; }
.faqs-rail {
  grid-area: rail;
  align-self: start;
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
}

/* Hero
   ========================================================================== */
.faqs-title {
  font: 600 clamp(3rem, 6.4vw, 7.25rem)/0.92 var(--font-display);
  letter-spacing: -0.05em;
  text-wrap: balance;
}
.faqs-title-thin { font-weight: 300; color: var(--white-60); }
.faqs-lede {
  max-width: 34rem;
  margin-top: 1.75rem;
  font: 400 clamp(1.05rem, 0.4vw + 0.95rem, 1.25rem)/1.55 var(--font-display);
  color: var(--white-75);
}

/* Rail: the doubt meter, the count, the categories
   ========================================================================== */
.faqs-meter { border: var(--line); }
.faqs-mark {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(9rem, 27vh, 17rem);
  border-bottom: var(--line);
}
.faqs-mark::before,
.faqs-mark::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  background:
    linear-gradient(var(--white-60), var(--white-60)) center / 1px 100% no-repeat,
    linear-gradient(var(--white-60), var(--white-60)) center / 100% 1px no-repeat;
}
.faqs-mark::before { top: -7px; left: -7px; }
.faqs-mark::after { top: -7px; right: -7px; }
.faqs-mark-svg {
  position: absolute;
  top: 19%;
  left: 0;
  width: 100%;
  height: 62%;
  overflow: visible;
}

.faqs-mark-v {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleY(var(--doubt, 1));
  transition: transform 0.9s var(--ease);
}
.faqs-stop-hi { stop-color: var(--beam-hi); }
.faqs-stop-mid { stop-color: var(--beam-mid); }
.faqs-stop-sheen { stop-color: var(--beam-sheen); }
.faqs-stop-lo { stop-color: var(--beam-lo); }
.faqs-stop-deep { stop-color: var(--beam-deep); }
.faqs-facet--top { fill: var(--beam-top); }
.faqs-facet--left { fill: var(--beam-left); }
.faqs-facet--right { fill: var(--beam-right); }
.faqs-facet--bottom { fill: var(--beam-bottom); }

.faqs-count {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3rem;
  padding: 0 1rem;
  font: 500 0.7rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--white-60);
}
.faqs-count-num { color: var(--paper); font-variant-numeric: tabular-nums; }

.faqs-filter {
  display: grid;
  margin-top: 1.5rem;
  border-top: var(--line);
}
.faqs-filter-btn {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  height: 2.35rem;
  padding: 0 0 0 1.2rem;
  border: 0;
  border-bottom: var(--line);
  background: none;
  font: 450 0.92rem/1 var(--font-display);
  text-align: left;
  color: var(--white-60);
  cursor: pointer;
}
/* the active category is marked with a minus */
.faqs-filter-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0.65rem;
  height: 2px;
  margin-top: -1px;
  background: var(--indigo-soft);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.faqs-filter-btn:hover { color: var(--paper); }
.faqs-filter-btn[aria-pressed="true"] { color: var(--paper); }
.faqs-filter-btn[aria-pressed="true"]::before { transform: scaleX(1); }
.faqs-filter-btn:focus-visible { outline: 1px solid var(--paper); outline-offset: -1px; }
.faqs-filter-count {
  font: 500 0.66rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  color: var(--white-40);
}

/* Groups and rows
   ========================================================================== */
.faqs-group + .faqs-group { margin-top: clamp(3.5rem, 6vw, 5.5rem); }
.faqs-group[hidden] { display: none; }
.faqs-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.1rem 0 1.5rem;
  border-top: 1px solid var(--white-40);
}
.faqs-group-title {
  font: 600 clamp(1.5rem, 1.6vw + 0.9rem, 2.4rem)/1.05 var(--font-display);
  letter-spacing: -0.035em;
}
.faqs-group-index {
  flex: none;
  font: 500 0.7rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
  color: var(--white-40);
}

.faqs-item { border-bottom: var(--line); }
.faqs-group-head + .faqs-item { border-top: var(--line); }
.faqs-question {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: clamp(1.1rem, 1.6vw, 1.5rem) 0;
  list-style: none;
  cursor: pointer;
}
.faqs-question::-webkit-details-marker { display: none; }
.faqs-question:focus-visible { outline: 1px solid var(--paper); outline-offset: 4px; }
.faqs-question-index {
  font: 500 0.7rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--white-40);
}
.faqs-item[open] .faqs-question-index { color: var(--indigo-soft); }
.faqs-question-text {
  font: 500 clamp(1.1rem, 0.6vw + 0.95rem, 1.5rem)/1.3 var(--font-display);
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

/* the plus, as two beams: hairline bevels top and bottom, ends chamfered */
.faqs-beams {
  position: relative;
  width: 1.6rem;
  height: 1.6rem;
  margin-right: 0.35rem;
  opacity: 0.72;
  transition: opacity var(--dur-fast) var(--ease);
}
.faqs-question:hover .faqs-beams,
.faqs-item[open] .faqs-beams { opacity: 1; }
.faqs-beam {
  position: absolute;
  clip-path: polygon(1px 0, calc(100% - 1px) 0, 100% 1px, 100% calc(100% - 1px), calc(100% - 1px) 100%, 1px 100%, 0 calc(100% - 1px), 0 1px);
}
.faqs-beam--h {
  inset: calc(50% - 3px) 0;
  background: linear-gradient(var(--paper) 0 1px, var(--white-75) 1px calc(100% - 1px), var(--white-40) calc(100% - 1px));
}
.faqs-beam--v {
  inset: 0 calc(50% - 3px);
  background: linear-gradient(90deg, var(--paper) 0 1px, var(--white-75) 1px calc(100% - 1px), var(--white-40) calc(100% - 1px));
  transform-origin: center;
  transition: transform var(--dur) var(--ease);
}
/* what's left once the doubt is gone: an indigo minus */
.faqs-beam--h::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--beam-top) 0 1px, var(--indigo) 1px calc(100% - 1px), var(--beam-deep) calc(100% - 1px));
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.faqs-item[open] .faqs-beam--v { transform: scaleY(0); }
.faqs-item[open] .faqs-beam--h::after { opacity: 1; }

.faqs-answer {
  display: grid;
  gap: 1rem;
  max-width: 44rem;
  padding: 0 0 clamp(1.5rem, 2.4vw, 2.25rem) 4rem;
}
.faqs-answer p,
.faqs-answer li {
  font: 400 clamp(1rem, 0.25vw + 0.95rem, 1.12rem)/1.6 var(--font-display);
  color: var(--white-75);
}
.faqs-answer-list { display: grid; border-top: var(--line); counter-reset: faqs-way; }
.faqs-answer-list li {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  padding: 0.7rem 0;
  border-bottom: var(--line);
  counter-increment: faqs-way;
}
.faqs-answer-list li::before {
  content: counter(faqs-way, decimal-leading-zero);
  padding-top: 0.3em;
  font: 500 0.68rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  color: var(--white-40);
}
@media (prefers-reduced-motion: no-preference) {
  .faqs-item[open] .faqs-answer { animation: faqs-answer-in 0.7s var(--ease) both; }
}
@keyframes faqs-answer-in {
  from { opacity: 0; transform: translateY(-8px); }
}

/* Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .faqs-layout { display: block; }
  .faqs-hero { margin-bottom: 2.5rem; }

  /* the rail becomes a bar under the nav: meter on the left, categories scroll */
  .faqs-rail {
    z-index: 5;
    top: var(--nav-height);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.9rem;
    margin: 0 calc(-1 * var(--gutter)) 2rem;
    padding: 0.2rem var(--gutter);
    border-top: var(--line);
    border-bottom: var(--line);
    background: rgba(3, 4, 6, 0.86);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .faqs-meter { display: flex; align-items: center; gap: 0.5rem; border: 0; }
  .faqs-mark { width: 1.9rem; height: 1.9rem; border: 0; }
  .faqs-mark::before, .faqs-mark::after { display: none; }
  .faqs-mark-svg { top: 0; height: 100%; }
  .faqs-count { height: auto; padding: 0; }
  .faqs-count-label { display: none; }
  .faqs-filter {
    position: relative;
    display: flex;
    gap: 0.45rem;
    margin: 0;
    border: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
  }
  .faqs-filter::-webkit-scrollbar { display: none; }
  /* a 44px tap target, the pill drawn inside it */
  .faqs-filter-btn {
    flex: none;
    height: 2.75rem;
    padding: 0 0.95rem;
    border: 0;
    font-size: 0.86rem;
    white-space: nowrap;
  }
  .faqs-filter-btn::after {
    content: "";
    position: absolute;
    inset: 0.3rem 0;
    border: 1px solid var(--white-25);
    border-radius: 999px;
    pointer-events: none;
  }
  .faqs-filter-btn::before, .faqs-filter-count { display: none; }
  .faqs-filter-btn[aria-pressed="true"]::after { border-color: var(--paper); }
  .faqs-filter-btn:focus-visible { outline: 0; }
  .faqs-filter-btn:focus-visible::after { border-color: var(--paper); box-shadow: 0 0 0 1px var(--paper); }
}
@media (max-width: 560px) {
  .faqs-question { grid-template-columns: 2.1rem minmax(0, 1fr) auto; gap: 0.75rem; }
  .faqs-answer { padding-left: 2.85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .faqs-mark-v, .faqs-beam--v, .faqs-beam--h::after, .faqs-filter-btn::before { transition: none; }
}
