/* Redparra Network — public site. No external resources (fonts, CDNs) on purpose.
 * The CSP forbids inline styles: every style lives here, charts size their bars with SVG attributes.
 */

:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-2: #0f1620;
  --panel: #111827;
  --panel-2: #0b1220;
  --text: #e5e7eb;
  --body: #c9ced6;
  --muted: #9ca3af;
  --dim: #6b7280;
  --accent: #22d3ee;
  --accent-soft: #a5f3fc;
  --accent-2: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --border: #1f2933;
  --border-2: #263241;
  --radius: 14px;
  /* sequential ramp (one hue, dark -> bright) for the heatmap */
  --seq-0: #141c26;
  --seq-1: #0f3d4a;
  --seq-2: #0e6a7c;
  --seq-3: #159bb0;
  --seq-4: #22d3ee;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(34, 211, 238, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(167, 139, 250, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .eyebrow, h1, h2, h3, .btn, .chip, dt, dd, .tags, .nav, .footer, .legend, .tool-label, .bar-value, time { font-family: var(--mono); }
.accent { color: var(--accent); }
.muted { color: var(--muted); }
.prompt { color: var(--accent); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0.5rem; z-index: 50; padding: 0.5rem 0.8rem; background: var(--accent); color: #04232a; border-radius: 8px; }
.skip:focus { left: 0.5rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- nav */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem clamp(16px, 4vw, 48px);
  background: rgba(11, 15, 20, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: var(--text); font-weight: 700; letter-spacing: 0.5px; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: clamp(0.8rem, 2vw, 1.6rem); font-size: 0.82rem; }
.nav-links a, .menu nav a { color: var(--muted); position: relative; }
.nav-links a:hover, .menu nav a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="true"] { color: var(--text); }
.nav-links a[aria-current="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.45rem; height: 2px; border-radius: 2px; background: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 0.6rem; }
.lang {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 1px; color: var(--text);
  padding: 0.3rem 0.55rem; border: 1px solid var(--border-2); border-radius: 8px;
}
.lang:hover { border-color: var(--accent); text-decoration: none; }
.menu { display: none; position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 0.25rem 0.55rem; border: 1px solid var(--border-2); border-radius: 8px; color: var(--text); }
.menu summary::-webkit-details-marker { display: none; }
.menu nav {
  position: absolute; right: 0; top: calc(100% + 0.6rem); min-width: 12rem; padding: 0.5rem;
  display: flex; flex-direction: column; background: rgba(11, 15, 20, 0.97); border: 1px solid var(--border-2); border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.menu nav a { padding: 0.55rem 0.7rem; border-radius: 8px; font-size: 0.9rem; }
.menu nav a:hover { background: rgba(34, 211, 238, 0.08); }

main { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* ---------- reveal on scroll (only when javascript runs) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- hero */
.hero {
  position: relative;
  display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center;
  padding: clamp(3rem, 9vw, 7rem) 0 clamp(2rem, 6vw, 4rem);
}
.hero-bg {
  position: absolute; inset: 0 calc(-1 * clamp(16px, 4vw, 48px)); width: calc(100% + 2 * clamp(16px, 4vw, 48px)); height: 100%;
  pointer-events: none; z-index: 0;
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse at 70% 40%, #000 30%, transparent 75%);
}
.hero-text, .kpis, .live-strip { position: relative; z-index: 1; }
.live-strip {
  grid-column: 1 / -1; justify-self: start;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 1.1rem;
  margin-bottom: -0.5rem; padding: 0.55rem 1rem 0.55rem 0.6rem; border-radius: 999px;
  font-family: var(--mono); font-size: 0.78rem; color: var(--muted);
  background: rgba(7, 10, 14, 0.7); border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 30px rgba(52, 211, 153, 0.06);
  transition: border-color .2s;
}
.live-strip:hover { text-decoration: none; border-color: var(--ok); }
.ls-badge {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.15rem 0.6rem; border-radius: 999px;
  background: rgba(52, 211, 153, 0.14); color: var(--ok); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 0.68rem;
}
.ls-item .v { color: var(--text); font-variant-numeric: tabular-nums; }
.ls-item .of { color: var(--dim); }
.ls-item.warn .v { color: var(--warn); }
.ls-age { color: var(--dim); font-size: 0.7rem; }
.live-strip.stale { border-color: rgba(251, 191, 36, 0.4); }
.live-strip.stale .ls-badge { background: rgba(251, 191, 36, 0.14); color: var(--warn); }
.live-strip.stale .pulse { background: var(--warn); animation: none; }
.eyebrow { color: var(--accent); font-size: 0.8rem; letter-spacing: 1px; text-transform: uppercase; margin: 0 0 1rem; display: flex; align-items: center; gap: 0.6rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

h1 { font-size: clamp(2.4rem, 6.5vw, 4.6rem); line-height: 1.02; margin: 0 0 1.5rem; letter-spacing: -1.5px; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.3rem); line-height: 1.15; margin: 0 0 0.8rem; letter-spacing: -0.5px; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
h3 small { font-weight: 400; font-size: 0.8rem; }
.hero-text p { color: var(--body); max-width: 60ch; margin: 0 0 1rem; }
.hero-text .lead { font-size: 1.15rem; color: var(--text); }

.hero-cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; padding: 0.75rem 1.2rem; border-radius: 10px;
  border: 1px solid var(--border-2); color: var(--text); font-size: 0.85rem; background: rgba(17, 24, 39, 0.6);
  transition: border-color .2s, transform .2s, background .2s;
}
.btn:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #04232a; font-weight: 700; }
.btn.primary:hover { background: #67e8f9; }

.kpis {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 0;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 0 60px rgba(34, 211, 238, 0.06);
}
.kpis > div { background: linear-gradient(180deg, var(--panel), var(--panel-2)); padding: 1.3rem 1.4rem; }
.kpis dt { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; }
.kpis dd { margin: 0.3rem 0 0; font-size: clamp(1.7rem, 3.6vw, 2.4rem); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.kpis > div:nth-child(6) dd { color: var(--ok); }
.kpi-foot { grid-column: 1 / -1; margin: 0; padding: 0.7rem 1.4rem; background: var(--panel-2); color: var(--muted); font-family: var(--mono); font-size: 0.72rem; }

/* ---------- sections & panels */
.section { padding: clamp(3rem, 8vw, 6rem) 0 0; }
.section-head { max-width: 760px; margin-bottom: 2rem; }
.section-head p.muted { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.panel {
  padding: 1.4rem 1.5rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  min-width: 0;
}
.panel > h3 { margin-bottom: 1rem; }
.panel + .grid, .grid + .panel { margin-top: 1rem; }

/* ---------- real status */
.live-section .pulse { background: var(--ok); }
.live-section.stale .pulse { background: var(--warn); animation: none; }
.live-age { font-family: var(--mono); font-size: 0.8rem; }
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.live-tile {
  padding: 1.2rem 1.3rem 0.9rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
}
.live-tile h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); font-weight: 500; }
.live-value { margin: 0.2rem 0 0.6rem; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.live-value .v { font-size: 2rem; font-weight: 700; color: var(--text); }
.live-value .of { font-size: 1rem; color: var(--dim); }
.live-tile.warn .v { color: var(--warn); }
.live-tile[data-metric="bw"] .v { color: var(--accent); }
.bw-split { color: var(--muted); }
.spark { display: block; width: 100%; height: 40px; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-area { fill: rgba(34, 211, 238, 0.08); stroke: none; }
.spark-dot { fill: var(--accent); stroke: var(--panel-2); stroke-width: 2; vector-effect: non-scaling-stroke; }
.live-foot { margin: 0.4rem 0 0; font-size: 0.68rem; color: var(--dim); font-family: var(--mono); }
.stale .live-tile { opacity: 0.6; }

/* ---------- map */
.map-card {
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); overflow: hidden;
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.85), rgba(11, 18, 32, 0.95));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), 0 0 80px rgba(34, 211, 238, 0.05);
}
.map-card:fullscreen { display: flex; flex-direction: column; border-radius: 0; background: var(--bg); }
.map-card:fullscreen .map-wrap { flex: 1; height: auto; }
.map-hud {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; }
.legend-item {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.6rem; border-radius: 999px; cursor: pointer;
  font-family: var(--mono); font-size: 0.72rem; color: var(--muted); background: transparent; border: 1px solid transparent;
}
.legend-item:hover { border-color: var(--border-2); color: var(--text); }
.legend-item[aria-pressed="false"] { opacity: 0.45; text-decoration: line-through; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.t-data { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.t-bgp { background: var(--accent-2); box-shadow: 0 0 8px var(--accent-2); }
.t-bfd { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.t-dns { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

.live-hud { display: flex; flex-wrap: wrap; gap: 0.3rem 1.6rem; margin: 0; }
.live-hud dt { font-size: 0.65rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.8px; }
.live-hud dd { margin: 0; font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.badge-real { display: inline-block; padding: 0 0.35rem; border-radius: 4px; background: var(--ok); color: #052e22; font-weight: 700; letter-spacing: 0.5px; }
.real-hud dd { color: var(--ok); }
.mode-badge { font-family: var(--mono); font-size: 0.68rem; padding: 0.15rem 0.5rem; }
.seg-btn .dot { width: 7px; height: 7px; margin-right: 0.25rem; vertical-align: 1px; }

.map-toolbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem 1.2rem;
  padding: 0.7rem 1.25rem; border-bottom: 1px solid var(--border); background: rgba(7, 10, 14, 0.4);
}
.tool-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.tool-label { font-size: 0.65rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.8px; margin-right: 0.2rem; }
.chip {
  font-size: 0.75rem; padding: 0.45rem 0.8rem; border-radius: 999px; cursor: pointer;
  color: var(--text); background: rgba(11, 15, 20, 0.8); border: 1px solid var(--border-2);
  transition: border-color .2s, color .2s;
}
.chip:hover { border-color: var(--accent); }
.chip:disabled { opacity: 0.4; cursor: wait; }
.chip[aria-pressed="true"] { border-color: var(--warn); color: var(--warn); }
.chip.primary { background: var(--accent); border-color: var(--accent); color: #04232a; font-weight: 700; }
.chip.icon-only { padding: 0.35rem 0.6rem; font-size: 0.95rem; line-height: 1; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 999px; overflow: hidden; }
.seg-btn { font-family: var(--mono); font-size: 0.72rem; padding: 0.4rem 0.75rem; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.seg-btn[aria-pressed="true"] { background: rgba(34, 211, 238, 0.14); color: var(--accent); }
.speed { display: inline-flex; align-items: center; gap: 0.4rem; }
.speed input { width: 90px; accent-color: var(--accent); }
.speed output { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); min-width: 2.6em; }

.map-wrap { position: relative; height: clamp(440px, 64vw, 700px); }
#netmap { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: manipulation; }
#m-tunnels.ok { color: var(--ok); } #m-tunnels.bad { color: var(--bad); }

.node-card {
  position: absolute; top: 1rem; right: 1rem; width: min(300px, calc(100% - 2rem));
  background: rgba(11, 15, 20, 0.92); border: 1px solid var(--border-2); border-radius: 12px;
  padding: 1rem 1.1rem; font-size: 0.82rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5); animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.node-card .close { position: absolute; top: 0.4rem; right: 0.5rem; background: none; border: 0; color: var(--muted); font-size: 1.3rem; cursor: pointer; line-height: 1; }
.nc-head { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.6rem; font-family: var(--mono); }
.nc-id { font-size: 1.2rem; }
.nc-kind { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; padding: 0.15rem 0.45rem; border-radius: 6px; border: 1px solid currentColor; }
.nc-kind.core { color: var(--accent-2); } .nc-kind.edge { color: var(--accent); } .nc-kind.cloud { color: var(--warn); }
.nc-body { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.9rem; margin: 0 0 0.7rem; }
.nc-body dt { color: var(--dim); font-size: 0.72rem; }
.nc-body dd { margin: 0; font-size: 0.78rem; font-family: var(--sans); }
.nc-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; padding: 0; }
.nc-tags li { font-family: var(--mono); font-size: 0.65rem; padding: 0.15rem 0.45rem; border-radius: 5px; background: rgba(34, 211, 238, 0.08); color: var(--accent-soft); }

.map-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); border-top: 1px solid var(--border); }
.trace { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 0.5rem; padding: 0.9rem 1.25rem; border-right: 1px solid var(--border); }
.trace .tool-label { flex-basis: 100%; }
.trace select {
  font-family: var(--mono); font-size: 0.8rem; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border-2); border-radius: 8px; padding: 0.35rem 0.5rem;
}
.trace-hops { flex-basis: 100%; list-style: none; margin: 0.3rem 0 0; padding: 0; font-family: var(--mono); font-size: 0.74rem; color: var(--muted); }
.trace-hops li { padding: 0.15rem 0 0.15rem 1rem; position: relative; }
.trace-hops li::before { content: "↳"; position: absolute; left: 0; color: var(--accent); }
.trace-hops li:last-child { color: var(--accent); }

.console { background: #070a0e; font-family: var(--mono); font-size: 0.74rem; min-width: 0; }
.console-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; border-bottom: 1px solid #131a22; color: var(--dim); }
.console-bar span { width: 9px; height: 9px; border-radius: 50%; background: #2a3441; }
.console-bar em { font-style: normal; margin-left: 0.5rem; }
#log { list-style: none; margin: 0; padding: 0.6rem 1rem; height: 8.6rem; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
#log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); animation: fadein .3s ease-out; }
#log time { color: var(--dim); margin-right: 0.6rem; }
#log .bad { color: var(--bad); } #log .ok { color: var(--ok); } #log .info { color: var(--accent); } #log .bgp { color: var(--accent-2); }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }

/* ---------- cards */
.grid.cards { grid-template-columns: repeat(3, 1fr); }
.card {
  position: relative; padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); overflow: hidden;
  transition: border-color .25s, transform .25s;
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(400px 160px at 0% 0%, rgba(34, 211, 238, 0.12), transparent 70%);
}
.card:hover { border-color: var(--border-2); transform: translateY(-2px); }
.card:hover::before { opacity: 1; }
.card p { color: var(--muted); font-size: 0.92rem; margin: 0; }
.icon {
  width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 1rem; border-radius: 10px;
  font-family: var(--mono); font-weight: 700; color: var(--accent); background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.2);
}

/* ---------- bar charts (one series, one hue: magnitude) */
.bars, .meters { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.bars li, .meters li { display: grid; grid-template-columns: minmax(7rem, 40%) 1fr 2.6rem; align-items: center; gap: 0.7rem; padding: 0.1rem 0; border-radius: 6px; }
.bars li:hover, .meters li:hover { background: rgba(34, 211, 238, 0.04); }
.bar-label, .meter-label { font-size: 0.84rem; color: var(--body); line-height: 1.25; }
.bar-track { display: block; width: 100%; height: 10px; border-radius: 4px; background: var(--seq-0); overflow: hidden; }
.bar-fill { fill: var(--accent); }
.bars li:hover .bar-fill, .meters li:hover .bar-fill { fill: #67e8f9; }
.bar-value { font-size: 0.8rem; font-weight: 700; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.as-table { margin-top: 0.9rem; font-size: 0.78rem; }
.as-table summary { cursor: pointer; color: var(--dim); font-family: var(--mono); font-size: 0.7rem; }
.as-table table { width: 100%; margin-top: 0.6rem; border-collapse: collapse; }
.as-table th, .as-table td { text-align: left; padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--border); color: var(--body); }
.as-table td:last-child, .as-table th:last-child { text-align: right; font-family: var(--mono); }

.segments { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0.6rem; }
.segments li { display: flex; justify-content: space-between; align-items: baseline; padding: 0.8rem 0.9rem; border-radius: 10px; border: 1px solid var(--border-2); background: rgba(7, 10, 14, 0.4); }
.segments strong { font-family: var(--mono); font-size: 0.85rem; }
.segments span { font-family: var(--mono); font-size: 1.2rem; font-weight: 700; color: var(--accent); }

/* ---------- architecture */
.journey { list-style: none; margin: 1.4rem 0 0.4rem; padding: 0; display: flex; align-items: stretch; }
.j-node {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.25rem;
  padding: 0.9rem 0.4rem; border-radius: 12px; border: 1px solid var(--border-2); background: rgba(7, 10, 14, 0.5);
}
.j-node strong { font-family: var(--mono); font-size: 0.82rem; }
.j-node small { font-size: 0.68rem; color: var(--muted); line-height: 1.3; }
.j-node.core { border-color: rgba(167, 139, 250, 0.5); }
.j-node.core .j-icon { stroke: var(--accent-2); }
.j-icon { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.j-link { flex: 0.9 1 0; position: relative; display: flex; align-items: center; justify-content: center; min-width: 3rem; }
.j-link::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--border-2); }
.j-link.wg::before { height: 6px; margin-top: -2px; border-radius: 6px; background: rgba(167, 139, 250, 0.25); border: 1px dashed rgba(167, 139, 250, 0.6); }
.j-link span { position: relative; top: -1.1rem; font-family: var(--mono); font-size: 0.62rem; color: var(--muted); white-space: nowrap; }
.j-link.wg span { color: var(--accent-2); }
.j-link::after {
  content: ""; position: absolute; top: calc(50% - 4px); left: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent); opacity: 0; animation: hop 4s linear infinite;
}
.journey .j-link:nth-child(4)::after { animation-delay: 1s; }
.journey .j-link:nth-child(6)::after { animation-delay: 2s; }
.journey .j-link:nth-child(8)::after { animation-delay: 3s; }
@keyframes hop { 0% { left: 0; opacity: 1; } 22% { left: calc(100% - 8px); opacity: 1; } 23%, 100% { opacity: 0; } }

.seg-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 1rem; padding: 0; }
.seg-chips li { font-family: var(--mono); font-size: 0.7rem; padding: 0.2rem 0.55rem; border-radius: 6px; border: 1px solid var(--border-2); color: var(--body); }
.seg-chips li.seg-safe { border-color: var(--ok); color: var(--ok); }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.ticks li { position: relative; padding-left: 1.2rem; font-size: 0.88rem; color: var(--body); }
.ticks li::before { content: "▸"; position: absolute; left: 0; color: var(--accent); }
.ticks strong { color: var(--text); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 0.9rem; }
.timeline::before { content: ""; position: absolute; left: 4.4rem; top: 0.4rem; bottom: 0.4rem; width: 2px; background: var(--border-2); }
.timeline li { display: grid; grid-template-columns: 3.7rem 1fr; gap: 1.6rem; font-size: 0.88rem; color: var(--body); position: relative; }
.timeline li::before { content: ""; position: absolute; left: calc(4.4rem - 4px); top: 0.45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.timeline li:first-child::before { border-color: var(--bad); }
.timeline li:last-child::before { border-color: var(--ok); background: var(--ok); }
.timeline .t { font-family: var(--mono); font-size: 0.72rem; color: var(--accent); text-align: right; padding-top: 0.1rem; white-space: nowrap; }

/* ---------- history */
.heat-scroll { overflow-x: auto; padding-bottom: 0.3rem; }
.heatmap { display: block; width: 100%; min-width: 640px; height: auto; }
.hm { fill: var(--seq-0); }
.hm.lv1 { fill: var(--seq-1); } .hm.lv2 { fill: var(--seq-2); } .hm.lv3 { fill: var(--seq-3); } .hm.lv4 { fill: var(--seq-4); }
rect.hm:hover { stroke: var(--text); stroke-width: 1.5; }
.hm-month, .hm-day { fill: var(--dim); font-family: var(--mono); font-size: 9px; }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 0.25rem; margin-top: 0.6rem; font-family: var(--mono); font-size: 0.68rem; color: var(--dim); }
.hm-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; background: var(--seq-0); }
.hm-legend i.lv1 { background: var(--seq-1); } .hm-legend i.lv2 { background: var(--seq-2); } .hm-legend i.lv3 { background: var(--seq-3); } .hm-legend i.lv4 { background: var(--seq-4); }
.hm-legend span { margin: 0 0.3rem; }
.milestones { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--border-2); display: grid; gap: 0.85rem; }
.milestones li { position: relative; display: grid; gap: 0.1rem; }
.milestones li::before { content: ""; position: absolute; left: calc(-1rem - 6px); top: 0.35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.milestones li:last-child::before { background: var(--accent); }
.milestones time { font-size: 0.72rem; color: var(--accent); }
.milestones span { font-size: 0.88rem; color: var(--body); }

/* ---------- pipeline */
.pipeline { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; position: relative; }
.pipeline::before {
  content: ""; position: absolute; left: 4%; right: 4%; top: 1.15rem; height: 2px;
  background: linear-gradient(90deg, transparent, var(--border-2) 10%, var(--border-2) 90%, transparent);
}
.pipeline::after {
  content: ""; position: absolute; top: calc(1.15rem - 3px); left: 4%; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: travel 5s linear infinite;
}
@keyframes travel { from { left: 4%; } to { left: 96%; } }
.pipeline li { position: relative; padding-top: 2.8rem; }
.step {
  position: absolute; top: 0; left: 0; font-family: var(--mono); font-size: 0.75rem; font-weight: 700;
  width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--accent); color: var(--accent); z-index: 1;
}
.pipeline p { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.6rem; }
.pipeline code { font-size: 0.72rem; color: var(--accent-soft); background: rgba(34, 211, 238, 0.07); padding: 0.15rem 0.4rem; border-radius: 5px; }

.terminal {
  margin: 0; padding: 1.2rem 1.4rem; border-radius: var(--radius); border: 1px solid var(--border);
  background: #070a0e; font-size: 0.8rem; line-height: 1.75; overflow-x: auto; color: var(--text);
}

/* ---------- stack */
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; }
.tags li { padding: 0.45rem 0.85rem; border-radius: 999px; font-size: 0.8rem; border: 1px solid var(--border-2); color: var(--body); background: rgba(17, 24, 39, 0.6); transition: border-color .2s, color .2s; }
.tags li:hover { border-color: var(--accent); color: var(--text); }
.tagline { margin: 2.5rem 0 0; padding-top: 1rem; border-top: 1px dashed var(--border); color: var(--muted); font-family: var(--mono); }

.footer {
  max-width: 1240px; margin: 4rem auto 0; padding: 1.5rem clamp(16px, 4vw, 48px) 2.5rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; font-size: 0.75rem; color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ---------- tooltip */
.tip {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; max-width: 260px;
  padding: 0.4rem 0.6rem; border-radius: 8px; font-family: var(--mono); font-size: 0.72rem; color: var(--text);
  background: rgba(11, 15, 20, 0.96); border: 1px solid var(--border-2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- legal & 404 */
.legal { max-width: 760px; padding-top: clamp(2.5rem, 7vw, 5rem); }
.legal h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 1rem; }
.legal h2 { font-size: 1.15rem; margin: 2.2rem 0 0.6rem; color: var(--accent); }
.legal p, .legal li { color: var(--body); }
.legal .lead { font-size: 1.1rem; color: var(--text); }
.legal ul { padding-left: 1.2rem; }
.legal li { margin-bottom: 0.4rem; }
.notfound .terminal { margin: 1.5rem 0; }
.small { font-size: 0.8rem; margin-top: 3rem; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .nav-links { display: none; }
  .menu { display: block; }
}
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .grid.cards, .grid.three { grid-template-columns: repeat(2, 1fr); }
  .pipeline { grid-template-columns: 1fr; gap: 1.2rem; }
  .pipeline::before { left: 1.15rem; right: auto; top: 0; bottom: 0; width: 2px; height: auto; background: var(--border-2); }
  .pipeline::after { display: none; }
  .pipeline li { padding: 0 0 0 3.4rem; }
  .map-bottom { grid-template-columns: 1fr; }
  .trace { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .grid.two, .grid.three, .grid.cards { grid-template-columns: 1fr; }
  .kpis dd { font-size: 1.6rem; }
  .live-hud { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); }
  .map-toolbar { padding: 0.7rem 0.75rem; }
  .live-strip { border-radius: 16px; margin-bottom: 0; }
  .map-wrap { height: auto; }
  #netmap { height: 480px; }
  .map-card:fullscreen #netmap { height: 100%; }
  .node-card { top: auto; bottom: 0.75rem; right: 0.75rem; left: 0.75rem; width: auto; }
  #log { height: 7rem; }
  .bars li, .meters li { grid-template-columns: minmax(6rem, 45%) 1fr 2.4rem; }
  /* the journey turns vertical */
  .journey { flex-direction: column; }
  .j-node { flex-direction: row; text-align: left; justify-content: flex-start; gap: 0.7rem; padding: 0.7rem 0.9rem; }
  .j-node small { margin-left: auto; text-align: right; }
  .j-link { min-height: 2.6rem; }
  .j-link::before { left: 50%; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
  .j-link.wg::before { width: 6px; margin: 0 0 0 -2px; height: auto; }
  .j-link span { top: 0; transform: translateX(calc(50% + 0.9rem)); }
  .j-link::after { left: calc(50% - 3px); top: 0; animation-name: hop-v; }
  @keyframes hop-v { 0% { top: 0; opacity: 1; } 22% { top: calc(100% - 8px); opacity: 1; } 23%, 100% { opacity: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
