/* The Journal of Tomorrow — shared visual tokens, tuned to the FT paper palette. */

:root {
  --paper: #fff1e5;
  --ink: #020a1d;
  --muted: #514a45;
  --rule: #cdb7a5;
  --accent: #0d7680;
  --dek: #3f3a36;
  --placeholder: #e6d6c8;
  --highlight: #f6f4c7;
  --page-bg: #fff7e9;
  --band: #f6f0dd;
  --footer-bg: #f2dfce;
  --market-poly: #0d7680;
  --market-kalshi: #b46a3c;
  --display: Georgia, serif;
  --masthead: "Manufacturing Consent", Georgia, serif;
  --headline: "Times New Roman", Georgia, serif;
  --meta: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  font-size: 110%;
  background: var(--band);
}

body {
  margin: 0;
  /* The page canvas is the band color so Safari derives its chrome tint from
     the topbar's background, not the paper's (Safari samples the body/canvas
     background and largely ignores theme-color on modern versions). */
  background: var(--band);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* Only small utility links carry an underline — card titles and photos stay clean. */
.empty a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
}

/* --- top bar ---------------------------------------------------------------- */

/* The header wrapper spans the full width behind the masthead; it carries the
   paper background so the masthead keeps sitting on cream even though the
   body canvas is now the band color. */
#site-header {
  background: var(--page-bg);
}

.topbar {
  font-family: var(--meta);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-align: center;
  padding: 0.75rem 1rem;
  background: var(--band);
}

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

.masthead {
  border-bottom: 3px double var(--ink);
  padding: 4rem 0 0;
  max-width: 68rem;
  margin: 0 auto;
}

.masthead-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.masthead-name {
  font-family: var(--masthead);
  font-size: 4.4rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
}

.masthead-tag {
  font-family: var(--meta);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.masthead-date {
  font-family: var(--meta);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

#sections {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
}

.section {
  appearance: none;
  border: 0;
  background: none;
  font-family: var(--meta);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.section:hover { color: var(--ink); }
.section.active { color: var(--ink); border-bottom-color: var(--accent); }

/* The static "About this project" entry after the category buttons. */
.section.about-link {
  color: var(--ink);
  margin-left: 0.75rem;
  border-left: 0;
  border-radius: 0;
  padding-left: 0.9rem;
  font-style: italic;
  font-weight: bold;
}
.section.about-link:hover { color: var(--ink); }
.section.about-link.active { color: var(--ink); border-bottom-color: var(--ink); }

/* --- front page ------------------------------------------------------------ */

.page {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

/* Full-width paper wrapper around the content column — the body canvas is the
   band color (Safari tint), so the cream has to span edge to edge here. */
#site-content {
  background: var(--page-bg);
}

.heroes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 2.2rem;
}

.hero .media-link { display: block; }
.hero img,
.hero .card-placeholder {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 20rem;
  object-fit: cover;
  display: block;
  border-bottom: 2px solid var(--ink);
}

.heroes.single .hero img,
.heroes.single .hero .card-placeholder {
  max-height: 26rem;
}

.hero h2 {
  font-family: var(--headline);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin: 1.2rem 0 0.6rem;
}
.hero .dek { font-size: 1.05rem; color: var(--dek); margin: 0 0 0.9rem; max-width: 48rem; }

.hero h2 a:hover,
.card h2 a:hover { color: var(--accent); }

.byline {
  font-family: var(--meta);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.river-section {
  border-top: 1px solid var(--rule);
  margin-top: 2.4rem;
  padding-top: 1.4rem;
}

.river-section-title {
  font-family: var(--meta);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.2rem;
}

.river {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 2.2rem;
}

.card .media-link { display: block; }
.card img,
.card .card-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--placeholder);
  color: var(--muted);
  font-family: var(--meta);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card h2 {
  font-family: var(--headline);
  font-weight: 800;
  font-size: 1.3rem;
  line-height: 1.3;
  letter-spacing: -0.04em;
  margin: 0.7rem 0 0.6rem;
}
.card .byline { font-size: 0.66rem; }

/* River cards have no byline line, so the time pill sits on its own line under
   the dek; the default pill margin-left is for inline use in bylines. */
.pill-line { margin: 0.7rem 0 0; }
.pill-line .pill { margin-left: 0; }
.card .dek {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.45;
  margin: -0.35rem 0 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 4rem 1rem;
  font-style: italic;
}

/* --- article page ---------------------------------------------------------- */

.article {
  max-width: 46rem;
  margin: 0 auto;
}

.article h1 {
  font-family: var(--headline);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin: 2rem 0 1rem;
}
.article .dek { font-size: 1.15rem; color: var(--dek); margin: 0 0 0.8rem; }
.article .byline { margin-bottom: 1.2rem; }

.article figure { margin: 0 0 1.4rem; }
.article figure img { width: 100%; max-height: 24rem; object-fit: cover; }

.pill {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.06rem 0.55rem;
  border-radius: 999px;
  background: var(--highlight);
  color: var(--ink);
  font-family: var(--meta);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  /*text-transform: uppercase;*/
  vertical-align: bottom;
}

.prose p { font-size: 1.06rem; line-height: 1.6; margin: 0 0 1.2rem; }
.prose h3 { font-family: var(--headline); font-weight: 700; font-size: 1.15rem; margin: 2rem 0 0.7rem; }

/* --- about page ------------------------------------------------------------ */

.about-page .article { max-width: 52rem; }

/* The page reads quieter than a news article: smaller title, muted standfirst. */
.about-page .article h1 {
  font-size: 1.9rem;
  font-weight: 400;
  margin: 0.4rem 0 0.6rem;
}
.about-page .article .dek {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 0.2rem;
}

.about-page .prose p {
  font-size: 1rem;
  line-height: 1.6;
}

.about-section {
  border-top: 1px solid var(--rule);
  margin-top: 4.25rem;
  padding-top: 2rem;
}

/* Every section uses the same title/dek treatment as the page introduction. */
.about-section h2 {
  font-family: var(--headline);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin: 0 0 0.6rem;
}

.about-section-intro {
  max-width: 42rem;
  font-family: var(--headline);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 1.4rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1.1rem;
}

.stat-tile {
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  background: rgba(255, 255, 255, 0.2);
  padding: 1rem 1.1rem 1.1rem;
}

.stat-tile-total {
  border-top-color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.stat-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stat-tile-name {
  font-family: var(--meta);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.stat-tile-participants {
  font-family: var(--meta);
  font-weight: 400;
  font-size: 1.9rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  margin: 0.9rem 0 0.1rem;
}

.stat-tile-participants-label {
  font-family: var(--meta);
  font-size: 0.75rem;
  line-height: 1.45;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.stat-tile-metrics {
  font-family: var(--meta);
  font-size: 0.75rem;
  line-height: 1.45;
  margin: 0 0 1rem;
}

.stat-tile-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.28rem 0;
  border-top: 1px solid var(--rule);
}

.stat-tile-metrics div:last-child { border-bottom: 1px solid var(--rule); }
.stat-tile-metrics dt { color: var(--muted); }
.stat-tile-metrics dd {
  font-family: var(--meta);
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* certainty donut */
.certainty-viz {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: none;
}
.ring { width: 3rem; height: 3rem; flex: none; }
.ring-track { fill: none; stroke: var(--placeholder); stroke-width: 3.2; }
.ring-fill {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3.2;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.stat-tile-total .ring-fill { stroke: var(--ink); }
.ring-label {
  font-family: var(--meta);
  font-size: 8.5px;
  font-weight: 600;
  text-anchor: middle;
  fill: var(--ink);
}
.certainty-label {
  font-family: var(--meta);
  font-size: 0.5rem;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* provider split — plum Polymarket, ochre Kalshi */
.provider-bar {
  display: flex;
  height: 0.45rem;
  border-radius: 999px;
  overflow: hidden;
  background: var(--placeholder);
}
.provider-poly { background: var(--market-poly); }
.provider-kalshi { flex: 1; background: var(--market-kalshi); }

.stat-tile-legend {
  font-family: var(--meta);
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0.45rem 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}
.dot-poly { background: var(--market-poly); }
.dot-kalshi { background: var(--market-kalshi); }

/* author signature block */
.author-signature {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
}

.author-avatar {
  flex: none;
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--footer-bg);
  color: var(--accent);
  font-family: var(--display);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.author-signature-text { display: flex; flex-direction: column; }

.author-name {
  font-family: var(--headline);
  font-weight: 400;
  font-size: 1.1rem;
  line-height: 1.2;
}

.author-role {
  font-family: var(--meta);
  font-size: 0.75rem;
  line-height: 1.45;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* pipeline section — steps (left, wide) + tech overview (right, narrow) */
.about-pipeline {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 2.2rem;
  align-items: start;
}

.tech-panel {
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  background: var(--footer-bg);
  padding: 1.1rem 1.2rem 1.2rem;
}

.tech-panel h3 {
  font-family: var(--meta);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.8rem;
}

.tech-list { margin: 0; }

.tech-list div {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--rule);
  font-family: var(--meta);
  font-size: 0.75rem;
  line-height: 1.45;
}

.tech-list div:last-child { border-bottom: 1px solid var(--rule); }

.tech-list dt {
  font-weight: 400;
  color: var(--ink);
}

.tech-list dd {
  margin: 0;
  color: var(--muted);
}

/* steps — numbered markers joined by a vertical connector */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.step { display: flex; gap: 1.1rem; }

.step-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
}

.step-marker {
  width: 2.3rem;
  height: 2.3rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--headline);
  font-weight: 700;
  font-size: 1rem;
}

.step-connector {
  position: relative;
  flex: 1;
  width: 2px;
  background: var(--rule);
  margin: 0.3rem 0;
}

.step-arrow {
  position: absolute;
  bottom: -0.2rem;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--rule);
  border-bottom: none;
}

.step:last-child .step-connector { display: none; }

.step-body { flex: 1; padding-bottom: 1.9rem; }

.step-name {
  font-family: var(--headline);
  font-weight: 400;
  font-size: 1.15rem;
  margin: 0.15rem 0 0.3rem;
}

.step-text {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--dek);
  margin: 0;
  max-width: 40rem;
}

/* --- footer ---------------------------------------------------------------- */

.site-footer {
  background: var(--band);
  width: 100%;
  margin: 2.5rem 0 0;
}

.site-footer-inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.6rem 1rem 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 3rem;
  align-items: start;
}

.footer-tagline {
  font-family: var(--masthead);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 1.4rem;
}

.footer-note {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  max-width: 44rem;
  margin: 0 0 1.5rem;
}

.footer-meta {
  font-family: var(--meta);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.footer-stats-title {
  font-family: var(--meta);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.8rem;
}

.footer-stats-list { margin: 0; }

.footer-stats-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
}

.footer-stats-list div:last-child {
  border-bottom: 1px solid var(--rule);
}

.footer-stats-list dt { color: var(--muted); }

.footer-stats-list dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .masthead-name { font-size: 2.3rem; }
  .heroes { grid-template-columns: 1fr; }
  .hero h2 { font-size: 1.5rem; }
  .site-footer-inner { grid-template-columns: 1fr; }
  .article h1 { font-size: 1.8rem; }
  .about-pipeline { grid-template-columns: 1fr; }
}
