/* ElprisAPI frontpage, "Oscilloskop v3". Reference: design/landing-v3/ */

:root {
  --bg: oklch(0.14 0.018 165);
  --plot: oklch(0.12 0.02 165);
  --surface: oklch(0.17 0.022 162);
  --surface-hover: oklch(0.16 0.022 162);
  --border: oklch(0.32 0.05 158);
  --border-soft: oklch(0.28 0.04 160);
  --border-input: oklch(0.3 0.04 160);
  --rule: oklch(0.26 0.04 160);
  --rule-2: oklch(0.24 0.035 160);
  --grid: oklch(0.23 0.035 160);
  --text: oklch(0.93 0.02 150);
  --head: oklch(0.96 0.04 150);
  --muted: oklch(0.72 0.04 155);
  --muted-2: oklch(0.68 0.05 155);
  --faint: oklch(0.58 0.05 155);
  --faint-2: oklch(0.55 0.05 155);
  --accent: oklch(0.88 0.17 150);
  --accent-hi: oklch(0.94 0.12 150);
  --trace: oklch(0.9 0.17 150);
  --spot: oklch(0.6 0.1 150);
  --on-accent: oklch(0.16 0.03 160);
  --danger: oklch(0.78 0.14 25);

  --sans: 'Schibsted Grotesk', system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --pad: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: oklch(0.95 0.1 150); }

button, input, select, textarea { font: inherit; color: inherit; }

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

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

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }

h1, h2 { margin: 0; font-weight: 600; color: var(--head); }
h2 { font-size: 44px; line-height: 1.02; letter-spacing: -0.035em; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: oklch(0.93 0.13 150); color: var(--on-accent); }
.btn-secondary { border-color: oklch(0.34 0.05 158); color: oklch(0.9 0.03 150); }
.btn-secondary:hover { border-color: oklch(0.6 0.08 155); color: oklch(0.9 0.03 150); }
.btn-tint {
  border-color: var(--accent);
  background: oklch(0.88 0.17 150 / .12);
  color: var(--accent-hi);
}
.btn-tint:hover { background: oklch(0.88 0.17 150 / .22); }
.btn-outline { border-color: var(--accent); background: transparent; color: oklch(0.9 0.15 150); }
.btn-outline:hover { background: oklch(0.88 0.17 150 / .12); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Nav ---------- */

.nav {
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 24px var(--pad);
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.logo:hover { color: var(--text); }
.logo-dash {
  width: 18px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.nav-links { display: flex; gap: 26px; font-size: 15px; }
.nav-links a { color: oklch(0.7 0.04 155); }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  margin-left: auto;
  font-size: 15px;
  font-weight: 500;
  padding: 9px 16px;
  border: 1px solid oklch(0.88 0.17 150 / .6);
  border-radius: 6px;
  transition: background-color .15s;
}
.nav-cta:hover { background: oklch(0.88 0.17 150 / .1); color: var(--accent); }

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

.hero {
  padding: 72px var(--pad) 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.hero-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
}
.pill {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid oklch(0.88 0.17 150 / .45);
}
.hero-tags .sub { color: var(--muted-2); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 56px;
  align-items: end;
}
.hero h1 { font-size: 84px; line-height: 0.98; letter-spacing: -0.045em; }
.hero-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 10px;
}
.hero-side p {
  margin: 0;
  font-size: 18px;
  line-height: 1.55;
  color: oklch(0.74 0.04 155);
  text-wrap: pretty;
}
.hero-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Scope ---------- */

.scope {
  margin: 56px var(--pad) 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
}
.seg {
  display: flex;
  padding: 3px;
  border-radius: 8px;
  background: var(--plot);
}
.seg button {
  padding: 6px 14px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
}
.seg button[aria-pressed="true"] {
  background: oklch(0.88 0.17 150 / .18);
  color: var(--accent-hi);
}
.seg-sm button { font-size: 13px; padding: 5px 12px; }
.op-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--plot);
  min-width: 200px;
  max-width: 260px;
}
.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--plot);
}
.stepper button {
  padding: 7px 11px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.stepper button:hover:not([disabled]) { color: oklch(0.9 0.15 150); }
.stepper button[disabled] { opacity: .35; cursor: default; }
.stepper-label { min-width: 96px; text-align: center; font-variant-numeric: tabular-nums;
  position: relative; align-self: stretch; display: flex; align-items: center; justify-content: center; cursor: pointer; }

.stepper-label:hover { color: oklch(0.9 0.15 150); }
.stepper-label:focus-within { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.stepper-label input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  color-scheme: dark;
}
.stepper-label input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.req {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: oklch(0.7 0.05 155);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.scope-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
}
.plot-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 28px 18px;
  background: var(--plot);
  min-width: 0;
}
.plot-pane[data-view="json"] .graph-view { display: none; }
.plot-pane[data-view="graph"] .json-view { display: none; }
.graph-view { display: flex; flex-direction: column; gap: 14px; }

.legend {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 13px;
  color: oklch(0.66 0.05 155);
}
.legend > span { display: flex; align-items: center; gap: 8px; }
.legend .total { color: oklch(0.92 0.12 150); }
.swatch-total { width: 16px; height: 2px; background: var(--trace); }
.swatch-spot { width: 16px; height: 0; border-top: 2px dashed var(--spot); }
.legend .scale { margin-left: auto; font-family: var(--mono); font-size: 11px; }

.plot {
  position: relative;
  height: 340px;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 20%, 8.7% 100%;
  border-bottom: 1px solid var(--grid);
  transition: opacity .2s;
  touch-action: pan-y;
}
.plot.loading { opacity: .35; }
.plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.trace-total { filter: drop-shadow(0 0 6px oklch(0.88 0.17 150 / .8)); }
.cursor-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 12px;
  background: oklch(0.95 0.12 150);
  box-shadow: 0 0 0 4px oklch(0.88 0.17 150 / .25), 0 0 14px var(--accent);
  pointer-events: none;
}
.hits { position: absolute; top: 0; bottom: 0; display: flex; }
.hits > div { flex: 1; cursor: crosshair; }
.hits > div.on { background: oklch(0.88 0.17 150 / .06); }
.plot-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}
.plot-msg[hidden] { display: none; }
.plot-msg.error { color: var(--danger); }

.axis {
  position: relative;
  height: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint-2);
}
.axis span { position: absolute; top: 0; transform: translateX(-50%); }
.axis span:first-child { transform: none; }
.axis span:last-child { transform: translateX(-100%); }
.summary { font-size: 14px; color: oklch(0.7 0.04 155); min-height: 1.4em; }

.json-view {
  margin: 0;
  height: 428px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: oklch(0.8 0.05 150);
}

.readout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px;
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.readout-when {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted-2);
  min-height: 18px;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 8px;
  background: var(--trace);
  flex: none;
  animation: epPulse 2s infinite;
}
.live-dot[hidden] { display: none; }
@keyframes epPulse {
  0% { box-shadow: 0 0 0 0 oklch(0.88 0.17 150 / .7); }
  70% { box-shadow: 0 0 0 8px oklch(0.88 0.17 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.88 0.17 150 / 0); }
}
.readout-total { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 14px; }
.readout-total .big {
  font-size: 60px;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: oklch(0.97 0.08 150);
  text-shadow: 0 0 22px oklch(0.88 0.17 150 / .45);
}
.readout-total .unit { font-size: 14px; color: var(--muted-2); }
.comp {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
}
.comp-row { display: flex; align-items: baseline; gap: 8px; font-size: 14px; min-width: 0; }
.comp-owner {
  font-size: 12px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.comp-val { margin-left: auto; font-variant-numeric: tabular-nums; color: oklch(0.97 0.06 150); }
.comp-bar { height: 3px; border-radius: 2px; background: var(--rule-2); }
.comp-bar > div {
  height: 3px;
  border-radius: 2px;
  width: 0;
  background: var(--c);
  box-shadow: 0 0 6px var(--c);
  transition: width .2s;
}

/* ---------- Stats ---------- */

.stats {
  margin: 0 var(--pad);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat { display: flex; align-items: baseline; gap: 12px; padding: 28px 0; }
.stat-n { font-size: 44px; font-weight: 600; letter-spacing: -0.03em; color: var(--accent); }
.stat-l { font-size: 15px; color: oklch(0.7 0.04 155); }

/* ---------- Generic sections ---------- */

.split {
  padding: 104px var(--pad) 0;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 64px;
}
.split-intro { display: flex; flex-direction: column; gap: 14px; }
.split-intro p, .lead {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  text-wrap: pretty;
}

.compare { display: flex; flex-direction: column; }
.compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  line-height: 1.5;
}
.compare-row .raw { color: oklch(0.6 0.04 155); }
.compare-head {
  padding: 0 0 10px;
  border: 0;
  font-size: 13px;
  color: var(--faint);
}
.compare-head span:last-child { color: var(--accent); }

.endpoints {
  padding: 104px var(--pad) 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.endpoints-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 20px; }
.endpoints-head span { font-size: 15px; color: oklch(0.65 0.04 155); }
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  transition: border-color .15s, background-color .15s;
}
.card:hover { border-color: oklch(0.88 0.17 150 / .55); background: var(--surface-hover); }
.card-path { display: flex; gap: 10px; font-family: var(--mono); font-size: 12px; }
.card-path .m { color: var(--accent); }
.card-path .p { color: oklch(0.8 0.03 150); }
.card-title { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
.card-desc { font-size: 15px; line-height: 1.55; color: oklch(0.7 0.04 155); }
.card-docs { justify-content: flex-end; gap: 6px; border: 1px dashed oklch(0.34 0.05 158); }
.card-docs:hover .card-title { color: var(--accent); }

.op-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 28px;
  align-content: start;
  margin: 0;
  padding: 0;
  list-style: none;
}
.op-list li { padding: 10px 0; border-top: 1px solid var(--rule-2); font-size: 15px; }

/* ---------- API key ---------- */

.keybox {
  margin: 104px var(--pad) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  scroll-margin-top: 24px;
}
.keybox-form { display: flex; flex-direction: column; gap: 14px; padding: 36px; }
.keybox-form h2 { font-size: 36px; letter-spacing: -0.03em; }
.inline-form { display: flex; gap: 8px; margin-top: 8px; }
.input {
  font-size: 15px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-input);
  background: transparent;
  min-width: 0;
}
.input::placeholder { color: var(--faint-2); }
.input:focus-visible { outline-offset: 0; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.inline-form .input { flex: 1; border-color: var(--border); background: var(--plot); }
.keybox-code {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 36px;
  background: var(--plot);
  border-left: 1px solid var(--border);
}
.keybox-code .label { font-size: 13px; color: oklch(0.62 0.05 155); }
.keybox-code pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  color: oklch(0.78 0.04 155);
  white-space: pre-wrap;
  word-break: break-word;
}
.keybox-code pre em { font-style: normal; color: var(--accent); }

.form-msg { margin: 0; font-size: 14px; line-height: 1.5; min-height: 1.5em; }
.form-msg.success { color: var(--accent); }
.form-msg.error { color: var(--danger); }

/* ---------- Contact ---------- */

.contact-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  font-size: 15px;
  align-content: start;
}
.contact-form .full { grid-column: 1 / -1; }
.contact-form textarea { resize: vertical; }
.contact-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Footer ---------- */

.footer {
  display: flex;
  gap: 24px;
  margin: 96px var(--pad) 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--faint-2);
}
.footer a { color: var(--faint-2); }
.footer a:hover { color: var(--text); }
.footer a:first-of-type { margin-left: auto; }

section[id] { scroll-margin-top: 24px; }

/* ---------- Responsive (not designed; README suggestion) ---------- */

@media (max-width: 1100px) {
  .hero h1 { font-size: 68px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; }
}

@media (max-width: 1000px) {
  :root { --pad: 32px; }
  .hero-grid, .split, .keybox, .scope-body { grid-template-columns: minmax(0, 1fr); }
  .hero-grid { gap: 28px; align-items: start; }
  .hero h1 { font-size: 60px; }
  .split { gap: 28px; padding-top: 80px; }
  .endpoints { padding-top: 80px; }
  .keybox { margin-top: 80px; }
  .readout { border-left: 0; border-top: 1px solid var(--border); }
  .keybox-code { border-left: 0; border-top: 1px solid var(--border); }
  .req { order: 10; flex-basis: 100%; margin-left: 0; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-links { display: none; }
}

@media (max-width: 640px) {
  :root { --pad: 20px; }
  .nav { padding-top: 18px; padding-bottom: 18px; }
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 48px; }
  .hero-tags { flex-wrap: wrap; }
  h2 { font-size: 34px; }
  .scope { margin-top: 40px; }
  .toolbar { padding: 10px; }
  .op-select { flex: 1; min-width: 0; max-width: none; }
  .plot-pane { padding: 18px 16px 14px; }
  .plot { height: 240px; }
  .legend { flex-wrap: wrap; gap: 8px 16px; }
  .legend .scale { margin-left: 0; flex-basis: 100%; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat { padding: 14px 0; }
  .stats .stat:first-child { padding-top: 28px; }
  .cards, .op-list { grid-template-columns: minmax(0, 1fr); }
  .op-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
  .compare-row { gap: 16px; font-size: 15px; }
  .keybox-form, .keybox-code { padding: 24px; }
  .inline-form { flex-direction: column; }
  .contact-form { grid-template-columns: minmax(0, 1fr); }
  .footer { margin-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .live-dot { animation: none; }
  * { transition: none !important; }
}
