/* The Lonely Runner Experiment · living journal folio on ivory · DESIGN.md v2 */

:root {
  --paper: oklch(0.97 0.012 90);
  --paper-deep: oklch(0.945 0.014 88);
  --ink: oklch(0.25 0.02 260);
  --ink-soft: oklch(0.45 0.018 258);
  --ink-faint: oklch(0.62 0.014 255);
  --hairline: oklch(0.86 0.012 90);
  --wax: oklch(0.46 0.09 165); /* chalkboard green: the accent */
  --alarm: oklch(0.55 0.15 30); /* reserved: COUNTEREXAMPLE only */
  --serif: "EB Garamond", Georgia, serif;
  --mono: "Fragment Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.17rem;
  line-height: 1.62;
  font-feature-settings: "onum" 1, "liga" 1;
  overflow-x: hidden;
}

a { color: var(--ink); text-decoration: underline; text-decoration-color: color-mix(in oklch, var(--wax) 55%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--wax); }

.mono { font-family: var(--mono); font-size: 0.78rem; font-feature-settings: normal; }
code { font-family: var(--mono); font-size: 0.82em; }

h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 500;
  margin: 0 0 1.4rem;
}
.secno { color: var(--wax); font-size: 0.62em; vertical-align: 0.25em; margin-right: 0.4rem; }

/* ---------- coin bar (only when the operator sets the variables) ---------- */

.coinbar[hidden] { display: none; } /* display:flex would defeat the attribute */
.coinbar {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
  padding: 0.55rem clamp(1.2rem, 4vw, 3rem);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}
.coin-ticker { color: var(--paper); font-weight: 700; letter-spacing: 0.14em; }
.coin-ca {
  font: inherit;
  color: color-mix(in oklch, var(--paper) 72%, transparent);
  background: none;
  border: 1px solid color-mix(in oklch, var(--paper) 28%, transparent);
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  overflow-wrap: anywhere;
  text-align: left;
}
.coin-ca:hover { color: var(--paper); border-color: color-mix(in oklch, var(--paper) 60%, transparent); }
.coin-links { margin-left: auto; display: flex; gap: 1.1rem; }
.coin-links a { color: var(--paper); border-bottom: none; text-decoration: underline; text-decoration-color: color-mix(in oklch, var(--paper) 45%, transparent); }
.coin-links a:hover { color: var(--paper); text-decoration-color: var(--paper); }

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 1rem clamp(1.2rem, 4vw, 3rem) 0.8rem;
  border-bottom: 1px solid var(--ink);
}
.mast-title { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em; white-space: nowrap; }
.mast-nav { display: flex; gap: 1.2rem; margin-inline: auto; overflow-x: auto; }
.mast-nav a { font-size: 0.72rem; letter-spacing: 0.05em; text-decoration: none; color: var(--ink-soft); white-space: nowrap; }
.mast-nav a:hover { color: var(--wax); }
.mast-nav .ext { color: var(--ink); }
.mast-live { font-size: 0.72rem; color: var(--wax); white-space: nowrap; }

/* ---------- the live stage ---------- */

.stage {
  display: grid;
  grid-template-columns: minmax(15rem, 1.1fr) minmax(18rem, 1.7fr) minmax(13rem, 0.9fr);
  gap: 0;
  border-bottom: 1px solid var(--ink);
  background: var(--paper-deep);
}
.stage > * { padding: 1.2rem clamp(1.2rem, 2.5vw, 2rem); }
.stage-now { border-right: 1px solid var(--hairline); }
.live-label { color: var(--wax); letter-spacing: 0.2em; font-size: 0.66rem; margin-bottom: 0.9rem; }
.live-dot {
  display: inline-block;
  width: 0.5em; height: 0.5em;
  border-radius: 50%;
  background: var(--wax);
  margin-right: 0.55em;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
#now-runs { line-height: 2.1; color: var(--ink); white-space: pre-wrap; }
#now-runs .wax { color: var(--wax); }
#now-runs .dim { color: var(--ink-faint); }

.stage-stream {
  border-right: 1px solid var(--hairline);
  line-height: 1.95;
  color: var(--ink-soft);
  font-size: 0.72rem;
  max-height: 17rem;
  overflow: hidden;
}
.stage-stream .sl { opacity: 0; animation: lnin 0.3s ease-out forwards; border-bottom: 1px solid color-mix(in oklch, var(--hairline) 55%, transparent); padding: 0.25rem 0; overflow-wrap: anywhere; }
.stage-stream .sl .seq { color: var(--ink-faint); }
.stage-stream .sl .wax { color: var(--wax); }

.stage-scope { text-align: center; }
.stage-scope canvas { width: 100%; max-width: 13.5rem; aspect-ratio: 1; }
.scope-cap { color: var(--ink-faint); font-size: 0.66rem; line-height: 1.8; margin-top: 0.4rem; }
.scope-cap .wax { color: var(--wax); }

/* the thinking line: the model's own voice, in human language */
.thinking {
  grid-column: 1 / -1;
  border-top: 1px solid var(--hairline);
  background: var(--paper);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 1.1rem;
  padding: 0.85rem clamp(1.2rem, 2.5vw, 2rem);
}
.think-label { color: var(--wax); letter-spacing: 0.18em; font-size: 0.62rem; white-space: nowrap; }
.think-text {
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--ink);
  min-height: 1.5em;
}
.think-text::after {
  content: "";
  display: inline-block;
  width: 0.5em; height: 1em;
  background: var(--wax);
  margin-left: 0.15em;
  vertical-align: -0.15em;
  animation: caret 1.1s step-end infinite;
}
.think-text.done::after { display: none; }
@keyframes caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.think-meta { color: var(--ink-faint); font-size: 0.66rem; white-space: nowrap; }

@media (max-width: 980px) {
  .thinking { grid-template-columns: 1fr; gap: 0.35rem; }
  .think-meta { white-space: normal; }
  .stage { grid-template-columns: 1fr 1fr; }
  .stage-scope { grid-column: 2; grid-row: 1; border-left: 1px solid var(--hairline); }
  .stage-now { grid-column: 1; grid-row: 1; border-right: none; }
  .stage-stream { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--hairline); border-right: none; max-height: 10rem; }
}
@media (max-width: 520px) {
  .stage { grid-template-columns: 1fr; }
  .stage-scope { grid-column: 1; grid-row: 1; border-left: none; }
  .stage-now { grid-column: 1; grid-row: 2; border-top: 1px solid var(--hairline); }
  .stage-stream { grid-row: 3; max-height: 8rem; }
}

/* ---------- folio column ---------- */

.folio {
  max-width: 46rem;
  margin-inline: auto;
  padding: 0 clamp(1.2rem, 4vw, 2rem) 5rem;
}

/* ---------- title page ---------- */

.titlepage { padding: clamp(2.6rem, 8vh, 5.5rem) 0 1rem; }
.over { color: var(--wax); letter-spacing: 0.22em; font-size: 0.68rem; margin-bottom: 1.6rem; }
h1 {
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  font-weight: 500;
  line-height: 1.06;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin-bottom: 1.3rem;
}
.authors { color: var(--ink-faint); margin-bottom: 2.4rem; }
.abstract {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--hairline);
  padding: 1.3rem 0 1.4rem;
  max-width: 62ch;
}
.abstract p { font-size: 1.05rem; line-height: 1.66; }
.abs-label { font-variant: small-caps; letter-spacing: 0.04em; font-weight: 600; margin-right: 0.35rem; }
#abs-live { color: var(--ink-soft); }
#abs-live .wax { color: var(--wax); }

/* reveals */
.reveal { opacity: 0; transform: translateY(10px); animation: rise 0.65s var(--ease) forwards; }
.reveal:nth-child(2) { animation-delay: 0.08s; }
.reveal:nth-child(3) { animation-delay: 0.16s; }
.reveal:nth-child(4) { animation-delay: 0.24s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; animation: none; }
}

/* ---------- figures ---------- */

.fig { margin: clamp(2.6rem, 7vh, 4.5rem) 0; position: relative; }
.figplate {
  position: relative;
  background:
    linear-gradient(var(--hairline) 1px, transparent 1px) 0 0 / 100% 9px,
    linear-gradient(90deg, var(--hairline) 1px, transparent 1px) 0 0 / 9px 100%,
    var(--paper-deep);
  background-blend-mode: normal;
  border: 1px solid var(--hairline);
  padding: clamp(0.8rem, 2vw, 1.6rem);
}
.figplate > svg, .figplate > canvas { display: block; width: 100%; height: auto; }
.figplate-canvas canvas { aspect-ratio: 1; max-width: 30rem; margin-inline: auto; }
.specimen-curve path, .figplate path { stroke: var(--ink); stroke-width: 1.1; }
.witness-dot { fill: var(--wax); }
.fig-main .figplate { min-height: 18rem; }
figcaption {
  margin-top: 0.7rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.7;
  max-width: 62ch;
}
figcaption .wax, .readout .wax { color: var(--wax); }

.stamp {
  position: absolute;
  top: clamp(0.6rem, 2vw, 1.4rem);
  right: clamp(0.6rem, 2vw, 1.4rem);
  width: clamp(5.2rem, 9vw, 7rem);
  color: var(--wax);
  opacity: 0.85;
  transform: rotate(8deg);
  animation: stampin 0.28s var(--ease);
}
.stamp svg { width: 100%; }
.stamp text { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em; fill: currentColor; }
.stamp .stamp-mid { font-size: 17px; letter-spacing: 0.3em; }
@keyframes stampin { from { transform: rotate(8deg) scale(1.25); opacity: 0; } }

.body-note { max-width: 62ch; margin: 1.5rem 0; }
.eq { font-style: italic; white-space: nowrap; }
.display-eq {
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-style: italic;
  text-align: center;
  margin: 2.2rem 0;
  letter-spacing: 0.01em;
}

/* ---------- timeline + ledgers ---------- */

.ledger { list-style: none; margin: 2.5rem 0; }
.ledger li {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--hairline);
  align-items: baseline;
}
.timeline .yr { color: var(--ink-faint); }
.timeline .who { color: var(--ink-faint); text-align: right; }
.timeline .open .yr, .timeline .open .what { color: var(--wax); }
.timeline .open .what { font-weight: 600; }

/* ---------- specimens shelf ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-top: 2rem;
}
.specimen { background: var(--paper); padding: 1.1rem 1.1rem 0.9rem; }
.specimen .specimen-curve { width: 100%; height: auto; display: block; }
.specimen .scap { margin-top: 0.6rem; font-size: 0.7rem; color: var(--ink-soft); line-height: 1.8; overflow-wrap: anywhere; }
.specimen .scap .wax { color: var(--wax); }

/* ---------- tracks ---------- */

.track {
  border-top: 1px solid var(--hairline);
  padding: 1.8rem 0;
}
.track h3 { font-size: 1.35rem; font-weight: 500; margin-bottom: 0.7rem; }
.tno { color: var(--wax); margin-right: 0.5rem; }
.track p { color: var(--ink-soft); max-width: 62ch; font-size: 1.02rem; }
.readout {
  margin-top: 1rem;
  white-space: pre-wrap;
  line-height: 2;
  color: var(--ink);
  background: var(--paper-deep);
  border: 1px solid var(--hairline);
  padding: 0.9rem 1.1rem;
}
.readout .dim { color: var(--ink-faint); }

/* ---------- ledger table (appendix) ---------- */

.ledger-table {
  border-top: 1px solid var(--ink);
  max-height: 24rem;
  overflow-y: auto;
  line-height: 2.05;
  color: var(--ink-soft);
  scrollbar-width: thin;
}
.ledger-table .ln { border-bottom: 1px solid color-mix(in oklch, var(--hairline) 60%, transparent); padding: 0.1rem 0; opacity: 0; animation: lnin 0.2s ease-out forwards; }
@keyframes lnin { to { opacity: 1; } }
.ledger-table .seq { color: var(--ink-faint); }
.ledger-table .t-EXACTLY_CERTIFIED, .ledger-table .t-CANDIDATE_FOUND { color: var(--wax); }
.ledger-table .t-HYPOTHESIS_PROPOSED { color: var(--wax); font-style: italic; }
.ledger-table .t-PRIME_VERIFIED { color: var(--ink); }
.ledger-table .hash { color: var(--ink-faint); }
.ledger-foot { margin-top: 1rem; color: var(--ink-faint); overflow-wrap: anywhere; }

/* ---------- checks + footer ---------- */

.checks { list-style: none; }
.checks li { border-bottom: 1px solid var(--hairline); padding: 0.9rem 0; color: var(--ink-soft); max-width: 68ch; }
footer { margin-top: 4rem; border-top: 1px solid var(--ink); padding-top: 1.6rem; }
.papers { list-style: none; color: var(--ink-faint); }
.papers li { padding: 0.3rem 0; font-size: 0.72rem; }
.colophon { margin-top: 1.6rem; font-style: italic; color: var(--ink-soft); max-width: 58ch; }

/* ---------- sections rhythm + mobile ---------- */

.folio section { margin-top: clamp(3.5rem, 10vh, 6.5rem); }
.stage { margin-top: 0; }

@media (max-width: 700px) {
  body { font-size: 1.08rem; }
  .masthead { flex-wrap: wrap; gap: 0.6rem 1.2rem; }
  .mast-nav { order: 3; width: 100%; margin: 0; }
  .ledger li { grid-template-columns: 3.6rem 1fr auto; gap: 0.6rem; }
  .timeline .who { display: none; }
  .shelf { grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
  .ledger-table { max-height: 18rem; }
}
