/* The car dealer FAQ split by topic: the questions of a made-up dealership, Arvelle Motors, on a white page.
   Three topics share one list: each topic is a group laid in the same place, and the script moves the rows in and
   out with GSAP, opens the answers on a spring and keeps the list as tall as what is shown. */
:root {
  --page: #ffffff;            /* the page */
  --panel: #fafbfc;           /* the panel */
  --edge: rgba(18, 22, 32, 0.08); /* the hairlines and the panel's edge */
  --ink: #12151c;             /* the questions */
  --muted: #6b7080;           /* the small words */
  --track: #f1f2f5;           /* the track of the tabs */
  --accent: #2b54e0;          /* the cobalt of the brand */
  --accent-deep: #1a37a8;     /* the dark side of the cobalt */
  --accent-soft: #e7ecff;     /* the tint of the facts and of the open row */
  --button: #12151c;          /* the button at the bottom */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the panel */
.faq {
  position: relative;
  width: min(94vw, 440px);
  padding: clamp(11px, 3.2vh, 20px) clamp(12px, 4vw, 20px) clamp(10px, 2.8vh, 16px);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, var(--panel) 70%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 0 0 1px var(--edge),
    0 1px 2px rgba(14, 20, 40, 0.05),
    0 8px 18px -8px rgba(14, 20, 40, 0.1),
    0 34px 66px -30px rgba(20, 34, 90, 0.24);
  opacity: 0;
  isolation: isolate;
}

/* a cold light that lies on the top edge of the panel, like on a car's paint */
.faq__sheen {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 0;
  height: 1px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, rgba(120, 150, 255, 0.55), transparent);
  pointer-events: none;
}

.faq__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.faq__mark {
  width: 30px;
  height: 30px;
  flex: none;
  padding: 3px;
  border-radius: 9px;
  background: linear-gradient(155deg, #4a72ff, var(--accent) 55%, var(--accent-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 5px 12px -5px rgba(43, 84, 224, 0.7);
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.faq__mark-b {
  stroke-opacity: 0.6;
}

.faq__title {
  margin: 0;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 640;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.faq__meta {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 460;
}

.faq__chip {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 70%, #ffffff);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ---------------------------------------------------------------- the tabs */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: clamp(10px, 2.8vh, 16px) 0 clamp(4px, 1.2vh, 8px);
  padding: 3px;
  height: clamp(36px, 9.6vh, 42px);
  border-radius: 13px;
  background: var(--track);
  box-shadow: inset 0 1px 2px rgba(14, 20, 40, 0.06), inset 0 0 0 1px rgba(14, 20, 40, 0.04);
}

/* the white plate under the chosen topic: GSAP moves its two edges one after the other, so it stretches as it goes */
.tabs__pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #fbfbfd);
  box-shadow:
    0 0 0 1px rgba(14, 20, 40, 0.06),
    0 1px 2px rgba(14, 20, 40, 0.08),
    0 4px 10px -4px rgba(20, 34, 90, 0.2);
  overflow: hidden;
  pointer-events: none;
}

.tabs__shine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(100deg, transparent, rgba(120, 150, 255, 0.14), transparent);
  opacity: 0;
}

.tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: clamp(12px, 3.4vw, 13.5px);
  font-weight: 560;
  font-variation-settings: 'wdth' 100;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.25s ease;
}

.tab.is-on {
  color: var(--ink);
}

.tab__ico {
  flex: none;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.25s ease;
}

.tab.is-on .tab__ico {
  stroke: var(--accent);
}

.tab__label {
  white-space: nowrap;
}

@media (hover: hover) {
  .tab:not(.is-on):hover {
    color: #3a3f4c;
  }
}

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

/* ---------------------------------------------------------------- the questions */
.list {
  position: relative;
  height: 150px;
  /* clipped only above and below: the rows that slide in from the side are not cut */
  clip-path: inset(0 -60px);
}

.group {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  visibility: hidden;
}

.row {
  position: relative;
}

.row::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 1px;
  background: var(--edge);
}

.row:last-child::after {
  opacity: 0;
}

.q {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: var(--qh, 46px);
  padding: 0 2px 0 4px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: clamp(13.5px, min(3.9vw, 3.8vh), 15px);
  font-weight: 560;
  font-variation-settings: 'wdth' var(--w, 100);
  letter-spacing: -0.008em;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.q:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 10px;
}

.q__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}

.plus {
  position: relative;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(14, 20, 40, 0.1), 0 1px 2px rgba(14, 20, 40, 0.06);
}

/* the cobalt plate behind the sign, faded in by GSAP when the row opens */
.plus::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(155deg, #4a72ff, var(--accent) 60%, var(--accent-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 4px 10px -4px rgba(43, 84, 224, 0.75);
  opacity: var(--on, 0);
}

.plus svg {
  position: relative;
  display: block;
  width: 16px;
  height: 16px;
  margin: 6px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.9;
  stroke-linecap: round;
}

.plus path {
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

@media (hover: hover) {
  .q:hover .plus {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 3px 8px -3px rgba(43, 84, 224, 0.35);
  }
  .q:hover .q__text {
    color: #000;
  }
}

.a {
  height: 0;
  overflow: hidden;
}

.a__in {
  padding: 0 42px 12px 4px;
}

.a__p {
  margin: 0;
  font-size: clamp(12.5px, min(3.5vw, 3.3vh), 13.5px);
  line-height: 1.48;
  color: #4b5060;
  font-weight: 450;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 0;
}

.fact {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent-deep);
  padding: 3px 8px;
  border-radius: 7px;
  background: linear-gradient(180deg, #f4f6ff, var(--accent-soft));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fact b {
  font-weight: 680;
}

/* ---------------------------------------------------------------- still have questions */
.more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(6px, 1.8vh, 12px);
  padding: clamp(9px, 2.4vh, 12px) clamp(10px, 3vw, 12px) clamp(9px, 2.4vh, 12px) clamp(12px, 3.4vw, 14px);
  border-radius: 15px;
  background: linear-gradient(180deg, #f5f6f9, #eff1f5);
  box-shadow: inset 0 0 0 1px rgba(14, 20, 40, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.more__text {
  min-width: 0;
}

.more__title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 640;
  font-variation-settings: 'wdth' 102;
  letter-spacing: -0.008em;
  white-space: nowrap;
}

.more__sub {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the button: the label widens on the wdth axis and the plate swells on a bounce, like the pills of the site */
.pill {
  position: relative;
  flex: none;
  height: 38px;
  min-width: 112px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pill__bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #2a2f3b, var(--button) 60%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 1px 2px rgba(14, 20, 40, 0.2),
    0 8px 16px -8px rgba(14, 20, 40, 0.55);
  transition: background 0.3s ease;
}

.pill.is-done .pill__bg {
  background: linear-gradient(180deg, #4a72ff, var(--accent) 60%, var(--accent-deep));
}

.pill__rail {
  position: relative;
  display: block;
  height: 38px;
  overflow: hidden;
}

.pill__line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  white-space: nowrap;
}

.pill__label {
  display: inline-block;
  font-variation-settings: 'wdth' var(--w, 100);
}

.pill__check {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- the pilot's hand */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  fill: #12151c;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  opacity: 0;
  pointer-events: none;
  z-index: 8;
}

@media (max-width: 330px) {
  .tab__ico {
    display: none;
  }
}

@media (max-width: 420px) {
  .a__in {
    padding-right: 34px;
  }
  .more__sub {
    display: none;
  }
  .more__title {
    white-space: normal;
    line-height: 1.2;
  }
  .pill {
    padding: 0 12px;
    min-width: 0;
    font-size: 12.5px;
  }
}

@media (max-height: 460px) {
  .more__sub {
    display: none;
  }
}
