/* chemlabs.ai — design tokens.
   Light is defined on bare :root; dark is redefined twice so an explicit
   toggle wins in both directions and "system" still resolves correctly. */
:root {
  --bg:        #fbfbfa;
  --bg-raised: #ffffff;
  --bg-sunken: #f2f2f0;
  --line:      #e2e2de;
  --line-soft: #ededea;
  --fg:        #16171a;
  --fg-muted:  #5f6470;
  --fg-faint:  #8b909c;
  --accent:    #00875a;   /* the separation line: a measured value */
  --accent-fg: #ffffff;
  --accent-dim:#e6f4ee;
  --magenta:   #b4179b;   /* the fill line */
  --amber:     #a86a00;   /* the tracked outline */
  --danger:    #c0392b;
  --shadow:    0 1px 2px rgba(16,17,26,.06), 0 8px 24px rgba(16,17,26,.06);
  --radius:    10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0a0b0d;
    --bg-raised: #131519;
    --bg-sunken: #08090b;
    --line:      #24272e;
    --line-soft: #1a1d22;
    --fg:        #eceef2;
    --fg-muted:  #9aa1ae;
    --fg-faint:  #6b7280;
    --accent:    #00d68f;
    --accent-fg: #04120c;
    --accent-dim:#0e2a20;
    --magenta:   #ff6ee0;
    --amber:     #ffc453;
    --danger:    #ff6b5e;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg:#0a0b0d; --bg-raised:#131519; --bg-sunken:#08090b;
  --line:#24272e; --line-soft:#1a1d22;
  --fg:#eceef2; --fg-muted:#9aa1ae; --fg-faint:#6b7280;
  --accent:#00d68f; --accent-fg:#04120c; --accent-dim:#0e2a20;
  --magenta:#ff6ee0; --amber:#ffc453; --danger:#ff6b5e;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
a { color: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }

/* ---------- nav ---------- */
header.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-in { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -.01em; text-decoration: none; font-size: 15px; }
.brand .mark { width: 20px; height: 20px; flex: none; }
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--fg-muted); text-decoration: none; font-size: 14px; }
.nav-links a:hover { color: var(--fg); }
@media (max-width: 720px) { .nav-links a.hide-sm { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 550; text-decoration: none;
  cursor: pointer; transition: background .15s, border-color .15s, opacity .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { opacity: .88; }
.btn-ghost { border-color: var(--line); color: var(--fg); background: transparent; }
.btn-ghost:hover { background: var(--bg-sunken); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--line); border-radius: 8px; background: transparent;
  color: var(--fg-muted); cursor: pointer;
}
.icon-btn:hover { color: var(--fg); background: var(--bg-sunken); }

/* ---------- hero ---------- */
.hero { padding: 88px 0 64px; border-bottom: 1px solid var(--line-soft); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-dim);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 22px;
}
h1 { font-size: clamp(34px, 5.2vw, 56px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 20px; font-weight: 660; }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--fg-muted); max-width: 660px; margin: 0 0 32px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* the claim strip — instrument readout, not marketing */
.readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden; margin-top: 48px;
}
.readout div { background: var(--bg); padding: 18px 20px; }
.readout .n { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -.02em; display: block; }
.readout .k { font-size: 12.5px; color: var(--fg-muted); margin-top: 4px; display: block; line-height: 1.4; }

/* ---------- sections ---------- */
section { padding: 76px 0; border-bottom: 1px solid var(--line-soft); }
h2 { font-size: clamp(24px, 3.2vw, 32px); letter-spacing: -.02em; margin: 0 0 14px; font-weight: 640; }
h3 { font-size: 17px; margin: 0 0 8px; font-weight: 600; letter-spacing: -.01em; }
.sub { color: var(--fg-muted); max-width: 640px; margin: 0 0 40px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.card {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}
.card p { color: var(--fg-muted); font-size: 14.5px; margin: 0; }
.card .glyph { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 12px; display: block; letter-spacing: .05em; }

/* ---------- tables ---------- */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-faint); font-weight: 600; }
td.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pass { color: var(--accent); font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.fail { color: var(--danger); font-family: var(--mono); font-size: 12.5px; font-weight: 600; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 550; margin-bottom: 6px; }
label .opt { color: var(--fg-faint); font-weight: 400; }
input, textarea, select {
  width: 100%; padding: 10px 13px; font: inherit; font-size: 14.5px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 110px; resize: vertical; }
.form-note { font-size: 12.5px; color: var(--fg-faint); margin-top: 10px; }
.msg { padding: 12px 15px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; display: none; }
.msg.show { display: block; }
.msg.ok { background: var(--accent-dim); color: var(--accent); }
.msg.err { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row-2 { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
footer { padding: 48px 0; color: var(--fg-faint); font-size: 13.5px; }
.foot-in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
footer a { color: var(--fg-muted); text-decoration: none; margin-left: 20px; }
footer a:hover { color: var(--fg); }

/* ---------- demo player ---------- */
.player-shell { background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.player-shell iframe, .player-shell video { width: 100%; height: 100%; border: 0; display: block; }
.gate {
  max-width: 460px; margin: 64px auto; background: var(--bg-raised);
  border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow);
}
.views-left {
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12.5px;
  color: var(--fg-muted); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.dot.spent { background: var(--fg-faint); opacity: .4; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 28px; flex-wrap: wrap; }
.admin-tabs button {
  padding: 10px 16px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--fg-muted); font: inherit; font-size: 14px; cursor: pointer;
}
.admin-tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.link-out { font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--accent); }
.badge { font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 5px; background: var(--bg-sunken); color: var(--fg-muted); border: 1px solid var(--line-soft); }
.badge.live { color: var(--accent); border-color: var(--accent); }
.badge.dead { color: var(--fg-faint); }
.empty { color: var(--fg-faint); font-size: 14px; padding: 32px 0; text-align: center; }
