@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/fonts/schibsted-grotesk-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "DSEG7";
  src: url("/fonts/dseg7-classic-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  --paper: #F2F6F8;      /* test vial white */
  --ink: #0E1B3D;        /* deep water navy */
  --ink-soft: #44506E;
  --actinic: #5B4BFF;    /* reef LED blue-violet */
  --actinic-deep: #3F31D9;
  --band: #DCE8FF;       /* target range wash */
  --zoa: #FF3D7F;        /* out of range, dots only */
  --zoa-text: #B8124F;   /* out of range, text */
  --grid: #CFDCE8;
  --lcd: #DCE5EB;
  --radius-s: 8px;
  --radius-m: 14px;
  --measure: 34rem;
  font-size: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--actinic-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--actinic);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem; border-radius: var(--radius-s);
}
.skip:focus { top: 1rem; }

/* ---------- Header ---------- */

.top {
  max-width: 74rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mark {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--ink); text-decoration: none;
  font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em;
}
.mark svg { width: 1.9rem; height: 1.9rem; }
.mark path { fill: none; stroke: var(--actinic); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.top-link { font-weight: 600; font-size: 1rem; }

/* ---------- Hero ---------- */

.hero {
  max-width: 74rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "title  inst"
    "lede   inst"
    "signup inst";
  column-gap: 4rem;
  align-items: start;
}
.hero h1 { grid-area: title; }
.hero .lede { grid-area: lede; }
.hero .instrument { grid-area: inst; }
.hero .signup { grid-area: signup; }

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 4.6vw + 0.6rem, 4.35rem);
  line-height: 1.02;
  font-weight: 830;
  letter-spacing: -0.035em;
  max-width: 13ch;
  text-wrap: balance;
}

.lede {
  margin: 1.6rem 0 0;
  max-width: var(--measure);
  font-size: 1.25rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.signup { margin-top: 2.25rem; max-width: 31rem; }

.join {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

input[type="email"], input[type="text"] {
  font: inherit;
  font-size: 1.0625rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid #B9C7D6;
  border-radius: var(--radius-s);
  padding: 0.8rem 0.95rem;
  min-width: 0;
}
input[type="email"]:hover, input[type="text"]:hover { border-color: var(--ink-soft); }
input[type="email"]:focus-visible, input[type="text"]:focus-visible { border-color: var(--actinic); outline-offset: 1px; }
input::placeholder { color: #7C879F; }

button, .button {
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  color: #fff;
  background: var(--actinic);
  border: 0;
  border-radius: var(--radius-s);
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color 120ms ease;
}
button:hover, .button:hover { background: var(--actinic-deep); color: #fff; }
button:focus-visible, .button:focus-visible { outline-color: var(--ink); }
button[disabled] { opacity: 0.6; cursor: progress; }

.form-note { grid-column: 1 / -1; margin: 0.35rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }
.form-error { grid-column: 1 / -1; margin: 0.35rem 0 0; font-size: 0.95rem; font-weight: 600; color: var(--zoa-text); }

/* ---------- Survey ---------- */

.survey, .thanks { outline: none; }
.survey-title { margin: 0; font-size: 1.6rem; line-height: 1.15; letter-spacing: -0.02em; font-weight: 780; }
.survey > p, .thanks > p { margin: 0.4rem 0 0; color: var(--ink-soft); }

fieldset { border: 0; padding: 0; margin: 1.5rem 0 0; }
legend { font-weight: 650; font-size: 1.02rem; line-height: 1.4; padding: 0; margin-bottom: 0.65rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips span {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border: 2px solid #B9C7D6;
  border-radius: 999px;
  background: #fff;
  font-size: 0.98rem;
  line-height: 1.3;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.chips label:hover span { border-color: var(--ink-soft); }
.chips input:checked + span { border-color: var(--actinic); background: var(--band); font-weight: 650; }
.chips input:focus-visible + span { outline: 3px solid var(--actinic); outline-offset: 2px; }

#survey-form > button { margin-top: 1.6rem; }

.share { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.6rem; margin-top: 1rem; }
.share input { font-size: 0.98rem; }

/* ---------- Instrument ---------- */

.instrument {
  margin: 0.5rem 0 0;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius-m);
  padding: 1.4rem 1.4rem 1.25rem;
  box-shadow: 10px 10px 0 var(--band);
}

.inst-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.inst-tank { margin: 0; font-weight: 750; font-size: 1.05rem; }
.inst-param { margin: 0.15rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }

.lcd {
  position: relative;
  flex: none;
  background: var(--lcd);
  border-radius: var(--radius-s);
  padding: 0.55rem 0.8rem 0.45rem;
  font-family: "DSEG7", ui-monospace, monospace;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--ink);
  box-shadow: inset 0 2px 0 rgba(14, 27, 61, 0.12);
  min-width: 7.4rem;
  text-align: right;
}
.lcd-ghost { position: absolute; right: 0.8rem; top: 0.55rem; color: rgba(14, 27, 61, 0.07); }
.lcd-value { position: relative; }
.lcd.is-low .lcd-value, .lcd.is-high .lcd-value { color: var(--zoa-text); }
.lcd.is-blink .lcd-value { animation: lcd-blink 420ms steps(2, jump-none) 2; }
@keyframes lcd-blink { 50% { opacity: 0; } }

.chart-wrap {
  margin-top: 1.1rem;
  background-color: #FBFDFE;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  border-radius: var(--radius-s);
  border: 1px solid var(--grid);
}
.chart { display: block; width: 100%; height: auto; }
.chart .band { fill: var(--band); opacity: 0.85; }
.chart .band-edge { stroke: var(--actinic); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.55; }
.chart .axis-label { font: 600 12px "Schibsted Grotesk", sans-serif; fill: var(--ink-soft); }
.chart .trend { fill: none; stroke: var(--ink); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: #fff; stroke: var(--ink); stroke-width: 2; }
.chart .dot.out { fill: var(--zoa); stroke: var(--zoa); }
.chart .dot.new { animation: dot-in 360ms cubic-bezier(.2,.9,.3,1.4); transform-box: fill-box; transform-origin: center; }
.chart .dose-line { stroke: var(--actinic); stroke-width: 2; }
.chart .dose-label { font: 650 12px "Schibsted Grotesk", sans-serif; fill: var(--actinic-deep); }
.chart.draw .trend { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.4s ease-out 250ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes dot-in { from { transform: scale(0.2); } to { transform: scale(1); } }

.try { margin-top: 1.1rem; }
.try-label { margin: 0 0 0.5rem; font-weight: 650; font-size: 0.98rem; }
.try-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.55rem; }
.try-chip {
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  min-height: 3rem;
  padding: 0.6rem 0.4rem;
}
.try-chip span { font-weight: 600; font-size: 0.85em; color: var(--ink-soft); }
.try-chip:hover { background: var(--band); color: var(--ink); }
.try-chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.try-chip[aria-pressed="true"] span { color: #C9D3E6; }
.try-type { margin-top: 0.85rem; }
.try-type label { display: block; font-weight: 600; font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 0.4rem; }
.try-next { display: inline-block; margin-top: 0.5rem; font-weight: 700; }
.try-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.55rem; }

.inst-note { margin: 0.9rem 0 0; font-size: 1rem; line-height: 1.45; min-height: 2.9em; }
.inst-note.warn { color: var(--zoa-text); font-weight: 600; }

/* ---------- Body sections ---------- */

.now, .does, .price, .faq {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 1.5rem 5.5rem;
}

h2 {
  margin: 0 0 1.75rem;
  font-size: clamp(1.75rem, 2.2vw + 0.8rem, 2.4rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 790;
  max-width: 30ch;
  text-wrap: balance;
}

.now-rows { border-top: 2px solid var(--ink); }
.now-row {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, var(--measure));
  gap: 2rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid #C3CFDC;
}
.now-row h3 { margin: 0; font-size: 1.2rem; line-height: 1.35; font-weight: 720; }
.now-row p { margin: 0; color: var(--ink-soft); }
.now-answer {
  margin: 2rem 0 0;
  font-size: clamp(1.35rem, 1.2vw + 1rem, 1.75rem);
  line-height: 1.3;
  font-weight: 720;
  letter-spacing: -0.015em;
  max-width: 28ch;
}

.does-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 4rem;
  row-gap: 2.1rem;
  max-width: 64rem;
}
.does-list div { padding-left: 1.1rem; border-left: 3px solid var(--actinic); }
.does-list dt { font-weight: 720; font-size: 1.15rem; }
.does-list dd { margin: 0.3rem 0 0; color: var(--ink-soft); max-width: var(--measure); }

.price {
  padding-top: 3.5rem;
  padding-bottom: 4rem;
}

.price p { max-width: var(--measure); color: var(--ink-soft); margin: 0 0 1.6rem; }

.faq details { border-top: 1px solid #C3CFDC; max-width: 46rem; }
.faq details:last-of-type { border-bottom: 1px solid #C3CFDC; }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 1.1rem 2rem 1.1rem 0;
  font-weight: 680;
  font-size: 1.1rem;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute; right: 0.25rem; top: 50%;
  width: 0.65rem; height: 0.65rem;
  border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 160ms ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.faq details p { margin: 0 0 1.2rem; color: var(--ink-soft); max-width: var(--measure); }

.foot {
  max-width: 74rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 2px solid var(--ink);
  font-size: 0.98rem;
  color: var(--ink-soft);
}
.foot p { margin: 0; }

.noscript { max-width: 74rem; margin: 0 auto 2rem; padding: 0 1.5rem; font-weight: 600; }

/* ---------- Small screens ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "title" "lede" "inst" "signup";
    padding-top: 2.25rem;
    padding-bottom: 4rem;
  }
  .lede { margin-top: 1rem; }
  .instrument { margin-top: 1.6rem; box-shadow: 6px 6px 0 var(--band); }
  .signup { margin-top: 2rem; }
  .now-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .does-list { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .top { padding-top: 1.1rem; }
  .top-link { font-size: 0.95rem; }
  .lede { font-size: 1.125rem; }
  .join, .share { grid-template-columns: 1fr; }
  .chart .axis-label { font-size: 19px; }
  .chart .dose-label { font-size: 18px; }
  .lcd { font-size: 2rem; min-width: 5.8rem; }
  .instrument { padding: 1.1rem 1rem 1rem; }
  .foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .chart.draw .trend { animation: none; stroke-dashoffset: 0; }
  .chart .dot.new, .lcd.is-blink .lcd-value { animation: none; }
  button, .button, .chips span, .faq summary::after { transition: none; }
}
