/* calistgress — one stylesheet for the site and the app. Plain on purpose:
   the numbers that matter (clean seconds, full reps) are read from across a
   room, so they are big and everything else stays out of their way. */

:root {
  color-scheme: light dark;
  --ink: #1a201d;
  --bg: #f5f5f2;
  --paper: #ffffff;
  --line: #dfe2dc;
  --muted: #5d6762;
  --brand: #1b4d3e;
  --brand-ink: #f2f5f1;
  --accent: #b7861a;
  --good: #1d7a4f;
  --bad: #b23b3b;
  --warn-bg: #fff4dc;
  --warn-line: #ecc77a;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6ebe7; --bg: #101513; --paper: #18201c; --line: #2a352f; --muted: #98a59e;
    --brand: #7cc4a4; --brand-ink: #0c1310; --accent: #e3b341; --good: #4cc08a; --bad: #ef7d7d;
    --warn-bg: #2d2717; --warn-line: #6d5a2c;
  }
}

* { box-sizing: border-box; }
/* Classes that set display (.claim, .btn, .card…) must not win over hidden. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--brand); }
h1 { font-size: clamp(28px, 4.6vw, 42px); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 22px; letter-spacing: -0.01em; margin: 32px 0 10px; }
h3 { font-size: 17px; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small, .hint { font-size: 14px; }
.hint { color: var(--muted); margin-top: 6px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.error { color: var(--bad); min-height: 1em; }
.ok { color: var(--good); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--paper); padding: 8px 12px; z-index: 10; }

main { max-width: 780px; margin: 0 auto; padding: 36px 20px 64px; }
main.wide { max-width: 1120px; }

/* ── Header and footer ─────────────────────────────────────────────────── */

.site-header {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; font-weight: 550; }
.site-header nav a[aria-current="page"], .site-header nav a:hover { color: var(--ink); }
.site-header .account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.sync-dot[data-state="synced"] { background: var(--good); }
.sync-dot[data-state="syncing"] { background: var(--accent); }
.sync-dot[data-state="error"], .sync-dot[data-state="offline"] { background: var(--bad); }

.claim { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 20px; background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); }

.site-footer {
  display: flex; gap: 18px; justify-content: space-between; flex-wrap: wrap;
  padding: 24px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px;
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }

/* ── Controls ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 650;
  text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 14px; }
.btn.link { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input[type="checkbox"], input[type="radio"] { width: auto; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 14px; }
.honeypot { position: absolute; left: -5000px; }

/* ── Blocks ────────────────────────────────────────────────────────────── */

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 14px 0; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.notice { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.notice ul { margin: 0; padding-left: 18px; }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 1px solid var(--line); color: var(--muted); }
.pill.good { color: var(--good); border-color: var(--good); }
.pill.bad { color: var(--bad); border-color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
tr:last-child td { border-bottom: 0; }

/* ── App: the skill tree ───────────────────────────────────────────────── */

.skill h2 { margin: 0 0 2px; }
.steps { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.steps li { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .mark { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; border: 2px solid var(--line); color: var(--muted); }
.steps li.done .mark { background: var(--good); border-color: var(--good); color: #fff; }
.steps li.current .mark { border-color: var(--brand); color: var(--brand); }
.steps li.current { background: color-mix(in srgb, var(--brand) 7%, transparent); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-radius: 8px; }
.steps .what { flex: 1 1 220px; }
.steps .what strong { display: block; }
.steps .best { font-size: 14px; color: var(--muted); }

/* ── App: the camera screen ────────────────────────────────────────────── */

.stage { position: relative; background: #0b0f0d; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; color: #cfd6d2; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
/* The skeleton is drawn over the video, never over the controls on the stage. */
.stage canvas { pointer-events: none; }
.stage .placeholder { position: relative; z-index: 1; }
.stage.mirror video, .stage.mirror canvas { transform: scaleX(-1); }
.stage .overlay { position: absolute; inset: auto 0 0 0; padding: 10px 14px; background: linear-gradient(transparent, rgb(0 0 0 / 0.7)); color: #fff; font-weight: 650; }
.stage .countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 120px; font-weight: 800; color: #fff; text-shadow: 0 4px 20px rgb(0 0 0 / 0.6); }
.stage .placeholder { padding: 24px; text-align: center; max-width: 460px; }
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0; }
.readout .big { font-size: clamp(54px, 12vw, 96px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.readout .big.clean { color: var(--good); }
.readout .k { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.readout .v { font-size: 28px; font-weight: 750; font-variant-numeric: tabular-nums; }
.fault { min-height: 1.6em; font-weight: 650; color: var(--accent); }
.target-met { color: var(--good); font-weight: 750; }

/* ── App: the log ──────────────────────────────────────────────────────── */

.entry { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; }
.entry .when { color: var(--muted); font-size: 14px; }
.entry .numbers { font-weight: 700; font-variant-numeric: tabular-nums; }
.entry .notes { white-space: pre-wrap; word-break: break-word; }
.entry img { max-width: 220px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.entry .actions { grid-column: 1 / -1; }

/* ── App ───────────────────────────────────────────────────────────────── */

.app-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.app-top select { width: auto; min-width: 220px; font-weight: 650; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 18px 0 8px; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--brand); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; max-width: 560px; width: calc(100% - 32px); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgb(0 0 0 / 0.35); }

/* ── Marketing ─────────────────────────────────────────────────────────── */

.hero { padding: 24px 0 8px; }
.hero .lede { font-size: 19px; color: var(--muted); max-width: 640px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.features .card { margin: 0; }
.features h3 { margin-top: 0; }
.waitlist { border: 2px solid var(--brand); }
.checks { display: grid; gap: 10px; }
.checks dt { font-weight: 750; }
.checks dd { margin: 0 0 8px; color: var(--muted); }

@media print {
  .site-header, .site-footer, .claim, .tabs, .no-print, .app-top select, .app-top .btn { display: none !important; }
  body { background: #fff; color: #000; }
  main, main.wide { max-width: none; padding: 0; }
  .card, table { border-color: #ccc; }
}
