/* False Static Flow
   ------------------------------------------------------------------ */

:root {
  --ink:        #0A0C0F;
  --surface:    #11151A;
  --line:       #1E242D;
  --line-soft:  #171C23;
  --text:       #DCE3EB;
  --muted:      #7A8794;
  --dim:        #4E5967;
  --accent:     #7B9BB8;
  --accent-dim: #46586B;
  --stale:      #C0956B;
  /* Market convention: green rises, red falls. Muted so they sit inside the
     palette rather than shouting over it. */
  --up:         #6FBF8E;
  --down:       #D9736B;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;

  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --measure: 62ch;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Ticker ------------------------------------------------------------ */

.ticker {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
  background: #0C1015;
  padding: .6rem 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
}

.ticker-rail {
  display: flex;
  width: max-content;
  animation: ticker-scroll 90s linear infinite;
}

.ticker:hover .ticker-rail { animation-play-state: paused; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  /* The rail holds the run twice, so scrolling exactly half is seamless. */
  to   { transform: translateX(-50%); }
}

.tick {
  display: inline-flex;
  align-items: baseline;
  gap: .5rem;
  padding: 0 1.5rem;
  font-size: .8125rem;
  white-space: nowrap;
  border-right: 1px solid var(--line-soft);
}

.tick-name  { color: var(--muted); letter-spacing: .01em; }
.tick-value { color: var(--text); font-variant-numeric: tabular-nums; }
.tick-move  { font-variant-numeric: tabular-nums; color: var(--dim); }
.tick-move[data-dir="up"]   { color: var(--up); }
.tick-move[data-dir="down"] { color: var(--down); }

/* Someone who has asked their system for less motion gets a still ticker
   rather than a scrolling one. Clip it cleanly instead of exposing a
   scrollbar — the fallback should look deliberate, not broken. */
@media (prefers-reduced-motion: reduce) {
  .ticker-rail { animation: none; }
  .ticker { overflow: hidden; }
  .ticker-rail > .tick:nth-child(n + 13) { display: none; }
}

/* Masthead --------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.4rem var(--gutter);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: var(--accent);
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
  letter-spacing: .01em;
  color: var(--text);
}

.masthead-nav {
  display: flex;
  gap: 1.5rem;
  font-size: .875rem;
  color: var(--muted);
}

.masthead-nav a {
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.masthead-nav a:hover { color: var(--text); border-bottom-color: var(--accent-dim); }

/* Opening ---------------------------------------------------------- */

.opening {
  position: relative;
  padding: clamp(4rem, 13vh, 8.5rem) var(--gutter) clamp(4rem, 12vh, 7.5rem);
  overflow: hidden;
  text-align: center;
}

/* Ambient motion layer. Decoration — carries no data. */
.flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  /* Fade the band out at both edges so it never hard-cuts into the section
     below or crowds the title above. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 34%, #000 62%, #000 88%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 34%, #000 62%, #000 88%, transparent 100%);
}

.opening-text { position: relative; }

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 200;
  font-size: clamp(2.9rem, 9vw, 6rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.lede {
  margin: 1.1rem 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.15rem, 2.6vw, 1.75rem);
  color: var(--accent);
  letter-spacing: -0.005em;
}

.sub {
  max-width: 46ch;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: clamp(.9rem, 1.5vw, 1.05rem);
}

.readout-band {
  padding: 0 var(--gutter) clamp(2.5rem, 7vh, 4rem);
  border-bottom: 1px solid var(--line-soft);
}

.readout {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(2rem, 6vw, 5rem);
  margin: 0;
}

.readout-item { min-width: 0; }

.readout dt {
  font-size: .8125rem;
  color: var(--dim);
  letter-spacing: .015em;
}

.readout dd { margin: .35rem 0 0; }

.figure {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2rem, 4.2vw, 2.875rem);
  line-height: 1.05;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.figure-sm { font-size: clamp(1.25rem, 2.2vw, 1.5rem); color: var(--muted); }

.readout[data-state="loading"] .figure { color: var(--dim); }

/* Board ------------------------------------------------------------ */

.board { padding: clamp(2.5rem, 7vh, 4.5rem) var(--gutter); }

.board-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  letter-spacing: -0.01em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  font-size: .875rem;
  color: var(--muted);
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}

.status[data-tone="live"] .status-dot {
  background: var(--accent);
  animation: breathe 3.2s ease-in-out infinite;
}
.status[data-tone="live"] { color: var(--accent); }

.status[data-tone="partial"] .status-dot { background: var(--stale); }
.status[data-tone="partial"] { color: var(--stale); }

.status[data-tone="down"] .status-dot { background: var(--dim); }

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* Map card -------------------------------------------------------- */

.mapcard {
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  background: #0D1116;
}

.mapcard-head,
.mapcard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1rem;
  font-size: .8125rem;
  color: var(--muted);
}

.mapcard-head { border-bottom: 1px solid var(--line); }
.mapcard-foot { border-top: 1px solid var(--line); }

.mapcard-brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--accent);
  font-family: var(--serif);
  font-size: .95rem;
}
.mapcard-brand svg { flex: none; }

.mapcard-foot strong {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--text);
}

.mapcard-handle { color: var(--dim); letter-spacing: .01em; }

.orbs {
  display: block;
  width: 100%;
  height: auto;
  max-height: 430px;
  background: radial-gradient(120% 90% at 50% 45%, #0E141B 0%, var(--ink) 70%);
}

.orb-ring {
  fill: none;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  transition: opacity .5s ease;
}

.orb-name  { fill: var(--text); font-weight: 500; letter-spacing: .01em; }
.orb-count { fill: var(--text); opacity: .78; font-variant-numeric: tabular-nums; }
.orb-lede  { fill: #EAF4FF; font-weight: 500; letter-spacing: .04em; }
.orb-sub   { fill: var(--muted); letter-spacing: .12em; }

/* Neon rims. Colour carries the move, so it never has to be read on its own —
   the number beside it says the same thing. */
.orb[data-dir="up"]   .orb-ring { stroke: #63E6A4; }
.orb[data-dir="down"] .orb-ring { stroke: #FF7A6B; }
.orb[data-dir="flat"] .orb-ring { stroke: #7FD9F5; }
.orb[data-lead="yes"] .orb-ring { stroke-width: 2.4; }

.orb-move { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.orb[data-dir="up"]   .orb-move { fill: #63E6A4; }
.orb[data-dir="down"] .orb-move { fill: #FF7A6B; }
.orb[data-dir="flat"] .orb-move { fill: var(--dim); }

.mapcaption {
  margin: 0 0 2.5rem;
  max-width: var(--measure);
  font-size: .8125rem;
  color: var(--dim);
}

/* Ledger ----------------------------------------------------------- */

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
}

.ledger thead th {
  padding: 0 0 .7rem;
  font-size: .75rem;
  font-weight: 400;
  color: var(--dim);
  text-align: left;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--line);
}

.ledger td {
  padding: .95rem 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: baseline;
}

.col-rank  { width: 3rem; }
.col-peak { width: 26%; }
.col-count, .ledger .col-count { text-align: right; width: 7.5rem; }
.col-watch, .ledger .col-watch { text-align: right; width: 8rem; }
.col-move,  .ledger .col-move  { text-align: right; width: 6rem; }

.rank { color: var(--dim); font-size: .8125rem; }

.game { color: var(--text); }

.game-source {
  display: block;
  font-size: .75rem;
  color: var(--dim);
}

tr[data-state="stale"] .game-source { color: var(--stale); }

.peak-track {
  position: relative;
  height: 4px;
  background: var(--line);
  max-width: 200px;
}

.peak-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent-dim);
  transition: width .9s cubic-bezier(.22,.61,.36,1), background-color .4s ease;
}

/* Near its daily peak means still climbing; well below means emptying out. */
.peak-fill[data-heat="high"] { background: var(--accent); }
.peak-fill[data-heat="low"]  { background: #5C5140; }

.peak-label {
  display: block;
  margin-top: .4rem;
  font-size: .75rem;
  color: var(--dim);
}

.count {
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
}

.count[data-state="empty"] { color: var(--dim); }

/* Trend sparkline ---------------------------------------------------- */

.col-trend, .ledger .col-trend { width: 120px; }

.spark { display: block; width: 108px; height: 26px; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark-line[data-dir="up"]   { stroke: var(--up); }
.spark-line[data-dir="down"] { stroke: var(--down); }
.spark-area { stroke: none; opacity: .12; }
.spark-area[data-dir="up"]   { fill: var(--up); }
.spark-area[data-dir="down"] { fill: var(--down); }
.spark-area[data-dir="flat"] { fill: var(--accent); }
.spark-head { fill: var(--text); }

.spark-wait { font-size: .7rem; color: var(--dim); }

/* Watching ---------------------------------------------------------- */

.watch { font-size: .9375rem; color: var(--text); font-variant-numeric: tabular-nums; }
.watch[data-state="none"] { color: var(--dim); }

.watch-ratio {
  display: block;
  margin-top: .2rem;
  font-size: .7rem;
  color: var(--dim);
}

/* Games with an unusually large audience relative to their player base are
   the interesting ones — mark them rather than leaving it to be spotted. */
.watch-ratio[data-heavy="yes"] { color: var(--accent); }

.seller {
  display: inline-block;
  margin-left: .5rem;
  padding: .05rem .35rem;
  font-size: .68rem;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  vertical-align: middle;
}

/* Layer availability ------------------------------------------------ */

body[data-watching="off"] .col-watch,
body[data-watching="off"] .ledger .col-watch { display: none; }

.move { font-size: .875rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.move[data-dir="up"]   { color: var(--up); }
.move[data-dir="down"] { color: var(--down); }
.move[data-dir="new"]  { color: var(--accent); }

.ledger-note {
  margin: 1.5rem 0 0;
  max-width: var(--measure);
  font-size: .8125rem;
  color: var(--dim);
}

.empty-state {
  margin: 2rem 0 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  background: var(--surface);
  max-width: var(--measure);
}

.empty-state h3 {
  margin: 0 0 .6rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.125rem;
}

.empty-state p { margin: 0; font-size: .875rem; color: var(--muted); }

/* Lines to post --------------------------------------------------- */

.post {
  padding: clamp(2.5rem, 7vh, 4rem) var(--gutter);
  border-top: 1px solid var(--line-soft);
}

.post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn {
  font: inherit;
  font-size: .8125rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  padding: .55rem .9rem;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.btn:hover { border-color: var(--accent-dim); color: var(--accent); }
.btn[disabled] { opacity: .45; cursor: default; }

.post-list { list-style: none; margin: 0; padding: 0; }

.post-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.post-text {
  margin: 0;
  max-width: 64ch;
  font-size: .9375rem;
  color: var(--text);
  line-height: 1.55;
}

.post-copy {
  flex: none;
  font: inherit;
  font-size: .75rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  padding: .35rem .7rem;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.post-copy:hover { border-color: var(--accent-dim); color: var(--accent); }
.post-copy[data-done="yes"] { color: var(--accent); border-color: var(--accent-dim); }

.post-empty { color: var(--dim); font-size: .875rem; }

.post-note {
  margin: 1.25rem 0 0;
  max-width: var(--measure);
  font-size: .8125rem;
  color: var(--dim);
}

@media (max-width: 700px) {
  .post-item { flex-direction: column; gap: .6rem; align-items: flex-start; }
}

/* Primer ----------------------------------------------------------- */

.primer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.primer-card {
  background: var(--ink);
  padding: clamp(1.5rem, 3.5vw, 2.25rem) var(--gutter);
}

.primer-card h3 {
  margin: 0 0 .6rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.15rem;
  color: var(--text);
}

.primer-card p {
  margin: 0;
  font-size: .875rem;
  color: var(--muted);
  max-width: 42ch;
}

/* Method ----------------------------------------------------------- */

.method {
  padding: clamp(2.5rem, 7vh, 4.5rem) var(--gutter) clamp(3rem, 9vh, 5.5rem);
  border-top: 1px solid var(--line-soft);
}

.method-body {
  max-width: var(--measure);
  margin-top: 1.25rem;
  color: var(--muted);
}

.method-body p { margin: 0 0 1.1rem; }
.method-body p:last-child { margin-bottom: 0; }

/* Colophon --------------------------------------------------------- */

.colophon {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--line-soft);
  font-size: .8125rem;
  color: var(--dim);
}

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

/* Narrow ----------------------------------------------------------- */

@media (max-width: 700px) {
  .masthead-nav { gap: 1.1rem; }
  .readout { gap: 1.75rem 2.5rem; }
  .orbs { max-height: 520px; }
  .opening { padding-top: clamp(2.5rem, 8vh, 4rem); padding-bottom: clamp(2.5rem, 8vh, 4rem); }
  .primer-card { padding-top: 1.4rem; padding-bottom: 1.4rem; }
  .mapcard-foot { font-size: .75rem; }
  .col-peak { display: none; }
  .ledger .col-peak { display: none; }
  .col-watch, .ledger .col-watch { width: 5.5rem; }
  .col-count, .ledger .col-count { width: 6.5rem; }
  .ledger td { padding: .8rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
