@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --paper: #ece8e1;
  --paper-2: #f4f1ea;
  --ink: #232323;
  --graphite: #5f5f5f;
  --graphite-soft: rgba(95, 95, 95, 0.45);
  --hair: rgba(35, 35, 35, 0.14);
  --cyan: #5ebfc6;
  --amber: #c79b47;
  --glass: rgba(255, 255, 255, 0.65);
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --headH: 84px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scrollbar-gutter: stable both-edges; overflow-y: scroll; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}
body.pre { overflow: hidden; height: 100%; }

/* ---------- drafting surface ---------- */
#sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--grid-max);
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(35, 35, 35, 0.045) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, rgba(35, 35, 35, 0.045) 1px, transparent 1px) 0 0 / 24px 100%,
    radial-gradient(1200px 800px at 50% 20%, var(--paper-2), var(--paper) 70%);
}
#sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.22'/></svg>");
  mix-blend-mode: multiply;
}

/* ---------- hero → persistent header ---------- */
#hero {
  position: fixed;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 40;
  transform: translateY(-50%);
  text-align: center;
  padding: 0 5vw;
  pointer-events: none;
  transition: top 1s cubic-bezier(.3,.8,.25,1), transform 1s cubic-bezier(.3,.8,.25,1),
              padding .9s ease, background .6s ease, box-shadow .6s ease;
}
#hero.docked {
  top: 0;
  transform: translateY(0);
  padding: 14px 5vw 12px;
  background: linear-gradient(rgba(236,232,225,.94), rgba(236,232,225,.74));
  backdrop-filter: blur(6px);
  box-shadow: 0 1px 0 var(--hair);
}

.eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-bottom: 1.1rem;
  transition: opacity .5s ease, margin .8s ease, font-size .8s ease;
}
#hero.docked .eyebrow { margin-bottom: .35rem; font-size: .5rem; opacity: .75; }

#hero h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(2.1rem, 6.4vw, 4.4rem);
  letter-spacing: -0.035em;
  margin: 0;
  line-height: 1;
  color: var(--ink);
  transition: font-size 1s cubic-bezier(.3,.8,.25,1), letter-spacing 1s ease;
}
#hero.docked h1 { font-size: clamp(1.15rem, 2.4vw, 1.65rem); letter-spacing: -0.02em; }

.cursor {
  display: inline-block;
  color: var(--cyan);
  margin-left: .06em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:0} }

.rule {
  width: 0;
  height: 1px;
  margin: 1.2rem auto 0;
  background: var(--graphite-soft);
  transition: width 1s cubic-bezier(.3,.8,.25,1) .35s, margin .8s ease;
}
#hero.docked .rule { width: min(920px, 90vw); margin-top: .7rem; }

.intro {
  max-width: 46rem;
  margin: 1.4rem auto 0;
  font-family: var(--sans);
  font-size: clamp(.9rem, 1.5vw, 1.02rem);
  line-height: 1.75;
  color: #333;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .8s ease .6s, transform .8s ease .6s, max-height .6s ease, margin .6s ease;
}
.intro.show { opacity: 1; transform: none; }
#hero.docked .intro { opacity: 0; transform: translateY(-8px); transition: opacity .35s ease, transform .35s ease; pointer-events: none; height: 0; margin: 0; overflow: hidden; }

.hint {
  margin-top: 1.6rem;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--graphite);
  opacity: .7;
  animation: breathe 2.6s ease-in-out infinite;
  transition: opacity .4s ease;
}
#hero.docked .hint { opacity: 0; animation: none; height: 0; margin: 0; overflow: hidden; }
@keyframes breathe { 0%,100%{opacity:.35} 50%{opacity:.85} }

/* ---------- shell ---------- */
#shell {
  position: relative;
  z-index: 10;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(var(--headH) + 15.5px) 5vw 6rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
}
#shell.on { opacity: 1; }
#shell.live { pointer-events: auto; }

/* ---------- map (live rules: "NAVIGATION MAP — progressive construction" block at end of file) ---------- */
#map { position: relative; }
/* ---------- content canvas ---------- */
#content { margin-top: 3.2rem; }

.empty {
  border: 1px dashed rgba(35,35,35,.28);
  border-radius: 4px;
  margin: 0 var(--card-inset);
  padding: 5.5rem 1.5rem;
  text-align: center;
  background: repeating-linear-gradient(45deg, rgba(35,35,35,.025) 0 8px, transparent 8px 16px);
}
.empty h2 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -.03em;
  margin: 0 0 .5rem;
}
.empty p { margin: 0; font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; color: var(--graphite); }

.sect-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--hair);
}
.sect-head .crumb { font-size: .55rem; letter-spacing: .24em; text-transform: uppercase; color: var(--graphite); }
.sect-head h2 { font-family: var(--sans); font-weight: 700; font-size: clamp(1.5rem,3.4vw,2.15rem); letter-spacing: -.03em; margin: .35rem 0 0; }
.sect-head .lede { margin: .55rem 0 0; font-family: var(--sans); font-size: .95rem; line-height: 1.7; color: #333; max-width: 44rem; white-space: pre-wrap; }
.sect-head .close {
  background: none; border: 1px solid rgba(35,35,35,.25); border-radius: 2px;
  padding: .25rem .5rem; font: inherit; font-size: .55rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--graphite); cursor: pointer;
}
.sect-head .close:hover { color: var(--amber); border-color: var(--amber); }

/* group sub-navigation (architecture) */
.groups { margin-top: 1.6rem; }
.groups .spine { height: 18px; width: 1px; margin-left: 12px; background: var(--graphite-soft); }
.grouprow { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .06em;
  padding: .5rem .7rem;
  border: 1px solid rgba(35,35,35,.3);
  border-radius: 3px;
  background: rgba(255,255,255,.6);
  color: var(--ink);
  cursor: pointer;
  transition: all .2s ease;
}
.chip small { display: block; font-size: .5rem; letter-spacing: .2em; text-transform: uppercase; color: var(--graphite); margin-top: .2rem; }
.chip:hover { border-color: var(--cyan); background: rgba(255,255,255,.9); }
.chip.on { border-color: var(--amber); background: #fff; box-shadow: 0 0 0 3px rgba(199,155,71,.15); }

/* language switcher (hero, top-right) — hidden on splash, revealed on dock */
.langrow {
  position: absolute;
  top: 10px;
  right: 5vw;
  display: flex;
  gap: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease .12s;
}
#hero.docked .langrow { opacity: 1; pointer-events: auto; }
.langchip {
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .14em;
  padding: .22rem .48rem;
  border: 1px solid rgba(35,35,35,.3);
  border-radius: 3px;
  background: rgba(255,255,255,.6);
  color: var(--graphite);
  cursor: pointer;
  transition: all .2s ease;
}
.langchip:hover { border-color: var(--cyan); color: var(--ink); background: rgba(255,255,255,.9); }
.langchip.on { border-color: var(--amber); color: var(--ink); background: #fff; box-shadow: 0 0 0 3px rgba(199,155,71,.15); }
.langchip.on:hover { border-color: var(--amber); }
.langchip.flash { animation: langflash .6s ease; }
@keyframes langflash {
  0%,100% { border-color: rgba(35,35,35,.3); }
  25%,60% { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(199,155,71,.2); }
}

/* ---------- deck ---------- */
.deckbar {
  margin: 1.8rem 0 1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .55rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--graphite);
}
.deckbar button {
  background: none; border: 1px solid rgba(35,35,35,.25); border-radius: 2px;
  padding: .25rem .5rem; font: inherit; color: var(--graphite); cursor: pointer;
}
.deckbar button:hover { color: var(--amber); border-color: var(--amber); }
.deckbar .count { flex: 1; text-align: center; color: var(--ink); letter-spacing: .22em; }
.deckbar.solo button { opacity: .3; pointer-events: none; }

.deck { position: relative; }

.card {
  position: absolute;
  inset: 0 0 auto 0;
  padding: 1.5rem 1.6rem 1.8rem;
  border: 1px solid rgba(35, 35, 35, 0.28);
  border-radius: 4px;
  background: var(--glass);
  backdrop-filter: blur(9px) saturate(115%);
  box-shadow: 0 18px 44px rgba(35, 35, 35, 0.14), 0 1px 0 rgba(255,255,255,.8) inset;
  transform-origin: 50% 0;
  transition: transform .5s cubic-bezier(.25,.8,.3,1), opacity .4s ease, filter .4s ease;
}
.card.behind {
  cursor: pointer;
  opacity: calc(1 - var(--o) * .22);
  filter: blur(calc(var(--o) * 1.1px));
  transform: translateY(calc(var(--o) * 16px)) scale(calc(1 - var(--o) * .028));
}
.card.behind:hover { filter: none; opacity: .85; }
.card.front { opacity: 1; filter: none; transform: none; z-index: 30; }
.card.enter { transform: scale(.94) translateY(-10px); opacity: 0; }

.card .head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  font-size: .55rem; letter-spacing: .22em; text-transform: uppercase; color: var(--graphite);
}
.card h3 { font-family: var(--sans); font-weight: 700; font-size: 1.55rem; letter-spacing: -.028em; margin: .8rem 0 .25rem; }
.card .sub { font-size: .62rem; letter-spacing: .18em; text-transform: uppercase; color: var(--graphite); }

.specs {
  margin-top: 1rem;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.specs div { padding: .55rem .1rem; font-size: .55rem; letter-spacing: .14em; text-transform: uppercase; color: var(--graphite); }
.specs div b { display: block; color: var(--ink); font-weight: 500; letter-spacing: .08em; margin-top: .2rem; }
.specs div b.ok { color: #4c8f78; }
.specs div b.rev { color: var(--amber); }

.payload {
  margin-top: 1.15rem;
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.75;
  color: #2c2c2c;
  white-space: pre-wrap;
  max-width: 46rem;
}
.kw {
  color: #1f6f76;
  border-bottom: 1px solid rgba(94, 191, 198, .6);
  cursor: pointer;
  padding: 0 1px;
  transition: background .2s ease;
}
.kw:hover { background: rgba(94, 191, 198, .18); }
.emph {
  color: #1f6f76;
  font-weight: 600;
}

.figure {
  margin-top: 1.3rem;
  aspect-ratio: 16 / 6;
  border: 1px dashed rgba(35, 35, 35, .3);
  border-radius: 3px;
  display: grid;
  place-content: center;
  gap: .35rem;
  text-align: center;
  background: repeating-linear-gradient(45deg, rgba(35,35,35,.03) 0 8px, transparent 8px 16px);
  color: var(--graphite);
  font-size: .55rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.figure.has-img {
  position: relative;
  display: block;
  aspect-ratio: auto;
  border: 1px dashed rgba(35, 35, 35, .3);
  background: none;
}
.figure.has-img img { display: block; width: 100%; height: auto; }
.fig-credit {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: .5rem .9rem;
  background: rgba(255, 255, 255, .94);
  border-top: 1px solid rgba(35, 35, 35, .15);
  color: var(--graphite);
  font-size: .55rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .25s ease;
}
.figure.has-img:hover .fig-credit,
.figure.has-img:focus-within .fig-credit { opacity: 1; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 2rem 0 0; padding: 0 0 0 26px; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px;
  background: linear-gradient(var(--graphite-soft) 60%, rgba(95,95,95,.18));
}
.ms { position: relative; margin-bottom: 1.1rem; }
.ms .dot {
  position: absolute; left: -26px; top: 16px; width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid var(--graphite); background: var(--paper);
}
.ms.done .dot { background: #4c8f78; border-color: #4c8f78; }
.ms.current .dot { background: var(--cyan); border-color: #2f8b93; box-shadow: 0 0 0 5px rgba(94,191,198,.22); }
.ms.planned .dot { background: var(--paper); border-style: dashed; }

.ms-card {
  padding: 1rem 1.15rem 1.1rem;
  border: 1px solid rgba(35,35,35,.24);
  border-radius: 4px;
  background: var(--glass);
  backdrop-filter: blur(8px) saturate(112%);
  box-shadow: 0 10px 26px rgba(35,35,35,.09), 0 1px 0 rgba(255,255,255,.8) inset;
  opacity: 0;
  transform: translateY(8px);
  animation: msIn .5s ease forwards;
}
@keyframes msIn { to { opacity: 1; transform: none; } }
.ms.planned .ms-card { border-style: dashed; background: rgba(255,255,255,.42); }
.ms.current .ms-card { border-color: rgba(94,191,198,.75); box-shadow: 0 0 0 3px rgba(94,191,198,.14), 0 10px 26px rgba(35,35,35,.1); }
.ms-meta { display: flex; gap: .7rem; align-items: baseline; font-size: .55rem; letter-spacing: .22em; text-transform: uppercase; color: var(--graphite); }
.ms-meta .state { color: var(--ink); }
.ms.done .ms-meta .state { color: #4c8f78; }
.ms.current .ms-meta .state { color: #2f8b93; }
.ms.planned .ms-meta .state { color: var(--amber); }
.ms h3 { font-family: var(--sans); font-weight: 600; font-size: 1.08rem; letter-spacing: -.02em; margin: .5rem 0 .3rem; }
.ms p { margin: 0; font-family: var(--sans); font-size: .9rem; line-height: 1.65; color: #333; max-width: 44rem; }

/* ---------- floating reference chip ---------- */
#ref {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  padding: .45rem .6rem;
  border-radius: 3px;
  border: 1px solid rgba(35,35,35,.28);
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 20px rgba(35,35,35,.14);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
  max-width: 250px;
}
#ref.show { opacity: 1; transform: translateY(0); }
#ref .r-t { font-family: var(--sans); font-weight: 600; font-size: .78rem; }
#ref .r-m { margin-top: .2rem; font-size: .52rem; letter-spacing: .18em; text-transform: uppercase; color: var(--graphite); }

/* ---------- tablet ---------- */
@media (max-width: 900px) {
  :root { --headH: 76px; }
  .map-row { gap: 10px; }
  .mnode { padding: 8px 10px; }
  .specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 1.2rem 1.2rem 1.4rem; }
}

/* ---------- phone: vertical map + vertical card list ---------- */
@media (max-width: 680px) {
  #shell { padding-top: calc(var(--headH) + 18px); }
  /* phone: horizontal flowchart — label -> trunk -> bar -> 4 buttons in a row */
  .map-label { font-size: .5rem; letter-spacing: .22em; }
  .map-diagram { display: grid; grid-template-rows: 18px 16px auto; overflow: hidden; max-height: 0; }
  .map.open .map-diagram { max-height: 150px; }
  .map-trunk { width: 1px; height: 18px; margin: 0 auto; background: var(--graphite-soft); }
  .map-bar { width: calc(75% + 6px); height: 1px; align-self: start; margin: 0 auto; background: var(--graphite-soft); }
  .map-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: start; margin-top: -16px; }
  .map-branch { display: flex; flex-direction: column; align-items: center; min-width: 0; }
  .map-drop { width: 1px; height: 16px; background: var(--graphite-soft); }
  .map.settled .map-drop { transform: scaleY(1); }
  .mnode { max-width: none; padding: .45rem .3rem; min-height: 44px; min-width: 0; overflow: hidden; }
  .mnode .n-title { font-size: clamp(6px, 1.9vw, 11px); line-height: 1.3; letter-spacing: .08em; overflow-wrap: break-word; }
  .mnode .n-kicker { font-size: clamp(5px, 1.4vw, 9px); white-space: normal; overflow: visible; text-overflow: clip; max-height: none; }

  #content { margin-top: 2.2rem; }
  .deck { display: flex; flex-direction: column; gap: 12px; height: auto !important; }
  .card {
    position: relative;
    inset: auto;
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    padding: 1.1rem 1.1rem 1.2rem;
  }
  .card.behind { cursor: pointer; background: rgba(255,255,255,.5); box-shadow: 0 6px 16px rgba(35,35,35,.07); }
  .card.behind .payload, .card.behind .figure, .card.behind .specs { display: none; }
  .card.behind h3 { font-size: 1.1rem; margin: .5rem 0 .2rem; }
  .deckbar { margin-top: 1.4rem; }
  .figure { aspect-ratio: 16 / 9; }
}

/* ---------- root marker (title is the root, no extra card) ---------- */
.map-root { display: flex; justify-content: center; }
.rootmark {
  display: inline-flex; align-items: baseline; gap: .6rem;
  padding: .2rem .1rem;
  border-bottom: 1px solid rgba(35,35,35,.35);
}
.rootmark .rm-title {
  font-family: var(--sans); font-weight: 700; font-size: 12px;
  letter-spacing: .18em; text-transform: uppercase;
}
.rootmark .rm-kicker { font-size: 8px; letter-spacing: .2em; text-transform: uppercase; color: var(--graphite); }

/* ---------- section head extras ---------- */
.sect-head .sh-left { min-width: 0; }
.sh-tagline {
  margin-top: .45rem; font-size: .58rem; letter-spacing: .24em;
  text-transform: uppercase; color: var(--amber);
}
.lede.narrative { margin-top: .5rem; color: #3a3a3a; }
.sectbody { position: relative; }

/* ---------- nested concepts inside a card ---------- */
.subrecords { margin-top: 1.4rem; border-top: 1px solid var(--hair); padding-top: .4rem; }
.subrec { margin-top: 1.1rem; padding-left: .9rem; border-left: 1px solid rgba(35,35,35,.22); }
.subrec.d2 { border-left-style: dashed; margin-top: .8rem; }
.sr-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.sr-head h4 { font-family: var(--sans); font-weight: 600; font-size: 1rem; letter-spacing: -.015em; margin: 0; }
.subrec.d2 .sr-head h4 { font-size: .88rem; }
.sr-meta { font-size: .5rem; letter-spacing: .2em; text-transform: uppercase; color: var(--graphite); }
.sr-body {
  margin-top: .35rem; font-family: var(--sans); font-size: .9rem; line-height: 1.7;
  color: #333; white-space: pre-wrap; max-width: 44rem;
}
.sr-nest { margin-top: .6rem; }

/* ---------- roadmap: pinned rail + shared detail ---------- */
.htimeline {
  margin-top: 2rem;
  margin-left: var(--card-inset); margin-right: var(--card-inset);
  display: flex; flex-direction: column; align-items: center; gap: 1.4rem;
}
.tl-rail { width: 100%; max-width: 880px; display: flex; flex-direction: column; gap: 10px; }
/* top scrollbar: custom bar, shown only when the rail overflows */
.tl-scrollbar { position: relative; height: 6px; border-radius: 3px; flex: 0 0 auto; background: transparent; cursor: default; }
.tl-scrollbar[hidden] { display: none; }
.tl-scrollbar .tl-thumb { position: absolute; top: 0; height: 100%; border-radius: 3px; background: rgba(95,95,95,.28); cursor: pointer; transition: background .15s ease; }
.tl-scrollbar .tl-thumb:hover { background: rgba(95,95,95,.42); }
.tl-scroller { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; padding: 0 0 14px; }
.tl-scroller::-webkit-scrollbar { display: none; }
.tl-line {
  position: absolute; left: 0; right: 0; top: 34px; height: 1px;
  background: linear-gradient(90deg, var(--graphite-soft) 60%, rgba(95,95,95,.2));
}
.tl-track {
  position: relative; display: flex; gap: 18px; justify-content: safe center;
}
.tl-item {
  position: relative; flex: 0 0 auto; width: 104px;
  text-align: center; cursor: pointer; outline: none;
  opacity: 0; transform: translateY(8px); animation: msIn .5s ease forwards;
}
.tl-item:hover, .tl-item:focus-visible, .tl-item.active { z-index: 3; }
.tl-date {
  font-size: .55rem; letter-spacing: .22em; text-transform: uppercase; color: var(--graphite);
  height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-dot {
  width: 11px; height: 11px; border-radius: 50%; margin: 7px auto 0;
  border: 1px solid var(--graphite); background: var(--paper);
  transition: transform .18s ease, box-shadow .18s ease;
}
.tl-item:hover .tl-dot, .tl-item:focus-visible .tl-dot, .tl-item.active .tl-dot { transform: scale(1.4); }
.tl-item.done .tl-dot { background: #4c8f78; border-color: #4c8f78; }
.tl-item.current .tl-dot { background: var(--cyan); border-color: #2f8b93; box-shadow: 0 0 0 5px rgba(94,191,198,.22); }
.tl-item.planned .tl-dot { border-style: dashed; }
.tl-item.active.done .tl-dot { box-shadow: 0 0 0 5px rgba(76,143,120,.2); }
.tl-item.active.planned .tl-dot { box-shadow: 0 0 0 5px rgba(199,155,71,.2); }
.tl-detail {
  width: 100%; max-width: 640px;
  padding: .95rem 1.1rem 1.05rem;
  border: 1px solid rgba(35,35,35,.24); border-radius: 4px;
  background: var(--glass); backdrop-filter: blur(8px) saturate(112%);
  box-shadow: 0 10px 26px rgba(35,35,35,.09), 0 1px 0 rgba(255,255,255,.8) inset;
  min-height: 96px;
}
.tl-detail .tl-state { font-size: .5rem; letter-spacing: .22em; text-transform: uppercase; color: var(--graphite); }
.tl-detail h3 { font-family: var(--sans); font-weight: 600; font-size: 1rem; letter-spacing: -.02em; margin: .4rem 0 .3rem; }
.tl-detail p { margin: 0; font-family: var(--sans); font-size: .85rem; line-height: 1.6; color: #333; }
.tl-detail.done { border-color: rgba(76,143,120,.55); }
.tl-detail.done .tl-state { color: #4c8f78; }
.tl-detail.current { border-color: rgba(94,191,198,.75); box-shadow: 0 0 0 3px rgba(94,191,198,.14), 0 10px 26px rgba(35,35,35,.1); }
.tl-detail.current .tl-state { color: #2f8b93; }
.tl-detail.planned { border-style: dashed; border-color: rgba(199,155,71,.6); background: rgba(255,255,255,.42); }
.tl-detail.planned .tl-state { color: var(--amber); }
.tl-changelog-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin-top: .7rem;
  padding: .35rem .6rem;
  border: 1px solid rgba(35,35,35,.2);
  border-radius: 3px;
  background: transparent;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: .55rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--graphite);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.tl-changelog-btn:hover {
  color: #333;
  border-color: rgba(35,35,35,.35);
  background: rgba(35,35,35,.03);
}
.tl-chg-chevron {
  font-size: .7rem;
  transition: transform .35s ease;
}
.tl-detail.changelog-open .tl-chg-chevron {
  transform: rotate(180deg);
}
.tl-changelog-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .35s ease;
}
.tl-detail.changelog-open .tl-changelog-panel {
  grid-template-rows: 1fr;
}
.tl-changelog-inner {
  overflow: hidden;
  min-height: 0;
}
.tl-chg-row {
  display: flex;
  gap: .5rem;
  padding: .3rem 0;
  border-top: 1px solid rgba(35,35,35,.08);
  font-size: .78rem;
  line-height: 1.5;
  color: #444;
}
.tl-chg-row:first-child {
  border-top: none;
  padding-top: .2rem;
}
.tl-chg-marker {
  flex: 0 0 auto;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: .7rem;
  width: 1.2rem;
  text-align: center;
  color: var(--graphite);
}
.tl-chg-text {
  flex: 1;
}

@media (max-width: 680px) {
  .deckbar { flex-wrap: wrap; }
  .deckbar .count { order: -1; flex: 1 0 100%; text-align: left; margin-bottom: .4rem; }
  .tl-scroller { overflow: visible; padding: 0; }
  .tl-line { left: 5px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .tl-track { display: block; overflow-x: visible; padding-left: 26px; }
  .tl-item { width: auto; margin-bottom: 1rem; text-align: left; cursor: default; }
  .tl-date { height: auto; white-space: normal; overflow: visible; }
  .tl-dot { position: absolute; left: -26px; top: 18px; margin: 0; }
  .tl-item:hover .tl-dot, .tl-item:focus-visible .tl-dot, .tl-item.active .tl-dot { transform: none; }
  .tl-detail { min-height: 0; }
  .subrec { padding-left: .7rem; }
}

/* =========================================================
   LAYOUT PASS — global frame, section width, card width
   ========================================================= */
:root {
  --frame-pad: clamp(18px, 3.2vw, 64px);
  --frame-max: 1720px;
  --grid-max: min(92vw, 2200px);
  --card-inset: clamp(18px, 5vw, 96px);
}

/* Level 1 — global page frame */
#shell {
  max-width: var(--frame-max);
  padding-left: var(--frame-pad);
  padding-right: var(--frame-pad);
}
#hero { padding-left: var(--frame-pad); padding-right: var(--frame-pad); }
#hero.docked { padding: 14px var(--frame-pad) 12px; }
#hero .intro { max-width: min(72ch, 100%); }
#hero.docked .rule { width: min(var(--frame-max), 100%); }

/* Level 2 — section content spans the frame */
.sect-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: baseline;
  column-gap: 1.25rem;
  margin-left: var(--card-inset);
  margin-right: var(--card-inset);
}
.sect-head .crumb { grid-column: 1; grid-row: 1; }
.sect-head .sh-left {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}
.sect-head .sh-titlerow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.sect-head .sh-titlerow h2 { min-width: 0; }
.sect-head .close {
  flex: 0 0 auto;
  margin-top: -2px;
  justify-self: end;
}
.sect-head .lede,
.sect-head .lede.narrative {
  max-width: none;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  padding-right: clamp(0px, 1.5vw, 28px);
}
.ms p { max-width: none; }

/* Level 3 — cards: wide but deliberately inset */
.groups, .deck, .deckbar {
  margin-left: var(--card-inset);
  margin-right: var(--card-inset);
}
.card { padding: 1.6rem clamp(1.4rem, 2.6vw, 2.6rem) 2rem; }
.payload { max-width: none; text-align: justify; text-justify: inter-word; }
.sr-body { max-width: none; }

/* ---------- card typography hierarchy ---------- */
.card .head { display: block; }
.card .head .trail {
  display: block;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--graphite);
}
.card h3 {
  font-size: clamp(1.75rem, 2.6vw, 2.35rem);
  margin: .55rem 0 .3rem;
}
.card .sub {
  font-size: .56rem;
  letter-spacing: .2em;
  color: var(--graphite);
}
.card > .payload { margin-top: 1rem; padding-top: .95rem; border-top: 1px solid var(--hair); }

/* ---------- map / navigation ---------- */
.map-label { text-align: center; font-size: .56rem; }
.map-root { display: none; }
.map-trunk { height: 30px; }
.map-bar { width: calc(100% - (100% - 3 * 14px) / 4); }
.map-row { margin-top: -1px; }
.map-drop { height: 26px; }
.mnode { max-width: 260px; }
.mnode.root { display: none; }

/* ---------- knowledge / blueprint blocks ---------- */
.kbox {
  position: relative;
  margin-top: 1.3rem;
  padding: 1.1rem 1.2rem 1.15rem 2.5rem;
  border: 1px solid rgba(35, 35, 35, .26);
  border-radius: 4px;
}
.kbox .kbox-label {
  position: absolute;
  left: .62rem;
  top: 1.1rem;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transform-origin: center;
  font-family: var(--mono);
  font-size: .52rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--graphite);
  white-space: nowrap;
}
.kbox .subrec { border-left-color: rgba(35, 35, 35, .18); }
.kbox .subrec:first-child { margin-top: 0; }
.kbox.kblock {
  background:
    repeating-linear-gradient(45deg, rgba(199, 155, 71, .08) 0 8px, transparent 8px 16px),
    rgba(199, 155, 71, .05);
  border-color: rgba(199, 155, 71, .35);
}
.kbox.kblock .kbox-label { color: #9a7429; }
.kbox.bpblock {
  background:
    repeating-linear-gradient(45deg, rgba(94, 191, 198, .07) 0 8px, transparent 8px 16px),
    rgba(94, 191, 198, .05);
  border-color: rgba(47, 139, 147, .32);
}
.kbox.bpblock .kbox-label { color: #2f8b93; }

/* ---------- custom page scrollbar / slider ---------- */
html { scrollbar-width: none; }
html::-webkit-scrollbar { width: 0; height: 0; }

.page-scroll {
  position: fixed;
  top: 84px;
  right: clamp(8px, 1vw, 14px);
  bottom: 18px;
  width: 10px;
  z-index: 90;
  display: flex;
  justify-content: center;
  opacity: 0;
  pointer-events: auto;
  transition: opacity .22s ease;
}
.page-scroll.show,
.page-scroll:hover,
.page-scroll.dragging { opacity: 1; }
.page-scroll-track {
  position: relative;
  width: 100%;
  height: 100%;
  cursor: pointer;
  background: transparent;
}
.page-scroll-thumb {
  position: absolute;
  left: 50%;
  top: 0;
  width: 6px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: rgba(95,95,95,.28);
  box-shadow: none;
  cursor: grab;
  transform: translateX(-50%);
  transition: background .18s ease, width .18s ease;
}
.page-scroll-thumb:hover,
.page-scroll.dragging .page-scroll-thumb {
  width: 6px;
  background: rgba(95,95,95,.42);
}
.page-scroll-thumb:active { cursor: grabbing; }

@media (max-width: 680px) {
  .page-scroll { display: none; }
}

/* ---------- back to top ---------- */
.totop {
  position: fixed;
  right: clamp(12px, 2vw, 26px);
  bottom: clamp(12px, 2vw, 26px);
  z-index: 80;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(35, 35, 35, .3);
  border-radius: 3px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .85rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, border-color .2s ease, color .2s ease;
}
.totop.show { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { border-color: var(--cyan); color: #1f6f76; }

/* ---------- roadmap rail width ---------- */
.tl-rail { max-width: 880px; }

@media (max-width: 900px) {
  .card { padding: 1.3rem 1.35rem 1.6rem; }
  .kbox { padding-left: 2.2rem; }
}

@media (max-width: 680px) {
  :root { --card-inset: 0px; }
  .sect-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .sect-head .sh-titlerow {
    align-items: center;
  }
  .sect-head .close {
    justify-self: end;
  }
  .card { padding: 1.15rem 1.1rem 1.3rem; }
  .card h3 { font-size: 1.35rem; }
  .sect-head .lede, .sect-head .lede.narrative { text-align: left; padding-right: 0; }
  .sect-head { grid-template-columns: minmax(0, 1fr) auto; }
  .payload { text-align: left; }
  .kbox { padding: 1rem .9rem 1rem 1.9rem; }
  .kbox .kbox-label { font-size: .46rem; }
  .totop { width: 34px; height: 34px; }
}

/* =========================================================
   NAVIGATION MAP — progressive construction
   ========================================================= */
.map-label {
  display: block;
  width: max-content;
  margin: 0 auto;
  appearance: none;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: .2rem .15rem .28rem;
  color: var(--graphite);
  font-family: var(--mono);
  font-size: .56rem;
  letter-spacing: .30em;
  text-transform: uppercase;
  opacity: .72;
  transition: opacity .2s ease, color .2s ease, border-color .2s ease;
}
.map-label:hover,
.map-label:focus-visible { opacity: 1; color: var(--ink); border-color: var(--graphite-soft); outline: none; }
.map-diagram {
  position: relative;
  display: grid;
  grid-template-rows: 30px 26px auto;
  overflow: hidden;
  max-height: 0;
  transition: max-height .53s ease;
}
.map.open .map-diagram { max-height: 150px; }
.map-trunk {
  width: 1px;
  height: 30px;
  margin: 0 auto;
  background: var(--graphite-soft);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .20s ease;
}
.map-bar {
  width: calc(75% + 10.5px);
  height: 1px;
  margin: 0 auto;
  align-self: start;
  background: var(--graphite-soft);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .23s cubic-bezier(.3,.8,.25,1) .12s;
}
.map.open .map-trunk { transform: scaleY(1); }
.map.open .map-bar { transform: scaleX(1); }
.map-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
  margin-top: -26px;
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .19s ease, transform .19s ease;
}
.map.settled .map-row { opacity: 1; transform: none; }
.map-branch { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.map-drop {
  width: 1px;
  height: 26px;
  background: var(--graphite-soft);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .10s ease .17s;
}
.map.settled .map-drop { transform: scaleY(1); }
.mnode {
  position: relative;
  width: 100%;
  max-width: 155px;
  min-height: 38px;
  padding: .55rem .8rem;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(35,35,35,.30);
  border-radius: 3px;
  box-shadow: none;
  font-family: var(--mono);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity .23s ease, transform .17s ease, border-color .13s ease, background .13s ease, box-shadow .13s ease;
}
.map.settled .mnode { opacity: 1; transform: none; transition-delay: .33s, .33s, 0s, 0s, 0s; }
.mnode .n-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: .64rem;
  letter-spacing: .10em;
  line-height: 1.2;
  text-transform: uppercase;
  text-align: center;
}
.mnode .n-kicker {
  font-size: .5rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--graphite);
  margin-top: 0;
  max-height: 1rem;
  opacity: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: .18rem;
}
.mnode.active { border-color: var(--amber); background: #fff; box-shadow: 0 0 0 3px rgba(199,155,71,.15); }
.mnode:hover, .mnode:focus-visible {
  background: rgba(255,255,255,.9);
  border-color: var(--cyan);
  outline: none;
}
.mnode.active:hover, .mnode.active:focus-visible {
  border-color: var(--amber);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(199,155,71,.15);
}



/* ---- Clippit: bottom-left corner easter egg ---- */
/* dblclick trigger zone: 10% x 10% of the viewport, the very corner. */
#ccZone {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 10vw;
  height: 10vh;
  cursor: help;
  z-index: 80;
}

/* Visible clippy. Width is a viewport proportion (clamped so it stays sane
   on 4K / phones); height follows the GIF's own 254:480 aspect. */
#clippyCorner {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 90;
  width: clamp(7px, 1.4vh, 17px);
  padding: 0 2px 1px 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
#clippyCorner .cc-img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: translateY(8px);
  filter: drop-shadow(0 1px 3px rgba(35,35,35,.22));
  transition: opacity .25s ease, transform .25s ease;
}
/* the "paper corner" flap that folds up first */
#clippyCorner .cc-fold {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 42%;
  height: 26%;
  background:
    linear-gradient(225deg, rgba(35,35,35,.12), rgba(35,35,35,0) 60%),
    var(--paper-2);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  transform-origin: 0% 100%;
  transform: scale(0);
}

@keyframes ccFoldIn {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes ccFadeIn {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}
body.cc-on #clippyCorner { opacity: 1; pointer-events: auto; }
body.cc-on #clippyCorner .cc-fold {
  animation: ccFoldIn 320ms cubic-bezier(.34, 1.56, .64, 1) both;
}
body.cc-on #clippyCorner .cc-img {
  animation: ccFadeIn 520ms ease-out 240ms both;
}

@media (prefers-reduced-motion: reduce) {
  body.cc-on #clippyCorner .cc-fold,
  body.cc-on #clippyCorner .cc-img { animation: none; }
  body.cc-on #clippyCorner .cc-fold { transform: scale(1); }
  body.cc-on #clippyCorner .cc-img { opacity: 1; transform: none; }
}

/* Corner dedication card — Ctrl+double-click on the bottom-left zone.
   Centered, above everything (z-index 100 > clippy 90 > sheet 40). */
#cornerCard {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 100;
  width: min(440px, 86vw);
  transform: translate(-50%, -50%) scale(.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  background: #fff;
  border: 1px solid var(--hair);
  box-shadow: 0 18px 50px rgba(20, 20, 20, .18);
  padding: 1.35rem 1.5rem 1.2rem;
}
#cornerCard.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
#cornerCard .ccard-kicker {
  margin: 0 0 .7rem;
  font-size: .55rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--graphite);
}
#cornerCard p {
  margin: 0 0 .8rem;
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.7;
  color: #2c2c2c;
  white-space: pre-wrap;
}
#cornerCard p:last-of-type { margin-bottom: 0; }
#cornerCard .ccard-close {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: none;
  border: 1px solid rgba(35, 35, 35, .25);
  border-radius: 2px;
  padding: .2rem .5rem;
  font: inherit;
  font-size: .55rem;
  letter-spacing: .18em;
  color: #333;
  cursor: pointer;
}
#cornerCard .ccard-close:hover { background: rgba(35, 35, 35, .06); }
@media (prefers-reduced-motion: reduce) {
  #cornerCard { transition: none; }
}

/* ============================================================
   PHONE MAP — FINAL OVERRIDES (must sit at end of file so it
   beats the base .mnode / .n-title / .n-kicker rules above,
   which have equal specificity and would otherwise win).
   Font scales with viewport width via vw; long titles stay on
   ONE line because the clamp keeps them inside their cell.
   ============================================================ */
@media (max-width: 680px) {
  /* line geometry — must override the base .map rules (L827-878) that
     sit later in the file and were silently applying the 26px desktop drops
     + 75%+10.5px bar. Values below are sized for the phone's 8px row gap:
     drop top meets bar bottom with no gap; bar ends exactly at outer drops. */
  .map-diagram { grid-template-rows: 18px 16px auto; }
  .map.open .map-diagram { max-height: 150px; }
  .map-trunk { height: 18px; }
  .map-bar { width: calc(75% + 6px); }
  .map-row { margin-top: -16px; gap: 8px; }
  .map-drop { height: 16px; }
  .map-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
  .mnode {
    max-width: none; min-width: 0; overflow: hidden;
    padding: .5rem .25rem; min-height: 44px;
  }
  .mnode .n-title {
    font-size: clamp(5.5px, 1.7vw, 10px);
    line-height: 1.25; letter-spacing: .04em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    overflow-wrap: normal; word-break: normal;
  }
  .mnode .n-kicker {
    font-size: clamp(4.5px, 1.25vw, 8.5px);
    letter-spacing: .12em;
    white-space: normal; overflow: hidden; text-overflow: clip; max-height: 2.2em;
    margin-top: .18rem;
  }
}
