:root {
  --ink: #0b0618;
  --accent: #ff4fa3;
  --teal: #5ee6d0;
  --cream: #fff1c9;
  --spotify: #1ed760;
  --glass: rgba(11, 6, 24, .55);
  --line: rgba(255, 255, 255, .12);
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --pad: clamp(14px, 2.4vw, 28px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body { color: var(--cream); font-family: var(--sans); }
button { font: inherit; color: inherit; }

/* ---------- stage: canvas covers the viewport ---------- */
#stage { position: fixed; inset: 0; overflow: hidden; background: #000; }
#screen {
  position: absolute; left: 50%; top: 50%;
  width: max(100vw, 177.78vh); height: max(100vh, 56.25vw);
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: saturate(1.12) contrast(1.04);
}
.scanlines, .vignette { position: absolute; inset: 0; pointer-events: none; }
.scanlines {
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .2) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
  animation: roll 7s linear infinite;
}
@keyframes roll { to { background-position: 0 30px; } }
.vignette { background: radial-gradient(120% 110% at 50% 50%, transparent 55%, rgba(0, 0, 0, .6) 100%); }

/* ---------- reels: scroll-snap layer ---------- */
#reels {
  position: fixed; inset: 0; z-index: 2;
  overflow-y: auto; overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
#reels::-webkit-scrollbar { display: none; }
.reel {
  height: 100vh; height: 100dvh;
  scroll-snap-align: start; scroll-snap-stop: always;
  position: relative; cursor: pointer;
}
.reel-info {
  position: absolute; left: var(--pad); bottom: calc(var(--pad) + 46px);
  max-width: min(520px, 60vw);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8);
}
.reel-no { font-family: var(--pixel); font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--teal); margin: 0 0 10px; }
.reel-no .trip { color: var(--accent); letter-spacing: 0; text-shadow: 0 0 8px var(--accent); }
.reel-no .trip i { font-style: normal; opacity: .35; }
.reel-info h2 {
  font-family: var(--pixel); font-weight: 400; margin: 0;
  font-size: clamp(14px, 2.2vw, 26px); line-height: 1.35;
  text-shadow: 2px 2px 0 var(--accent), 0 4px 18px rgba(0, 0, 0, .9);
}
.reel-info .artist { margin: 10px 0 6px; font-weight: 600; opacity: .9; }
.reel-info .blurb { margin: 0; font-size: 14px; line-height: 1.5; opacity: .75; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#hud > *, #hud .top > * { pointer-events: auto; }
#hud .top { pointer-events: none; }

.top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: var(--pad);
  background: linear-gradient(rgba(0, 0, 0, .45), transparent);
}
.counter { font-family: var(--pixel); font-size: 10px; opacity: .7; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.sync-state { font-family: var(--pixel); font-size: 8px; text-transform: uppercase; letter-spacing: 1px; opacity: .8; margin-right: 6px; }
.sync-state[data-mode="spotify"] { color: var(--spotify); }
.sync-state[data-mode="spotify"]::before { content: '●'; margin-right: 6px; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(8px);
  font-size: 14px; cursor: pointer;
  transition: background .15s, transform .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .14); }
.icon-btn:active { transform: scale(.94); }

.rail {
  position: absolute; right: var(--pad); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px;
}
.rail .play { width: 52px; height: 52px; border-radius: 50%; font-size: 15px; background: var(--accent); color: #0b0618; border: 0; box-shadow: 0 0 24px -4px var(--accent); }
.rail .icon-btn:not(.play) { margin-left: 6px; }

.caption {
  position: absolute; left: var(--pad); top: calc(var(--pad) + 56px);
  font-family: var(--pixel); font-size: clamp(11px, 1.6vw, 18px);
  text-shadow: 2px 2px 0 var(--accent), -1px -1px 0 rgba(94, 230, 208, .8);
  letter-spacing: 1px; opacity: 0; pointer-events: none !important;
}
.caption.show { animation: cap 3.2s steps(16) forwards; }
@keyframes cap {
  0% { opacity: 0; transform: translateY(8px); clip-path: inset(0 100% 0 0); }
  20% { opacity: 1; transform: none; clip-path: inset(0 0 0 0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
.toast {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  font-family: var(--pixel); font-size: 11px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px);
  padding: 10px 14px; border-radius: 8px;
  opacity: 0; transition: opacity .2s; pointer-events: none !important;
}
.toast.show { opacity: 1; }
.notice {
  position: absolute; left: 50%; top: calc(var(--pad) + 60px); transform: translateX(-50%);
  width: min(560px, calc(100vw - 2 * var(--pad)));
  display: flex; gap: 12px; align-items: flex-start;
  background: rgba(30, 215, 96, .14); border: 1px solid rgba(30, 215, 96, .5); backdrop-filter: blur(10px);
  padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45;
}
.notice[hidden] { display: none; }
.notice button { background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; opacity: .7; }

/* Spotify dock */
.dock {
  position: absolute; right: var(--pad); bottom: calc(var(--pad) + 40px);
  width: min(340px, calc(100vw - 2 * var(--pad)));
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  transition: opacity .3s, transform .3s;
}
.embed-wrap {
  width: 100%; height: 80px; border-radius: 12px; overflow: hidden;
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, .8);
}
.embed-wrap iframe { display: block; border: 0; }
.dock-link { font-size: 12px; color: var(--cream); opacity: .65; text-decoration: none; }
.dock-link:hover { opacity: 1; color: var(--spotify); }
.dock.nudge .embed-wrap { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(30, 215, 96, .7); }
  50% { box-shadow: 0 0 0 8px rgba(30, 215, 96, 0); }
}
body.sp-failed .embed-wrap { display: none; }
body.on-soon .dock, body.on-soon .progress { opacity: 0; pointer-events: none; transform: translateY(10px); }

/* progress bar along the bottom edge */
.progress {
  position: absolute; left: var(--pad); right: var(--pad); bottom: var(--pad);
  height: 24px; display: flex; align-items: center; gap: 14px;
}
.progress input { flex: 1; margin: 0; accent-color: var(--accent); cursor: pointer; position: relative; z-index: 1; }
.markers { position: absolute; left: 0; right: 110px; top: 0; bottom: 0; pointer-events: none; }
.markers span { position: absolute; top: 2px; width: 2px; height: 6px; background: var(--teal); opacity: .8; border-radius: 1px; }
.time { font-family: var(--pixel); font-size: 9px; opacity: .75; min-width: 96px; text-align: right; }

.scroll-hint {
  position: absolute; left: 50%; bottom: calc(var(--pad) + 40px); transform: translateX(-50%);
  font-family: var(--pixel); font-size: 8px; letter-spacing: 1px; opacity: .55;
  pointer-events: none !important; transition: opacity .5s;
}
.scroll-hint b { display: inline-block; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }
body.scrolled .scroll-hint { opacity: 0; }

/* ---------- start screen ---------- */
.start {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 55%, rgba(11, 6, 24, .25), rgba(11, 6, 24, .82));
  transition: opacity .5s, visibility .5s;
}
.start.hidden { opacity: 0; visibility: hidden; }
.start-inner { text-align: center; padding: 24px; max-width: 640px; }
.kicker { font-family: var(--pixel); font-size: 10px; letter-spacing: 3px; color: var(--teal); margin: 0 0 16px; text-transform: uppercase; }
.start h1 {
  font-family: var(--pixel); font-weight: 400;
  font-size: clamp(18px, 3.6vw, 40px); line-height: 1.35; margin: 0;
  text-shadow: 3px 3px 0 var(--accent), 6px 6px 0 rgba(107, 47, 163, .9);
}
.start .artist { margin: 14px 0 28px; opacity: .85; font-size: 16px; }
.start-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hint { font-size: 13px; opacity: .6; margin: 22px auto 0; max-width: 470px; line-height: 1.55; }

.spotify-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--spotify); color: #000; border: 0; cursor: pointer;
  font-weight: 700; font-size: 16px;
  padding: 14px 26px; border-radius: 999px;
  animation: pulse 2.2s infinite;
  transition: transform .15s;
}
.spotify-btn small { font-weight: 500; opacity: .65; font-size: 12px; }
.spotify-btn:hover { transform: translateY(-2px) scale(1.03); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(30, 215, 96, .55); }
  70% { box-shadow: 0 0 0 16px rgba(30, 215, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(30, 215, 96, 0); }
}
.ghost-btn {
  font-weight: 600; font-size: 15px;
  background: transparent; border: 1px solid rgba(255, 241, 201, .35); border-radius: 999px;
  padding: 13px 20px; cursor: pointer;
}
.ghost-btn:hover { border-color: var(--cream); background: rgba(255, 255, 255, .06); }

/* ---------- help ---------- */
.help { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(0, 0, 0, .55); }
.help[hidden] { display: none; }
.help-card { background: #140a2a; border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; min-width: 280px; max-width: 420px; }
.help-card h3 { font-family: var(--pixel); font-weight: 400; font-size: 12px; margin: 0 0 14px; color: var(--teal); }
.help-card p { margin: 8px 0; font-size: 14px; }
.help-card .fine { font-size: 12px; opacity: .55; margin-top: 16px; line-height: 1.5; }
kbd {
  font-family: var(--pixel); font-size: 8px;
  padding: 3px 5px; border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .05);
}

/* ---------- idle: after 5s with no input, everything but the picture melts away ---------- */
.top, .rail, .dock, .progress, .reel-info > * {
  transition: opacity .35s ease-out, transform .5s cubic-bezier(.2, .9, .3, 1.35), filter .35s ease-out;
}
/* coming back: quick, bottom-up cascade */
.reel-info > :nth-child(4) { transition-delay: 0s; }
.reel-info > :nth-child(3) { transition-delay: .04s; }
.reel-info > :nth-child(2) { transition-delay: .08s; }
.reel-info > :nth-child(1) { transition-delay: .12s; }
.progress { transition-delay: .02s; }
.dock { transition-delay: .06s; }
.rail { transition-delay: .1s; }
.top { transition-delay: .14s; }

body.idle, body.idle .reel { cursor: none; }
body.idle .top, body.idle .rail, body.idle .dock, body.idle .progress, body.idle .reel-info > * {
  opacity: 0; filter: blur(8px); pointer-events: none;
  transition: opacity 1.4s steps(10), transform 1.8s cubic-bezier(.55, 0, .8, .15), filter 1.4s ease-in;
}
body.idle .top { transform: translateY(-28px); }
body.idle .rail { transform: translate(48px, -50%) rotate(8deg); }
body.idle .dock { transform: translateX(70px) scale(.9); }
body.idle .progress { transform: translateY(24px) scaleX(.6); }
body.idle .reel-info > * { transform: translateX(-60px) skewX(-14deg); letter-spacing: .2em; }
/* going away: the title text dissolves line by line, then the chrome drifts off */
body.idle .reel-info > :nth-child(1) { transition-delay: 0s; }
body.idle .reel-info > :nth-child(2) { transition-delay: .18s; }
body.idle .reel-info > :nth-child(3) { transition-delay: .36s; }
body.idle .reel-info > :nth-child(4) { transition-delay: .5s; }
body.idle .top { transition-delay: .6s; }
body.idle .rail { transition-delay: .75s; }
body.idle .progress { transition-delay: .85s; }
body.idle .dock { transition-delay: 1s; }
body.idle .caption, body.idle .notice, body.idle .scroll-hint, body.idle .toast { opacity: 0 !important; transition: opacity .8s; }

/* the moment you move: a quick RGB-split glitch as things snap back */
body.waking .reel-info > *, body.waking .top > * { animation: wake .45s steps(6); }
@keyframes wake {
  0% { clip-path: inset(0 0 65% 0); translate: -8px 0; text-shadow: 4px 0 #f72585, -4px 0 #2ec4b6; }
  33% { clip-path: inset(45% 0 0 0); translate: 6px 0; text-shadow: -3px 0 #f72585, 3px 0 #2ec4b6; }
  66% { clip-path: inset(0 0 25% 0); translate: -3px 0; }
  100% { clip-path: inset(0); translate: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  body.waking .reel-info > *, body.waking .top > * { animation: none; }
  .scanlines, .spotify-btn, .scroll-hint b { animation: none; }
}
@media (max-width: 720px) {
  .counter, .sync-state { display: none; }
  .reel-info { max-width: calc(100vw - 2 * var(--pad) - 60px); bottom: calc(var(--pad) + 150px); }
  .reel-info .blurb { display: none; }
  .dock { left: var(--pad); right: var(--pad); width: auto; }
  .start .hint { display: none; }
  .start-actions { flex-direction: column; align-items: center; }
  .scroll-hint { display: none; }
}

/* ---------- HUD top-left: home + counter + up next ---------- */
.top-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.up-next { font-family: var(--pixel); font-size: 8px; letter-spacing: 1px; text-transform: uppercase; opacity: .55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#homeBtn { font-size: 18px; }

/* ---------- home: the playlist ---------- */
.home {
  position: fixed; inset: 0; z-index: 7;
  overflow-y: auto; overscroll-behavior: contain;
  background: #05030c;
  transition: opacity .6s ease, visibility .6s, transform .6s cubic-bezier(.2, .9, .3, 1);
  scroll-behavior: smooth;
}
.home.hidden { opacity: 0; visibility: hidden; transform: scale(1.04); pointer-events: none; }
#homeBg {
  position: fixed; left: 50%; top: 50%;
  width: max(100vw, 177.78vh); height: max(100vh, 56.25vw);
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
}
.home-scrim {
  position: fixed; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 3, 12, .15) 0%, rgba(5, 3, 12, .55) 38%, rgba(5, 3, 12, .9) 70%, #05030c 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
}
.home-inner { position: relative; max-width: 1080px; margin: 0 auto; padding: 26px clamp(16px, 4vw, 40px) 40px; }
.home-nav { display: flex; align-items: center; gap: 22px; }
.brand { font-family: var(--pixel); font-size: 13px; letter-spacing: 2px; margin-right: auto; }
.brand span { color: var(--accent); margin-left: 6px; text-shadow: 0 0 12px var(--accent); }
.home-nav a { color: var(--cream); opacity: .7; text-decoration: none; font-weight: 600; }
.home-nav a:hover { opacity: 1; }
.sp-status { font-size: 12px; opacity: .55; }
.pill { background: var(--cream); color: #05030c; border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 700; cursor: pointer; }
.pill:hover { transform: scale(1.04); }

.hero { display: flex; align-items: flex-end; gap: clamp(18px, 3vw, 32px); margin: clamp(40px, 9vh, 90px) 0 26px; }
.cover {
  width: clamp(150px, 22vw, 232px); aspect-ratio: 1; flex: none;
  display: grid; grid-template-columns: 1fr 1fr;
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 30px 70px -10px rgba(0, 0, 0, .8), 0 0 60px -20px var(--accent);
  animation: coverFloat 6s ease-in-out infinite;
}
.cover canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
@keyframes coverFloat { 50% { transform: translateY(-6px) rotate(-.6deg); } }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; margin: 0; color: var(--teal); }
.hero h1 {
  font-family: var(--pixel); font-weight: 400;
  font-size: clamp(30px, 7vw, 80px); line-height: 1.05; margin: 12px 0 14px;
  text-shadow: 4px 4px 0 var(--accent), 8px 8px 0 rgba(107, 47, 163, .9);
}
.hero h1 .see { color: var(--accent); text-shadow: 4px 4px 0 #fff1c9, 8px 8px 0 rgba(107, 47, 163, .9); }
.hero-sub { margin: 0 0 10px; opacity: .8; max-width: 520px; line-height: 1.5; }
.meta { margin: 0; font-size: 14px; opacity: .75; }
.meta b { opacity: 1; }

.actions { display: flex; align-items: center; gap: 20px; margin: 10px 0 24px; }
.big-play {
  width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--spotify); color: #000; font-size: 22px; padding-left: 4px;
  box-shadow: 0 10px 30px -8px rgba(30, 215, 96, .8);
  transition: transform .15s, box-shadow .2s;
}
.big-play:hover { transform: scale(1.07); box-shadow: 0 14px 40px -8px rgba(30, 215, 96, 1); }
.shuffle-tag { font-weight: 700; color: var(--spotify); font-size: 14px; }
.shuffle-tag b { font-size: 18px; margin-right: 4px; }
.ghost-btn.small { padding: 9px 16px; font-size: 13px; margin-left: auto; }

.tracks { display: flex; flex-direction: column; }
.tr {
  display: grid; grid-template-columns: 34px minmax(0, 1.6fr) minmax(0, 1fr) 96px 56px;
  align-items: center; gap: 16px; padding: 8px 14px;
  background: none; border: 0; border-radius: 6px;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background .15s;
}
.tr.head { cursor: default; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .55; border-bottom: 1px solid var(--line); border-radius: 0; padding-bottom: 10px; margin-bottom: 8px; }
.tr:not(.head):hover { background: rgba(255, 255, 255, .08); }
.num { position: relative; text-align: center; font-variant-numeric: tabular-nums; opacity: .75; }
.num i { font-style: normal; }
.num .p, .num .eq { display: none; }
.tr:not(.head):hover .num .n { display: none; }
.tr:not(.head):hover .num .p { display: inline; }
.tr.playing .num .n, .tr.playing:hover .num .p { display: none; }
.tr.playing .num .eq { display: inline-flex; }
.eq { gap: 2px; align-items: flex-end; height: 14px; }
.eq b { width: 3px; background: var(--spotify); animation: eq .9s ease-in-out infinite; }
.eq b:nth-child(2) { animation-delay: -.3s; } .eq b:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
.t-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.t-thumb { width: 44px; height: 44px; flex: none; border-radius: 4px; overflow: hidden; }
.t-thumb canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.t-text { display: flex; flex-direction: column; min-width: 0; }
.t-title { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-artist { font-size: 13px; opacity: .6; }
.tr.playing .t-title { color: var(--spotify); }
.col-album { font-size: 14px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-trip { font-family: var(--pixel); font-size: 9px; color: var(--accent); text-shadow: 0 0 8px var(--accent); letter-spacing: 1px; }
.col-trip i { font-style: normal; opacity: .3; }
.tr.head .col-trip { font-family: inherit; font-size: 12px; color: inherit; text-shadow: none; }
.col-dur { text-align: right; font-variant-numeric: tabular-nums; opacity: .65; font-size: 14px; }

.about {
  margin-top: 80px; padding: clamp(22px, 4vw, 40px);
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 40px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(107, 47, 163, .3), rgba(20, 10, 42, .7) 60%, rgba(94, 230, 208, .08));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(255, 79, 163, .35);
}
.about h2 { font-family: var(--pixel); font-weight: 400; font-size: clamp(16px, 2.4vw, 26px); line-height: 1.4; margin: 14px 0 18px; }
.about h2 span { color: var(--accent); text-shadow: 0 0 14px var(--accent); }
.about p { line-height: 1.65; opacity: .82; }
.about-side { display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.credit { font-size: 15px; line-height: 1.5; margin: 0; opacity: 1 !important; }
.credit b {
  font-family: var(--pixel); font-weight: 400; font-size: clamp(15px, 2vw, 22px);
  background: linear-gradient(90deg, #ff4fa3, #ffc46b, #5ee6d0, #c9b6ff, #ff4fa3);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
  line-height: 1.8;
}
@keyframes shimmer { to { background-position: 300% 0; } }
.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: 12px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); }
.home-foot { margin-top: 40px; font-size: 12px; opacity: .4; text-align: center; }

@media (max-width: 760px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .tr { grid-template-columns: 28px minmax(0, 1fr) 50px; }
  .col-album, .col-trip { display: none; }
  .about { grid-template-columns: 1fr; }
  .up-next { display: none; }
  .ghost-btn.small { margin-left: 0; }
  .actions { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .cover, .credit b, .eq b { animation: none; }
}

/* ---------- about-me popup ---------- */
.nav-link { background: none; border: 0; color: var(--cream); opacity: .7; font-weight: 600; cursor: pointer; padding: 0; }
.nav-link:hover { opacity: 1; }
.credit-link { text-decoration: none; }
.credit-link:hover b { filter: brightness(1.3); }

.me { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; }
.me[hidden] { display: none; }
.me-backdrop { position: absolute; inset: 0; background: #000; animation: meFade .35s ease-out both; }
.me-backdrop::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px);
  animation: roll 7s linear infinite;
}
@keyframes meFade { from { opacity: 0; } to { opacity: .94; } }
.me-card {
  position: relative; width: min(430px, 88vw);
  padding: 34px 32px 24px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 0 0 1px rgba(255, 79, 163, .2), 0 0 90px -20px rgba(255, 79, 163, .55), 0 0 140px -40px rgba(94, 230, 208, .45);
  animation: crtOn .75s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes crtOn {
  0% { transform: scale(0, .004); filter: brightness(8); }
  35% { transform: scale(1, .004); filter: brightness(5); }
  62% { transform: scale(1, 1.05); filter: brightness(1.7); }
  100% { transform: none; filter: none; }
}
.me.closing .me-card { animation: crtOff .38s ease-in both; }
.me.closing .me-backdrop { animation: meFadeOut .38s ease-in both; }
@keyframes crtOff {
  0% { transform: none; filter: none; }
  55% { transform: scale(1, .004); filter: brightness(5); }
  100% { transform: scale(0, .004); filter: brightness(8); }
}
@keyframes meFadeOut { from { opacity: .94; } to { opacity: 0; } }
.me-card > * { opacity: 0; animation: meIn .5s ease-out forwards; }
.me-card > :nth-child(1) { animation-delay: .6s; }
.me-card > :nth-child(2) { animation-delay: .55s; }
.me-card > :nth-child(3) { animation-delay: .62s; }
.me-card > :nth-child(4) { animation-delay: .68s; }
.me-card > :nth-child(5) { animation-delay: .74s; }
.me-card > :nth-child(6) { animation-delay: 1.9s; }
.me-card > :nth-child(7) { animation-delay: 2.1s; }
.me-card > :nth-child(8) { animation-delay: 2.3s; }
@keyframes meIn { from { opacity: 0; transform: translateY(6px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

.me-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--cream); font-size: 22px; opacity: .5; cursor: pointer; }
.me-close:hover { opacity: 1; }
.me-px { width: 64px; height: 72px; image-rendering: pixelated; display: block; margin-bottom: 14px; filter: drop-shadow(0 0 10px rgba(94, 230, 208, .5)); }
.me-eyebrow { font-family: var(--pixel); font-size: 8px; letter-spacing: 1px; color: var(--teal); margin: 0 0 12px; }
.me-name { font-family: var(--pixel); font-weight: 400; font-size: clamp(18px, 3vw, 24px); margin: 0 0 18px; position: relative; color: var(--cream); }
.me-name::before, .me-name::after { content: attr(data-text); position: absolute; left: 0; top: 0; pointer-events: none; mix-blend-mode: screen; }
.me-name::before { color: #ff4fa3; animation: glitchA 2.6s steps(1) infinite; }
.me-name::after { color: #5ee6d0; animation: glitchB 2.6s steps(1) infinite; }
@keyframes glitchA {
  0%, 86%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
  88% { transform: translate(-3px, 0); clip-path: inset(10% 0 55% 0); }
  91% { transform: translate(2px, 0); clip-path: inset(60% 0 5% 0); }
  94% { transform: translate(-1px, 0); clip-path: inset(30% 0 40% 0); }
}
@keyframes glitchB {
  0%, 87%, 100% { transform: none; clip-path: inset(0 0 100% 0); }
  89% { transform: translate(3px, 0); clip-path: inset(50% 0 20% 0); }
  92% { transform: translate(-2px, 0); clip-path: inset(5% 0 70% 0); }
}
.me-line { font-size: 15px; line-height: 1.65; margin: 0 0 12px; opacity: .8; }
.me-line.typed { min-height: 3.3em; opacity: 1; }
.me-line.typing::after { content: '▋'; color: var(--accent); margin-left: 2px; animation: blink .8s steps(2) infinite; }
.me-gh {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 10px;
  padding: 12px 16px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  color: var(--cream); text-decoration: none;
  font-family: var(--pixel); font-size: 10px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.me-gh span { color: var(--accent); }
.me-gh .arrow { color: var(--teal); transition: transform .2s; }
.me-gh:hover { border-color: var(--accent); box-shadow: 0 0 24px -6px var(--accent); transform: translateY(-2px); }
.me-gh:hover .arrow { transform: translate(2px, -2px); }
.me-foot { font-family: var(--pixel); font-size: 7px; opacity: .3 !important; margin: 22px 0 0; letter-spacing: 1px; }
@media (prefers-reduced-motion: reduce) {
  .me-card, .me-card > *, .me-name::before, .me-name::after { animation: none; opacity: 1; }
}
