/* THE CURRENT — Navigator dark language (distilled from lab.modern-navigator.com).
   Map-first: the system map runs full-bleed edge to edge; block clicks open the
   detail panel (right drawer) so the map never leaves view. The wire lives on
   wire.html. Lab signatures carried over: one-line fitted headlines, line-mask
   reveals, two-part custom cursor (dot + lerped ring), liquid-ripple headline. */

:root {
  --bg: #171614;
  --ink: #E8E4DA;
  --ink-70: rgba(232,228,218,0.72);
  --ink-50: rgba(232,228,218,0.5);
  --ink-35: rgba(232,228,218,0.35);
  --line: rgba(232,228,218,0.18);
  --line-mid: rgba(232,228,218,0.35);
  --line-strong: rgba(232,228,218,0.55);
  --accent: #FF4B1F;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --pad: clamp(20px, 3.5vw, 56px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
.mono { font-family: var(--mono); }
a { color: inherit; }
::selection { background: var(--accent); color: var(--bg); }

/* ---- Custom cursor (lab recipe) ---- */
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  a, button, .p-row, .wireitem, .chip, .mnode { cursor: none; }
  input, textarea, select { cursor: auto; }
}
.cur-dot, .cur-ring { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 999; border-radius: 50%; display: none; }
@media (hover: hover) and (pointer: fine) { .cur-dot, .cur-ring { display: block; } }
.cur-dot { width: 6px; height: 6px; background: var(--accent); transform: translate(-50%, -50%); }
.cur-ring {
  width: 34px; height: 34px; border: 1px solid var(--line-mid); transform: translate(-50%, -50%);
  transition: width .25s, height .25s, border-color .25s, background .25s;
}
.cur-ring.big { width: 68px; height: 68px; border-color: var(--accent); background: rgba(255,75,31,0.08); }

/* ---- Line-mask reveals (lab recipe) ---- */
.line { display: block; overflow: hidden; }
.line > span { display: block; transform: translateY(108%); }
body.ready .line > span { transform: none; transition: transform .85s cubic-bezier(.16,.7,.16,1); }

/* ---- Masthead (full-bleed) ---- */
.mast { padding: 24px var(--pad) 0; }
.mast-top {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--mono); font-weight: 700; font-size: 12px; letter-spacing: 0.22em; }
.brand .mono { color: var(--accent); margin-right: 1px; }
.mast-meta { font-size: 9.5px; letter-spacing: 0.14em; color: var(--ink-50); text-transform: uppercase; }
.mastlink { text-decoration: none; color: var(--accent); margin-right: 22px; font-weight: 700; }
.mastlink:hover { color: var(--ink); }

/* one-line fitted headline: JS sets .hero font-size so .hmain exactly spans the width.
   Hero spans are inline-block so scrollWidth measures the TEXT, not the container. */
.hero { margin-top: 40px; font-weight: 500; line-height: 0.94; }
.hero .line > span { display: inline-block; vertical-align: top; }
.hero .hmain {
  text-transform: uppercase; letter-spacing: -0.03em; white-space: nowrap;
  font-size: 1em;
}
.hero .halt {
  font-style: italic; font-weight: 400; color: var(--accent);
  letter-spacing: -0.02em; white-space: nowrap; font-size: 0.62em;
}
.heroband {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 40px;
  margin-top: 30px; flex-wrap: wrap;
}
.promise { font-size: 14.5px; line-height: 1.6; color: var(--ink-70); max-width: 520px; }
.ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.cta {
  background: var(--accent); color: var(--bg); border: none;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em;
  padding: 12px 18px; transition: background .15s;
  text-decoration: none; display: inline-block;
}
.cta:hover { background: var(--ink); }
.cta.ghost { background: none; border: 1px solid var(--line-strong); color: var(--ink); transition: all .15s; }
.cta.ghost:hover { border-color: var(--accent); color: var(--accent); background: none; }

/* ---- Stage: the map, full width ---- */
.stage { padding: 44px var(--pad) 26px; }
.mapcol { min-width: 0; }
.stage-rule {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 9.5px; letter-spacing: 0.16em; color: var(--ink-50);
  border-bottom: 1px solid var(--line-mid); padding-bottom: 10px;
}
.stage-rule span:first-child { color: var(--accent); }

.mapwrap { border: 1px solid var(--line-mid); border-top: none; overflow-x: auto; background: rgba(232,228,218,0.02); }
#mapsvg { display: block; min-width: 760px; width: 100%; height: auto; }
.mnode { outline: none; }
.mnode rect { fill: rgba(23,22,20,0.5); stroke: var(--line-mid); transition: stroke .15s; }
.mnode:hover rect, .mnode.hot rect, .mnode:focus rect { stroke: var(--accent); }
.mnode.sel rect { stroke: var(--accent); fill: rgba(255,75,31,0.07); }
.mnode .mtitle { font-family: var(--sans); font-size: 14px; font-weight: 500; fill: var(--ink); letter-spacing: 0.02em; }
.mnode .mnum { font-family: var(--mono); font-size: 8.5px; font-weight: 700; fill: var(--accent); letter-spacing: 0.15em; }
.mnode .msub { font-family: var(--mono); font-size: 8px; fill: var(--ink-50); letter-spacing: 0.05em; }
.medge { fill: none; stroke: var(--ink-35); stroke-width: 1; marker-end: url(#arr); transition: opacity .15s, stroke .15s; }
.medge.dashed { stroke-dasharray: 3 4; }
.medge.hot { stroke: var(--accent); }
.melabel { font-family: var(--mono); font-size: 7.5px; fill: var(--ink-35); letter-spacing: 0.12em; }
.mpulse {
  fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: 0.8; pointer-events: none;
  stroke-dasharray: 5 130; animation: mflow 4.5s linear infinite;
}
@keyframes mflow { to { stroke-dashoffset: -135; } }
#mapsvg.hovering .medge:not(.hot) { opacity: 0.18; }
#mapsvg.hovering .mpulse:not(.hot) { opacity: 0.08; }
#mapsvg.hovering .mnode:not(.hot) { opacity: 0.3; }
.mnode, .mpulse { transition: opacity .2s; }
.mloopspin {
  fill: none; stroke: var(--accent); stroke-width: 1.2; opacity: 0.85; pointer-events: none;
  stroke-dasharray: 34 29; animation: mflow 2.6s linear infinite;
}
.loopstrip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line-mid); border-top: none;
}
.loopstrip button {
  text-align: left; background: none; border: none; border-left: 1px solid var(--line);
  padding: 12px 14px 13px; font-family: var(--mono); display: flex; flex-direction: column; gap: 3px;
  transition: background .15s;
}
.loopstrip button:first-child { border-left: none; }
.loopstrip button:hover { background: rgba(255,75,31,0.06); }
.loopstrip .ln { color: var(--accent); font-weight: 700; font-size: 9px; letter-spacing: 0.15em; }
.loopstrip .lt { color: var(--ink); font-size: 9.5px; letter-spacing: 0.12em; font-weight: 500; }
.loopstrip .ld { color: var(--ink-50); font-size: 8.5px; letter-spacing: 0.04em; }
.loopstrip .lc { color: var(--ink-35); font-size: 7.5px; letter-spacing: 0.12em; }
.map-info { margin-top: 12px; font-size: 9px; letter-spacing: 0.12em; color: var(--ink-50); text-transform: uppercase; min-height: 14px; }

/* ---- The detail panel (right drawer over the map) ---- */
.dpanel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(470px, 94vw); z-index: 60;
  background: var(--bg); border-left: 1px solid var(--line-mid);
  box-shadow: -40px 0 80px rgba(0,0,0,0.5);
  padding: 20px 26px 34px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line-mid) transparent;
  transform: translateX(103%); transition: transform .45s cubic-bezier(.16,1,.3,1);
}
.dpanel.open { transform: none; }
.dp-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line-mid); padding-bottom: 12px; }
.dp-kicker { font-size: 9.5px; letter-spacing: 0.2em; color: var(--accent); font-weight: 700; }
.dp-close {
  background: none; border: 1px solid var(--line-mid); color: var(--ink-50);
  font-size: 8.5px; letter-spacing: 0.14em; padding: 6px 10px; transition: all .15s;
}
.dp-close:hover { border-color: var(--accent); color: var(--accent); }
.dp-title { margin-top: 16px; font-size: 26px; font-weight: 500; letter-spacing: -0.02em; text-transform: uppercase; line-height: 1.05; }
.dp-one { margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--ink-50); }
.dp-body { margin-top: 18px; }
.dp-p { border-top: 1px solid var(--line); }
.dp-prow {
  width: 100%; text-align: left; background: none; border: none;
  display: flex; align-items: baseline; gap: 10px;
  padding: 13px 0 4px; color: var(--ink); font-family: var(--sans);
}
.dp-prow:hover { background: rgba(232,228,218,0.04); }
.dp-pcaret { font-size: 10px; color: var(--accent); transition: transform .25s ease; }
.dp-p.open .dp-pcaret { transform: rotate(90deg); }
.dp-ptitle { flex: 1; font-size: 13.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.01em; }
.dp-pick { padding: 0 0 13px 20px; font-size: 12.5px; line-height: 1.55; color: var(--ink-70); }
.dp-det { display: none; padding: 0 0 18px 20px; }
.dp-p.open .dp-det { display: block; }
.dp-det li { list-style: none; position: relative; padding: 8px 0 8px 22px; font-size: 13px; line-height: 1.6; color: var(--ink-70); border-top: 1px solid var(--line); }
.dp-det li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); font-size: 10px; top: 10px; }
.dp-det .p-src { margin-top: 12px; }
.dp-meta { margin-top: 10px; font-size: 8.5px; letter-spacing: 0.12em; color: var(--ink-35); }
.dp-p.pulse { animation: deltapulse 2.2s ease-out 1; }
.dp-plain { margin-top: 4px; }
.dp-plain li { list-style: none; position: relative; padding: 11px 0 11px 24px; font-size: 13.5px; line-height: 1.62; color: var(--ink-70); border-top: 1px solid var(--line); }
.dp-plain li:first-child { border-top: none; }
.dp-plain li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); font-size: 10px; top: 13px; }
.dp-full {
  display: block; width: 100%; margin-top: 22px; padding: 12px 14px;
  background: none; border: 1px solid var(--line-mid); color: var(--ink-50);
  font-size: 9px; letter-spacing: 0.14em; text-align: left; transition: all .15s;
}
.dp-full:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Wire language (wire.html) ---- */
.k { width: 8px; height: 8px; display: inline-block; }
.k-change { background: var(--accent); }
.k-watch { border: 1px solid var(--ink-50); }
.k-none { border: 1px dashed var(--ink-35); }

.wireitem { padding: 18px 0 16px; border-bottom: 1px solid var(--line); }
.wireitem:hover { background: rgba(232,228,218,0.03); }
.wireitem.reveal { opacity: 0; transform: translateY(10px); }
.wireitem.reveal.in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s ease; }
.w-date { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; color: var(--ink-35); display: flex; align-items: center; gap: 9px; }
.w-title { margin-top: 7px; font-size: 14.5px; font-weight: 500; line-height: 1.3; }
.w-note { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: var(--ink-50); }
.w-deltas { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.dchip {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.1em;
  border: none; padding: 5px 9px; text-transform: uppercase; transition: all .15s;
}
.d-change { background: var(--accent); color: var(--bg); }
.d-change:hover { background: var(--ink); }
.d-watch { background: none; border: 1px solid var(--line-strong); color: var(--ink); }
.d-watch:hover { border-color: var(--accent); color: var(--accent); }
.d-none { background: none; border: 1px dashed var(--ink-35); color: var(--ink-50); }
.d-none:hover { border-color: var(--ink-50); color: var(--ink); }

/* ---- The stack zone (beneath the map) ---- */
.stackzone { padding: 40px var(--pad) 90px; }

.starthere { border: 1px solid var(--line-mid); margin-top: 30px; padding: 24px 26px 26px; max-width: 900px; }
.sh-head { font-size: 9.5px; letter-spacing: 0.2em; color: var(--accent); font-weight: 700; }
.sh-title { margin-top: 12px; font-size: 30px; font-weight: 500; letter-spacing: -0.02em; text-transform: uppercase; }
.sh-sub { margin-top: 6px; font-size: 13.5px; color: var(--ink-50); }
.sh-list { margin-top: 18px; list-style: none; display: flex; flex-direction: column; }
.sh-list li { display: flex; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.55; color: var(--ink-70); }
.sh-list .n { font-family: var(--mono); font-size: 10px; color: var(--accent); padding-top: 4px; flex: 0 0 24px; }
.sh-list a { text-decoration: none; border-bottom: 1px solid var(--line-mid); color: var(--ink); }
.sh-list a:hover { border-color: var(--accent); color: var(--accent); }

.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 40px; }
.search {
  flex: 1 1 200px; max-width: 340px; background: transparent; border: 1px solid var(--line-mid);
  padding: 10px 13px; font-size: 10px; letter-spacing: 0.14em; color: var(--ink); outline: none;
}
.search::placeholder { color: var(--ink-35); }
.search:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
  border: 1px solid var(--line-mid); background: none; color: var(--ink-50);
  padding: 7px 11px; text-transform: uppercase; transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.on { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.tbtn {
  font-size: 9px; letter-spacing: 0.14em; border: 1px solid var(--line-mid);
  background: none; padding: 9px 13px; color: var(--ink-50); white-space: nowrap;
}
.tbtn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---- Domains ---- */
.domain { margin-top: 64px; }
.domain.reveal { opacity: 0; transform: translateY(16px); }
.domain.reveal.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.16,1,.3,1); }
.d-head { display: block; }
.d-head::before { content: ""; display: block; border-top: 1px solid var(--line-mid); margin-bottom: 14px; }
.d-num { font-family: var(--mono); font-size: 10px; color: var(--accent); font-weight: 700; letter-spacing: 0.2em; display: block; }
.d-label {
  display: block; margin-top: 10px;
  font-size: clamp(28px, 3.4vw, 44px); font-weight: 500; letter-spacing: -0.02em;
  text-transform: uppercase; line-height: 1; white-space: nowrap;
}
.d-one { display: block; margin-top: 8px; font-size: 13px; color: var(--ink-50); max-width: 520px; }

.practice { border-bottom: 1px solid var(--line); max-width: 980px; }
.practice:first-of-type { margin-top: 18px; }
.p-row {
  width: 100%; text-align: left; background: none; border: none;
  display: grid; grid-template-columns: 1fr auto; gap: 5px 20px;
  padding: 17px 2px 15px; font-family: var(--sans); color: var(--ink);
}
.p-row:hover { background: rgba(232,228,218,0.04); }
.p-title { font-size: 14.5px; font-weight: 500; letter-spacing: 0.01em; text-transform: uppercase; display: flex; align-items: baseline; gap: 12px; }
.p-caret { font-family: var(--mono); font-size: 10px; color: var(--accent); transition: transform .25s ease; }
.practice.open .p-caret { transform: rotate(90deg); }
.p-pick { grid-column: 1; font-size: 13.5px; line-height: 1.6; color: var(--ink-70); max-width: 620px; }
.p-meta { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.badge { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; padding: 4px 9px; white-space: nowrap; }
.b-established { background: var(--ink); color: var(--bg); }
.b-emerging { border: 1px solid var(--line-strong); color: var(--ink); }
.b-contested { border: 1px solid var(--accent); color: var(--accent); }
.p-changed { font-family: var(--mono); font-size: 9px; color: var(--ink-35); letter-spacing: 0.08em; }

.p-detail { max-height: 0; overflow: hidden; transition: max-height .45s cubic-bezier(.16,1,.3,1); }
.p-detail-in { padding: 6px 2px 22px; max-width: 640px; }
.p-detail li { list-style: none; position: relative; padding: 9px 0 9px 24px; font-size: 14px; line-height: 1.65; color: var(--ink-70); border-top: 1px solid var(--line); }
.p-detail li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-family: var(--mono); font-size: 11px; top: 11px; }
.p-src { margin-top: 14px; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.1em; color: var(--ink-35); text-transform: uppercase; }
.p-src b { color: var(--ink-50); font-weight: 500; }

@keyframes deltapulse { 0% { background: rgba(255,75,31,0.22); } 100% { background: transparent; } }
.practice.pulse { animation: deltapulse 2.2s ease-out 1; }

/* ---- Footer ---- */
.foot { margin-top: 80px; border-top: 1px solid var(--line-mid); padding-top: 14px; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.1em; line-height: 1.8; color: var(--ink-35); text-transform: uppercase; }
.foot2 { margin-top: 8px; }

/* ---- Reveals (generic) ---- */
.reveal { opacity: 0; transform: translateY(12px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .55s ease, transform .55s ease; }

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .loopstrip { grid-template-columns: repeat(2, 1fr); }
  .loopstrip button:nth-child(3) { border-left: none; }
  .loopstrip button { border-top: 1px solid var(--line); }
  .loopstrip button:nth-child(-n+2) { border-top: none; }
  .heroband { flex-direction: column; align-items: flex-start; }
  .d-label { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mpulse, .mloopspin { animation: none; opacity: 0; }
  .line > span { transform: none !important; transition: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .p-detail { transition: none; }
  .practice.pulse, .dp-p.pulse { animation: none; }
  .dpanel { transition: none; }
  .cur-dot, .cur-ring { display: none !important; }
}
