/* ==========================================================================
   TRON LEGACY PORTFOLIO
   --------------------------------------------------------------------------
   Lighting model: every emissive element is built from a blown-out white core
   wrapped in progressively wider, dimmer accent halos. Colour lives in the
   halo, never in the core — that is what makes neon read as light rather than
   as paint.
   ========================================================================== */

:root {
  --bg: #030609;
  --bg-deep: #01050a;

  --cyan: #00e5ff;
  --cyan-soft: #7dfdfe;
  --cyan-dim: rgba(0, 229, 255, 0.35);
  --cyan-glow: rgba(0, 229, 255, 0.55);
  --cyan-glow-deep: rgba(0, 120, 140, 0.45);
  --cyan-far: rgba(0, 150, 200, 0.22);

  --orange: #ff9a1f;
  --orange-soft: #ffc46a;
  --orange-dim: rgba(255, 154, 31, 0.35);
  --orange-glow: rgba(255, 154, 31, 0.55);
  --orange-far: rgba(200, 100, 12, 0.24);

  --text: #d8f4ff;
  --text-dim: rgba(216, 244, 255, 0.45);
  --text-muted: rgba(216, 244, 255, 0.28);
  --white-hot: #eafdff;

  --panel-bg: rgba(3, 10, 18, 0.72);
  --panel-edge: rgba(125, 253, 254, 0.5);

  --font-display: "Orbitron", sans-serif;
  --font-body: "Rajdhani", sans-serif;
  --section-pad: clamp(1.1rem, 5vw, 3.5rem);

  /* Reusable emission stacks. Core first, halo outward. */
  --neon-core: 0 0 1px #fff, 0 0 4px #fff, 0 0 9px var(--cyan-soft);
  --neon-halo: 0 0 20px var(--cyan), 0 0 44px var(--cyan-glow),
    0 0 88px var(--cyan-glow-deep), 0 0 150px var(--cyan-far);

  --edge-bloom: inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 0 18px rgba(0, 200, 255, 0.07), 0 0 2px rgba(255, 255, 255, 0.5),
    0 0 10px var(--cyan-glow), 0 0 28px var(--cyan-glow-deep),
    0 0 64px var(--cyan-far);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(0, 229, 255, 0.28);
  color: #fff;
}

:focus-visible {
  outline: 1px solid var(--cyan-soft);
  outline-offset: 3px;
}

/* ==========================================================================
   WebGL Canvas
   ========================================================================== */

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ==========================================================================
   Atmosphere layer — vignette, CRT roll bar, mains-flicker dip
   --------------------------------------------------------------------------
   All three are composited (opacity / transform only) so they stay cheap.
   ========================================================================== */

.fx {
  position: fixed;
  inset: 0;
  z-index: 38;
  pointer-events: none;
  contain: layout paint style;
}

.fx-vignette {
  position: absolute;
  inset: -2px;
  /* Corner-weighted so the falloff never reaches content that has scrolled to
     the top or bottom edge of the viewport. */
  background:
    radial-gradient(
      ellipse 92% 84% at 50% 46%,
      transparent 0%,
      transparent 56%,
      rgba(0, 2, 5, 0.26) 82%,
      rgba(0, 2, 5, 0.62) 100%
    ),
    linear-gradient(
      to bottom,
      rgba(0, 2, 5, 0.3) 0%,
      transparent 12%,
      transparent 90%,
      rgba(0, 2, 5, 0.32) 100%
    );
}

/* Slow CRT retrace band drifting down the screen. */
.fx-roll {
  position: absolute;
  left: -5%;
  right: -5%;
  height: 26vh;
  top: -30vh;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(160, 246, 255, 0.035) 42%,
    rgba(220, 253, 255, 0.06) 50%,
    rgba(160, 246, 255, 0.03) 58%,
    transparent 100%
  );
  animation: crt-roll 11s linear infinite;
  animation-delay: var(--flk-delay, 0s);
  will-change: transform;
}

/* Very brief whole-room luminance dips — the mains flickering. */
.fx-dip {
  position: absolute;
  inset: 0;
  background: #000209;
  opacity: 0;
  animation: room-dip 19s linear infinite;
  animation-delay: var(--flk-delay, 0s);
}

/* Fine CRT scanline grille: sub-pixel pitch, barely-there, plus a whisper of
   chromatic fringing so it reads as a tube rather than as stripes. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 41;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0px,
      rgba(0, 0, 0, 0) 1.5px,
      rgba(0, 0, 0, 0.55) 1.5px,
      rgba(0, 0, 0, 0.55) 3px
    ),
    repeating-linear-gradient(
      to right,
      rgba(255, 0, 60, 0.05) 0px,
      rgba(0, 255, 220, 0.05) 1px,
      rgba(60, 120, 255, 0.05) 2px,
      rgba(0, 0, 0, 0) 3px
    );
  opacity: 0.085;
}

/* ==========================================================================
   No-WebGL Fallback — still decisively Tron
   ========================================================================== */

html.no-webgl #bg-canvas {
  display: none;
}

html.no-webgl body {
  background:
    radial-gradient(
      ellipse 90% 34% at 50% 58%,
      rgba(150, 250, 255, 0.22) 0%,
      rgba(0, 190, 240, 0.12) 18%,
      rgba(0, 90, 130, 0.05) 42%,
      transparent 70%
    ),
    linear-gradient(to bottom, var(--bg-deep) 40%, #041018 58%, var(--bg-deep) 100%);
}

/* Perspective floor. */
html.no-webgl body::before {
  content: "";
  position: fixed;
  left: -60%;
  right: -60%;
  top: 58%;
  bottom: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 47px,
      rgba(0, 229, 255, 0.5) 47px,
      rgba(0, 229, 255, 0.5) 48px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 47px,
      rgba(0, 229, 255, 0.34) 47px,
      rgba(0, 229, 255, 0.34) 48px
    );
  transform: perspective(340px) rotateX(74deg);
  transform-origin: 50% 0%;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 6%, #000 55%, transparent 92%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 6%, #000 55%, transparent 92%);
  opacity: 0.55;
}

/* Horizon light bar. */
html.no-webgl .fx::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--cyan-soft) 18%,
    #fff 50%,
    var(--cyan-soft) 82%,
    transparent 100%
  );
  box-shadow:
    0 0 6px #fff,
    0 0 22px var(--cyan),
    0 0 60px var(--cyan-glow),
    0 0 140px var(--cyan-glow-deep);
  opacity: 0.9;
}

/* ==========================================================================
   Boot Overlay
   ========================================================================== */

#boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  pointer-events: auto;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#boot-overlay.done {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.boot-scanlines {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 2px,
      rgba(0, 229, 255, 0.05) 2px,
      rgba(0, 229, 255, 0.05) 4px
    ),
    radial-gradient(ellipse 70% 55% at 50% 50%, rgba(0, 60, 90, 0.35), transparent 75%);
  opacity: 0.7;
  transition: opacity 0.4s ease;
}

/* The cold-cathode hairline that snaps open before anything else. */
.boot-crt {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 1px;
  transform: translate(-50%, -50%);
  background: linear-gradient(
    90deg,
    transparent,
    var(--cyan-soft) 12%,
    #fff 50%,
    var(--cyan-soft) 88%,
    transparent
  );
  box-shadow: 0 0 6px #fff, 0 0 20px var(--cyan), 0 0 54px var(--cyan-glow);
  opacity: 0;
}

.boot-glyph {
  position: absolute;
  top: calc(50% + 2.6rem);
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 4px #fff,
    0 0 12px var(--cyan-soft),
    0 0 30px var(--cyan),
    0 0 70px var(--cyan-glow),
    0 0 130px var(--cyan-glow-deep);
  opacity: 0;
}

body:not([data-stage]) .boot-glyph,
body[data-stage="1"] .boot-glyph {
  animation: glyph-flicker 0.62s steps(1, end) 0.06s infinite;
}

/* Power-surge bar: hot core, vertical smear trailing behind it. */
.boot-sweep {
  position: absolute;
  left: -4%;
  right: -4%;
  top: -6%;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(125, 253, 254, 0.7) 12%,
    #fff 42%,
    #fff 58%,
    rgba(125, 253, 254, 0.7) 88%,
    transparent 100%
  );
  box-shadow:
    0 0 8px #fff,
    0 0 26px var(--cyan),
    0 0 70px var(--cyan-glow),
    0 0 160px var(--cyan-glow-deep);
  opacity: 0;
}

.boot-sweep::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 34vh;
  background: linear-gradient(
    to top,
    rgba(0, 229, 255, 0.3),
    rgba(0, 160, 210, 0.08) 40%,
    transparent 100%
  );
}

/* White blowout at the instant the grid catches. */
.boot-flare {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 120% 70% at 50% 62%,
    rgba(234, 253, 255, 0.85) 0%,
    rgba(0, 229, 255, 0.4) 22%,
    transparent 62%
  );
  opacity: 0;
}

/* -- Stage 1: black, hairline snap, cursor -- */
body:not([data-stage]) .boot-crt,
body[data-stage="1"] .boot-crt {
  animation: crt-hairline 0.42s cubic-bezier(0.16, 1, 0.3, 1) 0.02s both;
}

/* -- Stage 2: surge -- */
body[data-stage="2"] #boot-overlay {
  animation: overlay-flicker 0.78s ease forwards;
}

body[data-stage="2"] .boot-crt {
  animation: crt-collapse 0.16s ease-in forwards;
}

body[data-stage="2"] .boot-sweep {
  animation: boot-sweep 0.72s cubic-bezier(0.4, 0, 0.15, 1) forwards;
}

body[data-stage="2"] .boot-flare {
  animation: boot-flare 0.85s ease-out 0.16s forwards;
}

body[data-stage="3"] #boot-overlay,
body[data-stage="4"] #boot-overlay {
  background: transparent;
  pointer-events: none;
}

body[data-stage="3"] .boot-scanlines,
body[data-stage="4"] .boot-scanlines {
  opacity: 0;
}

/* ==========================================================================
   Main App Shell
   ========================================================================== */

#app {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Boot Sequence — Content Visibility
   ========================================================================== */

#app[data-booting] #hero-title .l,
#app[data-booting] #hero-tagline,
#app[data-booting] #cv-btn,
#app[data-booting] .hero-rule,
#app[data-booting] .project-card,
#app[data-booting] .section-title,
#app[data-booting] #footer {
  opacity: 0;
}

/* Skip path: boot complete. The boot animations only match under
   [data-booting] selectors, so restoring opacity is all that's needed —
   hover transitions and idle animations must keep working. */
#app:not([data-booting]) #hero-title .l,
#app:not([data-booting]) #hero-tagline,
#app:not([data-booting]) #cv-btn,
#app:not([data-booting]) .hero-rule,
#app:not([data-booting]) .project-card,
#app:not([data-booting]) .section-title,
#app:not([data-booting]) #footer,
#app:not([data-booting]) .scroll-hint {
  opacity: 1;
}

/* Stage 3 — title ignition + tagline */
body[data-stage="3"] #app[data-booting] #hero-title .l,
body[data-stage="4"] #app[data-booting] #hero-title .l {
  animation: var(--ignite-name, letter-ignite-a) 0.9s var(--ignite-delay, 0s) both;
}

body[data-stage="3"] #app[data-booting] .hero-rule,
body[data-stage="4"] #app[data-booting] .hero-rule {
  animation: rule-draw 0.7s ease-out 0.34s both;
}

body[data-stage="3"] #app[data-booting] #hero-tagline,
body[data-stage="4"] #app[data-booting] #hero-tagline {
  animation: text-fade-in 0.75s ease 0.62s both;
}

body[data-stage="3"] #app[data-booting] .scroll-hint,
body[data-stage="4"] #app[data-booting] .scroll-hint {
  opacity: 0.6;
  transition: opacity 0.8s ease 1.2s;
}

/* Stage 4 — CV, section title, cards, footer */
body[data-stage="4"] #app[data-booting] #cv-btn {
  animation: btn-ignite 0.66s ease both;
}

body[data-stage="4"] #app[data-booting] .section-title {
  animation: text-fade-in 0.6s ease 0.1s both;
}

body[data-stage="4"] #app[data-booting] .project-card {
  animation: card-power-on 0.62s calc(var(--card-index) * 110ms) both;
}

body[data-stage="4"] #app[data-booting] .card-crt {
  animation: crt-flash 0.62s calc(var(--card-index) * 110ms) both;
}

body[data-stage="4"] #app[data-booting] #footer {
  animation: text-fade-in 0.7s ease 0.66s both;
}

/* ==========================================================================
   Ambient idle flicker (post-boot)
   --------------------------------------------------------------------------
   Duration and delay are jittered per element from JS (--flk-dur / --flk-delay)
   so nothing in the page ever pulses in lockstep.
   ========================================================================== */

#app:not([data-booting]) #hero-title .l {
  animation: neon-idle var(--flk-dur, 9s) ease-in-out var(--flk-delay, 0s)
    infinite;
}

#app:not([data-booting]) [data-flicker] {
  animation: neon-idle-soft var(--flk-dur, 13s) ease-in-out var(--flk-delay, 0s)
    infinite;
}

/* Rare tired-tube buzz on a single letter — applied by JS, then removed. */
#hero-title .l.buzz {
  animation: tube-buzz var(--buzz-dur, 0.42s) steps(1, end) both !important;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 4rem var(--section-pad) 5rem;
  text-align: center;
  position: relative;
  isolation: isolate;
}

/* Keeps the copy legible where it crosses the luminous grid. */
.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* Sized and centred on the copy block, and fully faded out well above the
     horizon band (~58% of the viewport) so the brightest light in the scene
     stays electric instead of washing out behind a grey sheet. */
  background: radial-gradient(
    ellipse 58% 27% at 50% 27%,
    rgba(1, 5, 10, 0.92) 0%,
    rgba(1, 5, 10, 0.78) 48%,
    rgba(1, 5, 10, 0.3) 76%,
    transparent 100%
  );
}

.hero-core {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(52rem, 100%);
  /* Lift the copy clear of the horizon band in the WebGL scene, which sits at
     roughly 58% of the viewport height. */
  margin-bottom: clamp(7rem, 26vh, 15rem);
}

/* -- Circuit rules ------------------------------------------------------- */

.hero-rule,
.footer-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  width: 100%;
  max-width: 30rem;
  transform-origin: 50% 50%;
}

.hero-rule--top {
  margin-bottom: clamp(1rem, 2.5vh, 1.6rem);
  max-width: 22rem;
}

.hero-rule--bottom {
  margin: clamp(0.6rem, 2vh, 1.35rem) 0 clamp(1.1rem, 2.5vh, 1.7rem);
}

.rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 229, 255, 0.55) 45%,
    var(--cyan-soft) 100%
  );
  box-shadow: 0 0 6px var(--cyan-glow-deep);
}

.rule-line:last-child {
  transform: scaleX(-1);
}

.rule-node {
  width: 9px;
  height: 9px;
  flex: none;
  background: var(--white-hot);
  transform: rotate(45deg);
  box-shadow:
    0 0 3px #fff,
    0 0 10px var(--cyan-soft),
    0 0 24px var(--cyan),
    0 0 52px var(--cyan-glow);
}

.rule-tick {
  width: 34px;
  height: 3px;
  flex: none;
  background: var(--cyan-soft);
  box-shadow:
    0 0 3px #fff,
    0 0 12px var(--cyan),
    0 0 30px var(--cyan-glow);
}

/* -- Title --------------------------------------------------------------- */

.neon-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 10.5vw, 6.4rem);
  letter-spacing: 0.1em;
  line-height: 1.06;
  text-transform: uppercase;
}

.neon-title .l {
  display: inline-block;
  color: var(--white-hot);
  text-shadow:
    0 0 1px #fff,
    0 0 4px #fff,
    0 0 10px var(--cyan-soft),
    0 0 22px var(--cyan),
    0 0 46px var(--cyan-glow),
    0 0 92px var(--cyan-glow-deep),
    0 0 160px var(--cyan-far);
  will-change: opacity, filter;
}

.neon-title .l-space {
  width: 0.32em;
}

/* -- Tagline ------------------------------------------------------------- */

#hero-tagline {
  margin: 0 0 clamp(1.9rem, 4.5vh, 2.9rem);
  max-width: 36rem;
  font-size: clamp(1.02rem, 2.8vw, 1.3rem);
  font-weight: 500;
  letter-spacing: 0.035em;
  color: rgba(216, 244, 255, 0.82);
  /* Dark halo first so the copy holds up over the grid, then a faint bloom. */
  text-shadow:
    0 0 10px rgba(1, 5, 10, 0.98),
    0 0 22px rgba(1, 5, 10, 0.92),
    0 1px 3px rgba(0, 0, 0, 0.9),
    0 0 34px rgba(0, 200, 255, 0.28);
}

/* ==========================================================================
   CV Button — identity-disc slug in an angular Tron panel
   ========================================================================== */

#cv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  min-height: 48px;
  min-width: 172px;
  padding: 0.9rem 2.1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--white-hot);
  text-shadow: 0 0 4px #fff, 0 0 14px var(--cyan-soft), 0 0 30px var(--cyan);
  background:
    linear-gradient(
      to bottom,
      rgba(0, 229, 255, 0.12) 0%,
      rgba(0, 130, 175, 0.05) 45%,
      rgba(0, 229, 255, 0.1) 100%
    ),
    rgba(2, 12, 20, 0.55);
  border: 1px solid var(--panel-edge);
  clip-path: polygon(
    14px 0,
    100% 0,
    100% calc(100% - 14px),
    calc(100% - 14px) 100%,
    0 100%,
    0 14px
  );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 0 20px rgba(0, 200, 255, 0.16),
    0 0 3px rgba(255, 255, 255, 0.55),
    0 0 14px var(--cyan-glow),
    0 0 38px var(--cyan-glow-deep),
    0 0 90px var(--cyan-far);
  transition:
    transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1),
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    background-color 0.28s ease;
  position: relative;
  overflow: hidden;
}

/* Identity disc. */
#cv-btn::before {
  content: "";
  flex: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 26%, transparent 27%),
    radial-gradient(
      circle,
      transparent 0 46%,
      var(--white-hot) 47% 62%,
      transparent 63%
    ),
    radial-gradient(circle, transparent 0 84%, var(--cyan-soft) 85% 100%);
  box-shadow:
    0 0 5px #fff,
    0 0 12px var(--cyan),
    0 0 26px var(--cyan-glow);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}

/* Light traced across the face. */
#cv-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.22) 49%,
    rgba(180, 250, 255, 0.3) 51%,
    transparent 62%
  );
  transform: translateX(-120%);
  animation: btn-shimmer 5.5s ease-in-out var(--flk-delay, 0s) infinite;
  pointer-events: none;
}

#cv-btn:hover,
#cv-btn:focus-visible {
  transform: translateY(-2px) scale(1.035);
  border-color: var(--cyan-soft);
  background-color: rgba(0, 229, 255, 0.06);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    inset 0 0 26px rgba(0, 220, 255, 0.28),
    0 0 5px rgba(255, 255, 255, 0.8),
    0 0 22px var(--cyan),
    0 0 56px var(--cyan-glow),
    0 0 130px var(--cyan-glow-deep);
  outline: none;
}

#cv-btn:hover::before,
#cv-btn:focus-visible::before {
  transform: rotate(180deg) scale(1.12);
}

#cv-btn:active {
  transform: translateY(0) scale(0.99);
}

/* ==========================================================================
   Scroll Hint
   ========================================================================== */

.scroll-hint {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  opacity: 0;
}

/* Sits over the brightest part of the floor, so it gets its own shadow well. */
.scroll-hint::before {
  content: "";
  position: absolute;
  inset: -0.5rem -1.5rem;
  z-index: -1;
  background: radial-gradient(
    ellipse 50% 50% at 50% 55%,
    rgba(1, 5, 10, 0.9),
    transparent 72%
  );
}

.scroll-hint-line {
  display: block;
  width: 1px;
  height: 2.1rem;
  background: linear-gradient(to bottom, transparent, #fff);
  box-shadow: 0 0 4px #fff, 0 0 12px var(--cyan), 0 0 26px var(--cyan-glow);
}

.scroll-hint-chevron {
  font-size: 1.2rem;
  line-height: 0.6;
  color: var(--white-hot);
  text-shadow: 0 0 4px #fff, 0 0 14px var(--cyan), 0 0 34px var(--cyan-glow);
  animation: scroll-pulse 2.6s ease-in-out var(--flk-delay, 0s) infinite;
}

#app:not([data-booting]) .scroll-hint {
  opacity: 0.6;
}

/* ==========================================================================
   Projects Section
   ========================================================================== */

#projects {
  --circuit-gap: 78px;

  position: relative;
  isolation: isolate;
  padding: clamp(4rem, 12vh, 7rem) var(--section-pad) 4rem;
  /* Sits the content on a darker deck so the grid reads behind, not through. */
  background: linear-gradient(
    to bottom,
    rgba(1, 5, 10, 0) 0%,
    rgba(1, 5, 10, 0.82) 9%,
    rgba(1, 5, 10, 0.93) 26%,
    rgba(1, 5, 10, 0.93) 100%
  );
}

/* Faint structural circuitry on the deck — static gradients, no repaint cost,
   so the panel never sits on dead black. */
#projects::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(var(--circuit-gap) - 1px),
      rgba(0, 229, 255, 0.075) calc(var(--circuit-gap) - 1px),
      rgba(0, 229, 255, 0.075) var(--circuit-gap)
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent calc(var(--circuit-gap) * 2 - 1px),
      rgba(0, 229, 255, 0.045) calc(var(--circuit-gap) * 2 - 1px),
      rgba(0, 229, 255, 0.045) calc(var(--circuit-gap) * 2)
    );
  -webkit-mask-image: radial-gradient(
    ellipse 74% 64% at 50% 42%,
    #000 0%,
    rgba(0, 0, 0, 0.45) 52%,
    transparent 84%
  );
  mask-image: radial-gradient(
    ellipse 74% 64% at 50% 42%,
    #000 0%,
    rgba(0, 0, 0, 0.45) 52%,
    transparent 84%
  );
}

.section-title,
.project-grid {
  position: relative;
  z-index: 1;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  margin: 0 0 clamp(1.9rem, 4vw, 2.8rem);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.2vw, 1.3rem);
  letter-spacing: 0.28em;
  color: var(--white-hot);
  text-shadow:
    0 0 2px #fff,
    0 0 10px var(--cyan-soft),
    0 0 26px var(--cyan),
    0 0 62px var(--cyan-glow-deep);
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--cyan-soft),
    rgba(0, 229, 255, 0.32) 22%,
    rgba(0, 229, 255, 0.08) 60%,
    transparent 100%
  );
  box-shadow: 0 0 8px var(--cyan-glow-deep);
}

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  perspective: 1100px;
}

@media (min-width: 700px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.6rem;
  }
}

/* ==========================================================================
   Project Cards — arcade cabinet panels
   ========================================================================== */

.project-card {
  --accent: var(--cyan);
  --accent-soft: var(--cyan-soft);
  --accent-dim: var(--cyan-dim);
  --accent-glow: var(--cyan-glow);
  --accent-glow-deep: var(--cyan-glow-deep);
  --accent-far: var(--cyan-far);
  --accent-rgb: 0, 229, 255;

  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 2.1rem 1.6rem 1.5rem 1.9rem;
  min-height: 44px;
  isolation: isolate;
  background:
    linear-gradient(
      160deg,
      rgba(var(--accent-rgb), 0.09) 0%,
      rgba(3, 12, 20, 0.2) 38%,
      rgba(3, 10, 18, 0.1) 100%
    ),
    var(--panel-bg);
  border: 1px solid rgba(var(--accent-rgb), 0.42);
  clip-path: polygon(
    0 0,
    calc(100% - 18px) 0,
    100% 18px,
    100% 100%,
    18px 100%,
    0 calc(100% - 18px)
  );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.045),
    inset 0 1px 26px rgba(var(--accent-rgb), 0.08),
    0 0 2px rgba(255, 255, 255, 0.28),
    0 0 14px var(--accent-glow),
    0 0 40px var(--accent-glow-deep),
    0 0 90px var(--accent-far);
  transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition:
    transform 0.2s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  will-change: transform;
}

.project-card--orange {
  --accent: var(--orange);
  --accent-soft: var(--orange-soft);
  --accent-dim: var(--orange-dim);
  --accent-glow: var(--orange-glow);
  --accent-glow-deep: rgba(190, 92, 8, 0.42);
  --accent-far: var(--orange-far);
  --accent-rgb: 255, 154, 31;
}

/* Top light bar — the cabinet marquee tube. */
.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 1;
  background: linear-gradient(
    90deg,
    var(--accent-soft) 0%,
    #fff 18%,
    var(--accent) 55%,
    rgba(var(--accent-rgb), 0.15) 100%
  );
  box-shadow:
    0 0 4px #fff,
    0 0 12px var(--accent),
    0 0 30px var(--accent-glow),
    0 0 70px var(--accent-glow-deep);
  opacity: 0.85;
  transition: opacity 0.3s ease;
}

/* Light traced along the marquee on hover. */
.project-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 34%;
  height: 2px;
  z-index: 2;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.35) 40%,
    #fff 50%,
    rgba(255, 255, 255, 0.35) 60%,
    transparent
  );
  box-shadow: 0 0 10px #fff, 0 0 26px var(--accent-soft);
  opacity: 0;
  transform: translateX(-110%);
  pointer-events: none;
}

/* Inner CRT texture + corner brackets. */
.card-frame {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0 2px,
      rgba(0, 0, 0, 0.16) 2px 4px
    ),
    radial-gradient(
      ellipse 120% 80% at 8% -10%,
      rgba(var(--accent-rgb), 0.16),
      transparent 62%
    );
  opacity: 0.75;
}

/* Corner brackets. Drawn as L-shapes and lit with drop-shadow rather than
   box-shadow, which would halo the full bounding box back into a square. */
.card-frame::before,
.card-frame::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 1px solid var(--accent-soft);
  filter: drop-shadow(0 0 3px var(--accent))
    drop-shadow(0 0 9px var(--accent-glow));
  opacity: 0.6;
  transition: opacity 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.card-frame::before {
  top: 8px;
  left: 8px;
  border-right: 0;
  border-bottom: 0;
}

.card-frame::after {
  right: 8px;
  bottom: 8px;
  border-left: 0;
  border-top: 0;
}

/* Boot-time CRT bloom wash. */
.card-crt {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(var(--accent-rgb), 0.35) 42%,
    rgba(255, 255, 255, 0.9) 50%,
    rgba(var(--accent-rgb), 0.35) 58%,
    transparent 100%
  );
}

.card-badge,
.card-title,
.card-desc,
.card-cta {
  position: relative;
  z-index: 4;
}

.card-badge {
  align-self: flex-start;
  padding: 0.26rem 0.62rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--white-hot);
  text-shadow: 0 0 6px var(--accent-soft), 0 0 16px var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  clip-path: polygon(
    5px 0,
    100% 0,
    100% calc(100% - 5px),
    calc(100% - 5px) 100%,
    0 100%,
    0 5px
  );
  box-shadow:
    inset 0 0 8px rgba(var(--accent-rgb), 0.2),
    0 0 2px rgba(255, 255, 255, 0.4),
    0 0 10px var(--accent-glow),
    0 0 26px var(--accent-glow-deep);
}

.card-title {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  letter-spacing: 0.11em;
  color: var(--white-hot);
  text-shadow:
    0 0 1px #fff,
    0 0 4px #fff,
    0 0 12px var(--accent-soft),
    0 0 26px var(--accent),
    0 0 58px var(--accent-glow),
    0 0 110px var(--accent-glow-deep);
}

.card-desc {
  margin: 0;
  flex: 1;
  font-size: 0.99rem;
  font-weight: 400;
  color: rgba(216, 244, 255, 0.6);
  line-height: 1.5;
}

.card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.65rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: rgba(var(--accent-rgb), 0.7);
  transition:
    color 0.25s ease,
    transform 0.25s ease,
    text-shadow 0.25s ease;
}

@media (hover: hover) {
  .project-card:hover {
    transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg))
      translateY(-5px);
    border-color: var(--accent-soft);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.1),
      inset 0 1px 40px rgba(var(--accent-rgb), 0.16),
      0 0 4px rgba(255, 255, 255, 0.6),
      0 0 24px var(--accent),
      0 0 66px var(--accent-glow),
      0 0 150px var(--accent-glow-deep);
  }

  .project-card:hover::before {
    opacity: 1;
  }

  .project-card:hover::after {
    opacity: 1;
    animation: bar-trace 1.35s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  }

  .project-card:hover .card-frame::before,
  .project-card:hover .card-frame::after {
    opacity: 1;
    width: 24px;
    height: 24px;
  }

  .project-card:hover .card-cta {
    color: var(--white-hot);
    transform: translateX(5px);
    text-shadow: 0 0 6px var(--accent-soft), 0 0 20px var(--accent);
  }
}

@media (hover: none) {
  .project-card:active {
    border-color: var(--accent-soft);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.12),
      inset 0 1px 40px rgba(var(--accent-rgb), 0.18),
      0 0 4px rgba(255, 255, 255, 0.6),
      0 0 26px var(--accent),
      0 0 70px var(--accent-glow);
  }

  .project-card:active .card-cta {
    color: var(--white-hot);
    text-shadow: 0 0 6px var(--accent-soft), 0 0 20px var(--accent);
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

#footer {
  position: relative;
  padding: 1rem var(--section-pad) 4.5rem;
  text-align: center;
  background: rgba(1, 5, 10, 0.93);
}

.footer-rule {
  max-width: 42rem;
  margin: 0 auto clamp(2rem, 5vh, 3rem);
  opacity: 0.85;
}

.easter-egg {
  margin: 0 auto 1.9rem;
  max-width: 32rem;
  font-size: 0.85rem;
  font-weight: 400;
  font-style: italic;
  color: rgba(216, 244, 255, 0.62);
  line-height: 1.55;
}

.easter-egg a {
  color: rgba(150, 253, 255, 0.88);
  text-shadow: 0 0 6px var(--cyan-glow), 0 0 18px var(--cyan-glow-deep);
  border-bottom: 1px solid rgba(0, 229, 255, 0.4);
  /* Grows the touch target past 44px without disturbing the line box. */
  padding: 0.85rem 0.2rem;
  margin: -0.85rem -0.2rem;
  transition: color 0.22s ease, text-shadow 0.22s ease, border-color 0.22s ease;
}

.easter-egg a:hover,
.easter-egg a:focus-visible {
  color: var(--white-hot);
  border-color: var(--cyan-soft);
  text-shadow: 0 0 5px #fff, 0 0 16px var(--cyan), 0 0 40px var(--cyan-glow);
  outline: none;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem 1rem;
  margin-bottom: 2.4rem;
}

.contact-links a {
  min-height: 44px;
  min-width: 108px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.25rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: rgba(186, 252, 255, 0.95);
  text-shadow: 0 0 8px var(--cyan-glow), 0 0 22px var(--cyan-glow-deep);
  background: rgba(0, 229, 255, 0.055);
  border: 1px solid rgba(0, 229, 255, 0.45);
  clip-path: polygon(
    8px 0,
    100% 0,
    100% calc(100% - 8px),
    calc(100% - 8px) 100%,
    0 100%,
    0 8px
  );
  box-shadow:
    inset 0 0 18px rgba(0, 200, 255, 0.09),
    0 0 1px rgba(255, 255, 255, 0.25),
    0 0 14px var(--cyan-glow-deep),
    0 0 34px rgba(0, 110, 150, 0.28);
  transition:
    color 0.22s ease,
    border-color 0.22s ease,
    background-color 0.22s ease,
    text-shadow 0.22s ease,
    box-shadow 0.22s ease;
}

.contact-links a:hover,
.contact-links a:focus-visible {
  color: var(--white-hot);
  border-color: var(--cyan-soft);
  background-color: rgba(0, 229, 255, 0.09);
  text-shadow: 0 0 5px #fff, 0 0 16px var(--cyan);
  box-shadow:
    inset 0 0 22px rgba(0, 220, 255, 0.22),
    0 0 3px rgba(255, 255, 255, 0.5),
    0 0 18px var(--cyan-glow),
    0 0 48px var(--cyan-glow-deep);
  outline: none;
}

.end-of-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.66rem;
  letter-spacing: 0.34em;
  color: rgba(198, 253, 255, 0.92);
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.5),
    0 0 10px var(--cyan-soft),
    0 0 26px var(--cyan-glow),
    0 0 56px var(--cyan-glow-deep);
}

.end-of-line::after {
  content: "▮";
  letter-spacing: 0;
  color: var(--cyan-soft);
  text-shadow: 0 0 4px #fff, 0 0 12px var(--cyan);
  animation: cursor-blink 1.15s steps(1, end) infinite;
}

/* ==========================================================================
   Sound Toggle
   ========================================================================== */

#sound-toggle {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(0, 229, 255, 0.42);
  background: rgba(2, 10, 18, 0.82);
  color: rgba(125, 253, 254, 0.7);
  cursor: pointer;
  clip-path: polygon(
    30% 0,
    70% 0,
    100% 30%,
    100% 70%,
    70% 100%,
    30% 100%,
    0 70%,
    0 30%
  );
  box-shadow:
    inset 0 0 12px rgba(0, 200, 255, 0.1),
    0 0 2px rgba(255, 255, 255, 0.2),
    0 0 12px var(--cyan-glow-deep),
    0 0 30px rgba(0, 100, 140, 0.28);
  /* Stays dark through the blackout and the surge, then powers on with the
     rest of the interface. */
  opacity: 0;
  pointer-events: none;
  transition:
    color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

body[data-stage="3"] #sound-toggle,
body[data-stage="4"] #sound-toggle {
  opacity: 1;
  pointer-events: auto;
  transition:
    color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease,
    opacity 0.8s ease 0.35s;
}

#sound-toggle:hover,
#sound-toggle:focus-visible {
  border-color: var(--cyan-soft);
  color: var(--white-hot);
  transform: scale(1.06);
  box-shadow:
    inset 0 0 18px rgba(0, 220, 255, 0.22),
    0 0 3px rgba(255, 255, 255, 0.6),
    0 0 20px var(--cyan-glow),
    0 0 50px var(--cyan-glow-deep);
  outline: none;
}

#sound-toggle .sound-icon {
  filter: drop-shadow(0 0 4px currentColor);
}

#sound-toggle[aria-pressed="true"] {
  color: var(--white-hot);
  border-color: var(--cyan-soft);
  box-shadow:
    inset 0 0 20px rgba(0, 220, 255, 0.3),
    0 0 4px rgba(255, 255, 255, 0.7),
    0 0 22px var(--cyan),
    0 0 56px var(--cyan-glow),
    0 0 110px var(--cyan-glow-deep);
  animation: toggle-live 3.4s ease-in-out infinite;
}

#sound-toggle[aria-pressed="true"] .sound-off-line {
  display: none;
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

@keyframes glyph-flicker {
  0%,
  46% {
    opacity: 1;
  }
  47%,
  100% {
    opacity: 0.06;
  }
}

@keyframes crt-hairline {
  0% {
    width: 0;
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  60% {
    width: 44vw;
    opacity: 1;
  }
  70% {
    opacity: 0.4;
  }
  100% {
    width: 52vw;
    opacity: 0.9;
  }
}

@keyframes crt-collapse {
  0% {
    width: 52vw;
    opacity: 1;
  }
  60% {
    width: 6vw;
    opacity: 1;
  }
  100% {
    width: 0;
    opacity: 0;
  }
}

@keyframes overlay-flicker {
  0% {
    opacity: 1;
  }
  9% {
    opacity: 0.22;
  }
  13% {
    opacity: 0.95;
  }
  22% {
    opacity: 0.12;
  }
  27% {
    opacity: 0.8;
  }
  34% {
    opacity: 0.06;
  }
  41% {
    opacity: 0.62;
  }
  55% {
    opacity: 0.08;
  }
  66% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    background: transparent;
  }
}

@keyframes boot-sweep {
  0% {
    opacity: 0;
    top: -6%;
    height: 2px;
  }
  8% {
    opacity: 1;
    height: 3px;
  }
  55% {
    opacity: 1;
    height: 2px;
  }
  100% {
    opacity: 0;
    top: 106%;
    height: 1px;
  }
}

@keyframes boot-flare {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 0.9;
  }
  22% {
    opacity: 0.35;
  }
  32% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
  }
}

/* Three ignite variants; JS assigns one at random per letter so the tubes
   catch with different stutter patterns. */
@keyframes letter-ignite-a {
  0% {
    opacity: 0;
    text-shadow: none;
    transform: translateY(0) scaleY(1);
  }
  6% {
    opacity: 0.9;
    transform: translateY(0) scaleY(1.03);
    text-shadow: 0 0 3px #fff, 0 0 14px var(--cyan-soft);
  }
  10% {
    opacity: 0.1;
    transform: translateY(0) scaleY(1);
  }
  16% {
    opacity: 1;
    text-shadow: 0 0 2px #fff, 0 0 10px var(--cyan-soft), 0 0 24px var(--cyan);
  }
  22% {
    opacity: 0.2;
  }
  30% {
    opacity: 1;
  }
  36% {
    opacity: 0.45;
  }
  42% {
    opacity: 1;
  }
  52% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
    text-shadow:
      0 0 1px #fff,
      0 0 4px #fff,
      0 0 10px var(--cyan-soft),
      0 0 22px var(--cyan),
      0 0 46px var(--cyan-glow),
      0 0 92px var(--cyan-glow-deep),
      0 0 160px var(--cyan-far);
  }
}

@keyframes letter-ignite-b {
  0% {
    opacity: 0;
    text-shadow: none;
  }
  4% {
    opacity: 0.35;
  }
  7% {
    opacity: 0;
  }
  13% {
    opacity: 1;
    text-shadow: 0 0 3px #fff, 0 0 16px var(--cyan-soft), 0 0 34px var(--cyan);
  }
  17% {
    opacity: 0.08;
  }
  20% {
    opacity: 0.95;
  }
  26% {
    opacity: 0.15;
  }
  33% {
    opacity: 1;
  }
  46% {
    opacity: 0.55;
  }
  55% {
    opacity: 1;
  }
  68% {
    opacity: 0.88;
  }
  100% {
    opacity: 1;
    text-shadow:
      0 0 1px #fff,
      0 0 4px #fff,
      0 0 10px var(--cyan-soft),
      0 0 22px var(--cyan),
      0 0 46px var(--cyan-glow),
      0 0 92px var(--cyan-glow-deep),
      0 0 160px var(--cyan-far);
  }
}

@keyframes letter-ignite-c {
  0% {
    opacity: 0;
    text-shadow: none;
    transform: scaleY(0.94);
  }
  9% {
    opacity: 1;
    transform: scaleY(1.05);
    text-shadow: 0 0 4px #fff, 0 0 20px var(--cyan-soft), 0 0 48px var(--cyan);
  }
  14% {
    opacity: 0.06;
    transform: scaleY(1);
  }
  19% {
    opacity: 0.7;
  }
  24% {
    opacity: 0.1;
  }
  29% {
    opacity: 1;
  }
  38% {
    opacity: 0.3;
  }
  47% {
    opacity: 1;
  }
  61% {
    opacity: 0.72;
  }
  66% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    text-shadow:
      0 0 1px #fff,
      0 0 4px #fff,
      0 0 10px var(--cyan-soft),
      0 0 22px var(--cyan),
      0 0 46px var(--cyan-glow),
      0 0 92px var(--cyan-glow-deep),
      0 0 160px var(--cyan-far);
  }
}

@keyframes rule-draw {
  0% {
    opacity: 0;
    transform: scaleX(0.05);
  }
  40% {
    opacity: 1;
  }
  55% {
    opacity: 0.35;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scaleX(1);
  }
}

@keyframes text-fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes btn-ignite {
  0% {
    opacity: 0;
    box-shadow: none;
    transform: scale(0.98);
  }
  14% {
    opacity: 0.5;
  }
  24% {
    opacity: 1;
    transform: scale(1.01);
  }
  36% {
    opacity: 0.16;
  }
  48% {
    opacity: 1;
  }
  60% {
    opacity: 0.45;
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.07),
      inset 0 0 20px rgba(0, 200, 255, 0.16),
      0 0 3px rgba(255, 255, 255, 0.55),
      0 0 14px var(--cyan-glow),
      0 0 38px var(--cyan-glow-deep),
      0 0 90px var(--cyan-far);
  }
}

/* Cabinet warming up: hot scanline snaps open into a full panel. */
@keyframes card-power-on {
  0% {
    opacity: 0;
    transform: scaleY(0.006);
  }
  10% {
    opacity: 1;
    transform: scaleY(0.012);
  }
  26% {
    opacity: 1;
    transform: scaleY(1.03);
  }
  33% {
    opacity: 0.28;
    transform: scaleY(1);
  }
  42% {
    opacity: 1;
  }
  52% {
    opacity: 0.5;
  }
  61% {
    opacity: 1;
  }
  74% {
    opacity: 0.82;
  }
  100% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes crt-flash {
  0% {
    opacity: 1;
  }
  22% {
    opacity: 0.9;
  }
  46% {
    opacity: 0.3;
  }
  60% {
    opacity: 0.45;
  }
  100% {
    opacity: 0;
  }
}

/* Idle: steady, with two dips so brief and shallow they register as life
   rather than as blinking. Deep failures are left to tube-buzz. */
@keyframes neon-idle {
  0%,
  31%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  31.5% {
    opacity: 0.95;
    filter: brightness(0.88);
  }
  32.1% {
    opacity: 1;
    filter: brightness(1.03);
  }
  32.7% {
    filter: brightness(1);
  }
  74% {
    opacity: 1;
    filter: brightness(1);
  }
  74.4% {
    opacity: 0.92;
    filter: brightness(0.82);
  }
  75% {
    opacity: 1;
    filter: brightness(1);
  }
}

@keyframes neon-idle-soft {
  0%,
  44%,
  100% {
    opacity: 1;
  }
  44.5% {
    opacity: 0.88;
  }
  45.3% {
    opacity: 1;
  }
}

@keyframes tube-buzz {
  0%,
  100% {
    opacity: 1;
    filter: brightness(1);
  }
  6% {
    opacity: 0.25;
    filter: brightness(0.4);
  }
  11% {
    opacity: 1;
    filter: brightness(1.15);
  }
  17% {
    opacity: 0.35;
  }
  21% {
    opacity: 1;
  }
  29% {
    opacity: 0.18;
    filter: brightness(0.3);
  }
  34% {
    opacity: 0.95;
  }
  41% {
    opacity: 0.4;
  }
  46% {
    opacity: 1;
    filter: brightness(1.2);
  }
  58% {
    opacity: 0.3;
  }
  63% {
    opacity: 1;
  }
  79% {
    opacity: 0.6;
  }
  86% {
    opacity: 1;
  }
}

@keyframes btn-shimmer {
  0%,
  74%,
  100% {
    transform: translateX(-120%);
  }
  88% {
    transform: translateX(120%);
  }
}

@keyframes bar-trace {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(400%);
  }
}

@keyframes scroll-pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(5px);
  }
}

@keyframes cursor-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.05;
  }
}

@keyframes crt-roll {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(160vh);
  }
}

@keyframes room-dip {
  0%,
  30.9%,
  31.5%,
  62.4%,
  62.9%,
  87.4%,
  88.1%,
  100% {
    opacity: 0;
  }
  31%,
  31.35% {
    opacity: 0.22;
  }
  62.5%,
  62.75% {
    opacity: 0.12;
  }
  87.5%,
  87.95% {
    opacity: 0.28;
  }
}

@keyframes toggle-live {
  0%,
  100% {
    box-shadow:
      inset 0 0 20px rgba(0, 220, 255, 0.3),
      0 0 4px rgba(255, 255, 255, 0.7),
      0 0 22px var(--cyan),
      0 0 56px var(--cyan-glow),
      0 0 110px var(--cyan-glow-deep);
  }
  50% {
    box-shadow:
      inset 0 0 26px rgba(0, 220, 255, 0.42),
      0 0 6px rgba(255, 255, 255, 0.9),
      0 0 30px var(--cyan),
      0 0 78px var(--cyan-glow),
      0 0 150px var(--cyan-glow-deep);
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 699px) {
  .hero-core {
    margin-bottom: clamp(6rem, 24vh, 13rem);
  }

  .neon-title {
    letter-spacing: 0.06em;
  }

  .project-card {
    padding: 1.5rem 1.25rem 1.2rem;
  }

  .contact-links a {
    min-width: 96px;
  }
}

@media (max-width: 380px) {
  .neon-title {
    font-size: clamp(1.9rem, 9.6vw, 2.4rem);
    letter-spacing: 0.03em;
  }

  #cv-btn {
    min-width: 100%;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

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

  #boot-overlay {
    display: none !important;
  }

  .fx-roll,
  .fx-dip {
    display: none !important;
  }

  #sound-toggle {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  #app[data-booting] #hero-title .l,
  #app[data-booting] #hero-tagline,
  #app[data-booting] #cv-btn,
  #app[data-booting] .hero-rule,
  #app[data-booting] .project-card,
  #app[data-booting] .section-title,
  #app[data-booting] #footer,
  #app[data-booting] .scroll-hint {
    opacity: 1 !important;
  }

  #app[data-booting] .card-crt,
  #app:not([data-booting]) .card-crt {
    opacity: 0 !important;
  }

  html {
    scroll-behavior: auto;
  }
}
