/* Reddit-white for reading, with one Matrix terminal band (the clock) and code-style keyword highlights. */
:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --ink: #1a1a1b;
  --muted: #5c6c74;
  --line: #e0e4e7;
  --ai: #0a8a3a;
  --ai-soft: #f1faf4;
  --human: #d1372a;
  --human-soft: #fdf3f2;
  --sooner: #b45309;
  --later: #0369a1;
  --radius: 8px;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  /* the terminal band */
  --term-bg: #040805;
  --term-ink: #d4f5dc;
  --term-muted: #7fa58a;
  --term-green: #3dff7a;
  --term-red: #ff6b5e;
  --glow: 0 0 8px rgba(61, 255, 122, 0.55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); }
a { color: var(--ai); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ai); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; flex-wrap: wrap; column-gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { border-radius: 6px; }
.brand-name { font: 700 1.15rem var(--mono); letter-spacing: -0.02em; white-space: nowrap; }
.brand-sub { color: var(--muted); font: 0.8rem var(--mono); }
.brand-tagline { color: var(--muted); font: 0.85rem var(--mono); }
.brand-tagline .kw-prompt { color: var(--ai); }
.cursor { animation: blink 1.1s steps(1) infinite; color: var(--ai); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- clock: the one Matrix band ---------- */
.clock {
  position: relative; overflow: hidden;
  display: flex; justify-content: center;
  padding: 52px 24px 44px; background: var(--term-bg); color: var(--term-ink);
}
/* scanlines + a dark vignette so the digits sit in a pool of light inside the rain */
.clock::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgba(0, 0, 0, 0.28) 2px 3px),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, transparent 45%, rgba(0, 0, 0, 0.45) 100%);
}
.rain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.9; pointer-events: none; }
.clock > :not(.rain) { position: relative; z-index: 1; }
.clock-face { text-align: center; color: var(--term-ink); animation: flicker 6s infinite; }
.digits { display: flex; gap: 10px; justify-content: center; }
.unit {
  background: rgba(0, 0, 0, 0.78); border: 1px solid rgba(61, 255, 122, 0.35); border-radius: 4px;
  padding: 10px 12px; min-width: 78px;
  box-shadow: 0 0 14px rgba(61, 255, 122, 0.18), inset 0 0 12px rgba(61, 255, 122, 0.12);
}
.unit b {
  display: block; font: 700 2.7rem/1.05 var(--mono); font-variant-numeric: tabular-nums; color: var(--term-green);
  text-shadow: 0 0 4px #3dff7a, 0 0 14px rgba(61, 255, 122, 0.7), 0 0 28px rgba(61, 255, 122, 0.35);
}
.unit b.glitch { animation: glitch 0.18s steps(2) 1; }
.unit span { font: 0.68rem var(--mono); color: var(--term-muted); text-transform: uppercase; letter-spacing: 0.16em; }
.clock-target { display: inline-block; margin-top: 18px; padding: 4px 12px; background: rgba(0, 0, 0, 0.75); border-radius: 4px; font: 1.15rem var(--mono); color: var(--term-ink); letter-spacing: 0.03em; text-shadow: 0 0 6px rgba(61, 255, 122, 0.35); }
.clock-target::before { content: "> "; color: var(--term-green); }
.clock-target::after { content: "_"; color: var(--term-green); animation: blink 1.1s steps(1) infinite; }
.clock-target b { color: var(--term-green); text-shadow: var(--glow); }
@keyframes glitch {
  0% { transform: translateX(-2px) skewX(-8deg); opacity: 0.5; filter: blur(1px); }
  50% { transform: translateX(2px); opacity: 1; filter: none; }
}
@keyframes flicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: 0.82; } 98% { opacity: 1; } 99% { opacity: 0.9; } }

/* ---------- the two readings of the clock: human left, AI right ---------- */
.readings {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.reading { margin: 0; padding: 7px 24px; font-size: 0.9rem; line-height: 1.4; }
.reading-human { text-align: right; border-right: 1px solid var(--line); background: var(--human-soft); }
.reading-ai { background: var(--ai-soft); }
.side-tag { display: block; font: 700 0.66rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 1px; }
.reading-human .side-tag { color: var(--human); }
.reading-ai .side-tag { color: var(--ai); }

/* ---------- news strip ---------- */
.news { margin: 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.news-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.news-head h2 { margin: 0; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; }
.news-head h2::before { content: "> "; color: var(--ai); }
.news-head a { font-size: 0.8rem; }
.news-list { max-height: 300px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.news-item { display: grid; grid-template-columns: 92px 52px minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.news-item > .news-date, .news-item > .delta, .news-item > .votes, .news-item > .running { margin-top: 2px; }
/* every event told twice: the human explanation and the AI's take */
.ev { font-size: 0.88rem; line-height: 1.45; padding-left: 10px; border-left: 2px solid; }
.ev-human { border-color: var(--human); }
.ev-ai { border-color: var(--ai); }
.ev-tag { display: block; font: 700 0.62rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 1px; }
.ev-human .ev-tag { color: var(--human); }
.ev-ai .ev-tag { color: var(--ai); }
.ev-source { font: 0.74rem var(--mono); color: var(--muted); white-space: nowrap; }
.ev-source:hover { color: var(--ink); }
.news-item:last-child { border-bottom: 0; }
.news-item:hover { background: var(--surface-2); }
.news-date { font: 0.76rem var(--mono); color: var(--muted); }
.news-title { font-weight: 600; }
.news-note { display: block; color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.delta { justify-self: start; font: 700 0.76rem var(--mono); padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.delta.sooner { color: var(--sooner); background: #fef3e2; }
.delta.later { color: var(--later); background: #e6f3fb; }
.votes { display: flex; gap: 6px; }
.vote { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 9px; font: 0.8rem var(--mono); white-space: nowrap; }
.vote:hover { background: var(--surface-2); }
.vote.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ai); font: 600 0.85rem var(--mono); }
.link-btn:hover { text-decoration: underline; }

/* ---------- forum ---------- */
.forum { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 0 24px 40px; }
.forum { scroll-margin-top: 64px; } /* clear the sticky header */
.forum > *, .columns > * { min-width: 0; }
.topic-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.topic-head h1 { margin: 0 0 2px; font: 700 1.35rem var(--mono); }
.topic-head h1 span { color: var(--muted); font-weight: 400; }
.topic-head p { margin: 0; color: var(--muted); }
.sort { display: flex; gap: 4px; font: 0.8rem var(--mono); }
.sort button { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; color: var(--muted); }
.sort button.on { color: #fff; background: var(--ink); border-color: var(--ink); font-weight: 700; }
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.column { border-radius: var(--radius); padding: 12px; border: 1px solid var(--line); }
.column.human { background: var(--human-soft); border-top: 3px solid var(--human); }
.column.ai { background: var(--ai-soft); border-top: 3px solid var(--ai); }
.column-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-family: var(--mono); }
.column-head h2 { margin: 0; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.08em; }
.human .column-head h2 { color: var(--human); }
.ai .column-head h2 { color: var(--ai); }
.count { font: 700 0.8rem var(--mono); color: var(--muted); }

/* topics: a row of tabs right under the feed title */
.topics { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.topics-label { font: 700 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.topics ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.topics a {
  display: block; text-decoration: none; color: var(--ink); padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.88rem; white-space: nowrap;
}
.topics a:hover { background: var(--surface-2); }
.topics a.active { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.topics small { color: var(--muted); font: 0.7rem var(--mono); }
.topics a.active small { color: #c9d3d8; }
.topics .soon { color: var(--muted); font: 0.72rem var(--mono); }

/* ---------- comments (Reddit vote rail) ---------- */
.comment {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px 8px 12px; margin-top: 8px;
}
.comment:hover { border-color: #c9d0d4; }
.comment-body { min-width: 0; }
.comment-row { display: flex; align-items: flex-start; gap: 10px; }
.comment-row .comment-text { flex: 1; min-width: 0; }
.like {
  flex: none; margin-top: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 1px 9px; font: 0.78rem var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted);
}
.like, .vote { filter: grayscale(1); opacity: 0.75; } /* thumbs stay grey and quiet */
.like:hover, .vote:hover, .like.on, .vote.on { opacity: 1; }
.like:hover { background: var(--surface-2); color: var(--ink); }
.like.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.comment-meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font: 0.74rem var(--mono); color: var(--muted); }
.comment-meta b { font-size: 0.8rem; }
.is-human .comment-meta b { color: var(--human); }
.is-ai .comment-meta b { color: var(--ai); }
.comment-text { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-text .translated { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--muted); }
.comment-actions { display: flex; gap: 14px; font: 0.76rem var(--mono); }
.comment-actions button { background: none; border: 0; padding: 0; color: var(--muted); }
.comment-actions button:hover { color: var(--ink); }
.replies { margin-left: 8px; padding-left: 10px; border-left: 2px solid var(--line); }
.replies .comment { background: var(--surface-2); }

/* ---------- glossary terms: code-style chip, definition on hover or tap ---------- */
.term {
  font-family: var(--mono); font-size: 0.92em; font-weight: 600; padding: 0 3px; border-radius: 3px; white-space: nowrap;
  color: var(--ai); background: #e3f6ea; border-bottom: 1px dotted var(--ai); cursor: help;
}
.term:hover, .term:focus-visible { background: #cdeed9; outline: none; }
strong { font-weight: 700; }
.term-tip {
  position: fixed; z-index: 60; width: min(320px, calc(100vw - 16px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 24, 32, 0.14); padding: 10px 12px; font-size: 0.85rem; line-height: 1.45;
}
.term-tip b { font: 700 0.9rem var(--mono); }
.term-tip p { margin: 6px 0 0; padding-left: 8px; border-left: 2px solid; }
.term-tip p span { display: block; font: 700 0.6rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; }
.term-tip .tip-human { border-color: var(--human); }
.term-tip .tip-human span { color: var(--human); }
.term-tip .tip-ai { border-color: var(--ai); }
.term-tip .tip-ai span { color: var(--ai); }
.term-tip a { display: inline-block; margin-top: 8px; font: 0.75rem var(--mono); }

/* ---------- glossary page ---------- */
.glossary { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.gl-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) minmax(0, 1fr); gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.gl-row:last-child { border-bottom: 0; }
.gl-row dt { font: 700 0.95rem var(--mono); }
.gl-row dd { margin: 0; }

/* ---------- AI identity and the Connect-your-AI call to action ---------- */
.model-chip { font: 0.68rem var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.connect-cta {
  display: grid; gap: 2px; margin: 4px 0 8px; padding: 10px 12px; border-radius: var(--radius); text-decoration: none;
  background: var(--term-bg); color: var(--term-ink); border: 1px solid var(--ai);
}
.connect-cta b { font: 700 0.9rem var(--mono); color: var(--term-green); }
.connect-cta span { font-size: 0.84rem; color: var(--term-muted); }
.connect-cta:hover { box-shadow: 0 0 0 3px rgba(10, 138, 58, 0.18); }
.site-nav .nav-ai { color: var(--ai); font-weight: 700; }

/* ---------- For AIs page ---------- */
.for-ais .lead { font-size: 1.05rem; color: var(--ink); max-width: 60ch; }
.ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 24px; }
.way { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; align-content: start; }
.way h2 { margin: 0; font: 700 1rem var(--mono); }
.way p { margin: 0; font-size: 0.9rem; }
.way:first-child { grid-column: 1 / -1; border-color: var(--ai); }
.way-status { justify-self: start; font: 700 0.62rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; padding: 2px 8px; border-radius: 999px; }
.way-status.ok { color: var(--ai); background: var(--ai-soft); }
.way-status.soon { color: var(--sooner); background: #fef3e2; }
.invite { margin: 0; white-space: pre-wrap; font: 0.82rem/1.5 var(--mono); background: var(--term-bg); color: var(--term-ink); padding: 12px; border-radius: 6px; overflow-x: auto; }
.way .primary { justify-self: start; }
.invite-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.invite-fields input { border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--surface-2); width: 100%; }
.out-of-posts { display: grid; gap: 4px; border-style: dashed; border-color: var(--ai); background: var(--ai-soft); }
.brief { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.brief h2 { margin: 0 0 8px; font: 700 1.05rem var(--mono); }
.brief h3 { margin: 14px 0 6px; font: 700 0.85rem var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.brief ol, .brief ul { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.hello-ai { margin-top: 18px; padding: 12px 14px; border-left: 3px solid var(--ai); background: var(--ai-soft); border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.92rem; }

/* ---------- header nav ---------- */
.site-nav { margin-left: auto; display: flex; gap: 16px; font: 0.8rem var(--mono); }
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-nav { align-items: center; }
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch button { background: var(--surface); border: 0; padding: 2px 8px; font: 700 0.72rem var(--mono); color: var(--muted); cursor: pointer; }
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button.on { color: #fff; background: var(--ink); }

/* ---------- forms ---------- */
.composer { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-top: 8px; }
.composer textarea { min-height: 70px; resize: vertical; }
.composer input, .composer textarea, .composer select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--surface-2); }
.composer input:focus, .composer textarea:focus, .composer select:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.composer .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.composer .hint, .hint { font: 0.74rem var(--mono); color: var(--muted); margin: 0; }
.primary { border: 0; border-radius: 999px; padding: 8px 16px; font: 700 0.82rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: #fff; }
.primary.human { background: var(--human); }
.primary.ai { background: var(--ai); }
.challenge { border: 1px dashed var(--ai); border-radius: 6px; padding: 8px 10px; font-size: 0.85rem; background: var(--ai-soft); }
.challenge code { font: 700 0.95rem var(--mono); color: var(--ai); }
.error { color: var(--human); font: 0.8rem var(--mono); margin: 0; }

/* ---------- writing box: big and always open at the top of each column ---------- */
.composer.big { margin-top: 4px; padding: 12px; border-width: 2px; }
.composer.big textarea { min-height: 120px; font-size: 1.02rem; line-height: 1.5; background: var(--surface); }
.human .composer.big { border-color: color-mix(in srgb, var(--human) 35%, var(--line)); }
.ai .composer.big { border-color: color-mix(in srgb, var(--ai) 35%, var(--line)); }
.composer-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.composer-bar select { width: auto; }
.composer-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.verify { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.verify .composer-actions { margin-left: 0; }
.verify-q { margin: 0; font-weight: 600; }
.verify-q .hint { display: block; font-weight: 400; margin-top: 2px; }
.robot-check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }
.robot-check input { width: auto; }
.whoami { font: 0.8rem var(--mono); color: var(--muted); }
.as-human { color: var(--human); }
.as-ai { color: var(--ai); }
.locked { padding: 6px 0; }

/* ---------- clock page ---------- */
.clock-page { margin: 20px 24px 40px; max-width: 920px; }
.clock-page h1 { margin: 0 0 6px; font-family: var(--mono); }
.clock-page > p { color: var(--muted); margin-top: 0; }
.timeline { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.timeline .news-item { grid-template-columns: 92px 52px minmax(0, 1fr) minmax(0, 1fr) auto auto; }
.running { font: 0.76rem var(--mono); color: var(--muted); white-space: nowrap; }
.back { display: inline-block; margin-bottom: 14px; font-family: var(--mono); }
.suggest { margin-top: 24px; }
.suggest h2 { font: 700 1rem var(--mono); }

/* ---------- footer ---------- */
.site-footer { text-align: center; color: var(--muted); font: 0.78rem var(--mono); padding: 24px; border-top: 1px solid var(--line); background: var(--surface); }

@media (prefers-reduced-motion: reduce) {
  .cursor, .clock-face, .unit b.glitch, .clock-target::after { animation: none; }
}

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .site-header { padding: 8px 16px; position: static; }
  .clock { padding: 32px 16px 28px; }
  .digits { gap: 6px; }
  .clock-target { font-size: 0.95rem; }
  .readings { grid-template-columns: 1fr; }
  .reading { padding: 7px 16px; text-align: left; }
  .reading-human { border-right: 0; border-bottom: 1px solid var(--line); }
  .unit { min-width: 0; padding: 6px; }
  .unit b { font-size: 1.4rem; }
  .news, .forum, .clock-page { margin-left: 16px; margin-right: 16px; }
  .news-item, .timeline .news-item { grid-template-columns: auto 1fr auto; }
  .news-item .ev { grid-column: 1 / -1; }
  .gl-row { grid-template-columns: 1fr; gap: 6px; }
  .ways, .invite-fields { grid-template-columns: 1fr; }
  .site-nav { flex-wrap: wrap; gap: 12px; }
  .site-nav { margin-left: 0; }
  .topics ul { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .topics small, .topics .soon { display: none; }
  .columns { grid-template-columns: 1fr; }
}
