/* =============================================================================
   throughline — styles
   Editorial, quiet, typography-led. Importance is encoded by type size and
   weight (the "inverted pyramid"), not loud color.
   ========================================================================== */

/* ----------------------------------- Tokens ----------------------------------- */
:root {
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --header-h: 58px;
  --rail-w: 108px;          /* left gutter that holds the day label + spine */
  --edge: 60px;             /* full-bleed page padding — the left rail snaps to this */
  --aside-w: 320px;         /* the left callout rail */
  --gap: calc(var(--edge) * 2);  /* divider sits centered -> rail gets --edge padding on BOTH sides */
  --stream-max: 880px;      /* the timeline centers within the remaining space */

  /* type accent dots */
  --t-model: #b4541e;
  --t-research: #5b6cd0;
  --t-policy: #3f77a6;
  --t-business: #9a7b36;
  --t-product: #2a9d8f;
  --t-safety: #c2533b;
  --t-culture: #9b5da0;
}

html[data-theme="light"] {
  --paper: #fbfaf6;
  --paper-2: #f3f1ea;
  --paper-3: #ece9df;
  --ink: #1a1813;
  --ink-soft: #423e36;
  --muted: #6f6a5e;
  --faint: #9a9484;
  --line: #e7e3d8;
  --line-strong: #d8d3c5;
  --accent: #b4541e;
  --accent-ink: #8f3f12;
  --accent-soft: rgba(180, 84, 30, 0.10);
  --open: #2e7d5b;
  --open-soft: rgba(46, 125, 91, 0.12);
  --shadow: 0 1px 2px rgba(40, 34, 22, 0.04), 0 8px 24px rgba(40, 34, 22, 0.05);
}

html[data-theme="dark"] {
  --paper: #14130f;
  --paper-2: #1c1a15;
  --paper-3: #24221b;
  --ink: #ece7db;
  --ink-soft: #cbc5b6;
  --muted: #948d7c;
  --faint: #6c6655;
  --line: #2a271f;
  --line-strong: #3a362b;
  --accent: #db7a3e;
  --accent-ink: #e89a68;
  --accent-soft: rgba(219, 122, 62, 0.14);
  --open: #5bbd8f;
  --open-soft: rgba(91, 189, 143, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  --t-research: #8b97e0;
  --t-policy: #6fa0c8;
  --t-culture: #bd86c0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scrollbar-gutter: stable; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv05";
}

a { color: inherit; }

::selection { background: var(--accent-soft); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ----------------------------------- Header ----------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: none;
  margin: 0;
  height: var(--header-h);
  padding: 0 var(--edge); position: relative;
  display: flex; align-items: center; gap: 18px;
}

.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--ink);
  font-family: var(--serif); font-weight: 600; font-size: 1.18rem;
  letter-spacing: -0.01em;
}
.wordmark-line {
  width: 22px; height: 2px; background: var(--accent); border-radius: 2px;
  transition: width 0.25s ease;
}
.wordmark:hover .wordmark-line { width: 30px; }

.view-tabs { display: flex; gap: 2px; margin-left: 6px; }
/* center the nav between the wordmark (left) and controls (right) on desktop */
@media (min-width: 761px) { .view-tabs { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin-left: 0; } }
.tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: var(--sans); font-size: 0.86rem; font-weight: 500; color: var(--muted);
  padding: 7px 12px; border-radius: 8px; transition: color 0.15s, background 0.15s;
}
.tab:hover { color: var(--ink); background: var(--paper-2); }
.tab.is-active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 600; }

.header-controls { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: 38px; height: 38px; border-radius: 9px; color: var(--muted);
  display: grid; place-items: center; transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--ink); background: var(--paper-2); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* theme icon swap */
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

/* search + filter drawers */
.search-bar, .filter-bar, .models-bar { border-bottom: 1px solid var(--line); background: var(--paper); }
/* Separator between the main header row and the Models filter bar. */
.models-bar { border-top: 1px solid var(--line); }
.search-inner, .filter-inner {
  max-width: none; margin: 0; padding: 12px var(--edge);
  display: flex; align-items: center; gap: 14px;
}
.search-inner { position: relative; }
#search-input {
  flex: 1; appearance: none; background: var(--paper-2); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 11px 38px 11px 15px; font-family: var(--sans); font-size: 0.95rem;
  color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s;
}
#search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-clear {
  position: absolute; right: 40px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--muted); font-size: 1.4rem; cursor: pointer; line-height: 1;
  width: 28px; height: 28px; border-radius: 6px;
}
.search-clear:hover { color: var(--ink); background: var(--paper-3); }

.filter-inner { flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 10px; }
.filter-group--reset { margin-left: auto; }
.filter-label { font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  appearance: none; cursor: pointer; font-family: var(--sans); font-size: 0.8rem; font-weight: 500;
  color: var(--muted); background: var(--paper-2); border: 1px solid var(--line-strong);
  padding: 5px 11px 5px 9px; border-radius: 100px; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.14s ease;
}
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--muted)); flex: none; }
.chip.is-off { opacity: 0.4; }
.chip.is-off .dot { background: var(--faint); }
.text-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--accent);
  font-family: var(--sans); font-size: 0.82rem; font-weight: 600; padding: 6px 8px; border-radius: 7px;
}
.text-btn:hover { background: var(--accent-soft); }

/* ----------------------------------- Page / hero ----------------------------------- */
.page { max-width: none; margin: 0; padding: 0 var(--edge); }

/* full-bleed two-column: callout rail snaps left, timeline fills + centers right */
.layout {
  position: relative;
  display: grid;
  grid-template-columns: var(--aside-w) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
/* full-height vertical divider between the rail and the timeline */
.layout::before {
  content: "";
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--aside-w) + var(--gap) / 2);
  width: 1px; background: var(--line-strong);
}
.masthead {
  position: sticky; top: var(--sticky-h, var(--header-h)); align-self: start;
  height: calc(100vh - var(--sticky-h, var(--header-h)));
  display: flex; flex-direction: column;
  padding: 0;
}
/* the rail's upper content scrolls within itself; the Rhyme card stays pinned at the bottom */
.rail-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 56px 0 0;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.rail-scroll::-webkit-scrollbar { width: 9px; }
.rail-scroll::-webkit-scrollbar-track { background: transparent; }
.rail-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 3px solid var(--paper); background-clip: padding-box; }
/* the timeline column fills the remaining width but centers its content within it */
.stream { min-width: 0; max-width: var(--stream-max); margin: 0 auto; padding-top: 56px; }

.masthead .hero-title { font-size: clamp(1.7rem, 2.2vw, 2.15rem); margin-bottom: 16px; }
.masthead .hero-sub { font-size: 0.98rem; margin-bottom: 28px; max-width: none; }
.masthead .depth { margin-bottom: 26px; }
.masthead .pyramid { max-width: none; }
.masthead .hero-stats { gap: 18px; }

.hero { padding: 64px 0 26px; max-width: 640px; }
.hero-eyebrow {
  margin: 0 0 18px; font-size: 0.78rem; letter-spacing: 0.04em; color: var(--muted);
  display: inline-flex; align-items: center; gap: 9px;
}
.hero-eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.hero-title {
  font-family: var(--serif); font-weight: 500; letter-spacing: -0.02em;
  font-size: clamp(2.1rem, 5.4vw, 3.3rem); line-height: 1.04; margin: 0 0 20px;
}
.hero-title em { font-style: italic; color: var(--accent-ink); font-weight: 500; }
.hero-sub { margin: 0 0 34px; color: var(--ink-soft); font-size: 1.04rem; line-height: 1.6; max-width: 52ch; }

/* depth / pyramid */
.depth { display: flex; flex-direction: column; gap: 10px; margin-bottom: 30px; }
.depth-caption { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.pyramid { display: flex; flex-direction: column; gap: 4px; align-items: stretch; max-width: 384px; }
.pyramid-tier {
  appearance: none; cursor: pointer; font-family: var(--sans); text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--paper-2); border: 1px solid var(--line-strong); color: var(--muted);
  border-radius: 9px; padding: 9px 13px; transition: all 0.16s ease;
}
.pyramid-tier .pt-name { font-size: 0.86rem; font-weight: 550; display: flex; align-items: center; gap: 9px; }
.pyramid-tier .pt-num {
  font-family: var(--serif); font-size: 0.82rem; font-weight: 600; width: 17px; height: 17px;
  display: grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; opacity: 0.5;
}
.pyramid-tier .pt-count { font-size: 0.76rem; color: var(--faint); font-variant-numeric: tabular-nums; }
/* widths form the inverted pyramid */
.pyramid-tier[data-tier="1"] { width: 100%; }
.pyramid-tier[data-tier="2"] { width: 87%; }
.pyramid-tier[data-tier="3"] { width: 74%; }
.pyramid-tier[data-tier="4"] { width: 61%; }
/* included (at or above the chosen depth) */
.pyramid-tier.is-in {
  color: var(--ink); border-color: color-mix(in srgb, var(--accent) 38%, var(--line-strong));
  background: var(--accent-soft);
}
.pyramid-tier.is-in .pt-num { opacity: 1; color: var(--accent); }
.pyramid-tier.is-floor { box-shadow: inset 0 0 0 1.5px var(--accent); border-color: var(--accent); }
.pyramid-tier.is-floor .pt-count { color: var(--accent-ink); }
.pyramid-tier:not(.is-in) { opacity: 0.55; }
.pyramid-tier:hover { opacity: 1; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 22px; }
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat-num { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1; }
.stat-label { font-size: 0.72rem; letter-spacing: 0.05em; color: var(--faint); text-transform: uppercase; }

/* call-to-action card — pinned to the bottom of the sticky rail */
.cta {
  margin: 0 calc(-1 * var(--edge)) 0;  /* bleed full-width to viewport edge + divider; flex pins it to the bottom */
  display: flex; flex-direction: column; gap: 12px;
  padding: 32px var(--edge) 34px;
  border: none; border-top: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--paper-2);
}
.cta-head { display: flex; align-items: center; gap: 12px; }
.cta-logo {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  background: #1A1410; color: #FBF6EA;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.32rem; letter-spacing: -0.04em; line-height: 1;
}
html[data-theme="dark"] .cta-logo { border: 1px solid var(--line-strong); }
.cta-dot { font-style: normal; color: #BD5335; }
.cta-brand { font-size: 1.32rem; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
/* Rhyme's brand typeface (Fraunces) for the logo + wordmark */
.cta-logo, .cta-brand { font-family: var(--serif); font-weight: 600; }

/* About panel */
.about { max-width: 60ch; padding-top: 6px; }
.about-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -0.01em; margin: 0 0 16px; color: var(--ink); }
.about p { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.65; margin: 0 0 14px; }
.cta-blurb { margin: 0; font-size: 0.93rem; line-height: 1.5; color: var(--muted); }
.cta-link {
  align-self: flex-start; margin-top: 2px;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
  color: #fff; background: #BD5335;
  padding: 10px 16px; border-radius: 10px; border: none;
  transition: background 0.16s, transform 0.16s, box-shadow 0.16s;
}
.cta-link:hover { background: #a8481f; transform: translateY(-1px); box-shadow: 0 5px 16px rgba(192, 83, 43, 0.28); }
.cta-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cta-link:hover svg { transform: translate(2px, -2px); transition: transform 0.16s; }

/* models sub-filter */
.models-subfilter { margin: 4px 0 14px; display: flex; align-items: center; gap: 12px; }
.seg-label { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; flex: none; }
.seg { display: inline-flex; background: var(--paper-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font-family: var(--sans); font-size: 0.84rem; font-weight: 500; padding: 7px 14px; border-radius: 7px; transition: all 0.14s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-active { color: var(--accent-ink); background: var(--paper); box-shadow: var(--shadow); font-weight: 600; }

.active-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 2px; font-size: 0.82rem; color: var(--muted); align-items: center; }

/* Models filter bar (search + scrollable pills) */
.models-bar-inner { max-width: none; margin: 0; padding: 10px var(--edge); display: flex; align-items: center; gap: 14px; }
.models-search { position: relative; flex: none; width: 210px; display: flex; align-items: center; }
.models-search svg { position: absolute; left: 12px; width: 15px; height: 15px; stroke: var(--muted); fill: none; stroke-width: 1.7; pointer-events: none; }
.models-search input { width: 100%; appearance: none; background: var(--paper-2); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 12px 8px 34px; font-family: var(--sans); font-size: 0.9rem; color: var(--ink); }
.models-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pill-scroll { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; overflow-x: auto; padding: 2px 0; scrollbar-width: thin; }
.pill-scroll::-webkit-scrollbar { height: 6px; }
.pill-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.mpill { flex: none; appearance: none; cursor: pointer; white-space: nowrap; font-family: var(--sans); font-size: 0.8rem; font-weight: 500; color: var(--muted); background: var(--paper-2); border: 1px solid var(--line-strong); padding: 6px 12px; border-radius: 100px; transition: color .14s, background .14s, border-color .14s; }
.mpill:hover { color: var(--ink); border-color: var(--muted); }
.mpill.is-on { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); font-weight: 600; }
.mpill-div { flex: none; width: 1px; align-self: stretch; background: var(--line-strong); margin: 4px 4px; }
@media (max-width: 560px) { .models-search { width: 132px; } }

/* compact model filters: license toggle + a "Makers" dropdown + removable chips */
.models-filters { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mk-wrap { position: relative; }
.mk-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 550; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line-strong); border-radius: 100px; padding: 6px 11px;
  transition: border-color .14s, background .14s, color .14s;
}
.mk-btn:hover { border-color: var(--muted); }
.mk-btn.is-on { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line-strong)); }
.mk-btn svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mk-caret { opacity: .65; transition: transform .2s ease; }
.mk-btn.mk-open .mk-caret { transform: rotate(180deg); }
.mk-panel {
  position: absolute; top: calc(100% + 7px); left: 0; z-index: 30;
  width: min(290px, calc(100vw - 40px)); max-height: min(62vh, 400px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 13px;
  box-shadow: 0 18px 40px rgba(20, 16, 12, 0.2);
}
.mk-search { flex: none; padding: 8px; border-bottom: 1px solid var(--line); }
.mk-search input {
  width: 100%; box-sizing: border-box; appearance: none; background: var(--paper-2);
  border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 11px;
  font-family: var(--sans); font-size: 0.85rem; color: var(--ink);
}
.mk-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mk-list { overflow-y: auto; padding: 5px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; overscroll-behavior: contain; }
.mk-list::-webkit-scrollbar { width: 9px; }
.mk-list::-webkit-scrollbar-track { background: transparent; }
.mk-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 3px solid var(--paper); background-clip: padding-box; }
.mk-row {
  width: 100%; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left;
  appearance: none; border: 0; background: transparent; border-radius: 8px; padding: 8px 9px;
  font-family: var(--sans); font-size: 0.86rem; color: var(--ink);
}
.mk-row:hover { background: var(--paper-2); }
.mk-check { width: 16px; height: 16px; flex: none; border-radius: 5px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; transition: background .12s, border-color .12s; }
.mk-row.is-on .mk-check { background: var(--accent); border-color: var(--accent); }
.mk-row.is-on .mk-check::after { content: ""; width: 7px; height: 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translateY(-1px); }
.mk-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row.is-on .mk-name { font-weight: 600; }
.mk-count { flex: none; font-size: 0.76rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.mk-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.mk-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--sans); font-size: 0.8rem; font-weight: 550;
  color: var(--accent-ink); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line-strong));
  border-radius: 100px; padding: 5px 7px 5px 12px;
}
.mk-chip span { font-size: 1.05rem; line-height: .8; opacity: .65; }
.mk-chip:hover { color: var(--accent); border-color: var(--accent); }
/* mobile: full-width dropdown anchored just below the filter bar (never overflows a narrow screen).
   The header's backdrop-filter is the containing block for this fixed panel, so top:100% = header bottom. */
@media (max-width: 760px) {
  .mk-panel {
    position: fixed; left: 0; right: 0; top: calc(100% + 6px); bottom: auto;
    width: auto; max-width: none; max-height: 58vh; border-radius: 0 0 14px 14px;
  }
}

/* ----------------------------------- Timeline ----------------------------------- */
.timeline { position: relative; padding-bottom: 56px; }
/* the continuous spine */
.timeline::before {
  content: ""; position: absolute; top: 8px; bottom: 0;
  left: var(--rail-w); width: 1px;
  background: linear-gradient(var(--line), var(--line) 92%, transparent);
}

.month-group { position: relative; }
.month-header {
  position: sticky; top: var(--month-top, var(--header-h)); z-index: 20;
  display: flex; align-items: baseline; gap: 12px;
  padding: 16px 0 15px; margin-left: 0;
  /* mostly-solid so entries scrolling underneath are cleanly hidden, with a short soft edge */
  background: linear-gradient(var(--paper), var(--paper) 80%, transparent);
}
.month-header h2 {
  font-family: var(--serif); font-weight: 600; font-size: 1.16rem; letter-spacing: -0.01em; margin: 0;
  color: var(--ink); flex: none; white-space: nowrap;
}
.month-header .month-rule { flex: 1; height: 1px; background: var(--line); align-self: center; }
/* keep the timeline (incl. the month rule) clear of the fixed year rail */
@media (min-width: 761px) { .stream { padding-right: 72px; } }

/* (rail stays sticky at all desktop heights — with the stats removed its content
   fits ~100vh; on the rare shorter screen the CTA is reachable at the page bottom) */

.month-entries { display: flex; flex-direction: column; }

/* a single event */
.entry {
  display: grid; grid-template-columns: var(--rail-w) 1fr; align-items: start;
  position: relative; padding: 13px 0;
}
.entry-rail { position: relative; text-align: right; padding-right: 26px; padding-top: 1px; }
.entry-day { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; white-space: nowrap; }
.entry-node {
  position: absolute; right: -4px; top: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--line-strong); z-index: 2;
}
.entry-body { padding-left: 26px; min-width: 0; }

.entry-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.badge {
  font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
  padding: 2px 7px; border-radius: 5px; display: inline-flex; align-items: center; gap: 5px;
}
.badge-type { color: var(--muted); background: var(--paper-2); border: 1px solid var(--line); }
.badge-type .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--muted)); }
.badge-open { color: var(--open); background: var(--open-soft); border: 1px solid color-mix(in srgb, var(--open) 30%, transparent); }
.badge-closed { color: var(--muted); background: transparent; border: 1px solid var(--line-strong); }
.entry-org { font-size: 0.76rem; color: var(--muted); font-weight: 500; }

.entry-title { font-family: var(--sans); font-weight: 600; letter-spacing: -0.005em; margin: 0; color: var(--ink); }
.entry-title a { text-decoration: none; background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size 0.25s ease; }
.entry-title a:hover { background-size: 100% 1px; }
.entry-summary { margin: 5px 0 0; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.55; max-width: 60ch; }

.entry-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 9px; }
.src-link {
  font-size: 0.78rem; font-weight: 500; color: var(--muted); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px; transition: color 0.14s;
}
.src-link:hover { color: var(--accent); }
.src-link svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* ---- tier scaling: the visual inverted pyramid ---- */
.entry.tier-1 { padding: 26px 0; }
.entry.tier-1 .entry-title { font-family: var(--serif); font-weight: 560; font-size: clamp(1.35rem, 2.6vw, 1.62rem); line-height: 1.16; }
.entry.tier-1 .entry-summary { font-size: 1rem; }
.entry.tier-1 .entry-node { width: 13px; height: 13px; right: -6px; top: 5px; background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.entry.tier-1 .entry-day { color: var(--ink-soft); font-weight: 500; }

.entry.tier-2 { padding: 18px 0; }
.entry.tier-2 .entry-title { font-family: var(--serif); font-weight: 540; font-size: 1.16rem; line-height: 1.25; }
.entry.tier-2 .entry-node { width: 10px; height: 10px; right: -4.5px; border-color: var(--ink-soft); }

.entry.tier-3 .entry-title { font-size: 1rem; }
.entry.tier-3 .entry-node { width: 8px; height: 8px; }

/* tier 4 recedes into a quiet log line */
.entry.tier-4 { padding: 8px 0; }
.entry.tier-4 .entry-title { font-size: 0.92rem; font-weight: 500; color: var(--ink-soft); }
.entry.tier-4 .entry-summary { display: none; }
.entry.tier-4 .entry-node { width: 6px; height: 6px; border-color: var(--line-strong); }
.entry.tier-4 .badge-type { display: none; }
.entry.tier-4 .entry-day { font-size: 0.73rem; color: var(--faint); }

/* reveal-on-scroll (progressive enhancement; only when motion is OK) */
.timeline.reveal .entry { opacity: 0; transform: translateY(10px); transition: opacity 0.5s ease, transform 0.5s ease; }
.timeline.reveal .entry.is-in { opacity: 1; transform: none; }

/* ----------------------------------- Year rail ----------------------------------- */
.year-rail {
  position: fixed; right: var(--edge); top: 50%; transform: translateY(-50%); z-index: 30;
  display: flex; flex-direction: column; gap: 1px; align-items: flex-end;
}
.year-rail button {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--faint);
  font-family: var(--sans); font-size: 0.7rem; font-variant-numeric: tabular-nums; font-weight: 500;
  padding: 3px 6px; border-radius: 6px; line-height: 1; letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 7px; transition: color 0.15s;
}
.year-rail button::after { content: ""; width: 14px; height: 1.5px; background: currentColor; border-radius: 2px; opacity: 0.5; transition: width 0.18s; }
.year-rail button:hover { color: var(--ink); }
.year-rail button.is-active { color: var(--accent); }
.year-rail button.is-active::after { width: 22px; opacity: 1; }

/* back to today */
.to-today {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 30; appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 100px;
  padding: 10px 18px 10px 14px; font-family: var(--sans); font-size: 0.84rem; font-weight: 550;
  box-shadow: var(--shadow); transition: opacity 0.25s, transform 0.25s;
}
.to-today svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.to-today:hover { transform: translateX(-50%) translateY(-2px); }

/* empty state */
.empty-state { text-align: center; padding: 80px 0; color: var(--muted); }
.empty-state p { margin: 0 0 10px; font-family: var(--serif); font-size: 1.15rem; }

/* ----------------------------------- Footer ----------------------------------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; }
.footer-inner { max-width: none; margin: 0; padding: 34px var(--edge) 60px; display: flex; flex-direction: column; gap: 12px; }
.footer-mark { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; margin-right: 10px; }
.footer-dim { color: var(--faint); font-size: 0.82rem; }
.footer-note { margin: 0; color: var(--muted); font-size: 0.84rem; max-width: 60ch; line-height: 1.6; }
.footer-note code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

/* ----------------------------------- Focus ----------------------------------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --------------------- Mobile chrome (inert on desktop) --------------------- */
.mobile-only { display: none; }
.qmark { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; line-height: 1; }
.scrim { position: fixed; inset: var(--header-h) 0 0; z-index: 36; background: rgba(20, 16, 12, 0.34); }
.rhyme-drawer { display: none; }

/* --------------------- Source peek (in-page reader drawer) --------------------- */
.peek { position: fixed; inset: 0; z-index: 60; }
.peek-scrim { position: absolute; inset: 0; background: rgba(20, 16, 12, 0.42); opacity: 0; transition: opacity 0.3s ease; }
.peek.is-open .peek-scrim { opacity: 1; }
.peek-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(560px, 94vw);
  display: flex; flex-direction: column; background: var(--paper);
  box-shadow: -14px 0 50px rgba(20, 16, 12, 0.26);
  transform: translateX(100%); transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}
.peek.is-open .peek-panel { transform: translateX(0); }
.peek-bar {
  flex: none; height: 52px; display: flex; align-items: center; gap: 10px;
  padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); background: var(--paper-2);
}
.peek-site { flex: 1; min-width: 0; font-family: var(--sans); font-size: 0.85rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peek-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.peek-open, .peek-close {
  width: 36px; height: 36px; flex: none; border-radius: 8px; border: 0; background: transparent;
  cursor: pointer; color: var(--muted); display: grid; place-items: center; text-decoration: none;
  transition: color 0.14s, background 0.14s;
}
.peek-open:hover, .peek-close:hover { color: var(--ink); background: var(--paper); }
.peek-open svg, .peek-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.peek-frame-wrap { position: relative; flex: 1; min-height: 0; background: var(--paper); }
.peek-frame { width: 100%; height: 100%; border: 0; display: block; }
.peek-loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--paper); }
.peek-spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: peek-spin 0.8s linear infinite; }
@keyframes peek-spin { to { transform: rotate(360deg); } }
html.peek-lock { overflow: hidden; }
.src-link--peek:hover { color: var(--accent); }
@media (max-width: 760px) {
  .peek-panel {
    top: auto; right: 0; left: 0; bottom: 0; width: auto; height: 92vh;
    border-radius: 16px 16px 0 0; box-shadow: 0 -14px 50px rgba(20, 16, 12, 0.3);
    transform: translateY(100%);
  }
  .peek.is-open .peek-panel { transform: translateY(0); }
}

/* ----------------------------------- Responsive ----------------------------------- */
@media (max-width: 1180px) { :root { --edge: 44px; } }

@media (max-width: 960px) {
  :root { --edge: 40px; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .layout::before { display: none; }
  .masthead { position: static; height: auto; min-height: 0; padding: 40px 0 6px; }
  .rail-scroll { display: contents; }
  .masthead .hero-title { font-size: clamp(2rem, 5vw, 2.7rem); margin-bottom: 18px; }
  .masthead .hero-sub { max-width: 56ch; }
  .masthead .pyramid { max-width: 384px; }
  .cta { margin: 28px 0 0; max-width: 440px; border: 1px solid var(--line-strong); border-radius: 14px; padding: 20px; }
  /* stacked: left-align the timeline with the rail instead of centering it */
  .stream { max-width: none; margin: 0; padding-top: 16px; }
}

@media (max-width: 760px) {
  :root { --rail-w: 64px; --edge: 20px; }
  .header-inner { gap: 12px; }
  .wordmark { font-size: 1.06rem; gap: 7px; }
  .wordmark-line { width: 16px; }
  .view-tabs { margin-left: 0; }
  .tab { padding: 6px 9px; font-size: 0.82rem; }
  .icon-btn { width: 36px; height: 36px; }
  .hero { padding-top: 40px; }
  .entry-rail { padding-right: 14px; }
  .entry-body { padding-left: 16px; }
  .year-rail { display: none; }

  /* more vertical breathing room between entries on mobile */
  .entry { padding: 18px 0; }
  .entry-meta { margin-bottom: 6px; }
  .entry-title { line-height: 1.32; }
  .entry-summary { font-size: 0.95rem; line-height: 1.62; margin-top: 7px; }
  .month-header { padding-bottom: 18px; }

  /* --- mobile: the timeline is the immediate content; chrome tucks away --- */
  .mobile-only { display: grid; }
  #filter-toggle, #theme-toggle { display: none; }
  .view-tabs { display: none; }            /* nav moves into the hamburger */

  /* the masthead (about + filters) becomes a slide-down panel behind the "?" */
  .masthead {
    position: fixed; left: 0; right: 0; top: var(--header-h); z-index: 38;
    margin: 0; min-height: 0; max-height: calc(100dvh - var(--header-h));
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 28px 22px 38px;
    background: var(--paper); border-bottom: 1px solid var(--line-strong);
    box-shadow: 0 16px 30px rgba(20, 16, 12, 0.17);
    transform: translateY(-118%); transition: transform 0.3s ease; will-change: transform;
  }
  html.info-open .masthead { transform: translateY(0); }
  .masthead .hero { padding: 0; max-width: none; }
  .masthead .hero-eyebrow { margin-bottom: 16px; }
  .masthead .hero-title { font-size: clamp(1.6rem, 6vw, 2rem); line-height: 1.1; margin-bottom: 14px; }
  .masthead .hero-sub { margin-bottom: 26px; font-size: 1rem; line-height: 1.6; }
  .masthead .depth { margin-bottom: 0; gap: 12px; }
  .masthead .pyramid { gap: 7px; }
  .masthead .pyramid-tier { padding: 12px 14px; }
  .masthead .cta, .masthead .hero-stats { display: none; }   /* Rhyme → bottom drawer */

  .stream { padding-top: 14px; }

  /* hamburger dropdown (reuses .view-tabs) */
  html.nav-open .view-tabs {
    display: flex; flex-direction: column; gap: 3px;
    position: fixed; top: calc(var(--header-h) + 6px); right: var(--edge); z-index: 41;
    min-width: 172px; padding: 7px;
    background: var(--paper); border: 1px solid var(--line-strong); border-radius: 13px;
    box-shadow: 0 16px 30px rgba(20, 16, 12, 0.17);
  }
  html.nav-open .view-tabs .tab { width: 100%; text-align: left; padding: 10px 13px; font-size: 0.94rem; }

  /* Rhyme: a slim bottom drawer that expands on tap, collapses on scroll.
     It inverts against the theme to stand out: dark in light mode, light in dark mode. */
  .rhyme-drawer {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 44;
    background: #1A1410; color: #FBF6EA;
    box-shadow: 0 -14px 40px rgba(20, 16, 12, 0.36);
    transform: translateY(calc(100% - 60px)); transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .rhyme-drawer.is-open { transform: translateY(0); }
  html.info-open .rhyme-drawer, html.nav-open .rhyme-drawer { transform: translateY(100%); }  /* out of the way while a menu is open */
  .rhyme-handle {
    width: 100%; height: 60px; display: flex; align-items: center; gap: 12px;
    appearance: none; border: 0; background: transparent; cursor: pointer; padding: 0 22px;
  }
  .rhyme-handle-logo {
    width: 30px; height: 30px; flex: none; border-radius: 8px;
    background: #FBF6EA; color: #1A1410; font-family: var(--serif); font-weight: 600;
    font-size: 1rem; letter-spacing: -0.04em; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .rhyme-handle-logo .cta-dot { color: #BD5335; }
  .rhyme-handle-label { flex: 1; text-align: left; font-family: var(--sans); font-size: 0.95rem; font-weight: 600; color: #FBF6EA; }
  .rhyme-chev { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: rgba(251, 246, 234, 0.6); transition: transform 0.3s ease; }
  .rhyme-drawer.is-open .rhyme-chev { transform: rotate(180deg); }
  .rhyme-body { padding: 4px 22px calc(28px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; }
  .rd-blurb { margin: 0; font-size: 0.96rem; line-height: 1.55; color: rgba(251, 246, 234, 0.74); }
  .rd-btn {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 7px;
    text-decoration: none; color: #fff; background: #BD5335;
    font-size: 0.94rem; font-weight: 600; padding: 13px 20px; border-radius: 12px;
  }
  .rd-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  /* dark mode: flip the drawer to light/cream so it still stands out */
  html[data-theme="dark"] .rhyme-drawer { background: #FBF6EA; color: #1A1410; box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.5); }
  html[data-theme="dark"] .rhyme-handle-logo { background: #1A1410; color: #FBF6EA; }
  html[data-theme="dark"] .rhyme-handle-label { color: #1A1410; }
  html[data-theme="dark"] .rhyme-chev { color: rgba(26, 20, 16, 0.5); }
  html[data-theme="dark"] .rd-blurb { color: rgba(26, 20, 16, 0.66); }

  /* the floating "Today" pill would collide with the drawer */
  .to-today { display: none; }
}

@media (max-width: 460px) {
  :root { --edge: 14px; }
  .header-inner { gap: 8px; }
  .wordmark { font-size: 1.02rem; }
  .view-tabs { margin-left: 0; }
  .tab { padding: 6px 7px; font-size: 0.8rem; }
  .header-controls { gap: 0; }
  .icon-btn { width: 34px; height: 34px; }
  /* manual theme toggle drops out on narrow phones; system preference still applies */
  #theme-toggle { display: none; }
}

@media (max-width: 540px) {
  :root { --rail-w: 0px; }
  .timeline::before { left: 4px; }
  .entry { grid-template-columns: 1fr; }
  .entry-rail { text-align: left; padding: 0 0 0 22px; }
  .entry-day { display: inline-block; }
  .entry-node { right: auto; left: 0; top: 3px; }
  .entry-body { padding-left: 22px; }
  .month-header { padding-left: 0; }
  .month-header h2 { width: auto; text-align: left; padding-left: 22px; }
  .entry.tier-1 .entry-node { left: -2px; }
  .entry.tier-4 .entry-node { left: 1.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
