/*
  The dashboard's own tokens (src/app/globals.css, src/lib/accent.ts), so the
  site and the screenshots on it read as one product. Dark is the default, as
  in the dashboard; light follows the visitor's system unless they pick.
*/
:root {
  --bg: #000000;
  --bg-panel: #0a0a0b;
  --bg-inset: #08080a;
  --border: #1e1e22;
  --border-strong: #2c2c33;
  --text: #f5f5f7;
  --text-dim: #a1a1aa;
  --text-faint: #7c7c88;
  --danger: #ff4d4f;
  --grid: #1a1a1e;
  --hm-none: #0b0b0d;
  --tip-bg: #0c0c0e;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.02);
  --ink-lo: 0.45;
  --ink-hi: 1;
  --down-keep: 78%;
  --down-mix: #000;
  --up-keep: 72%;
  --up-mix: #fff;
  --row-hover: #101012;

  --blue: #2f80ed;  --blue-bright: #4d97ff;  --blue-fill: #1570eb;
  --green: #3ddc84; --green-bright: #66eda5;

  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f4f5f7;
  --bg-panel: #ffffff;
  --bg-inset: #eef0f3;
  --border: #e3e5ea;
  --border-strong: #cfd2d9;
  --text: #16171a;
  --text-dim: #52525b;
  --text-faint: #6b6b76;
  --danger: #b42318;
  --grid: #eceef2;
  --hm-none: #f6f7f9;
  --tip-bg: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.05);
  --ink-lo: 0;
  --ink-hi: 0.78;
  --down-keep: 100%;
  --down-mix: #000;
  --up-keep: 45%;
  --up-mix: #fff;
  --row-hover: #eceff4;

  --blue: #1664d9;  --blue-bright: #0f5bc4;  --blue-fill: #1664d9;
  --green: #0d7340; --green-bright: #0b6b3a;
  color-scheme: light;
}

/* Per-device accent: the same switch the dashboard flips with data-device. */
:root, [data-device='windows'] {
  --accent: var(--blue);
  --accent-bright: var(--blue-bright);
  --accent-fill: var(--blue-fill);
  --on-accent: #ffffff;
}
[data-device='android'] {
  --accent: var(--green);
  --accent-bright: var(--green-bright);
  --accent-fill: var(--green);
  --on-accent: #06140c;
}
:root[data-theme='light'] [data-device='android'] { --on-accent: #ffffff; }
[data-device] {
  --down: color-mix(in srgb, var(--accent) var(--down-keep), var(--down-mix));
  --up: color-mix(in srgb, var(--accent-bright) var(--up-keep), var(--up-mix));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Geist, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Geist Mono', ui-monospace, Consolas, monospace; font-size: 0.86em; background: var(--bg-inset); border: 1px solid var(--border); border-radius: 5px; padding: 0.05em 0.35em; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-blue { background: var(--blue); }
.dot-green { background: var(--green); }
.accent-text { color: var(--accent-bright); }
.red { color: var(--danger); font-weight: 600; }

/* ---------------------------------------------------------------- top bar */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.top-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.top-links { display: none; gap: 4px; margin-left: 16px; }
.top-links a { color: var(--text-dim); padding: 6px 12px; border-radius: 8px; font-size: 15px; }
.top-links a:hover { color: var(--text); background: var(--bg-inset); text-decoration: none; }
@media (min-width: 860px) { .top-links { display: flex; } }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--border-strong); border-radius: 999px;
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--bg-inset); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme='dark'] .i-moon, :root[data-theme='light'] .i-sun { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 18px; border-radius: 999px; font-weight: 500; font-size: 15px;
  border: 1px solid var(--border-strong); color: var(--text); background: transparent;
  transition: background 150ms, transform 150ms;
}
.btn:hover { background: var(--bg-inset); text-decoration: none; transform: translateY(-1px); }
.btn-solid { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-solid:hover { background: var(--accent-fill); filter: brightness(1.08); }

/* ---------------------------------------------------------------- hero */
.hero { padding-top: 56px; padding-bottom: 24px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 999px;
  font: 13px 'Geist Mono', ui-monospace, monospace; color: var(--text-dim);
}
h1 { font-size: clamp(2.3rem, 6.4vw, 4.6rem); line-height: 1.02; font-weight: 700; letter-spacing: -0.045em; }
.lede { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--text-dim); margin: 24px 0 0; }
.lede strong { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }

.retention { margin-top: 48px; padding: 22px 24px 18px; }
.ret-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 10px; }
.ret-title { font-weight: 600; }
.ret-scale { display: none; }
.ret-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); }
.ret-label { font-size: 15px; }
.ret-label small { display: block; color: var(--text-faint); font-size: 13px; }
.ret-label.strong { font-weight: 600; }
.ret-track { position: relative; height: 26px; background: var(--bg-inset); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.ret-fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; transform-origin: right; animation: grow 900ms ease-out both; }
.ret-win { background: var(--blue); opacity: 0.55; }
.ret-and { background: var(--green); opacity: 0.55; }
.ret-us { background: linear-gradient(90deg, color-mix(in srgb, var(--blue) 35%, transparent), var(--blue)); transform-origin: left; }
.ret-empty { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font: 12px 'Geist Mono', monospace; color: var(--text-faint); }
.ret-reset { position: absolute; top: 3px; bottom: 3px; width: 2px; background: var(--danger); }
.ret-reset::after { content: 'reset'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 12px 'Geist Mono', monospace; color: var(--danger); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (min-width: 720px) {
  .ret-row { grid-template-columns: 230px 1fr; align-items: center; gap: 20px; }
  .ret-scale { display: flex; justify-content: space-between; width: calc(100% - 250px); font: 12px 'Geist Mono', monospace; color: var(--text-faint); }
}

/* ---------------------------------------------------------------- sections */
.section { padding-top: 88px; }
.section h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); font-weight: 700; }
.section-lede { color: var(--text-dim); margin: 10px 0 28px; }
.section > h2 + .flow { margin-top: 28px; }

/* flow */
.flow { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .flow { grid-template-columns: 1fr 1fr; } .sink { grid-column: 1 / -1; } }
.lane { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; border-top: 3px solid var(--blue); }
.lane-and { border-top-color: var(--green); }
.lane-head { display: flex; align-items: center; gap: 10px; font-weight: 600; flex-wrap: wrap; }
.lane-head small { color: var(--text-faint); font-weight: 400; font-size: 13px; }
.steps { list-style: none; margin: 14px 0 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 8px 0 8px 40px; border-top: 1px solid var(--border); }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 10px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font: 600 13px 'Geist Mono', monospace; background: var(--bg-inset); border: 1px solid var(--border-strong); color: var(--text-dim);
}
.steps b { display: block; font-weight: 600; }
.steps span { color: var(--text-dim); font-size: 15px; }
.sink { display: grid; gap: 12px; align-items: stretch; grid-template-columns: 1fr; }
@media (min-width: 720px) { .sink { grid-template-columns: 1fr 40px 1fr; } }
.sink-box { border: 1px solid var(--border-strong); background: var(--bg-panel); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.sink-box span { color: var(--text-dim); font-size: 15px; }
.sink-dash { border-color: color-mix(in srgb, var(--blue) 55%, var(--border)); }
.sink-arrow { display: none; }
@media (min-width: 720px) {
  .sink-arrow { display: block; position: relative; }
  .sink-arrow::before { content: ''; position: absolute; left: 4px; right: 10px; top: 50%; height: 2px; background: var(--border-strong); }
  .sink-arrow::after { content: ''; position: absolute; right: 4px; top: calc(50% - 6px); border: 7px solid transparent; border-left-color: var(--border-strong); border-right: 0; }
}

/* tour */
.tabs, .seg { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs button, .seg button {
  font: 500 14px Geist, system-ui, sans-serif; color: var(--text-dim);
  background: transparent; border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.tabs button:hover, .seg button:hover { color: var(--text); background: var(--bg-inset); }
.tabs button[aria-selected='true'] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.seg button[aria-checked='true'] { color: var(--text); background: var(--bg-inset); border-color: var(--text-faint); }
.shot { margin: 16px 0 0; overflow: hidden; }
.shot-scroll { height: min(78vh, 760px); overflow-y: auto; background: #000; }
.shot-scroll img { display: block; width: 100%; height: auto; }

/* chart gallery */
.charts-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
.charts-head > div:first-child { flex: 1 1 520px; }
.charts-head .section-lede { margin-bottom: 0; }
.gallery { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.viz { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.viz header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.viz h3 { font-size: 1.15rem; font-weight: 600; }
.where { font: 12px 'Geist Mono', monospace; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.viz > p { color: var(--text-dim); font-size: 15px; margin: 6px 0 16px; }
/* A card with no paragraph still needs its gap under the header. */
.viz > header + .stats, .viz > header + .chart { margin-top: 16px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text, .svg-text { fill: var(--text-faint); font: 11px Geist, system-ui, sans-serif; }

.callout { text-align: right; }
.callout-label { font: 10px 'Geist Mono', monospace; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.callout-date { margin-left: 6px; font-size: 13px; }
.callout-value { color: var(--accent-bright); font-weight: 650; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.chart-top { display: flex; justify-content: flex-end; margin: -6px 0 4px; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--bg-inset); transition: transform 180ms, border-color 180ms; }
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat-label { font: 11px 'Geist Mono', monospace; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.stat-value { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin-top: 6px; }
.stat-value small { font-size: 0.5em; color: var(--text-dim); margin-left: 4px; font-weight: 500; }
.stat:first-child .stat-value { color: var(--accent-bright); }
.stat-sub { color: var(--text-dim); font-size: 13px; font-variant-numeric: tabular-nums; }

.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--text-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.hm-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--text-faint); }
.hm-scale { display: inline-flex; align-items: center; gap: 3px; }
.hm-scale i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.hm-scale i.none { background: var(--hm-none); box-shadow: inset 0 0 0 1px var(--border-strong); }
.mini-btn { font: 500 13px Geist, system-ui, sans-serif; color: var(--text); background: transparent; border: 1px solid var(--border-strong); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.mini-btn:hover { background: var(--bg-inset); }
.hm { display: grid; grid-template-columns: 30px repeat(26, minmax(0, 1fr)); gap: 3px; font-size: 11px; color: var(--text-faint); }
.hm-month { white-space: nowrap; overflow: visible; line-height: 1.6; }
.hm-day { align-self: center; line-height: 1; }
.hm-cell { aspect-ratio: 1; border-radius: 3px; }
.hm-cell.hm-none { background: var(--hm-none); box-shadow: inset 0 0 0 1px var(--border-strong); }
@media (min-width: 900px) { .hm { gap: 4px; } }
.hm-block-label { font-size: 13px; color: var(--text-dim); margin: 14px 0 4px; }

.split-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--bg-inset); }
.split-bar span { height: 100%; transform-origin: left; animation: grow 800ms ease-out both; }
.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.half-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.half-label i { width: 9px; height: 9px; border-radius: 2px; }
.half-value { font-size: clamp(1.6rem, 3.6vw, 2.3rem); font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.half-value small { font-size: 0.5em; color: var(--text-dim); margin-left: 4px; }
.half-sub { color: var(--text-dim); font-size: 13px; }

.netlist { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.netlist-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-faint); margin-bottom: 4px; }
.netlist-head b { color: var(--text); font-weight: 600; }
.netrow { display: grid; grid-template-columns: minmax(0, 1.3fr) 80px minmax(0, 2fr); align-items: center; gap: 12px; padding: 7px 0; font-size: 14px; }
.netrow .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.netrow .n.unnamed { font-style: italic; color: var(--text-faint); }
.netrow .v { text-align: right; font-variant-numeric: tabular-nums; }
.bar-track { height: 6px; border-radius: 999px; background: transparent; }
.bar-fill { height: 100%; border-radius: 999px; transform-origin: left; animation: grow 800ms ease-out both; min-width: 3px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th { text-align: left; font: 500 11px 'Geist Mono', monospace; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); padding: 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
th button { all: unset; cursor: pointer; padding: 10px 10px; display: inline-block; }
th button:focus-visible { outline: 2px solid var(--accent-bright); border-radius: 4px; }
th[aria-sort='ascending'] button, th[aria-sort='descending'] button { color: var(--accent-bright); }
th.num, td.num { text-align: right; }
td { padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:hover td { background: var(--row-hover); }
.app-cell { display: flex; align-items: center; gap: 10px; }
.app-cell i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.badge { font: 500 11px Geist, system-ui, sans-serif; color: var(--text-dim); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 8px; }
.share { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.share .bar-track { flex: 1; background: var(--bg-inset); }
.share span { width: 44px; text-align: right; color: var(--text-dim); }
td.total { font-weight: 600; }

/* features */
.feat-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); margin-top: 28px; }
@media (min-width: 720px) { .feat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1060px) { .feat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.feat { padding: 20px 22px; }
.feat h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 600; }
.feat ul { margin: 12px 0 0; padding: 0 0 0 18px; color: var(--text-dim); font-size: 15px; }
.feat li { margin: 7px 0; }
.feat li::marker { color: var(--text-faint); }
.feat b { color: var(--text); font-weight: 600; }

.stack-sec .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip { font: 13px 'Geist Mono', monospace; color: var(--text-dim); padding: 6px 12px; border-radius: 8px; background: var(--bg-panel); border: 1px solid var(--border); }
.req { margin-top: 20px; padding: 16px 20px; display: grid; gap: 6px; color: var(--text-dim); font-size: 15px; }
.req b { color: var(--text); font-weight: 600; margin-right: 6px; }

.foot { margin-top: 96px; border-top: 1px solid var(--border); }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 22px; padding-bottom: 28px; font-size: 13px; color: var(--text-faint); }

/* tooltip */
.tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 260px;
  background: var(--tip-bg); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 8px 11px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-dim);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.tip b { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.tip .row { display: flex; align-items: center; gap: 6px; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* charts drawing in */
.draw { animation: rise 700ms ease-out both; transform-box: fill-box; transform-origin: bottom; }
.draw-x { animation: grow 700ms ease-out both; transform-box: fill-box; transform-origin: left; }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.fade { animation: fade 600ms ease-out both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
