/* ============================================================
   ULTRA — Brand system A · "Clinical Instrument"
   ------------------------------------------------------------
   A dark, Swiss-influenced, instrument-grade system.
   Rooted in the language of scientific hardware:
   registration marks, revision numbers, tabular numerals,
   leader lines, spec cells, and monospaced metadata.
   ============================================================ */

/* TOKENS ---------------------------------------------------- */
:root {
  /* Color — surfaces */
  --ink:        #eef1f5;   /* body text, primary ink */
  --ink-2:      #aab1bc;   /* secondary text */
  --ink-3:      #6b7280;   /* meta / tertiary */
  --ink-4:      #4a515c;   /* disabled */

  --bg:         #0a0b0d;   /* page */
  --bg-2:       #111318;   /* elevated panel */
  --bg-3:       #15181e;   /* card */
  --bg-4:       #191d25;   /* hover */

  --line:       #22262e;   /* hairline */
  --line-2:     #2d323c;   /* stronger rule / card border */
  --line-3:     #3a4150;   /* input outline */

  /* Color — signal */
  --accent:     #ff5a1f;   /* safety orange — primary, signal, CTAs */
  --accent-2:   #ff7543;   /* hover */
  --accent-3:   #2a1108;   /* accent-tinted surface */
  --cyan:       #2ddbff;   /* clinical cyan — data, leaders, live ticks */
  --cyan-2:     #5ce5ff;
  --ok:         #4ade80;   /* status: nominal */
  --warn:       #fbbf24;   /* status: caution */
  --err:        #f87171;   /* status: fault */

  /* Accent tint for light surfaces (specimen tables, print) */
  --paper:      #f4f2ed;
  --paper-ink:  #0a0b0d;

  /* Type scale */
  --f-mono:     'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --f-sans:     'Inter Tight', ui-sans-serif, system-ui, -apple-system, sans-serif;

  /* Size scale */
  --t-10: 10px; --t-11: 11px; --t-12: 12px; --t-13: 13px;
  --t-14: 14px; --t-16: 16px; --t-18: 18px; --t-20: 20px;
  --t-24: 24px; --t-32: 32px; --t-40: 40px; --t-56: 56px;
  --t-72: 72px; --t-96: 96px; --t-128: 128px;

  /* Space scale (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;

  /* Radii — minimal. Everything is 3/4px or square. */
  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;

  /* Grid */
  --col-max: 1320px;
  --gutter:  32px;

  /* Timing */
  --dur-fast: 120ms;
  --dur: 160ms;
  --ease: cubic-bezier(.2,.7,.3,1);
}

/* RESET ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--t-16);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--bg); }

/* TYPOGRAPHY ----------------------------------------------- */
.mono,
.t-mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.eyebrow {
  font-family: var(--f-mono);
  font-size: var(--t-11);
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: var(--s-2);
}
.eyebrow::before {
  content: ""; width: 24px; height: 1px; background: currentColor;
}
.label {
  font-family: var(--f-mono);
  font-size: var(--t-10);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.05; color: var(--ink); }
h1 { font-size: var(--t-96); letter-spacing: -0.04em; line-height: 0.94; }
h2 { font-size: var(--t-56); letter-spacing: -0.03em; line-height: 1; }
h3 { font-size: var(--t-24); }
h4 { font-size: var(--t-18); }
.lede { font-size: 19px; color: var(--ink-2); max-width: 60ch; line-height: 1.5; }

/* LAYOUT --------------------------------------------------- */
.wrap { max-width: var(--col-max); margin: 0 auto; padding: 0 var(--gutter); }

/* NAV ------------------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(10,11,13,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 28px; height: 60px; }
.logo { font-weight: 700; letter-spacing: 0.04em; font-size: 15px; }
.logo::before { content: "◼ "; color: var(--accent); }
.nav-links { display: flex; gap: 22px; font-size: 13px; color: var(--ink-2); margin-left: 30px; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); }
.nav-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
/* Active state for the "Get device" CTA — /device isn't a NAV_ITEMS entry,
   so this is how the device pages signal "you are here" in the nav. */
.nav-right .btn[aria-current="page"] { box-shadow: 0 0 0 2px var(--accent-2, var(--accent)); }

/* PILL / CHIP ---------------------------------------------- */
.pill {
  font-family: var(--f-mono);
  font-size: var(--t-11);
  color: var(--ink-3);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.pill .dot { color: var(--ok); margin-right: 4px; }
.pill.accent { color: var(--accent); border-color: var(--accent); }
.pill.cyan { color: var(--cyan); border-color: rgba(45,219,255,0.35); }

/* BUTTONS -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  color: var(--ink);
  background: transparent;
  font-family: inherit;
  transition: border var(--dur) var(--ease), background var(--dur) var(--ease);
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-2); }
.btn.accent { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 600; }
.btn.accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); }
.btn.lg { padding: 12px 20px; font-size: 14px; }
.btn.xl { padding: 14px 24px; font-size: 15px; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }

/* REGISTRATION MARKS --------------------------------------- */
.reg { position: absolute; width: 14px; height: 14px; border: 1px solid var(--cyan); pointer-events: none; }
.reg.tl { top: -7px; left: -7px; border-right: 0; border-bottom: 0; }
.reg.tr { top: -7px; right: -7px; border-left: 0; border-bottom: 0; }
.reg.bl { bottom: -7px; left: -7px; border-right: 0; border-top: 0; }
.reg.br { bottom: -7px; right: -7px; border-left: 0; border-top: 0; }

/* CARD / PANEL --------------------------------------------- */
.card {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-6);
}
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: var(--t-11);
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
}
.panel-body { padding: var(--s-5); }

/* SPEC CELL (data row) ------------------------------------- */
.spec-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden;
}
.spec-grid > .cell { background: var(--bg-2); padding: var(--s-6); }
.cell .k { font-family: var(--f-mono); font-size: var(--t-11); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.cell .v { font-family: var(--f-mono); font-size: 48px; font-weight: 500; letter-spacing: -0.03em; margin-top: 8px; line-height: 1; }
.cell .v .u { font-size: 16px; color: var(--ink-3); font-weight: 400; margin-left: 4px; }
.cell .sub { font-size: 12px; color: var(--ink-2); margin-top: 8px; }

/* SECTION HEAD --------------------------------------------- */
.sec { padding: 100px 0; border-bottom: 1px solid var(--line); }
.sec.compact { padding: 60px 0; }
/* sec-head — Phase 8.5 closeout polish (was: 200px / 1fr / 40px grid from
   the v2 source). The literal v2 grid layout had `.sec-title` floating
   far to the right of the marginalia-style `.sec-num` rail on wide
   viewports — "Three proposals on the floor." sat near center while
   "01 · ACTIVE PROPOSALS" hugged the left rule, reading as two
   unrelated elements on the same row rather than label-and-title.
   Resolution: stack `.sec-num` above `.sec-title`, both left-aligned
   to the wrap (followups option 1 — most conventional pattern). The
   title now anchors with the section content below, the rail label
   sits directly above its title, and long sec-num text never wraps.
   See docs/migration/followups.md "Public surface .sec-head layout"
   for the surfacing detail. */
.sec-head { display: block; margin-bottom: 48px; }
.sec-num { display: block; font-family: var(--f-mono); font-size: var(--t-11); color: var(--accent); letter-spacing: 0.1em; margin-bottom: 14px; }
.sec-title { font-size: 56px; line-height: 1; letter-spacing: -0.03em; font-weight: 500; max-width: 720px; }
@media (max-width: 720px) {
  .sec-head { margin-bottom: 32px; }
  .sec-title { font-size: 40px; }
}

/* TICKER --------------------------------------------------- */
.ticker { border-bottom: 1px solid var(--line); padding: 16px 0; overflow: hidden; }
.ticker-inner {
  display: flex; gap: 60px;
  font-family: var(--f-mono); font-size: 12px;
  color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase;
  white-space: nowrap;
}
.ticker-inner b { color: var(--ink); font-weight: 500; }

/* WAVEFORM / CHART ----------------------------------------- */
.waveform { height: 48px; display: flex; gap: 2px; align-items: flex-end; padding: 4px 0; }
.waveform .bar { flex: 1; background: var(--ink-3); border-radius: 1px; opacity: 0.6; transition: background var(--dur) var(--ease); }
.waveform.live .bar { background: var(--cyan); opacity: 0.9; }
.chart-mini { height: 40px; display: flex; gap: 2px; align-items: flex-end; }
.chart-mini .b { flex: 1; background: var(--accent); opacity: 0.3; border-radius: 1px; }
.chart-mini .b.on { opacity: 0.9; }

/* FORM ----------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-family: var(--f-mono); font-size: var(--t-11); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.input, select, textarea {
  font-family: inherit; font-size: 14px;
  background: var(--bg-2);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  outline: 0;
  transition: border var(--dur) var(--ease);
  width: 100%;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }

/* BADGE / STATUS ------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: var(--t-10);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 7px; border-radius: 2px;
  background: var(--bg-3); color: var(--ink-2);
}
.badge.ok { color: var(--ok); background: rgba(74,222,128,0.08); }
.badge.warn { color: var(--warn); background: rgba(251,191,36,0.08); }
.badge.err { color: var(--err); background: rgba(248,113,113,0.1); }
.badge.accent { color: var(--accent); background: rgba(255,90,31,0.08); }

/* GRID UTILITIES ------------------------------------------- */
.g-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: var(--s-5); }
.g-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--s-5); }
.g-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--s-5); }
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-6 > * + * { margin-top: var(--s-6); }

.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.accent { color: var(--accent); }
.cyan { color: var(--cyan); }

/* FOOTER --------------------------------------------------- */
footer.site {
  padding: 60px 0 30px;
  color: var(--ink-3); font-size: 12px;
  font-family: var(--f-mono);
  letter-spacing: 0.06em; text-transform: uppercase;
}
footer.site .ft-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px; }
footer.site h4 { font-family: var(--f-mono); font-size: 11px; color: var(--ink); margin-bottom: 14px; letter-spacing: 0.06em; }
footer.site a { display: block; padding: 4px 0; color: var(--ink-3); }
footer.site a:hover { color: var(--ink); }
footer.site .copyright {
  margin-top: 50px; padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between;
}

/* GRID BACKGROUND (for hero product) ----------------------- */
.grid-bg {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* LEADER LINE (engineering callout) ------------------------ */
.leader {
  position: absolute;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 10px;
  color: var(--ink-2); letter-spacing: 0.08em; text-transform: uppercase;
  z-index: 2;
}
.leader::before { content: ""; width: 34px; height: 1px; background: var(--cyan); }
.leader.right { flex-direction: row-reverse; }

/* UTIL: RULE DOT ------------------------------------------- */
.rule-dot::before {
  content: "·";
  margin: 0 8px;
  color: var(--ink-3);
}
