/* The FAQ with the filter that opens the right answer: the help questions of an e-bike rental, Corvo, on a white page.
   The rows sit in one absolute layer inside the list and the script places them with GSAP (y and height), so they can
   change order and size on a spring without moving in the DOM. */
:root {
  --page: #ffffff;          /* the page */
  --panel: #fbfbf9;         /* the panel */
  --edge: rgba(20, 24, 22, 0.08); /* the hairlines and the panel's edge */
  --ink: #141816;           /* the questions */
  --muted: #6c736f;         /* the small words */
  --accent: #0f8a5c;        /* the green of the brand */
  --accent-soft: #d7f5e6;   /* the highlighter on the matched letters */
  --field: #ffffff;         /* the search field */
}

* {
  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: 12px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the panel */
.faq {
  position: relative;
  width: min(94vw, 440px);
  padding: clamp(12px, 3.6vh, 20px) clamp(12px, 4vw, 20px) clamp(8px, 2.4vh, 14px);
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, var(--panel) 60%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 0 0 1px var(--edge),
    0 1px 2px rgba(16, 24, 20, 0.05),
    0 8px 18px -8px rgba(16, 24, 20, 0.1),
    0 32px 64px -28px rgba(16, 40, 30, 0.22);
  opacity: 0;
}

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

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

.faq__mark {
  width: 30px;
  height: 30px;
  flex: none;
  padding: 3px;
  border-radius: 9px;
  background: linear-gradient(160deg, #13a06c, var(--accent) 60%, #0b6d48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 10px -4px rgba(15, 138, 92, 0.6);
}

.faq__mark circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.45);
  stroke-width: 1.6;
}

.faq__mark path {
  fill: #ffffff;
}

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

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

.faq__chip {
  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 search field */
.search {
  position: relative;
  margin: clamp(10px, 3vh, 16px) 0 clamp(4px, 1.4vh, 8px);
  height: clamp(40px, 11vh, 46px);
  border-radius: 13px;
  background: var(--field);
  box-shadow:
    inset 0 0 0 1px rgba(20, 24, 22, 0.1),
    inset 0 1px 2px rgba(20, 24, 22, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.9);
  transition: box-shadow 0.28s ease;
  overflow: hidden;
}

.search.is-focus {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--accent) 62%, transparent),
    0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent),
    0 6px 16px -8px color-mix(in srgb, var(--accent) 45%, transparent);
}

.search__lens {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 0.25s ease;
}

.search.is-focus .search__lens {
  stroke: var(--accent);
}

.search__input,
.search__mirror {
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.search__input {
  position: absolute;
  inset: 0;
  width: 100%;
  padding: 0 128px 0 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  caret-color: var(--accent);
  -webkit-appearance: none;
  appearance: none;
}

.search__input::placeholder {
  color: #9aa19d;
}

.search__mirror {
  position: absolute;
  left: 40px;
  top: 0;
  visibility: hidden;
  white-space: pre;
}

/* the pilot's caret: the field is never focused by the pilot, so a caret is drawn for it */
.search__caret {
  position: absolute;
  left: 40px;
  top: 50%;
  width: 1.6px;
  height: 18px;
  margin-top: -9px;
  border-radius: 1px;
  background: var(--accent);
  opacity: 0;
}

.search.is-typing .search__caret {
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

.search__count {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 540;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.search__drum {
  position: relative;
  display: inline-block;
  height: 16px;
  min-width: 8px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 640;
}

.search__n {
  display: block;
  line-height: 16px;
  text-align: right;
}

.search__drum .search__n + .search__n {
  position: absolute;
  right: 0;
  top: 0;
}

.search__clear {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(20, 24, 22, 0.06);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}

.search__clear svg {
  width: 16px;
  height: 16px;
  display: block;
  margin: 5px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.search.has-text .search__clear {
  pointer-events: auto;
}

@media (hover: hover) {
  .search__clear:hover {
    background: rgba(20, 24, 22, 0.1);
  }
}

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

/* a thin light that runs along the bottom edge when the results change */
.search__glint {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 80%, #ffffff), transparent);
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the questions */
.list {
  position: relative;
  height: 230px;
}

.row {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  overflow: hidden;
  will-change: transform;
}

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

.row.is-last::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' 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 {
  position: relative;
  isolation: isolate;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform-origin: 0 50%;
}

.q__text mark {
  position: relative;
  background: none;
  color: inherit;
  font-weight: 680;
}

.q__text mark .hl {
  position: absolute;
  left: -1.5px;
  right: -1.5px;
  top: 8%;
  bottom: 4%;
  z-index: -1;
  border-radius: 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 70%, #ffffff), var(--accent-soft));
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--accent) 28%, transparent);
  transform-origin: 0 50%;
}

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

/* the filled 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(160deg, #13a06c, var(--accent) 65%, #0b6d48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 10px -4px rgba(15, 138, 92, 0.7);
  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(15, 138, 92, 0.35);
  }
  .q:hover .q__text {
    color: #000;
  }
}

.a {
  position: relative;
}

.a__in {
  padding: 0 46px 14px 4px;
}

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

.a__more {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.a__more svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list__empty {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  margin: 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the pilot's hand */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  fill: #141816;
  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: 420px) {
  .search__input {
    padding-right: 112px;
  }
  .search__count {
    right: 38px;
  }
  .a__in {
    padding-right: 36px;
  }
}
