:root {
  font-synthesis: none;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
  src: url("/assets/fonts/newsreader-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
  src: url("/assets/fonts/newsreader-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --primary: #111113;
  --secondary: #666A73;
  --tertiary: #FF4D00;
  --neutral-warm: #FAFAF7;
  --surface-glass: #F8F8F5;
  --surface: #FFFFFF;
  --surface-muted: #EBEBEB;
  --neutral-cool: #ECEEF4;
  --neutral-strong: #D8D5CC;
  
  --edge: #E6E4DD; 
  --edge-dark: #C7C4BC;
  --grid: #E6E4DD;
  --grid-dark: #C7C4BC;

  --on-light: #111113;
  --on-dark: #FFFFFF;
  
  --trace: #7EA2FF;
  --signal-orange: #FF4D00;
  --signal-orange-soft: #FF7A1A;
  --accent-memory: #6E56CF;
  --accent-verified: #18794E;
  --accent-alert: #C23B22;

  --rounded-sm: 4px;
  --rounded-md: 8px;
  --rounded-lg: 12px;
  --rounded-panel: 20px;
  --rounded-full: 999px;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --spacing-3xl: 72px;
  --spacing-4xl: 96px;
}

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

html {
  overflow-x: hidden;
}

body.dark-mode {
  --primary: #FAFAF7;
  --secondary: #A2A6AD;
  --on-light: #FAFAF7;
  
  --neutral-warm: #0B0D10;
  --surface-glass: #111411; 
  --surface: #15181A;
  --surface-muted: #1A1C1F;
  --neutral-cool: #0E1012;
  --neutral-strong: #232824;
  
  --edge: #262B28; 
  --edge-dark: #1F2420;
  --grid: #262B28;
  
  --trace: #7EA2FF;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background-color: var(--neutral-warm);
  color: var(--on-light);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.xray-page-trace {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 8;
  width: 100%;
  min-height: 100vh;
  opacity: 0;
  overflow: visible;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

body.dark-mode .xray-page-trace {
  opacity: 0.58;
}

.trace-route {
  opacity: 0.78;
  filter: drop-shadow(0 0 4px color-mix(in srgb, currentColor 60%, transparent));
}

.trace-route-glow {
  opacity: 0.22;
  filter: blur(6px);
}

.trace-station {
  opacity: 0.92;
}

.trace-train {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.82));
}

.floating-header {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 40;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 3px;
  width: max-content;
  max-width: calc(100vw - 28px);
  min-height: 58px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--rounded-full);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(248, 248, 245, 0.46));
  box-shadow: 0 18px 54px rgba(17, 17, 19, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.88), inset 0 -1px 0 rgba(17, 17, 19, 0.05);
  transform: translate3d(-50%, -86px, 0) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.38s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.24s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.floating-header.is-visible {
  transform: translate3d(-50%, 0, 0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

body.dark-mode .floating-header {
  border-color: rgba(255, 255, 255, 0.09);
  background: linear-gradient(135deg, rgba(21, 24, 26, 0.7), rgba(17, 20, 17, 0.42));
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(255, 77, 0, 0.08);
}

.floating-logo,
.floating-menu,
.floating-xray-control {
  display: inline-flex;
  align-items: center;
}

.floating-logo {
  gap: 8px;
  min-height: 46px;
  padding: 0 10px 0 5px;
  border-radius: var(--rounded-full);
  color: var(--primary);
  font-size: 0.94rem;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.floating-logo-mark {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  background: transparent;
  color: var(--signal-orange);
  font-family: "JetBrains Mono", monospace;
  font-size: 1.82rem;
  line-height: 1;
}

.floating-menu {
  gap: 1px;
}

.floating-menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 4px;
  border-radius: var(--rounded-full);
  color: var(--secondary);
  font-size: 0.66rem;
  font-weight: 620;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.floating-xray-control {
  gap: 5px;
  min-height: 42px;
  padding: 0 6px;
  border-left: 1px solid rgba(17, 17, 19, 0.12);
  color: var(--secondary);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6rem;
  font-weight: 620;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.floating-xray-control .hw-toggle {
  width: 30px;
  height: 16px;
}

.floating-xray-control .hw-toggle::after {
  width: 12px;
  height: 12px;
}

.floating-xray-control .hw-toggle:checked::after {
  transform: translateX(14px);
}

body.dark-mode .floating-xray-control {
  border-left-color: rgba(255, 255, 255, 0.1);
  color: var(--trace);
}

body.dark-mode .floating-logo-mark {
  color: var(--signal-orange-soft);
}

h1, h2, h3, .display-xl, .display-2xl {
  margin: 0 0 var(--spacing-sm);
  font-family: "Newsreader", serif;
  font-weight: 350;
  letter-spacing: -0.025em;
  color: var(--primary);
}

.hero-title {
  font-weight: 300;
  font-size: clamp(3.5rem, 5.5vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: var(--spacing-xl);
}

.section-divider {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: var(--spacing-xl);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-color: var(--surface-muted); 
  border-bottom: 1px solid var(--grid);
}

.section-divider::before {
  content: "";
  display: none;
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--heading-illustration);
  background-repeat: no-repeat;
  background-position: right 8% center;
  background-size: min(420px, 58vw) auto;
  opacity: 0.28;
  pointer-events: none;
}

body.dark-mode .section-divider::before {
  opacity: 0.34;
}

.note-teaser {
  isolation: isolate;
  overflow: hidden;
  min-height: 330px;
}

.note-teaser::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: var(--heading-illustration);
  background-repeat: no-repeat;
  background-position: right -8% center;
  background-size: min(560px, 74vw) auto;
  filter: grayscale(1) contrast(1.18) saturate(0.2);
  opacity: 0.16;
  pointer-events: none;
}

.note-teaser::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(90deg, var(--surface-glass) 0%, color-mix(in srgb, var(--surface-glass) 84%, transparent) 58%, transparent 100%);
  pointer-events: none;
}

.note-teaser > * {
  position: relative;
  z-index: 1;
}

body.dark-mode .note-teaser::before {
  opacity: 0.24;
  filter: grayscale(1) invert(1) contrast(1.45) saturate(0);
}

.section-divider .editorial-header {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
}

.editorial-header {
  padding-top: var(--spacing-xs);
  margin-bottom: var(--spacing-lg);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.editorial-header h2 {
  font-size: 2.25rem;
  margin: 0;
}
.editorial-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xs);
}

.body-lg { font-size: 1.125rem; line-height: 1.7; }
.body-md { font-size: 1rem; }
.body-sm { font-size: 0.9375rem; line-height: 1.55; color: var(--secondary); }

/* Editorial Wired Typography */
.pseudo-footnote {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.45em;
  color: var(--secondary);
  vertical-align: super;
  margin-left: 3px;
  letter-spacing: 0;
  opacity: 0.8;
  font-weight: 400;
}
.circle-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  border: 1px solid var(--secondary);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  color: var(--secondary);
  margin-right: 8px;
  line-height: 1;
}
.scramble-text {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--trace);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  min-width: 80px;
}

/* Glass Effects */
.liquid-glass {
  background-color: rgba(248, 248, 245, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.02), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
body.dark-mode .liquid-glass {
  background-color: rgba(17, 20, 17, 0.55);
  border-color: rgba(255, 255, 255, 0.04);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hardware-label { 
  font-family: "JetBrains Mono", monospace; 
  font-size: 0.65rem; 
  font-weight: 500; 
  line-height: 1; 
  letter-spacing: 0.06em; 
  display: inline-block; 
  margin-bottom: var(--spacing-xs); 
  color: var(--secondary); 
  text-transform: uppercase; 
}

.mono-sm { font-family: "JetBrains Mono", monospace; font-size: 0.75rem; font-weight: 500; line-height: 1.45; }

/* Bento Grid System */
.bento-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(12px, 3vw, var(--spacing-xl));
}

.article-shell .bento-wrapper {
  padding-top: 96px;
}

.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-lg);
  min-height: 64px;
  margin-bottom: var(--spacing-lg);
}

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 1.32rem;
  color: var(--primary);
  letter-spacing: -0.01em;
  line-height: 1;
}

.logo sup {
  margin-left: 2px;
  color: var(--signal-orange);
  font-family: "JetBrains Mono", monospace;
  font-size: 1.18rem;
  line-height: 0;
}

.nav { display: flex; align-items: center; justify-content: flex-end; gap: var(--spacing-lg); min-width: 0; }
.nav-links,
.floating-menu {
  display: inline-flex;
  align-items: center;
}

.nav-links {
  gap: var(--spacing-sm);
  min-width: 0;
}

.nav a,
.floating-menu a {
  position: relative;
  color: var(--secondary);
  text-decoration: none;
}

.nav a {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav a::after,
.floating-menu a::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 1px;
  background-color: currentColor;
  opacity: 0;
  transform: scaleX(0.45);
  transform-origin: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible,
.floating-menu a:hover,
.floating-menu a:focus-visible {
  color: var(--primary);
}

.nav a:hover::after,
.nav a:focus-visible::after,
.floating-menu a:hover::after,
.floating-menu a:focus-visible::after {
  opacity: 0.72;
  transform: scaleX(1);
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
  background-color: var(--grid);
  border: 1px solid var(--grid);
  border-radius: var(--rounded-lg);
  overflow: hidden;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.hero-composite {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: var(--spacing-xl);
  min-height: 60vh;
  padding: var(--spacing-xl);
}

.hero-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: clamp(var(--spacing-xl), 5vw, var(--spacing-3xl));
  border-radius: var(--rounded-md);
}

.hero-panel-primary {
  min-height: min(560px, 72vh);
}

.bento-item {
  background-color: var(--surface-glass);
  padding: var(--spacing-xl);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: background-color 0.4s ease;
}

.bento-item.blueprint {
  background-color: var(--neutral-cool);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(125,125,125,0.03) 10px, rgba(125,125,125,0.03) 11px);
}

.col-span-12 { grid-column: span 12; }
.col-span-8 { grid-column: span 8; }
.col-span-6 { grid-column: span 6; }
.col-span-4 { grid-column: span 4; }
.col-span-3 { grid-column: span 3; }

@media (max-width: 1024px) {
  .col-span-8, .col-span-6, .col-span-4, .col-span-3 { grid-column: span 12; }
  .hero-composite {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .floating-header {
    top: 10px;
    grid-template-columns: 1fr;
    gap: 2px;
    width: min(calc(100vw - 24px), 420px);
    padding: 7px;
  }
  .floating-logo {
    justify-content: center;
    min-height: 34px;
    padding: 0;
  }
  .floating-menu {
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
  }
  .floating-menu a {
    min-height: 30px;
    padding: 0 4px;
    font-size: 0.62rem;
  }
  .floating-xray-control {
    min-height: 30px;
    padding: 0 4px;
    border-left: 0;
    font-size: 0.56rem;
  }
}

@media (max-width: 760px) {
  .article-shell .bento-wrapper {
    padding-top: 112px;
  }

  .nav-bar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: var(--spacing-md);
    min-height: 0;
    margin-bottom: var(--spacing-md);
  }

  .logo {
    font-size: 1rem;
    line-height: 1.15;
  }

  .nav {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    width: 100%;
  }

  .nav-links {
    flex: 0 0 100%;
    justify-content: flex-start;
    gap: 4px;
    white-space: nowrap;
  }

  .nav a,
  .x-ray-module {
    min-height: 38px;
  }

  .nav a {
    display: inline-flex;
    align-items: center;
    padding: 0 2px;
  }

  .nav a::after {
    left: 2px;
    right: 2px;
    bottom: 5px;
  }

  .x-ray-module {
    justify-content: space-between;
    padding: 6px 12px;
  }

  .bento-grid {
    border-radius: var(--rounded-md);
  }

  .bento-item {
    padding: var(--spacing-lg);
  }

  .hero-composite {
    gap: var(--spacing-md);
    padding: var(--spacing-md);
  }

  .hero-panel {
    padding: clamp(var(--spacing-lg), 7vw, var(--spacing-xl));
  }

  .hero-panel-primary {
    min-height: 560px;
  }

  .hero-title {
    font-size: clamp(3rem, 14.5vw, 4.35rem);
    line-height: 0.92;
  }

  .body-lg {
    font-size: 1.02rem;
    line-height: 1.58;
  }

  .editorial-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-xs);
  }

  .editorial-header h2 {
    font-size: 2rem;
  }

  .editorial-meta {
    flex-wrap: wrap;
    gap: var(--spacing-xs);
  }

  .button-primary {
    width: 100%;
    min-height: 44px;
    padding: 0 var(--spacing-md);
  }

  .button-secondary {
    min-height: 38px;
  }

  .hw-control-group {
    flex-wrap: wrap;
  }

  .footer {
    flex-direction: column;
    gap: var(--spacing-sm);
  }
}

@media (max-width: 430px) {
  .floating-header {
    max-width: calc(100vw - 16px);
  }

  .floating-logo {
    font-size: 0.76rem;
  }

  .floating-menu a {
    padding: 0 3px;
    font-size: 0.58rem;
  }

  .floating-xray-control {
    font-size: 0.54rem;
  }

  .hero-composite {
    padding: var(--spacing-sm);
  }

  .hero-panel-primary {
    min-height: 520px;
  }

  .hero-title {
    font-size: clamp(2.6rem, 14vw, 3.45rem);
  }

  .section-divider {
    padding: var(--spacing-lg);
  }

  .code-block {
    overflow-x: auto;
  }
}

/* Hardware Metaphors & Micro-interactions */
.hw-control-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: auto;
  padding-top: var(--spacing-lg);
}

.x-ray-module {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border: 1px solid var(--grid-dark);
  border-radius: var(--rounded-lg);
  background-color: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.x-ray-module:hover,
.x-ray-module:focus-within {
  border-color: rgba(255, 77, 0, 0.35);
  box-shadow: 0 0 0 1px rgba(255, 77, 0, 0.05), 0 0 18px rgba(255, 77, 0, 0.09), 0 2px 8px rgba(0,0,0,0.02);
  filter: saturate(1.02);
}
body.dark-mode .x-ray-module {
  border-color: var(--trace);
  box-shadow: 0 0 12px rgba(126, 162, 255, 0.15);
}
body.dark-mode .x-ray-module:hover,
body.dark-mode .x-ray-module:focus-within {
  box-shadow: 0 0 0 1px rgba(126, 162, 255, 0.08), 0 0 18px rgba(126, 162, 255, 0.22);
}

.hw-lamp {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--secondary);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
  transition: all 0.25s ease;
}
.hw-lamp.verified {
  background-color: var(--accent-verified);
  box-shadow: 0 0 4px var(--accent-verified), inset 0 1px 1px rgba(255,255,255,0.3);
}
.hw-lamp.memory {
  background-color: var(--accent-memory);
  box-shadow: 0 0 4px var(--accent-memory), inset 0 1px 1px rgba(255,255,255,0.3);
}
.hw-lamp.alert {
  background-color: var(--accent-alert);
  box-shadow: 0 0 4px var(--accent-alert), inset 0 1px 1px rgba(255,255,255,0.3);
}

.hw-toggle {
  appearance: none;
  width: 36px;
  height: 20px;
  background-color: var(--neutral-strong);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  outline: none;
  border: 1px solid rgba(125,125,125,0.1);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.hw-toggle:hover,
.hw-toggle:focus-visible {
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1), 0 0 10px rgba(255, 77, 0, 0.11);
}
.hw-toggle::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 16px;
  height: 16px;
  background-color: #FAFAF7;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.hw-toggle:checked { background-color: var(--signal-orange); }
.hw-toggle:checked::after { transform: translateX(16px); }

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 24px;
  border-radius: var(--rounded-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  background-color: var(--signal-orange);
  color: #FFFFFF;
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.button-primary:hover { background-color: var(--primary); transform: translateY(-1px); }

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--rounded-full);
  font-size: 0.65rem;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  background-color: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.button-secondary:hover { background-color: var(--primary); color: var(--neutral-warm); }

.code-block {
  background-color: var(--primary);
  color: var(--neutral-warm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--rounded-sm);
  margin: var(--spacing-md) 0;
  border: 1px solid var(--grid-dark);
  font-size: 0.7rem;
}

/* Animations */
@keyframes basilisk-grid-drift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(24px, -18px, 0); }
}

@keyframes basilisk-trace-sweep {
  0% { stroke-dashoffset: 260; opacity: 0; }
  20% { opacity: 0.8; }
  80% { opacity: 0.8; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes signal-lamp-pulse {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* X-Ray Trace Logs & Elements */
.trace-log-node {
  position: absolute;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  color: var(--trace);
  background-color: var(--surface-glass);
  padding: 2px 6px;
  border: 1px solid var(--grid);
  border-radius: var(--rounded-sm);
  white-space: nowrap;
  animation: fadeInNode 0.3s forwards;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
@keyframes fadeInNode { to { opacity: 1; } }

.x-ray-crosshair {
  position: absolute;
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  color: var(--accent-alert);
  animation: fadeInOut 2.5s forwards;
  opacity: 0;
  pointer-events: none;
  z-index: 12;
}
@keyframes fadeInOut {
  0% { opacity: 0; transform: scale(0.5); }
  20% { opacity: 0.8; transform: scale(1.5); }
  40% { opacity: 0.5; transform: scale(1); }
  80% { opacity: 0.5; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.5); }
}

.x-ray-only {
  opacity: 0 !important;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
body.dark-mode .x-ray-only {
  opacity: 1 !important;
  pointer-events: auto;
}

.x-ray-mark {
  position: absolute;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.55rem;
  color: var(--secondary);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  letter-spacing: 0.1em;
  z-index: 5;
}
body.dark-mode .x-ray-mark { opacity: 0.6; }

/* Lattice wrap */
.basilisk-lattice-wrap {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  pointer-events: none;
}
.basilisk-lattice-wrap svg {
  width: 120%;
  height: 120%;
  display: block;
}
.basilisk-grid-drift {
  animation: none;
}

.lattice-light { opacity: 0.04; transition: opacity 0.6s ease; }
.lattice-dark { opacity: 0.08; transition: opacity 0.6s ease; }
.lattice-node { opacity: 0; transition: opacity 0.6s ease; }
.pulsing-node { animation: signal-lamp-pulse 1s infinite alternate; }

.basilisk-trace-path { opacity: 0; transition: opacity 0.6s ease; stroke-dasharray: 260; stroke-dashoffset: 260; animation: basilisk-trace-sweep 4s ease-in-out infinite; }
.trace-2 { animation-duration: 5.5s; animation-delay: 1s; stroke-dasharray: 220; stroke-dashoffset: 220; }
.trace-3 { animation-duration: 6.8s; animation-delay: 2.5s; stroke-dasharray: 300; stroke-dashoffset: 300; }
.trace-4 { animation-duration: 4.2s; animation-delay: 0.5s; stroke-dasharray: 200; stroke-dashoffset: 200; }
.trace-5 { animation-duration: 3.8s; animation-delay: 1.8s; stroke-dasharray: 150; stroke-dashoffset: 150; }

body.dark-mode .lattice-light { opacity: 0.16; stroke: #262B28; }
body.dark-mode .lattice-dark { opacity: 0.22; stroke: #1F2420; }
body.dark-mode .lattice-node { opacity: 0.72; }
body.dark-mode .basilisk-trace-path { opacity: 0.8; }
body.dark-mode .trace-3, body.dark-mode .trace-4 { opacity: 0.6; }

@media (min-width: 761px) and (prefers-reduced-motion: no-preference) {
  .floating-header {
    backdrop-filter: blur(18px) saturate(1.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
  }

  .liquid-glass {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  body.dark-mode .basilisk-grid-drift {
    animation: basilisk-grid-drift 28s ease-in-out infinite alternate;
  }
}

@media (prefers-reduced-motion: reduce) {
  .basilisk-grid-drift, .basilisk-trace-path, .trace-2, .trace-3, .trace-4, .trace-5, .pulsing-node, .x-ray-crosshair { animation: none; }
  .floating-header { transition-duration: 0.001ms !important; }
}

.footer {
  display: flex;
  justify-content: space-between;
  padding-top: var(--spacing-xl);
  margin-top: var(--spacing-3xl);
  color: var(--secondary);
  font-size: 0.65rem;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
