/* feedwrapped — light and dark are both selected, never an automatic flip. */

:root {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --rule: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-soft: #cde2fb;
  --critical: #d03b3b;

  /* Sequential blue ramp, light→dark: magnitude grows away from the surface. */
  --cell-0: #e8e7e1;
  --cell-1: #cde2fb;
  --cell-2: #9ec5f4;
  --cell-3: #5598e7;
  --cell-4: #2a78d6;
  --cell-5: #184f95;

  /* Raw scatter points sit behind the trend line; a wash on either surface. */
  --scatter-opacity: 0.25;

  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --rule: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-soft: #184f95;
    --critical: #e66767;

    /* On a dark surface the ramp runs dark→light for the same reason. */
    --cell-0: #232322;
    --cell-1: #184f95;
    --cell-2: #256abf;
    --cell-3: #3987e5;
    --cell-4: #6da7ec;
    --cell-5: #b7d3f6;
    /* The same wash reads fainter against a dark surface, so lift it. */
    --scatter-opacity: 0.42;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 0.4em; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

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

.masthead {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2rem 0 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.wordmark {
  font-weight: 650; font-size: 1.1rem; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.wordmark span { color: var(--accent); }
.tagline { margin: 0; color: var(--muted); font-size: 0.9rem; }

main { max-width: 62rem; margin: 0 auto; }

.colophon {
  max-width: 62rem; margin: 3rem auto 0; padding-top: 1.25rem;
  border-top: 1px solid var(--grid);
  color: var(--muted); font-size: 0.85rem;
}

/* ---------- landing ---------- */

.hero { padding: 3rem 0 1rem; max-width: 40rem; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); font-weight: 650; }
.lede { color: var(--ink-2); font-size: 1.05rem; margin: 0 0 2rem; }

.feed-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.feed-form input {
  flex: 1 1 22rem; min-width: 0;
  padding: 0.7rem 0.85rem;
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
.feed-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

button, .button, .button-quiet {
  padding: 0.7rem 1.1rem;
  font: inherit; font-weight: 550;
  color: #fff; background: var(--accent);
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.6; cursor: progress; }

.samples { list-style: none; display: flex; gap: 0.5rem; flex-wrap: wrap;
  padding: 0; margin: 1.5rem 0 0; color: var(--muted); font-size: 0.9rem;
  align-items: center; }
.sample {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: transparent; color: var(--accent); border: 1px solid var(--grid);
  padding: 0.25rem 0.6rem; border-radius: 999px; font-size: 0.85rem; font-weight: 450;
  text-decoration: none; line-height: 1.6;
}
.sample:hover { border-color: var(--rule); }
/* Fixed box so a slow cover never reflows the row. */
.sample-art {
  width: 20px; height: 20px; flex: none; object-fit: cover;
  border-radius: 4px; background: var(--grid);
}

/* ---------- progress ---------- */

.progress-card {
  margin-top: 1.5rem; padding: 1.1rem 1.2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.progress-track { height: 6px; background: var(--grid); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; background: var(--accent); border-radius: 999px;
  transition: width 300ms ease;
}
.progress-message {
  margin: 0.7rem 0 0; color: var(--ink-2); font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.spinner {
  width: 12px; height: 12px; flex: none;
  border: 2px solid var(--grid); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .progress-fill { transition: none; }
}

.progress-steps {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.85rem;
  padding: 0; margin: 0.9rem 0 0; font-size: 0.8rem; color: var(--muted);
}
.progress-steps li::before { content: "○ "; }
.progress-steps li.active { color: var(--ink); font-weight: 550; }
.progress-steps li.active::before { content: "◐ "; }
.progress-steps li.done::before { content: "● "; color: var(--accent); }

.small { font-size: 0.85rem; }
.feed-url {
  display: inline-block; max-width: 100%; overflow-wrap: anywhere;
  padding: 0.15rem 0.45rem; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--grid);
  font-size: 0.85rem; color: var(--ink-2);
}

.notice {
  margin-top: 1.5rem; padding: 0.9rem 1.1rem;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface);
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.notice-error { border-left: 3px solid var(--critical); }
.notice-error strong { color: var(--critical); }

/* ---------- podcast page ---------- */

.wrap { padding: 1rem 0 0; }

.feed-head { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.artwork {
  width: 132px; height: 132px; flex: none; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--grid);
}
.artwork-blank { display: grid; place-items: center; font-size: 3rem; }
.feed-meta { flex: 1 1 22rem; min-width: 0; }
.feed-meta h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.byline { margin: 0 0 0.5rem; color: var(--ink-2); }
.blurb { margin: 0 0 0.75rem; color: var(--ink-2); font-size: 0.95rem; }

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0 0 0.6rem; }
.chip {
  font-size: 0.78rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--ink);
}
.chip-quiet { background: transparent; border: 1px solid var(--grid); color: var(--muted); }
.links { margin: 0; font-size: 0.85rem; display: flex; gap: 0.9rem; flex-wrap: wrap; }
.muted { color: var(--muted); }

.headline { margin: 2.5rem 0 2rem; }
.hero-figure {
  margin: 0; font-size: clamp(3rem, 10vw, 4.5rem); font-weight: 650;
  line-height: 1; letter-spacing: -0.03em;
}
.hero-label { margin: 0.4rem 0 0; color: var(--ink-2); max-width: 46rem; font-size: 1.05rem; }
.dormant { color: var(--muted); }

.tiles {
  display: grid; gap: 1px; background: var(--grid);
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  border: 1px solid var(--grid); border-radius: var(--radius); overflow: hidden;
  margin-bottom: 2rem;
}
.tile { background: var(--surface); padding: 1rem 1.1rem; }
.tile-label { margin: 0; font-size: 0.78rem; color: var(--muted); text-transform: none; }
.tile-value { margin: 0.2rem 0 0; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }
.tile-note { margin: 0.15rem 0 0; font-size: 0.78rem; color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.4rem 1.4rem; margin-bottom: 1.5rem;
}
.card-head { margin-bottom: 0.75rem; }
.card-head h2 { font-size: 1.15rem; margin: 0; }
.card-sub { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.88rem; }
.calendar { width: 100%; }
/* Sized to include the x-axis band, so the card never grows a nested scrollbar. */
.plot { width: 100%; height: 340px; }
.plot-short { height: 260px; }
.empty { color: var(--muted); font-size: 0.9rem; }

.table-view { margin-top: 0.5rem; border-top: 1px solid var(--grid); padding-top: 0.6rem; }
.table-view summary { cursor: pointer; color: var(--ink-2); font-size: 0.85rem; }
.table-scroll { overflow-x: auto; margin-top: 0.6rem; }
table { border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
th, td { padding: 0.3rem 0.6rem; text-align: right; border-bottom: 1px solid var(--grid); }
thead th { color: var(--muted); font-weight: 500; }
tbody th { text-align: left; font-weight: 550; }
td.total { font-weight: 600; }

.episodes { list-style: none; margin: 0; padding: 0; }
.episodes li {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--grid);
}
.episodes li:last-child { border-bottom: 0; }
/* 40px stays under the two-line title+meta block, so artwork never sets the
   row height and the list keeps the rhythm it had without covers. */
.episode-art {
  width: 40px; height: 40px; flex: none;
  object-fit: cover; border-radius: 6px;
  border: 1px solid var(--border); background: var(--grid);
}
.episode-main { min-width: 0; }
.episode-title { margin: 0; font-weight: 500; }
.episode-title a { color: var(--ink); text-decoration: none; }
.episode-title a:hover { text-decoration: underline; }
.episode-meta { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.82rem; }

.again { margin: 2rem 0 0; display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

.button-quiet {
  background: transparent; color: var(--accent);
  border: 1px solid var(--grid);
}
.button-quiet:hover { filter: none; border-color: var(--rule); }

/* ---------- the shareable card ---------- */

.card-preview {
  display: block; width: 100%; height: auto; margin: 0.5rem 0 1rem;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--plane);
}
.card-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0 0; }
#card-years { margin: 0; }
#card-years .chip { cursor: pointer; border: 1px solid var(--grid); background: transparent;
  color: var(--ink-2); font: inherit; font-size: 0.8rem; padding: 0.2rem 0.7rem; }
#card-years .chip-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ECharts injects its own tooltip node at the end of the chart container. */
.chart-tip {
  font-family: var(--sans);
  font-size: 0.82rem;
}

/* ---------- prose pages ---------- */

.prose { max-width: 44rem; padding: 1rem 0 0; }
.prose h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.prose h2 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.1rem; }
.prose li { margin: 0.35rem 0; }
.prose code {
  font-size: 0.88em; padding: 0.1em 0.35em; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--grid); color: var(--ink);
}
.snippet {
  margin: 0.6rem 0 0; padding: 0.8rem 1rem; overflow-x: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.snippet code { background: none; border: 0; padding: 0; color: var(--ink); }
.facts { width: 100%; margin-top: 0.5rem; }
.facts th { text-align: left; font-weight: 500; color: var(--muted); white-space: nowrap; }
.facts td { text-align: left; color: var(--ink-2); }

/* ---------- homepage copy ---------- */

.pitch, .faq { max-width: 44rem; margin-top: 3.5rem; }
.pitch h2, .faq h2 { font-size: 1.25rem; margin-bottom: 0.6rem; }
.pitch p { color: var(--ink-2); margin: 0 0 0.9rem; }
.pitch-points { list-style: none; padding: 0; margin: 1.25rem 0 0; }
.pitch-points li {
  color: var(--ink-2); padding: 0.5rem 0;
  border-top: 1px solid var(--grid); font-size: 0.95rem;
}
.pitch-points strong { color: var(--ink); font-weight: 550; }

.faq-item { border-bottom: 1px solid var(--grid); }
.faq-item summary {
  cursor: pointer; padding: 0.75rem 0;
  font-weight: 550; color: var(--ink); list-style-position: inside;
}
.faq-item summary::marker { color: var(--muted); }
.faq-item summary:hover { color: var(--accent); }
.faq-item p { margin: 0 0 1rem; color: var(--ink-2); font-size: 0.95rem; }
