:root {
  --bg: #0b0b0c;
  --bg-2: #141416;
  --fg: #ecebe6;
  --muted: #8a8984;
  --line: #2a2a2e;
  --accent: #ff4d2e;
  --cyan: #2ee6ff;
  --green: #3dff8a;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hud-h: 64px;
  --wire-y: 15vh;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
.accent { color: var(--accent); }
.mono { font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; }
.dim { color: var(--muted); }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  height: var(--hud-h);
}
.hud-top {
  top: 0;
  justify-content: space-between;
  background: linear-gradient(var(--bg) 30%, transparent);
}
.hud-bottom {
  bottom: 0;
  background: linear-gradient(transparent, var(--bg) 70%);
}
.logo {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: .01em;
}
.nav { display: flex; gap: 22px; }
.nav a {
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s;
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--fg); }
.nav a[aria-current="true"]::before { content: "● "; color: var(--accent); }

.tc { color: var(--fg); white-space: nowrap; font-variant-numeric: tabular-nums; }
.meter {
  flex: 1;
  height: 6px;
  background: var(--line);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px);
  mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px);
}
.meter-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green) 0 65%, #ffd23e 80%, var(--accent));
  background-size: 100vw 100%;
}
#sect { white-space: nowrap; min-width: 11ch; text-align: right; }

/* ---------- Horizontal scroller ---------- */
.viewport {
  height: 100vh;
  height: 100svh;
  overflow-x: auto;
  overflow-y: hidden;
}
.js .viewport {
  position: sticky;
  top: 0;
  overflow: hidden;
}
.track {
  position: relative;
  display: flex;
  height: 100%;
  width: max-content;
  will-change: transform;
}

/* signal wire running through every panel */
.wire {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--wire-y);
  height: 2px;
  background: var(--line);
  pointer-events: none;
}
.wire-lit {
  height: 100%;
  width: calc(var(--x, 0) * 1px + 50vw);
  background: linear-gradient(90deg, transparent, var(--accent) 120px);
  box-shadow: 0 0 12px var(--accent);
}

.panel {
  position: relative;
  flex: none;
  width: 100vw;
  height: 100%;
  padding: calc(var(--hud-h) + 4vh) 7vw calc(var(--wire-y) + 6vh);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.node {
  position: absolute;
  left: 7vw;
  bottom: var(--wire-y);
  margin: 0 0 14px;
  color: var(--muted);
}
.node::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--muted);
  transition: border-color .4s, background .4s, box-shadow .4s;
}
.is-in .node { color: var(--fg); }
.is-in .node::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}

.index { margin: 0 0 8px; color: var(--accent); }
.big {
  margin: 0;
  font-size: clamp(3.5rem, 11vw, 10rem);
  line-height: .9;
  letter-spacing: -.04em;
  font-weight: 700;
}
.copy {
  margin: 24px 0 0;
  max-width: 28em;
  color: var(--muted);
  font-size: clamp(.95rem, 1.3vw, 1.1rem);
}

/* reveal */
.js .panel .index, .js .panel .big, .js .panel .copy {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.js .panel .big { transition-delay: .08s; }
.js .panel .copy { transition-delay: .16s; }
.js .panel.is-in .index, .js .panel.is-in .big, .js .panel.is-in .copy {
  opacity: 1;
  transform: none;
}

/* ---------- Hero ---------- */
.panel-hero { justify-content: center; }
.scope {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-body { position: relative; }
.hero-title {
  margin: 4px 0 0;
  font-size: clamp(4.5rem, 17vw, 16rem);
  line-height: .85;
  letter-spacing: -.05em;
  font-weight: 700;
}
.hero-dot { color: var(--muted); }
.hero-copy {
  margin: 32px 0 0;
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  line-height: 1.9;
}
.scroll-hint {
  position: absolute;
  right: 7vw;
  bottom: var(--wire-y);
  margin: 0 0 14px;
  color: var(--muted);
}
.scroll-hint span { display: inline-block; color: var(--accent); animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(8px); } }

/* ---------- Sound ---------- */
.eq {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 22vh;
  margin-top: 5vh;
  max-width: 900px;
}
.eq i {
  flex: 1;
  height: 100%;
  background: linear-gradient(to top, var(--accent), #ffb23e 70%, var(--fg));
  transform-origin: bottom;
  transform: scaleY(.08);
  animation: eq var(--d, .8s) ease-in-out var(--delay, 0s) infinite alternate;
}
@keyframes eq {
  from { transform: scaleY(.06); }
  to { transform: scaleY(var(--h, 1)); }
}

/* ---------- Visual (color bars) ---------- */
.panel-bars { padding: 0; }
.bars { position: absolute; inset: 0; display: flex; flex-direction: column; }
.bars-main, .bars-sub { display: flex; }
.bars-main { flex: 1; }
.bars-sub { height: 12%; }
.bars i { flex: 1; }
.bars-main i:nth-child(1) { background: #c0c0c0; }
.bars-main i:nth-child(2) { background: #c0c000; }
.bars-main i:nth-child(3) { background: #00c0c0; }
.bars-main i:nth-child(4) { background: #00c000; }
.bars-main i:nth-child(5) { background: #c000c0; }
.bars-main i:nth-child(6) { background: #c00000; }
.bars-main i:nth-child(7) { background: #0000c0; }
.bars-sub i:nth-child(1) { background: #0000c0; }
.bars-sub i:nth-child(2) { background: #131313; }
.bars-sub i:nth-child(3) { background: #c000c0; }
.bars-sub i:nth-child(4) { background: #131313; }
.bars-sub i:nth-child(5) { background: #00c0c0; }
.bars-sub i:nth-child(6) { background: #131313; }
.bars-sub i:nth-child(7) { background: #c0c0c0; }
.bars::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(transparent 0 45%, rgba(255, 255, 255, .12) 50%, transparent 55%) 0 0 / 100% 300%,
    repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .18) 2px 4px);
  animation: scan 5s linear infinite;
}
@keyframes scan { to { background-position: 0 100%, 0 0; } }
.bars-text {
  position: relative;
  align-self: flex-start;
  margin: calc(var(--hud-h) + 6vh) 0 0 7vw;
  padding: 28px 36px 32px;
  background: var(--bg);
}
.panel-bars .node { z-index: 1; padding: 2px 8px; background: var(--bg); }

/* ---------- Split panels ---------- */
.panel-split {
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 6vh;
}

/* ---------- Rack ---------- */
.rack {
  position: relative;
  justify-self: center;
  width: min(420px, 100%);
  padding: 10px 26px;
  background: #050506;
  border: 1px solid var(--line);
  border-radius: 4px;
}
.rack::before, .rack::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: 10px;
  background: repeating-linear-gradient(transparent 0 8px, #2c2c30 8px 12px, transparent 12px 28px);
}
.rack::before { left: 8px; }
.rack::after { right: 8px; }
.unit {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  margin-bottom: 3px;
  padding: 0 12px;
  background: linear-gradient(#1d1d21, #151518);
  border: 1px solid #26262b;
  border-radius: 2px;
}
.unit.u2 { height: 59px; }
.unit span {
  flex: 1;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .14em;
  color: var(--muted);
}
.unit.patch {
  background:
    radial-gradient(circle, #050506 0 2.5px, transparent 3px) 82px 50% / 14px 14px repeat-x,
    linear-gradient(#1d1d21, #151518);
}
.led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: blink 2.4s steps(1) infinite;
}
.led.o { background: #ffb23e; box-shadow: 0 0 6px #ffb23e; animation-duration: 3.7s; }
.led.b { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); animation-duration: 3.1s; }
.led.fast { animation-duration: .35s; }
.led.d1 { animation-delay: -.3s; }
.led.d2 { animation-delay: -.9s; }
.led.d3 { animation-delay: -1.4s; }
.led.d4 { animation-delay: -.6s; }
@keyframes blink { 0%, 70% { opacity: 1; } 71%, 100% { opacity: .25; } }

/* ---------- Network ---------- */
.topo, .construct { justify-self: center; width: min(520px, 100%); height: auto; overflow: visible; }
.topo .links path { stroke: #3a3a40; stroke-width: 1.5; fill: none; }
.topo .packets path {
  stroke: var(--cyan);
  stroke-width: 3;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 3 97;
  animation: packet 2.6s linear infinite;
  filter: drop-shadow(0 0 4px var(--cyan));
}
.topo .packets path:nth-child(2) { animation-duration: 3.4s; stroke: var(--accent); filter: drop-shadow(0 0 4px var(--accent)); }
.topo .packets path:nth-child(3) { animation-duration: 4.2s; animation-delay: -1s; }
@keyframes packet { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
.topo .nodes circle { fill: var(--bg); stroke: var(--fg); stroke-width: 2; }
.topo .labels text { fill: var(--muted); font-family: var(--mono); font-size: 11px; }

/* ---------- Design ---------- */
.construct .grid path { stroke: #1f1f23; stroke-width: 1; fill: none; }
.construct .guides circle, .construct .guides path {
  stroke: var(--cyan);
  stroke-width: .75;
  stroke-dasharray: 4 4;
  fill: none;
  opacity: .6;
}
.construct .glyphs rect {
  fill: none;
  stroke: var(--accent);
  stroke-width: 14;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 2.2s cubic-bezier(.6, 0, .2, 1);
}
.construct .glyphs rect:nth-child(2) { transition-delay: .35s; }
.no-js .construct .glyphs rect, .is-in .construct .glyphs rect { stroke-dashoffset: 0; }

/* ---------- About ---------- */
.profile { margin: 5vh 0 0; max-width: 640px; }
.profile > div {
  display: grid;
  grid-template-columns: 7em 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.profile dt { font-family: var(--mono); font-size: .75rem; letter-spacing: .1em; color: var(--accent); padding-top: .25em; }
.profile dd { margin: 0; font-size: .95rem; }

/* ---------- End ---------- */
.panel-end { align-items: center; text-align: center; border-right: 0; }
.end-mark {
  margin: 0;
  font-size: clamp(8rem, 30vw, 22rem);
  font-weight: 700;
  line-height: .9;
  letter-spacing: -.06em;
}
.back { margin-top: 24px; text-decoration: none; color: var(--accent); }

/* ---------- Desktop widths ---------- */
@media (min-width: 900px) {
  .panel { width: 78vw; }
  .panel-hero { width: 100vw; }
  .panel-bars { width: 92vw; }
  .panel-split { width: 108vw; grid-template-columns: 1fr 1fr; align-items: center; gap: 6vw; }
  .panel-end { width: 72vw; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  :root { --hud-h: 56px; --wire-y: 12vh; }
  .hud { padding: 0 16px; gap: 14px; }
  .nav { display: none; }
  .panel { padding-left: 24px; padding-right: 24px; }
  .node { left: 24px; }
  .scroll-hint { right: 24px; }
  .bars-text { margin-left: 16px; margin-right: 16px; padding: 20px 22px 24px; }
  .rack { width: min(300px, 100%); }
  .unit { height: 22px; }
  .unit.u2 { height: 47px; }
  .topo, .construct { width: min(320px, 100%); }
  .profile > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.notfound h1 { margin: 0; font-size: clamp(5rem, 20vw, 12rem); line-height: 1; letter-spacing: -.05em; color: var(--accent); }
