/* Cohort — playcohort.app
   The site is the product's argument in HTML: it must read like a real analytics
   tool, not a game about one. Flat, cold, competent. Palette and type are lifted
   verbatim from cohort-design/DESIGN-HANDOFF.md. One accent only (#6E9EC7). Red
   (#C7534B) means something specific and is never decorative. No gradients,
   glows, shadows, rounded playful type, or celebration. */

:root {
  --bg: #0E1116;
  --surface: #161A21;
  --raised: #1C2129;
  --border: #252B35;
  --primary: #E6E9EF;   /* values, headings */
  --secondary: #8A93A3; /* body, labels */
  --tertiary: #5D6573;  /* field labels, footnotes */
  --accent: #6E9EC7;    /* the single accent */
  --negative: #C7534B;  /* churn, negative deltas, insolvency. reserved. */
  --positive: #5E9E78;  /* sparingly, never to celebrate */

  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, "Roboto Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --maxw: 940px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--secondary);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--primary); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(30px, 5vw, 46px); letter-spacing: -0.025em; }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 17px; }
p { margin: 0 0 16px; max-width: 68ch; }
strong { color: var(--primary); font-weight: 600; }

/* Uppercase mono field label, straight from the app. */
.label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tertiary);
}
.mono { font-family: var(--mono); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--primary); }

/* ---------- Nav ---------- */
.nav { border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(14,17,22,0.85); backdrop-filter: blur(10px); z-index: 40; }
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--primary); }
.brand .word { font-family: var(--mono); font-weight: 700; letter-spacing: 0.18em; font-size: 15px; text-transform: uppercase; }
.brand .tick { width: 10px; height: 10px; background: var(--accent); display: inline-block; }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--secondary); }
.nav-links a:hover { color: var(--primary); text-decoration: none; }
@media (max-width: 620px) { .nav-links a.hide-sm { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: clamp(56px, 9vw, 104px) 0 clamp(40px, 6vw, 72px); border-bottom: 1px solid var(--border); }
.eyebrow { color: var(--tertiary); margin-bottom: 20px; }
.hero h1 { max-width: 20ch; margin-bottom: 22px; }
.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--secondary); max-width: 60ch; }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 7vw, 84px) 0; border-bottom: 1px solid var(--border); }
.section > .wrap > .label { margin-bottom: 14px; display: block; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 22px 22px; }
.card .label { display: block; margin-bottom: 10px; }
.metric { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--primary); font-size: 34px; font-weight: 600; line-height: 1; margin-bottom: 6px; }
.metric-note { font-size: 13.5px; color: var(--secondary); }
.metric-src { font-size: 12px; color: var(--tertiary); margin-top: 12px; }

/* ---------- Data table (the accounts aesthetic) ---------- */
.table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13.5px; }
.table th { text-align: left; color: var(--tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); color: var(--secondary); vertical-align: top; }
.table td .v { color: var(--primary); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }

/* ---------- Store badges (pre-launch, non-clickable) ---------- */
.badges { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; }
.badge { display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 20px; }
.badge .s { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--tertiary); }
.badge .m { font-size: 17px; font-weight: 600; color: var(--primary); margin-top: 2px; }
a.badge.live { transition: border-color 0.15s ease; }
a.badge.live:hover { border-color: var(--accent); text-decoration: none; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--sans); font-weight: 600; font-size: 15px; border-radius: 8px; padding: 12px 20px; border: 1px solid var(--border); color: var(--primary); background: transparent; cursor: pointer; }
.btn:hover { border-color: var(--secondary); text-decoration: none; }
.btn-primary { background: var(--accent); color: #0E1116; border-color: var(--accent); }
.btn-primary:hover { background: #7FAAD0; border-color: #7FAAD0; }
.btn-bar { width: 100%; padding: 16px; font-size: 16px; }

/* ---------- Forms (The Network) ---------- */
.field { margin-bottom: 20px; }
.field label { display: block; margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--primary); font-family: var(--sans); font-size: 15px; padding: 12px 14px;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: 12.5px; color: var(--tertiary); margin-top: 6px; }
.field textarea { min-height: 96px; resize: vertical; }

/* ---------- Footer ---------- */
.footer { padding: 40px 0 56px; }
.footer .row { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; justify-content: space-between; }
.footer .fine { font-size: 12.5px; color: var(--tertiary); max-width: 70ch; }
.footer a { color: var(--secondary); }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
hr { border: none; border-top: 1px solid var(--border); margin: 28px 0; }
ul.clean { padding-left: 18px; margin: 0 0 16px; }
ul.clean li { margin-bottom: 8px; }

/* ==========================================================================
   Dashboard surface — the site's central move: the page IS the product.
   Flat, cold, competent. No gradients, glows, or shadows.
   ========================================================================== */

/* Faint plotting-grid behind the hero. Flat 1px hairlines, no color fade. */
.hero {
  position: relative;
  overflow: hidden;
  background-image:
    linear-gradient(to right, rgba(37,43,53,0.5) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(37,43,53,0.5) 1px, transparent 1px);
  background-size: 46px 46px;
  background-position: center top;
}
.hero > .wrap { position: relative; z-index: 1; }
/* fade the grid out toward the edges so it reads as texture, not a table */
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 30%, var(--bg) 78%);
}

.hero .lead { margin-bottom: 4px; }

/* ---------- The framed dashboard panel ---------- */
.panel {
  margin-top: clamp(34px, 5vw, 52px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.panel-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 44px; padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--raised);
}
.crumb { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; color: var(--tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { color: var(--secondary); font-weight: 600; }
.crumb .sep { color: var(--border); padding: 0 7px; }
.live { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tertiary); }
.live .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
@media (prefers-reduced-motion: no-preference) { .live .pip { animation: pip 2.4s ease-in-out infinite; } }
@keyframes pip { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 18px 18px 16px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.kpi:nth-child(4n) { border-right: none; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.kpi .k-val { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--primary); font-size: clamp(22px, 3.4vw, 30px); font-weight: 600; line-height: 1; }
.kpi .k-sub { font-size: 11.5px; color: var(--tertiary); margin-top: 8px; font-family: var(--mono); }
.delta { font-family: var(--mono); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: var(--positive); }
.delta.down { color: var(--negative); }
.delta .arw { font-size: 9px; }
.spark { display: block; }
@media (max-width: 700px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(4n) { border-right: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-right: none; }
}

/* Main chart */
.chart-wrap { padding: 22px 20px 12px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.chart-head .t { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--tertiary); }
.chart-head .r { font-family: var(--mono); font-size: 11px; color: var(--tertiary); }
.chart { display: block; width: 100%; height: auto; }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.chart .axis-t { fill: var(--tertiary); font-family: var(--mono); font-size: 10px; }
.chart .area { fill: rgba(110,158,199,0.10); stroke: none; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cap { fill: var(--accent); }
.chart .cap-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.35; }
@media (prefers-reduced-motion: no-preference) {
  .chart .line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.5s cubic-bezier(0.65,0,0.35,1) 0.15s forwards; }
  .chart .area { opacity: 0; animation: fadein 0.9s ease 0.85s forwards; }
  .chart .cap, .chart .cap-ring { opacity: 0; animation: fadein 0.5s ease 1.5s forwards; }
  .chart .cap-ring { animation: fadein 0.5s ease 1.5s forwards, ring 2.6s ease-out 1.6s infinite; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }
@keyframes ring { 0% { r: 4; opacity: 0.5; } 70%, 100% { r: 13; opacity: 0; } }

.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--raised); }
.panel-foot span { font-family: var(--mono); font-size: 10.5px; color: var(--tertiary); letter-spacing: 0.03em; }

/* ---------- Card sparklines + deltas (the metric cards) ---------- */
.card .c-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card .metric { margin-bottom: 6px; }

/* ---------- Drill row: the horror beat ---------- */
.table tr.flag td { background: rgba(199,83,75,0.05); }
.table td.stripe { position: relative; }
.table tr.flag td:first-child { box-shadow: inset 2px 0 0 var(--negative); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--negative); border: 1px solid rgba(199,83,75,0.35); border-radius: 5px; padding: 3px 8px; }
.chip .d { width: 5px; height: 5px; border-radius: 50%; background: var(--negative); }

/* two-column split for the drill section */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; margin-top: 24px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

/* ---------- Lever board (what you operate) ---------- */
.levers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lever { background: var(--surface); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name set" "bar bar"; row-gap: 12px; column-gap: 12px; align-items: center; }
.lever .lv-name { grid-area: name; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--secondary); }
.lever .lv-set { grid-area: set; font-family: var(--mono); font-size: 11px; color: var(--primary); font-variant-numeric: tabular-nums; text-align: right; }
.lever .lv-bar { grid-area: bar; position: relative; height: 3px; background: var(--border); border-radius: 2px; }
.lever .lv-bar::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--f, .5) * 100%); background: var(--accent); border-radius: 2px; }
/* a lever pushed into aggressive territory reads red at the top of its range */
.lever.hot .lv-bar::before { background: var(--negative); }
.lever.hot .lv-set { color: var(--negative); }
