/* Fall brand (same tokens as the project reports; see ~/lab/tools/pages/brand/brand.css).
   Variable names kept from the old blue theme so the timeline CSS needs no edits:
   --blue is now the rust link/accent color, --blue-wash its light wash.
   Track and category colors are all >= 3:1 on paper (checked), and every category also has a text label. */
:root {
  --paper: #f6f1e7;
  --surface: #fdfaf3;
  --ink: #2b2118;
  --muted: #5c4f42;
  --rule: #d8ccb8;
  --divider: #000000;
  --blue: #9a3b12;
  --blue-wash: #f3e1d3;
  --moss: #4f5f3a;
  --saffron: #c99a04;
  --fall: linear-gradient(90deg, #76885b 0%, #ebb305 30%, #c4621a 62%, #9a3b12 82%, #6b2233 100%);
  --measure: 38rem;
  --mono: "IBM Plex Mono", ui-monospace, "Courier New", monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --c-ai: #4f5f3a; --c-ai-light: #76885b; --c-edu: #245f7d; --c-job: #1d6a66; --c-job-deep: #0f4a47; --c-gnd: #3f6b86; --c-int: #8a6200; --c-club: #6f3f86; --c-sport: #9a3b12; --c-adv: #8a2b5a; --c-adv-deep: #5e1a3f; --c-adv-light: #b85f90;
  --t1: #9a3b12; --t2: #8a6200; --t3: #4f5f3a; --t4: #1d6a66; --t5: #6b2233; --t6: #7a5230; --t7: #8a3d6b; --t8: #5c4f42;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b1510;
    --surface: #251d16;
    --ink: #f1e8d8;
    --muted: #bfb09a;
    --rule: #433727;
    --divider: #f1e8d8;
    --blue: #f0a05a;
    --blue-wash: #3a2616;
    --moss: #a9bd8a;
    --saffron: #f0c43c;
    --c-ai: #a9bd8a; --c-ai-light: #cddcb2; --c-edu: #8cc0dd; --c-job: #6fcfc7; --c-job-deep: #a6e8e2; --c-gnd: #9cc3d9; --c-int: #f0c43c; --c-club: #c9a6e3; --c-sport: #f08a5c; --c-adv: #e891bd; --c-adv-deep: #cf7ba6; --c-adv-light: #f6bfd9;
    --t1: #f08a5c; --t2: #f0c43c; --t3: #a9bd8a; --t4: #6fcfc7; --t5: #e59aa6; --t6: #d9a46b; --t7: #e891bd; --t8: #bfb09a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
}
a { color: var(--blue); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }

.site-head {
  border-bottom: 4px solid var(--divider);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 1rem;
  max-width: 56rem; margin: 0 auto; padding: 1.25rem 1.25rem 0.75rem;
}
.site-head .name { font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.site-head nav a { white-space: nowrap; }

main { max-width: 56rem; margin: 0 auto; padding: 0 1.25rem 5rem; }

.intro { padding: 3.5rem 0 1rem; }
.intro h1 { font-size: 2.4rem; max-width: 18ch; line-height: 1.1; font-weight: 600; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
.intro p { color: var(--muted); font-size: 1.15rem; margin: 0; }

/* Timeline grid: date | parallel track lanes | main spine | content */
.tl { --lane-w: 16px; --gutter: 7.5rem; --cg: 0.75rem; --spine: 1.5rem; --g0: calc(var(--gutter) + var(--cg)); margin-top: 2.5rem; }
.row { position: relative; display: grid; grid-template-columns: var(--gutter) calc(var(--lanes, 0) * var(--lane-w)) var(--spine) minmax(0, 1fr); column-gap: var(--cg); }
.branch {
  position: absolute; z-index: 1; height: 2px;
  top: calc(0.35rem + 3px + var(--k) * 6px);
  left: calc(var(--g0) + var(--l) * var(--lane-w) + var(--lane-w) / 2);
  width: calc((var(--lanes) - var(--l)) * var(--lane-w) - var(--lane-w) / 2 + var(--cg) + var(--spine) / 2);
}
.wire { position: absolute; top: 0; height: 2px; background: var(--c); }
.hop { position: absolute; top: -5px; width: 10px; height: 7px; box-sizing: border-box; border: 2px solid var(--c); border-bottom: 0; border-radius: 6px 6px 0 0; }
.node.small { width: 8px; height: 8px; left: calc(50% - 4px); top: calc(0.35rem + var(--k, 0) * 6px); border-width: 0; z-index: 2; }
.row > .body { padding-bottom: 1.75rem; max-width: var(--measure); }
.chapter-row > .body { padding: 2.5rem 0 1.5rem; }
.when {
  text-align: right; padding-top: 0.05rem;
  font-family: var(--mono); font-weight: 600;
  font-size: 1.05rem; line-height: 1.5; color: var(--muted); text-wrap: balance;
}
.when-inline { display: none; }
.when .w { display: block; white-space: nowrap; }
.when-inline .w { white-space: nowrap; display: inline-block; }

.lanes { display: flex; }
.lane { position: relative; width: var(--lane-w); }
.seg { position: absolute; left: calc(50% - 1.5px); width: 3px; background: var(--c); top: 0; bottom: 0; }
.seg.start { top: 0.6rem; }
.seg.start.edge { top: 0; }
.seg.ongoing { top: 0.65rem; }
.seg.ongoing::before { content: ""; position: absolute; top: -3px; left: -3.5px; border: 5px solid transparent; border-bottom: 6px solid var(--c); border-top: 0; }
.cap.edge { top: 0; }
.cap { position: absolute; left: calc(50% - 4px); top: calc(0.6rem - 1px); width: 8px; height: 2px; background: var(--c); }
.seg.end { bottom: auto; height: 0.75rem; }
.seg.only { top: 0.6rem; bottom: 1.9rem; }
.seg.only::after { content: ""; position: absolute; bottom: 0; left: -2.5px; width: 8px; height: 2px; background: var(--c); }
.seg.only.ph::after { background: var(--c); }
.seg.ph { background: repeating-linear-gradient(var(--c) 0 6px, transparent 6px 10px); }
.node { position: absolute; z-index: 2; left: calc(50% - 6px); top: 0.3rem; width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 2px solid var(--paper); }

.spine { position: relative; }
.spine::before { content: ""; position: absolute; left: calc(50% - 1px); top: 0; bottom: 0; width: 2px; background: var(--rule); }
.row:first-child .spine::before { top: 0.6rem; }
.row:last-child .spine::before { bottom: auto; height: 0.6rem; }
.layer-trunk .spine::before { width: 5px; left: calc(50% - 2.5px); background: color-mix(in srgb, var(--rule) 55%, var(--muted)); }
.dot { position: absolute; z-index: 2; left: calc(50% - 6px); top: 0.35rem; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--blue); }
.dot { border-color: var(--c, var(--blue)); }
.dot.start { background: var(--c); }
.has-story .dot { background: var(--c, var(--blue)); }
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin: 1.25rem 0 0; padding: 0; list-style: none; font-size: 0.95rem; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c); background: var(--c); }
.dot.today { width: 16px; height: 16px; left: calc(50% - 8px); top: 0.2rem; background: var(--blue); border: 3px solid var(--paper); box-shadow: 0 0 0 2px var(--blue); }
.today-row .body { padding-bottom: 1rem; }
.today-row h3 { color: var(--blue); }

.chapter-head h2 { font-size: 1.75rem; font-weight: 600; line-height: 1.2; margin: 0; }
.chapter-head .years { font-family: var(--mono); font-weight: 600; color: var(--blue); font-size: 1.15rem; margin: 0.1rem 0 0.6rem; }
.chapter-intro { margin: 0 0 0.5rem; }
.body h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.35; margin: 0 0 0.2rem; }
.body p { margin: 0 0 0.35rem; }
.swatch { display: inline-block; width: 0.8rem; height: 3px; background: var(--c); vertical-align: 0.3em; margin-right: 0.45rem; }
.swatch.ph { background: repeating-linear-gradient(90deg, var(--c) 0 4px, transparent 4px 6px); }
.sources { font-size: 0.92rem; color: var(--muted); }
.story-link { font-weight: 500; }
.tags { font-size: 0.92rem; color: var(--muted); }
.stream-nav { margin-top: 0.9rem !important; font-size: 1rem !important; }
.intro .back { font-size: 0.95rem; margin: 0 0 1rem; }
.empty { color: var(--muted); }

/* Story pages */
.story { max-width: var(--measure); padding-top: 2.5rem; }
.story .back { font-size: 0.95rem; margin: 0 0 2rem; }
.story h1 { font-size: 2.4rem; line-height: 1.1; font-weight: 600; margin: 0 0 0.5rem; }
.story .dek { font-size: 1.2rem; color: var(--muted); margin: 0 0 2.5rem; }
.story h2 { font-size: 1.3rem; font-weight: 600; margin: 2.5rem 0 0.5rem; }
.story p { margin: 0 0 1.1rem; }

@media (max-width: 40rem) {
  .tl { --lane-w: 12px; --cg: 0.5rem; --spine: 1.25rem; --g0: 0px; }
  .row { grid-template-columns: calc(var(--lanes, 0) * var(--lane-w)) var(--spine) minmax(0, 1fr); }
  .row > .when { display: none; }
  .when-inline { display: block; margin: 0 0 0.1rem !important; font-family: var(--mono); font-weight: 600; color: var(--muted); }
  .intro h1 { font-size: 2.1rem; }
}

/* Native scrollbar in the timeline's colors */
html { scrollbar-color: var(--blue) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 5px; border: 3px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }

/* Scroll rail: mini spine with a dot per section */
.rail { position: fixed; z-index: 5; right: 28px; top: 14vh; bottom: 14vh; width: 14px; }
.rail::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--rule); }
.rail-fill { position: absolute; left: 6px; top: 0; width: 2px; background: var(--blue); }
.rail-mark { position: absolute; left: 1px; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--paper); border: 2px solid var(--blue); }
.rail-mark.today, .rail-mark.current { background: var(--blue); }
.rail-mark:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.rail-mark span {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%); white-space: nowrap;
  font: 600 0.85rem/1 var(--mono); color: var(--muted);
  opacity: 0; transition: opacity 120ms; pointer-events: none;
}
.rail:hover .rail-mark span, .rail-mark:focus-visible span { opacity: 1; }
.rail-mark.current span { color: var(--blue); }
@media (max-width: 70rem) { .rail { display: none; } }
@media (prefers-reduced-motion: reduce) { .rail-mark span { transition: none; } }

/* Lines shown only for context on a stream page */
.row.context > .body { padding-bottom: 1.5rem; }
.row.context h3 { font-size: 0.95rem; font-weight: 500; color: var(--muted); }
.row.context .when { font-size: 0.95rem; }
.row.context { min-height: 3.7rem; }

/* Stream switcher: big, tappable pills */
.stream-tabs { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.stream-tabs a {
  display: inline-block; padding: 0.6rem 1.1rem; min-height: 44px; line-height: 1.4;
  border: 2px solid var(--rule); border-radius: 999px; background: transparent;
  font-weight: 600; font-size: 1rem; color: var(--ink); text-decoration: none;
}
.stream-tabs a:hover { border-color: var(--blue); color: var(--blue); }
.stream-tabs a[aria-current="page"] { background: var(--blue); border-color: var(--blue); color: var(--paper); }

/* Rail labels only on hover or keyboard focus, on a paper chip, so they never sit over the text */
.rail-mark span { opacity: 0; transition: opacity .15s; background: var(--paper); padding: 0 .35rem; border-radius: 4px; pointer-events: none; }
.rail-mark:hover span, .rail-mark:focus-visible span { opacity: 1; }

/* Second row of filters inside a stream (e.g. AI Safety by type) */
.stream-tabs.sub { margin-top: 0.75rem; }
.stream-tabs.sub a { font-size: 0.95rem; font-weight: 500; }
.stream-tabs[hidden] { display: none; }

/* Coming up: future items sit above Today on a dashed spine */
.row.horizon .spine::before, .row.horizon-head .spine::before { background: repeating-linear-gradient(var(--rule) 0 6px, transparent 6px 11px); }
.row.horizon-head:first-child .spine::before { top: 2.2rem; }
.row.horizon-head .body { padding: 0 0 1rem; }
.row.horizon-head h2 { margin: 0; font-size: 1.35rem; }
.dot.upcoming { background: var(--paper); border: 2px solid var(--c); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--rule); }
.row.horizon h3 { color: var(--ink); }

/* Focused landing pages */
.intro p.full-link { margin-top: 1rem; font-size: 1rem; }

/* Research home page */
.intro .mission { color: var(--ink); font-size: 1.3rem; font-weight: 500; margin: 0 0 0.75rem; }
.intro .jump { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin-top: 1.25rem; font-weight: 500; }
.home-sec { padding-top: 2.75rem; }
.home-sec h2 { border-top: 3px solid var(--divider); padding-top: 0.6rem; font-family: var(--mono); font-weight: 600; font-size: 1.15rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin: 0 0 1rem; }
.home-sec h3 { font-size: 1.05rem; margin: 0.5rem 0 0.4rem; }
.home-sec ul { padding-left: 1.2rem; margin: 0.25rem 0; }
.home-sec li { margin: 0.3rem 0; }
.two-col { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.toc-chain { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.toc-chain li { position: relative; padding: 0.55rem 0 0.55rem 1.4rem; border-left: 2px solid var(--blue-wash); }
.toc-chain li::before { content: ""; position: absolute; left: -6px; top: 0.95rem; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.toc-chain li span { display: block; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--blue); }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.card { border: 1px solid var(--rule); border-radius: 6px; padding: 1rem 1.1rem; background: color-mix(in srgb, var(--paper) 92%, var(--blue-wash)); }
.card h3 { margin: 0.2rem 0 0.5rem; font-size: 1.05rem; line-height: 1.3; }
.card p { margin: 0.4rem 0; font-size: 0.97rem; }
.card-meta { font-size: 0.85rem !important; color: var(--muted); margin: 0 !important; }
.card-meta .status { text-transform: capitalize; }
.card-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-weight: 500; }
.muted { color: var(--muted); }
.writing { list-style: none; padding: 0 !important; }
.writing li { padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }

/* Now banner, scope line, post summaries (Neel-style home) */
.now { margin: 0 0 2rem; padding: 0.75rem 1rem; border-left: 3px solid var(--blue); background: var(--blue-wash); }
.now strong { margin-right: 0.4rem; }
.intro p.scope-line { color: var(--ink); font-size: 1.05rem; margin-top: 0.6rem; }
.post-sum { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
.ai-note { max-width: var(--measure); margin: 1.5rem 0 0; padding: .5rem .8rem; font-size: .9rem; color: var(--muted); border: 1px dashed var(--rule); border-radius: 4px; }
.intro.has-photo { display: grid; grid-template-columns: 140px 1fr; column-gap: 1.5rem; }
.intro.has-photo > :not(.headshot) { grid-column: 2; }
.headshot { grid-row: 1 / span 6; border-radius: 50%; object-fit: cover; width: 140px; height: 140px; }
@media (max-width: 600px) { .intro.has-photo { display: block; } .headshot { width: 96px; height: 96px; margin-bottom: 1rem; } }
.bio { color: var(--ink) !important; font-size: 1rem !important; margin-top: .8rem !important; }
.audiences dt { font-weight: 600; margin-top: .8rem; } .audiences dd { margin: .2rem 0 0; color: var(--muted); }
.short-bio { color: var(--muted); }

/* Labelled icon buttons */
.social { list-style: none; padding: 0 !important; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.social-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .85rem; border: 1px solid var(--rule); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 500; background: var(--paper); }
a.social-btn:hover { border-color: var(--blue); color: var(--blue); }
.social-btn svg { flex: none; }
.social-btn.subscribe { background: var(--blue); border-color: var(--blue); color: var(--paper); margin-top: .75rem; }
.social-btn.subscribe:hover { color: var(--paper); opacity: .9; }
.writing li.has-img { display: grid; grid-template-columns: 96px 1fr; column-gap: 1rem; align-items: start; }
.writing li.has-img > :not(:first-child) { grid-column: 2; }
.post-img { grid-row: 1 / span 3; width: 96px; height: 64px; object-fit: cover; border-radius: 4px; }
.paper-title { font-weight: 600; }
.connect-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem 2rem; }
.connect-groups h3 { margin: 0 0 .2rem; font-size: .95rem; }
.intro p.pitch { color: var(--ink); margin-top: .8rem; }
.pitch3 { margin: 1rem 0 0; }
.pitch3 dt { font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: .7rem; }
.pitch3 dd { margin: .15rem 0 0; color: var(--ink); font-size: 1.05rem; }
.repo-link { display: inline-flex; align-items: center; gap: .35rem; }
.card h3, .card-links a { overflow-wrap: anywhere; }

/* Accessibility additions */
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 20; font-family: var(--mono); }
.skip:focus { left: 0.5rem; top: 0.5rem; }
.site-head nav a[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, .rail-mark:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; border-radius: 2px; }
.cat { font: 500 0.8rem var(--mono); color: var(--muted); margin: 0 0 0.1rem !important; display: flex; align-items: center; gap: 0.4rem; }
.cat i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--c); flex: none; }
time { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* Featured vs. more projects, code list */
.card.feature { border-top: 4px solid var(--moss); background: var(--surface); }
.more-projects { list-style: none; padding: 0 !important; display: grid; gap: 0.6rem; }
.more-projects li { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; align-items: baseline; padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.more-projects .t { font-weight: 600; }
.repo-list { list-style: none; padding: 0 !important; display: grid; gap: 0 2rem; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.repo-list li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.repo-list a { font-family: var(--mono); font-weight: 600; overflow-wrap: anywhere; }
.repo-list .meta { display: block; color: var(--muted); font-size: 0.9rem; }
.pin { font: 600 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; border: 1px solid var(--moss); color: var(--moss); border-radius: 999px; padding: 0 0.45rem; margin-left: 0.4rem; }

/* The mission line is the page's h1; the name is already in the site header */
.intro h1.mission { max-width: none; font-size: clamp(1.7rem, 3.2vw, 2.3rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 0.75rem; }
