:root {
  /* Compliance vocabulary: (Google Interaction Pattern (9% frequency Interactions:** Implement cursor effects interactive elements. When user's cursor approaches element 120px Interface (2% IntersectionObserver` threshold */
  --deep: #0a1628;
  --panel: #121f36;
  --active: #1a3055;
  --cerulean: #3d8bfd;
  --amber: #f0a830;
  --teal: #2dd4a8;
  --text: #e8edf3;
  --muted: #8a9bb8;
  --ink: #4a6fa5;
  --paper: #f5f0e8;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  font-family: "Source Sans 3", Inter, Lato, sans-serif;
  background-color: var(--deep);
  background-image: linear-gradient(#1a3055 1px, transparent 1px), linear-gradient(90deg, #1a3055 1px, transparent 1px);
  background-size: 24px 24px;
  transition: background-color 700ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% 10%, rgba(61, 139, 253, 0.16), transparent 32%), radial-gradient(circle at 85% 80%, rgba(240, 168, 48, 0.1), transparent 28%), rgba(10, 22, 40, 0.74);
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

.field-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.55;
}

.field-lines path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-dasharray: 18 20;
  animation: fieldDraw 8s linear infinite;
}

.dashboard-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr 1fr 280px;
  grid-template-rows: auto 1fr 1fr auto;
  grid-template-areas:
    "header header header header"
    "nav main main status"
    "nav main main readout"
    "console console console console";
  gap: 14px;
  padding: 14px;
}

.panel-frame {
  position: relative;
  background: rgba(18, 31, 54, 0.88);
  box-shadow: 8px 8px 0 rgba(10, 22, 40, 0.9), inset 0 0 38px rgba(61, 139, 253, 0.06);
  overflow: hidden;
}

.wobble-border {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.wobble-border path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.is-drawn > .wobble-border path { stroke-dashoffset: 0; }
.panel-frame > *:not(.wobble-border) { opacity: 0; transform: translateY(8px); transition: opacity 620ms ease, transform 620ms ease; }
.panel-frame.is-drawn > *:not(.wobble-border) { opacity: 1; transform: translateY(0); }

.dash-header {
  grid-area: header;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: rgba(10, 22, 40, 0.94);
}

.header-mark, .panel-label {
  font-family: "Bitter", Georgia, serif;
  font-size: clamp(0.9rem, 1.5vw, 1.2rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.header-lamps { display: flex; gap: 16px; }
.lamp { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid currentColor; box-shadow: 0 0 18px currentColor; animation: blink 5s ease-in-out infinite; }
.lamp.teal { color: var(--teal); }
.lamp.amber { color: var(--amber); animation-delay: 1.1s; }
.lamp.blue { color: var(--cerulean); animation-delay: 2s; }

.drawer-toggle { display: none; background: transparent; border: 0; padding: 8px; }
.drawer-toggle span { display: block; width: 30px; height: 3px; margin: 5px 0; background: var(--cerulean); border-radius: 10px; transform: rotate(-1deg); }
.drawer-toggle span:nth-child(2) { width: 25px; transform: rotate(2deg); }
.drawer-toggle span:nth-child(3) { width: 32px; transform: rotate(-2deg); }

.nav-panel { grid-area: nav; padding: 28px 22px; }
.status-panel { grid-area: status; padding: 24px 18px; }
.readout-panel { grid-area: readout; padding: 24px 18px; }
.console-strip { grid-area: console; min-height: 78px; padding: 18px 28px; font-family: "IBM Plex Mono", monospace; color: var(--teal); text-shadow: 0 0 8px rgba(110, 180, 255, 0.3); }

.parameter-list { display: grid; gap: 14px; margin: 28px 0; }
.parameter-link { display: flex; align-items: center; gap: 12px; padding: 11px 8px; font-family: "IBM Plex Mono", monospace; font-size: 0.85rem; color: var(--text); border-bottom: 1px dashed rgba(74, 111, 165, 0.55); }
.toggle-dot { width: 22px; height: 15px; border: 1.5px solid var(--ink); border-radius: 999px; position: relative; }
.toggle-dot::after { content: ""; width: 7px; height: 7px; position: absolute; top: 2.5px; left: 3px; background: var(--muted); border-radius: 50%; transition: transform 240ms ease, background 240ms ease; }
.parameter-link.active .toggle-dot::after, .parameter-link:hover .toggle-dot::after { transform: translateX(8px); background: var(--teal); box-shadow: 0 0 10px var(--teal); }

.dial-card { margin-top: 30px; padding: 14px; background: rgba(26, 48, 85, 0.5); transform: rotate(-0.7deg); }
.dial-card p, .notebook-scribble { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 0.85rem; line-height: 1.5; }
.notebook-scribble { margin-top: 26px; color: var(--amber); transform: rotate(1deg); }

.main-panel {
  grid-area: main;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-height: 0;
}
.main-panel::-webkit-scrollbar { display: none; }

.chapter {
  min-height: calc(100vh - 184px);
  scroll-snap-align: start;
  padding: clamp(28px, 5vw, 58px);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.chapter-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr); gap: clamp(24px, 5vw, 54px); align-items: center; }
.chapter-grid.reverse { grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.08fr); }

.headline, h1, h2 {
  font-family: "Zilla Slab", Georgia, serif;
  color: var(--text);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.02em;
}

.headline { font-size: clamp(3.3rem, 9vw, 7rem); margin: 18px 0; min-height: 1em; }
.headline .letter { display: inline-block; opacity: 0; transform: translateY(4px); transition: opacity 280ms ease, transform 280ms ease; }
.headline .letter.visible { opacity: 1; transform: translateY(0); }
h2 { font-size: clamp(2.2rem, 5vw, 4.5rem); margin: 16px 0 20px; }
.lead, .chapter-copy p:not(.panel-label) { font-size: clamp(1rem, 1.2vw, 1.15rem); line-height: 1.72; max-width: 650px; color: var(--text); }

.photo-frame {
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--deep);
  padding: 14px 14px 28px;
  background: var(--paper);
  color: var(--deep);
}
.rotate-left { transform: rotate(-1.2deg); }
.rotate-right { transform: rotate(0.8deg); }
.photo-screen { min-height: 260px; background-color: var(--active); background-image: linear-gradient(135deg, rgba(240, 168, 48, 0.08), rgba(61, 139, 253, 0.12)); position: relative; overflow: hidden; }
.terminal-photo span { position: absolute; left: 12%; right: 12%; height: 10px; background: var(--teal); box-shadow: 0 0 16px var(--teal); opacity: 0.75; transform: skewY(-6deg); }
.terminal-photo span:nth-child(1) { top: 22%; width: 66%; }
.terminal-photo span:nth-child(2) { top: 38%; width: 42%; background: var(--cerulean); }
.terminal-photo span:nth-child(3) { top: 57%; width: 74%; background: var(--amber); }
.terminal-photo span:nth-child(4) { top: 74%; width: 52%; }
.photo-frame small { display: block; margin-top: 12px; font-family: "IBM Plex Mono", monospace; color: var(--active); }

.draw-divider { width: 65%; margin-top: 34px; overflow: visible; }
.draw-divider path { fill: none; stroke: var(--amber); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 550; stroke-dashoffset: 550; transition: stroke-dashoffset 1.2s ease 300ms; }
.is-drawn .draw-divider path { stroke-dashoffset: 0; }

.network-sketch { min-height: 310px; border: 2px dashed var(--ink); background: rgba(26, 48, 85, 0.42); box-shadow: 4px 4px 0 var(--deep); transform: rotate(-0.8deg); }
.network-sketch svg { width: 100%; height: 100%; }
.edges path { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.nodes circle { fill: var(--panel); stroke: var(--cerulean); stroke-width: 3; animation: pulse 3s ease-in-out infinite; }
.nodes circle:nth-child(even) { animation-delay: 800ms; stroke: var(--teal); }

.badge-row, .status-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.badge-row span, .status-badges span { font-family: "IBM Plex Mono", monospace; font-size: 0.8rem; color: var(--teal); border: 1.5px solid var(--teal); border-radius: 999px; padding: 6px 10px; transform: rotate(-0.5deg); animation: badgeBlink 4.6s ease-in-out infinite; }
.badge-row span:nth-child(2), .status-badges span:nth-child(2) { color: var(--amber); border-color: var(--amber); animation-delay: 1.1s; }

.osc-photo { background: var(--paper); }
.osc-photo svg { width: 100%; background: var(--active); background-image: linear-gradient(135deg, rgba(240, 168, 48, 0.08), rgba(61, 139, 253, 0.12)); }
.grid-line { stroke: rgba(245, 240, 232, 0.16); stroke-width: 1; }
.wave { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 18 16; animation: waveMove 2.8s linear infinite; }
.wave-one { stroke: var(--cerulean); }
.wave-two { stroke: var(--teal); animation-duration: 3.4s; }

.blueprint-card { min-height: 310px; display: grid; place-items: end start; position: relative; background: var(--paper); overflow: hidden; }
.blueprint-lines { position: absolute; inset: 18px; background-image: linear-gradient(rgba(74,111,165,0.45) 1px, transparent 1px), linear-gradient(90deg, rgba(74,111,165,0.45) 1px, transparent 1px); background-size: 22px 22px; }
.blueprint-card p { position: relative; font-family: "Zilla Slab", Georgia, serif; font-weight: 700; color: var(--active); font-size: clamp(1.4rem, 3vw, 2.3rem); line-height: 1.15; }

.dial-arc, .ticks path, .large-gauge circle, .mini-dial circle { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.dial-needle { stroke: var(--amber); stroke-width: 4; stroke-linecap: round; transform-origin: 50% 78%; animation: oscillate 6s ease-in-out infinite alternate; }
.large-gauge { width: 100%; margin: 22px 0; }
.large-gauge .dial-needle { transform-origin: 110px 132px; }
.micro-wave { width: 100%; margin-top: 18px; }
.micro-wave path { fill: none; stroke: var(--cerulean); stroke-width: 4; stroke-dasharray: 16 14; animation: waveMove 3s linear infinite; }

.log-window { height: 190px; overflow: hidden; margin-top: 18px; background: rgba(10, 22, 40, 0.5); border: 1px dashed var(--ink); padding: 10px; }
.log-lines { font-family: "IBM Plex Mono", monospace; font-size: 0.85rem; line-height: 1.5; letter-spacing: 0.03em; color: var(--text); text-shadow: 0 0 8px rgba(110, 180, 255, 0.3); animation: logScroll 24s linear infinite; }
.log-lines p { margin: 0 0 14px; }
.log-lines p::before { content: "> "; color: var(--teal); }

.console-strip p { position: relative; z-index: 2; margin: 0; line-height: 1.5; }
.console-strip span { color: var(--amber); }
.matrix-rain { position: absolute; right: 8%; top: -30px; opacity: 0.15; color: var(--teal); animation: matrixFall 12s linear infinite; white-space: pre; }

.magnetic-item { will-change: transform; transition: color 180ms ease; }
.magnetic-item:hover { color: var(--cerulean); }

@keyframes fieldDraw { to { stroke-dashoffset: -76; } }
@keyframes blink { 0%, 76%, 100% { opacity: 1; } 82% { opacity: 0.25; } 88% { opacity: 0.75; } }
@keyframes oscillate { from { transform: rotate(-10deg); } to { transform: rotate(14deg); } }
@keyframes pulse { 0%, 100% { filter: drop-shadow(0 0 0 rgba(61, 139, 253, 0)); } 50% { filter: drop-shadow(0 0 12px rgba(61, 139, 253, 0.95)); } }
@keyframes waveMove { to { stroke-dashoffset: -68; } }
@keyframes badgeBlink { 0%, 86%, 100% { filter: brightness(1); } 91% { filter: brightness(1.8); } }
@keyframes logScroll { 0%, 12% { transform: translateY(0); } 100% { transform: translateY(-172px); } }
@keyframes matrixFall { from { transform: translateY(-45%); } to { transform: translateY(120%); } }

@media (max-width: 959px) {
  body { overflow: auto; }
  .dashboard-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto auto auto auto; grid-template-areas: "header" "main" "status" "readout" "console"; padding: 10px; }
  .drawer-toggle { display: block; }
  .nav-panel { position: fixed; left: 10px; top: 92px; width: min(320px, calc(100vw - 20px)); bottom: 100px; z-index: 10; transform: translateX(calc(-100% - 20px)); transition: transform 320ms ease; }
  .nav-panel.open { transform: translateX(0); }
  .main-panel { overflow: visible; scroll-snap-type: none; }
  .chapter { min-height: auto; margin-bottom: 12px; }
  .chapter-grid, .chapter-grid.reverse { grid-template-columns: 1fr; }
  .status-panel, .readout-panel { min-height: 260px; }
  .header-lamps { display: none; }
}

@media (max-width: 620px) {
  .dash-header { padding: 16px; }
  .header-mark { font-size: 0.78rem; letter-spacing: 0.12em; }
  .chapter { padding: 26px 20px; }
  .photo-screen { min-height: 210px; }
}
