/* happy.digital — a calm instrument for the internet's mood.
   One voice with two registers: Fraunces, soft and large for the instrument, crisp and small for
   what people wrote; a quiet system sans for everything else. One warm accent; mood tints the light. */

@font-face {
  font-family: "Fraunces";
  src: url(/assets/fonts/fraunces.woff2) format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
/* metric-matched fallback so the swap barely moves anything */
@font-face { font-family: "Fraunces Fallback"; src: local("Georgia"); size-adjust: 103%; ascent-override: 95%; descent-override: 25%; }
/* Mood colours come from js/mood.js (one continuous OKLCH scale). Registered so they glide. */
@property --wash-l { syntax: "<color>"; inherits: true; initial-value: #f3f1ec; }
@property --wash-d { syntax: "<color>"; inherits: true; initial-value: #1a1814; }
@property --mark-l { syntax: "<color>"; inherits: true; initial-value: #6f695e; }
@property --mark-d { syntax: "<color>"; inherits: true; initial-value: #a49d90; }
@property --glow-l { syntax: "<color>"; inherits: true; initial-value: #e4ded2; }
@property --glow-d { syntax: "<color>"; inherits: true; initial-value: #3a352d; }

:root {
  color-scheme: light dark;
  --f-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-num: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --f-serif: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --soft-num: "SOFT" 100, "WONK" 0;

  /* type scale */
  --t-xs: 0.8125rem;
  --t-sm: 0.9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.375rem;
  --t-xl: clamp(1.75rem, 4vw, 2.5rem);
  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 40px; --s7: 64px; --s8: 96px;
  --gutter: clamp(20px, 5vw, 48px);
  --radius: 14px;

  --wash: var(--wash-l); --mark: var(--mark-l); --glow: var(--glow-l); --up: var(--up-l, #7a4a1c); --down: var(--down-l, #33457a);
  --bg: var(--wash);
  --raised: #fffdf8;
  --soft: color-mix(in oklab, var(--wash), var(--ink) 4%);
  --ink: #22201b;
  --ink-2: #4a453c;
  --muted: #665f53;
  --line: #e4dccb;
  --accent: #d9921a;
  --accent-ink: #8a5a00;
  --pos: #2f6b3a;
  --mid: #7d5d12;
  --neg: #a7402f;
  --machine: #3d5f93;
  --human: #a8501f;
  --focus: #22201b;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.7) inset, 0 1px 2px rgb(60 40 10 / 0.05), 0 12px 32px -18px rgb(60 40 10 / 0.22);
  --atmos: radial-gradient(1200px 640px at 15% -10%, rgb(255 255 255 / 0.6), transparent 70%);
  transition: --wash-l 1.4s ease, --wash-d 1.4s ease, --mark-l 1.4s ease, --mark-d 1.4s ease, --glow-l 1.8s ease, --glow-d 1.8s ease;
}
.mk { --mark: var(--mark-l); }
.mw { --wash: var(--wash-l); }

@media (prefers-color-scheme: dark) {
  :root {
    --wash: var(--wash-d); --mark: var(--mark-d); --glow: var(--glow-d); --up: var(--up-d, #f2c79a); --down: var(--down-d, #a9b9e6);
    --raised: color-mix(in oklab, var(--wash), white 5%);
    --soft: color-mix(in oklab, var(--wash), white 8%);
    --ink: #f2ede3;
    --ink-2: #d4cdc0;
    --muted: #a69e8f;
    --line: #342f26;
    --accent: #e8b04a;
    --accent-ink: #e8b04a;
    --pos: #8fcf95;
    --mid: #e3c37a;
    --neg: #f0998a;
    --machine: #9db8e6;
    --human: #f0a77c;
    --focus: #e8b04a;
    --shadow: 0 1px 0 rgb(255 240 210 / 0.04) inset, 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 36px -20px rgb(0 0 0 / 0.8);
    --atmos: radial-gradient(1100px 620px at 50% -12%, color-mix(in oklab, var(--glow) 45%, transparent), transparent 70%);
  }
  .mk { --mark: var(--mark-d); }
  .mw { --wash: var(--wash-d); }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: url(/assets/grain.png), var(--atmos), var(--bg); color: var(--ink);
  font: 400 var(--t-md)/1.55 var(--f-sans);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
main { flex: 1; outline: none; }
img { max-width: 100%; }
a { color: inherit; text-decoration-color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color 0.15s; }
a:hover { text-decoration-color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--f-num); font-weight: 600; font-variation-settings: "SOFT" 50; letter-spacing: -0.015em; line-height: 1.15; text-wrap: balance; }
h2 { font-size: var(--t-lg); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s3); top: -60px; z-index: 50; background: var(--ink); color: var(--bg); padding: var(--s2) var(--s4); border-radius: 10px; }
.skip:focus { top: var(--s3); }
.wrap, .bar-inner, .hero, .ambient, .cols { max-width: 1120px; margin-inline: auto; padding-inline: var(--gutter); }
.narrow, .essay { max-width: 720px; }
.muted, .kicker { color: var(--muted); }
.kicker { font-size: var(--t-sm); margin-bottom: var(--s1); }
.loading { color: var(--muted); padding: var(--s5) 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s5);
  border-radius: 999px; border: 1px solid var(--line); background: var(--raised); color: var(--ink);
  font-size: var(--t-sm); font-weight: 600; text-decoration: none; transition: border-color 0.15s, transform 0.1s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-quiet { background: transparent; }
.icon { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- header / footer ---------- */
.site-header .bar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 72px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; font: 600 1.25rem/1 var(--f-num); font-variation-settings: var(--soft-num); letter-spacing: -0.01em; }
.wordmark img { width: 26px; height: 26px; }
.wordmark .dot-sep { color: var(--accent-ink); }
.site-nav { display: flex; gap: var(--s1); margin-right: calc(-1 * var(--s3)); }
.site-nav a { white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); color: var(--muted); text-decoration: none; font-size: var(--t-sm); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }

.site-footer { margin-top: var(--s8); background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent) top / 100% 1px no-repeat; color: var(--muted); font-size: var(--t-xs); }
.foot { display: grid; gap: var(--s3); padding-block: var(--s5) var(--s6); }
.foot a { color: var(--ink-2); }
.colophon span { font-family: var(--f-num); font-weight: 700; color: var(--ink-2); }
@media (min-width: 860px) { .foot { grid-template-columns: auto 1fr; column-gap: var(--s6); } .foot .status-host { grid-row: span 2; } }
.status summary, .status-sum { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; cursor: pointer; list-style: none; color: var(--ink-2); }
.status summary::-webkit-details-marker { display: none; }
.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); min-width: min(100%, 320px); }
.status-list li { display: grid; grid-template-columns: 10px 1fr auto; column-gap: var(--s2); align-items: center; }
.status-list strong { font-weight: 600; color: var(--ink); }
.status-list small { grid-column: 2 / -1; }
.st-healthy { color: var(--pos); } .st-stale, .st-never, .st-paused { color: var(--mid); } .st-failing { color: var(--neg); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot-healthy { background: var(--pos); } .dot-stale, .dot-paused, .dot-never { background: var(--accent); } .dot-failing { background: var(--neg); }

/* ---------- hero ---------- */
.hero { display: grid; gap: var(--s6); padding-block: var(--s7) var(--s6); isolation: isolate; }
.hero-read { position: relative; }
.hero.no-trace { grid-template-columns: minmax(0, 1fr); }
.hero.no-trace .trace { color: var(--muted); font-size: var(--t-xs); margin-top: calc(-1 * var(--s5)); }
.hero.no-trace .trace-head, .hero.no-trace .chart-host { display: inline; margin: 0 var(--s1) 0 0; }
.hero.no-trace .trace-head::after { content: ":"; }
.hero.no-trace .chart-empty { display: inline; min-height: 0; padding: 0; background: none; font-size: inherit; text-align: left; }
.hero.no-trace .chart-host { min-height: 0; }
.hero-read::before {
  content: ""; position: absolute; z-index: -1; left: -12%; top: -10%; width: 110%; aspect-ratio: 1.3; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--glow) 50%, transparent), transparent);
}
@media (prefers-color-scheme: dark) { .hero-read::before { background: radial-gradient(closest-side, color-mix(in oklab, var(--glow) 50%, transparent), transparent); } }
@media (min-width: 900px) { .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); column-gap: var(--s7); align-items: end; padding-block: var(--s8) var(--s6); } }
.hero-q { font-size: var(--t-lg); font-weight: 600; color: var(--ink-2); outline: none; margin-bottom: var(--s5); }
.score-box { display: flex; align-items: center; gap: clamp(12px, 2.5vw, 24px); }
.face { display: block; flex: none; }
.face-lg { width: clamp(72px, 11vw, 112px); height: auto; aspect-ratio: 1; filter: drop-shadow(0 10px 18px rgb(80 50 0 / 0.16)); }
.hero .face-lg { animation: breathe 7s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.035); } }
.face-sm { width: 28px; height: 28px; }
.big { display: flex; align-items: baseline; gap: var(--s1); font-family: var(--f-num); line-height: 0.85; }
.big-num { font-size: clamp(5rem, 15vw, 10rem); font-weight: 560; font-variation-settings: var(--soft-num); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.04em; border-radius: 12px; }
.big .of { font-size: var(--t-md); color: var(--muted); font-weight: 600; letter-spacing: 0; }
.hero-mood, .mood-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s4); margin-top: var(--s4); }
.mood-label { font: 500 1.625rem/1.2 var(--f-num); font-variation-settings: var(--soft-num); font-style: normal; }
.meta { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); color: var(--muted); font-size: var(--t-xs); }
.counts-line { color: var(--muted); font-size: var(--t-xs); grid-column: 1 / -1; padding-top: var(--s4); background: linear-gradient(90deg, var(--line), transparent 85%) top / 100% 1px no-repeat; }
.is-gathering .big { display: none; }
.hero.is-error .mood-label { color: var(--neg); }
.gather-note { margin-top: var(--s3); max-width: 44ch; color: var(--ink-2); font-size: var(--t-sm); }
.gather-progress { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); font-weight: 600; color: var(--ink); }
.gather-bar { width: 120px; flex: none; }
.bar-gather .bar-fill { fill: var(--mark); }

.tier { color: var(--muted); font-size: var(--t-xs); text-decoration: underline dotted var(--line); text-underline-offset: 4px; cursor: help; }
.deltas { display: inline-flex; flex-wrap: wrap; gap: var(--s4); font-size: var(--t-xs); color: var(--muted); }
.delta { font-weight: 650; white-space: nowrap; }
.delta-up { color: var(--up); } .delta-down { color: var(--down); } .delta-flat, .delta-none { color: var(--muted); }
.bump-up { animation: bumpUp 1.2s ease-out; } .bump-down { animation: bumpDown 1.2s ease-out; }
@keyframes bumpUp { from { color: var(--up); } }
@keyframes bumpDown { from { color: var(--down); } }
.score-box.pulse .big-num { animation: land 1.2s ease-out; }
@keyframes land { from { background: color-mix(in oklab, var(--glow) 70%, transparent); } }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); position: relative; flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--pos); opacity: 0; animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { transform: scale(0.5); opacity: 0.6; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
html[data-live="offline"] .live-dot, html[data-live="paused"] .live-dot { background: var(--muted); }
html[data-live="offline"] .live-dot::after, html[data-live="paused"] .live-dot::after { display: none; }

/* ---------- charts ---------- */
.trace { margin: 0; min-width: 0; }
.trace-head { display: flex; justify-content: space-between; color: var(--muted); font-size: var(--t-xs); margin-bottom: var(--s2); }
.chart-host { min-height: 140px; }
.chart-empty { display: grid; place-items: center; min-height: 140px; padding: var(--s5); text-align: center; color: var(--muted); font-size: var(--t-sm); background: var(--soft); border-radius: var(--radius); }
.chart-cap { font-size: var(--t-xs); color: var(--muted); margin-top: var(--s2); }
.chart-cap:empty { display: none; }
.chart { display: block; overflow: visible; touch-action: pan-y; }
.chart { --curve: var(--mark); }
.chart text { font: 11px var(--f-sans); fill: var(--muted); }
.chart .grid line.mid { stroke: var(--line); stroke-dasharray: 2 5; }
.chart .line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .s-score { stroke: var(--curve); stroke-width: 2.5; }
.chart .s-auto { stroke: var(--machine); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .s-human { stroke: var(--human); stroke-width: 1.75; }
.chart .area { stroke: none; }
.fade-top { stop-color: var(--curve); stop-opacity: 0.22; } .fade-bottom { stop-color: var(--curve); stop-opacity: 0; }
.chart .pt.s-score { fill: var(--curve); } .chart .pt.s-auto { fill: var(--machine); } .chart .pt.s-human { fill: var(--human); }
.chart .line.draw.s-score, .chart .line.draw.s-human { stroke-dasharray: 1 2; stroke-dashoffset: 1; stroke-linecap: butt; animation: draw 1.6s cubic-bezier(0.3, 0.6, 0.2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart .tip-dot { fill: var(--curve); stroke: var(--bg); stroke-width: 2; filter: drop-shadow(0 0 6px var(--curve)); }
.chart .tip-ring { fill: none; stroke: var(--curve); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ring 2.4s ease-out infinite; }
@keyframes ring { 0% { transform: scale(0.4); opacity: 0.9; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
.chart .hit { fill: transparent; pointer-events: all; }
.chart .readout { opacity: 0; transition: opacity 0.15s; pointer-events: none; }
.chart .readout.on { opacity: 1; }
.chart .readout line { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .readout text { fill: var(--ink); font-weight: 600; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }

.spark { display: block; width: 100%; height: 24px; overflow: visible; }
.spark-line { fill: none; stroke: var(--mark); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark-empty { display: none; }
.bar { display: block; width: 100%; height: 6px; border-radius: 3px; overflow: hidden; }
.bar-track { fill: var(--soft); }
.bar-fill { fill: var(--ink-2); }
.bar-mood .bar-fill { fill: var(--mark); }
.bar-src .bar-fill { fill: var(--machine); }
.split { display: block; width: 100%; height: 6px; border-radius: 3px; overflow: hidden; }
.split-machine { fill: var(--machine); opacity: 0.5; }
.split-human { fill: var(--human); }

/* ---------- ambient ---------- */
.ambient { display: grid; gap: var(--s4); align-items: center; padding-block: var(--s5); margin-bottom: var(--s7); }
.ambient > * { min-width: 0; }
.ambient h2 { font-size: var(--t-md); }
.amb-body { color: var(--muted); font-size: var(--t-sm); max-width: 56ch; margin-top: var(--s1); }
.amb-score { display: flex; align-items: center; gap: var(--s3); }
.amb-num { font: 560 2.25rem/1 var(--f-num); font-variation-settings: var(--soft-num); letter-spacing: -0.02em; }
.amb-meta { color: var(--muted); font-size: var(--t-xs); max-width: 20ch; }
.ambient.is-gathering .amb-num { display: none; }
@media (min-width: 760px) { .ambient { grid-template-columns: 1fr auto; } }
.ambient { background: color-mix(in oklab, var(--wash), var(--ink) 4%); transition: --wash-l 1.4s ease, --wash-d 1.4s ease; border-radius: var(--radius); padding-inline: var(--s5); max-width: calc(1120px - 2 * var(--gutter)); width: calc(100% - 2 * var(--gutter)); }

/* ---------- sections ---------- */
.cols { display: grid; gap: var(--s7); }
@media (min-width: 1060px) { .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s7); align-items: start; } }
.cols h2, .feed h2, .sec-head { margin-bottom: var(--s4); }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.sec-head h2 { margin: 0; }
.sec-intro { color: var(--muted); font-size: var(--t-sm); margin-bottom: var(--s5); max-width: 60ch; }
.controls { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between; align-items: center; margin-bottom: var(--s3); }
.segs { display: inline-flex; gap: var(--s4); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg { min-height: 40px; padding: 0; border: 0; background: none; color: var(--muted); font-size: var(--t-sm); font-weight: 600; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; transition: color 0.15s, box-shadow 0.15s; }
.seg:hover { color: var(--ink); }
.seg[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--mark); }
.select select {
  appearance: none; -webkit-appearance: none; min-height: 40px; padding: 0 28px 0 0; border: 0; background: transparent no-repeat right center;
  font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23857f72' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.select option { color: #22201b; }

/* ---------- things list ---------- */
.things { list-style: none; margin: 0; padding: 0; }
.things[aria-busy="true"] { opacity: 0.5; transition: opacity 0.2s; }
.things li + li { background: linear-gradient(90deg, transparent, var(--line) 10%, var(--line) 90%, transparent) top / 100% 1px no-repeat; }
.row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 56px auto; align-items: center; gap: var(--s4);
  padding: var(--s3) var(--s2); margin-inline: calc(-1 * var(--s2)); border-radius: 10px; text-decoration: none; transition: background 0.15s;
}
.row:hover { background: color-mix(in srgb, var(--raised) 70%, transparent); box-shadow: var(--shadow); }
.row:active { transform: scale(0.995); }
.row-name { min-width: 0; display: grid; }
.row-name strong { font-weight: 600; overflow-wrap: anywhere; }
.row-name small { color: var(--muted); font-size: var(--t-xs); }
.row-score { display: grid; grid-template-columns: auto auto; column-gap: var(--s3); align-items: center; justify-items: end; }
.row-score .delta { grid-column: 2; }
.row-num { font: 560 1.5rem/1.1 var(--f-num); font-variation-settings: var(--soft-num); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.02em; border-radius: 6px; }
.mood-bar { width: 44px; height: 4px; border-radius: 2px; }
.mood-bar .bar-track { fill: var(--line); }
.mood-bar .bar-fill { fill: var(--mark); }
.row-score .delta { font-size: var(--t-xs); }
.row-score .delta-none { display: none; }
.row-gathering .row-name strong { color: var(--ink-2); font-weight: 500; }
@media (max-width: 420px) { .row { grid-template-columns: 28px minmax(0, 1fr) auto; } .row-spark { display: none; } }
.show-all { margin-top: var(--s4); }
.suggest-line { margin-top: var(--s5); color: var(--muted); font-size: var(--t-sm); }
.suggest-line a { color: var(--ink); font-weight: 600; }

/* ---------- empty / error ---------- */
.empty { display: grid; justify-items: center; gap: var(--s2); text-align: center; padding: var(--s6) var(--s5); background: var(--soft); border-radius: var(--radius); }
.empty .face { width: 32px; height: 32px; }
.empty-title { font-weight: 650; }
.empty-body { color: var(--muted); max-width: 44ch; font-size: var(--t-sm); }
.empty .btn { margin-top: var(--s2); }

/* ---------- evidence feed ---------- */
.feed-list { display: grid; gap: var(--s3); }
.feed-list[aria-busy="true"]:empty { min-height: 160px; }
.reading { position: relative; background: linear-gradient(180deg, var(--raised), color-mix(in srgb, var(--raised) 85%, var(--soft))); box-shadow: var(--shadow); border-radius: 18px; padding: var(--s4) var(--s5) var(--s3) calc(var(--s5) + 6px); overflow: hidden; }
.reading::before { content: ""; position: absolute; left: 0; top: var(--s4); bottom: var(--s4); width: 3px; border-radius: 0 3px 3px 0; background: var(--mark); transition: background 1s ease; }
.reading.pending { opacity: 0.85; }
.reading.is-new { animation: arrive 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes arrive { from { transform: translateY(-8px); opacity: 0; } }
.reading-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s2); font-size: var(--t-xs); color: var(--muted); }
.reading-head .subject { color: var(--ink); font-weight: 650; font-size: var(--t-sm); text-decoration: none; }
.reading-head a.subject:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.subject-ambient { font-style: italic; }
.ts-group { white-space: nowrap; }
.orig { margin-left: auto; display: inline-flex; align-items: center; gap: var(--s1); min-height: 36px; color: var(--muted); font-size: var(--t-xs); text-decoration: none; }
.orig:hover { color: var(--ink); }
.excerpt { position: relative; margin: var(--s2) 0 var(--s3); font-family: var(--f-serif); font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.1875rem); font-weight: 380; font-variation-settings: "SOFT" 0, "WONK" 0; line-height: 1.5; color: var(--ink); max-width: 58ch; }
.excerpt p { overflow-wrap: break-word; }
.excerpt p::before { content: "“"; position: absolute; left: -0.5em; color: var(--mark); font-weight: 600; }
.excerpt p::after { content: "”"; }
.src::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 2px; background: var(--muted); vertical-align: 1px; }
.src-hn::before { background: #e8742c; } .src-mastodon::before { background: #7c63e6; } .src-bluesky::before { background: #3d8cf0; border-radius: 50%; }
.src-lemmy::before { background: #4fa36a; border-radius: 50%; } .src-appstore::before { background: #3d8cf0; }
.reading-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s4); }
.reading-foot .mread { flex-basis: 100%; }
.checks { margin-left: calc(-1 * var(--s3)); }
.mread { font-size: var(--t-xs); color: var(--muted); }
.mread strong { color: var(--ink-2); font-weight: 600; }
.stars { color: var(--accent); letter-spacing: 1px; }
.stars-off { color: var(--line); }
.checks { display: inline-flex; gap: var(--s1); }
.check {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s3); border-radius: 999px;
  border: 0; background: transparent; color: var(--muted); font-size: var(--t-xs); font-weight: 600; transition: background 0.15s, color 0.15s;
}
.check:hover { background: var(--soft); color: var(--ink); }
.check .count { font-family: var(--f-num); }
.check[aria-pressed="true"] .icon { animation: pop 0.45s cubic-bezier(0.3, 1.7, 0.5, 1); }
@keyframes pop { from { transform: scale(0.3) rotate(-20deg); } }
.check[aria-pressed="true"] { background: color-mix(in oklab, var(--ink) 9%, transparent); color: var(--ink); }
.feed-more { display: grid; justify-items: center; margin-top: var(--s5); }
.feed-end { color: var(--muted); font-size: var(--t-xs); }
.new-pill { position: sticky; top: var(--s3); z-index: 5; display: flex; align-items: center; gap: 6px; margin: 0 auto var(--s3); min-height: 40px; padding: 0 var(--s4); border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); font-weight: 600; font-size: var(--t-sm); }

/* ---------- thing page ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: var(--s3); color: var(--muted); text-decoration: none; font-size: var(--t-sm); }
.back:hover { color: var(--ink); }
.page-title { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.03em; outline: none; overflow-wrap: anywhere; }
.lede { color: var(--ink-2); font-size: var(--t-md); margin-top: var(--s3); max-width: 60ch; }
.thing-head { display: grid; gap: var(--s5); padding-block: var(--s5) var(--s6); }
@media (min-width: 860px) { .thing-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--s6); } }
.thing-score { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); }
.thing-score .big-num { font-size: clamp(4rem, 11vw, 7rem); }
.score-side { display: grid; gap: var(--s2); }
.score-side .mood-row { margin-top: 0; }
.thing-grid { display: grid; gap: var(--s6); }
@media (min-width: 960px) { .thing-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } .vote-sec { position: sticky; top: var(--s4); } }
.thing-main { display: grid; gap: var(--s6); min-width: 0; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.side { border-top: 2px solid var(--machine); padding-top: var(--s3); min-width: 0; }
.side-human { border-top-color: var(--human); }
.k { font-size: var(--t-xs); color: var(--muted); }
.side-num { display: block; font: 560 2.5rem/1.1 var(--f-num); font-variation-settings: var(--soft-num); letter-spacing: -0.02em; margin-top: var(--s1); }
.side small { color: var(--muted); font-size: var(--t-xs); }
.blend { margin-top: var(--s4); display: grid; gap: var(--s2); font-size: var(--t-sm); color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s4); list-style: none; margin: 0; padding: 0; font-size: var(--t-xs); color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend li::before { content: ""; width: 16px; border-top: 2px solid var(--ink); }
.legend .lg-auto::before { border-top: 2px dashed var(--machine); }
.legend .lg-human::before { border-top-color: var(--human); }
.vote-sec h2 { font-size: var(--t-md); }
.votes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s4); }
.vote {
  display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 108px; padding: var(--s3) var(--s1);
  border: 1px solid transparent; border-radius: var(--radius); background: var(--soft); color: var(--ink); transition: background 0.15s, border-color 0.15s;
}
.vote .face { width: 36px; height: 36px; transition: transform 0.2s; }
.vote:hover { border-color: var(--line); background: var(--raised); }
.vote:hover .face { transform: scale(1.08) rotate(-4deg); }
.vote-label { font-weight: 600; font-size: var(--t-xs); text-align: center; line-height: 1.25; }
.vote-mine { font-size: 0.6875rem; color: var(--accent-ink); visibility: hidden; }
.vote[aria-pressed="true"] { background: var(--raised); border-color: var(--mark); }
.vote[aria-pressed="true"] .vote-mine { visibility: visible; }
.vote.pending { cursor: progress; }
.vote-note { margin-top: var(--s3); font-size: var(--t-xs); color: var(--muted); min-height: 2.6em; }
.vote-note.landed { color: var(--ink); font-weight: 600; }
.detail-grid { display: grid; gap: var(--s6); margin-block: var(--s7); }
@media (min-width: 860px) { .detail-grid { grid-template-columns: 1fr 1fr; gap: var(--s7); } }
.detail-grid h2 { font-size: var(--t-md); margin-bottom: var(--s3); }
.dist-list, .src-list { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: var(--s3); font-size: var(--t-sm); }
.dist-list li { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 3rem; align-items: center; gap: var(--s3); }
.dist-label { display: inline-flex; align-items: center; gap: var(--s2); }
.dist-label .face { width: 20px; height: 20px; }
.dist-n, .src-score { font-weight: 650; text-align: right; }
.src-list li { display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto 3rem; align-items: center; gap: var(--s3); }
.src-n { color: var(--muted); font-size: var(--t-xs); white-space: nowrap; }
@media (max-width: 480px) { .dist-list li { grid-template-columns: 7.5rem minmax(0, 1fr) 2.75rem; } .src-list li { grid-template-columns: 1fr auto 3rem; } .src-list .bar { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- essay pages ---------- */
.prose-head { padding-block: var(--s6) var(--s5); }
.prose-head .lede { font-size: 1.1875rem; line-height: 1.6; }
.prose section { margin-top: var(--s6); }
.prose h2 { margin-bottom: var(--s3); }
.prose p { margin-bottom: var(--s4); line-height: 1.7; color: var(--ink-2); max-width: 64ch; }
.active-sources { color: var(--ink) !important; font-weight: 600; }
.facts { margin: 0; display: grid; gap: var(--s4); }
.facts dt { font-weight: 650; }
.facts dd { margin: 2px 0 0; color: var(--ink-2); line-height: 1.6; }
.mood-scale { list-style: none; padding: 0; margin: var(--s2) 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--s5) var(--s3); }
.mood-scale li { display: grid; justify-items: center; text-align: center; gap: 2px; }
.mood-scale .face { width: 36px; height: 36px; margin-bottom: var(--s1); }
.mood-scale strong { font-size: var(--t-xs); }
.mood-scale small { font-size: var(--t-xs); color: var(--muted); }

/* ---------- suggest ---------- */
.suggest-form { display: grid; gap: var(--s5); max-width: 520px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; }
.field input { min-height: 48px; padding: 0 var(--s4); border-radius: 12px; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-size: var(--t-md); }
.field input:focus-visible { outline-offset: 1px; }
.field input[aria-invalid="true"] { border-color: var(--neg); }
.help { font-size: var(--t-xs); color: var(--muted); }
.field-err, .form-err { color: var(--neg); font-size: var(--t-sm); font-weight: 600; }
.form-err:empty { display: none; }
.human-note { padding-left: var(--s4); border-left: 2px solid var(--human); color: var(--ink-2); font-size: var(--t-sm); }
.suggest-form .btn-primary { justify-self: start; }
.thanks, .notfound { padding-block: var(--s6); display: grid; gap: var(--s4); justify-items: start; }
.thanks p:last-child { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 40; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: min(480px, calc(100vw - 32px)); width: max-content; background: var(--ink); color: var(--bg); border-radius: 12px; padding: var(--s3) var(--s4);
  font-size: var(--t-sm); transition: transform 0.25s, opacity 0.25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast[data-kind="error"] { box-shadow: inset 3px 0 0 var(--neg); }
.turnstile-host { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 45; }
.turnstile-host:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .chart .line.draw.s-score, .chart .line.draw.s-human { stroke-dasharray: none; stroke-dashoffset: 0; }
}
@media (forced-colors: active) {
  .seg[aria-pressed="true"], .check[aria-pressed="true"], .vote[aria-pressed="true"] { outline: 2px solid CanvasText; }
  .bar-fill, .split-human { fill: Highlight; }
}
.dist .muted, .sources .muted { font-size: var(--t-sm); }
.retry { margin-top: var(--s4); }
@media (max-width: 420px) {
  .wordmark { font-size: 1.125rem; gap: var(--s2); }
  .site-nav a { padding: 0 var(--s2); }
}
@media (prefers-color-scheme: dark) { .ambient { background: color-mix(in oklab, var(--wash), white 8%); } }
/* More contrast requested: keep the paper neutral and let face, word, number and bars carry the mood. */
@media (prefers-contrast: more) {
  :root { --wash: #fbfaf7; --glow: transparent; --muted: #4f4a41; }
  .mw { --wash: #fbfaf7; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --wash: #100f0d; --muted: #c9c2b5; }
  .mw { --wash: #100f0d; }
}
@media (forced-colors: active) { .reading::before { background: CanvasText; } .hero-read::before { display: none; } }
