/* =========================================================
   David Pérez Salort — Portfolio
   ========================================================= */

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Pixel Digits';
  src: url('../assets/fonts/vt323.woff2') format('woff2');
  unicode-range: U+0030-0039, U+002E, U+003A, U+00B0; /* 0-9 . : ° */
  size-adjust: 125%;
  font-display: swap;
}
@font-face {
  font-family: 'Pixelify Sans';
  src: url('../assets/fonts/pixelify-sans.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/space-grotesk.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #07090d;
  --bg-2: #0c0f15;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e9ecf2;
  --muted: #98a1b1;
  --faint: #7f8899;
  --accent: #3ddc84;
  --accent-text: #4ae391;
  --accent-2: #8b6cff;
  --accent-3: #22d3ee;
  --on-accent: #04130b;
  --shadow: 0 30px 80px -20px rgba(0, 0, 0, .65);
  --grid-line: rgba(255, 255, 255, .045);
  --particle: 180, 200, 230;
  --pixel-lit: 61, 220, 132;
  --grain-opacity: .05;
  --px: 4px;
  --px-line: #283040;
  --px-shadow: #010203;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --font-pixel: 'Pixel Digits', 'Pixelify Sans', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --container: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 68px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-2: #eceef2;
  --surface: rgba(12, 18, 32, .03);
  --surface-2: rgba(12, 18, 32, .055);
  --border: rgba(12, 18, 32, .1);
  --border-strong: rgba(12, 18, 32, .18);
  --text: #0b0e14;
  --muted: #4d5666;
  --faint: #626b7c;
  --accent: #1fb866;
  --accent-text: #0a7d42;
  --accent-2: #6a4cf0;
  --accent-3: #0891b2;
  --on-accent: #ffffff;
  --shadow: 0 30px 70px -25px rgba(20, 30, 60, .28);
  --grid-line: rgba(12, 18, 32, .06);
  --particle: 60, 80, 120;
  --pixel-lit: 31, 184, 102;
  --grain-opacity: .05;
  --px-line: #c3c9d4;
  --px-shadow: #d2d7df;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  transition: background-color .5s var(--ease), color .5s var(--ease);
}
/* Subtle scanlines */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 100;
  opacity: var(--grain-opacity);
  background: repeating-linear-gradient(0deg, #000 0 1px, transparent 1px 3px);
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: fixed; left: 16px; top: 16px; z-index: 200; transform: translateY(-200%);
  padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  transition: transform .2s;
}
.skip-link:focus { transform: none; }

.gradient-text {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-3) 45%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ---------- Scroll progress & cursor ---------- */
.scroll-progress {
  position: fixed; inset: 0 0 auto; height: 4px; z-index: 120;
  background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent-2));
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 12px);
  mask: repeating-linear-gradient(90deg, #000 0 10px, transparent 10px 12px);
  clip-path: inset(0 calc(100% - var(--p, 0%)) 0 0);
}
.cursor-halo {
  position: fixed; left: 0; top: 0; z-index: 0;
  width: 520px; height: 520px; margin: -260px 0 0 -260px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 13%, transparent) 0%, transparent 60%);
  opacity: 0; transition: opacity .6s;
  will-change: transform;
}
@media (pointer: fine) { .cursor-halo.is-on { opacity: 1; } }
main, .footer { position: relative; z-index: 1; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 110;
  height: var(--nav-h);
  transition: background-color .4s, border-color .4s, backdrop-filter .4s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom-color: var(--border);
}
.nav-inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.nav-logo { display: inline-flex; align-items: center; gap: 3px; font: 700 1.15rem/1 var(--font-display); letter-spacing: -.02em; }
.nav-logo-mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  background: var(--surface); font-family: var(--font-pixel); font-weight: 600;
}
.nav-logo { gap: 8px; }
.nav-logo-dot { width: 8px; height: 8px; background: var(--accent); align-self: flex-end; margin-bottom: 2px; animation: blink 1.05s steps(1) infinite; }
.nav nav { margin-left: auto; }
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  position: relative; display: block; padding: 8px 14px;
  font-size: .9rem; color: var(--muted); transition: color .25s, background-color .25s;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.is-active { color: var(--text); }
.nav-links a.is-active::after {
  content: ''; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px;
  background: var(--accent);
}
.nav-actions { display: flex; align-items: center; gap: 8px; }
.mascot { position: relative; top: -7px; width: 40px; height: 48px; margin-left: 2px; } /* the droid sits in the lower part of the canvas: shift it up to centre it with the icons */
.mascot-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.mascot:focus-visible { outline-offset: 2px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface);
  font: 600 .82rem/1 var(--font-pixel); letter-spacing: .04em;
  transition: border-color .25s, background-color .25s, transform .25s var(--ease);
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn:active { transform: scale(.94); }
.lang-other, .lang-sep { color: var(--faint); }
.theme-toggle { padding: 0; width: 38px; }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; transition: transform .6s var(--ease), opacity .3s; }
.theme-toggle .icon-moon { position: absolute; }
.theme-toggle { position: relative; }
[data-theme="dark"] .theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(.5); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(.5); }

@media (max-width: 760px) {
  .nav nav { display: none; }
  .nav-actions { margin-left: auto; }
}

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 24px;
  font: 600 1rem/1 var(--font-pixel); letter-spacing: .02em;
  transition: background-color .3s, color .3s, translate .1s steps(1);
  isolation: isolate; overflow: hidden;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover svg { transform: translateY(3px); }
.btn-ghost { background: var(--surface); }
.btn-ghost:hover { background: var(--surface-2); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--nav-h) + 40px) 0 90px;
  overflow: hidden;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-aurora { position: absolute; inset: 0; pointer-events: none; filter: blur(70px); opacity: .28; }
.hero-aurora span { position: absolute; border-radius: 50%; will-change: transform; }
.hero-aurora span:nth-child(1) { width: 46vw; height: 46vw; left: -12vw; top: -14vw; background: color-mix(in srgb, var(--accent) 38%, transparent); }
.hero-aurora span:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 5vh; background: color-mix(in srgb, var(--accent-2) 40%, transparent); }
.hero-aurora span:nth-child(3) { width: 34vw; height: 34vw; left: 30vw; bottom: -18vw; background: color-mix(in srgb, var(--accent-3) 28%, transparent); }
[data-theme="light"] .hero-aurora { opacity: .2; }
.hero-inner {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  align-items: center; gap: clamp(32px, 5vw, 72px);
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 10px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  font: 500 .85rem/1.2 var(--font-pixel); color: var(--muted);
}
.pulse-dot { position: relative; width: 8px; height: 8px; background: var(--accent); flex: none; }
.pulse-dot::after { content: ''; position: absolute; inset: 0; background: var(--accent); animation: ping 1.6s steps(4) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(2.5); opacity: 0; } }

.hero-name {
  margin-top: 22px;
  font: 700 clamp(2.9rem, 8.2vw, 6.4rem)/.95 var(--font-display);
  letter-spacing: -.045em;
}
.hero-name .split { display: block; padding-bottom: .06em; }
.hero-name .word { display: inline-block; white-space: nowrap; }
.hero-name .char { display: inline-block; will-change: transform, opacity, filter; }
.hero-name .gradient-text .char {
  background: inherit; -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* The surname gradient is applied per letter so it works with the split */
.hero-name .gradient-text { background: none; }
.hero-name .gradient-text .char { background-image: linear-gradient(100deg, var(--accent) 0%, var(--accent-3) 55%, var(--accent-2) 110%); background-repeat: no-repeat; }

.hero-role {
  margin-top: 22px;
  font: 500 clamp(1rem, 1.9vw, 1.28rem)/1.3 var(--font-mono);
  color: var(--text); letter-spacing: -.01em;
  display: flex; align-items: center; flex-wrap: wrap;
}
.role-bracket { color: var(--accent-text); }
.caret { display: inline-block; width: .55em; height: 1.15em; margin-left: 6px; background: var(--accent); animation: blink 1.05s steps(1) infinite; vertical-align: middle; }
@keyframes blink { 50% { opacity: 0; } }
.hero-desc { margin-top: 20px; max-width: 58ch; font-size: clamp(1rem, 1.35vw, 1.1rem); color: var(--muted); }
.hero-tags { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-tags li {
  padding: 6px 12px; font-size: .8rem; font-weight: 500;
  background: var(--surface); color: var(--text);
}
.hero-ctas { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-stats { margin: 48px 0 0; display: flex; gap: clamp(20px, 4vw, 48px); flex-wrap: wrap; }
.hero-stats > div { display: flex; flex-direction: column-reverse; }
.hero-stats dd { margin: 0; font: 700 clamp(1.9rem, 3.2vw, 2.6rem)/1 var(--font-pixel); color: var(--accent-text); font-variant-numeric: tabular-nums; }
.hero-stats dt { margin-top: 6px; font-size: .8rem; color: var(--faint); }

.scroll-hint {
  position: absolute; left: 50%; bottom: 26px; margin-left: -12px;
  width: 24px; height: 38px; border: 3px solid var(--border-strong);
}
.scroll-hint span { position: absolute; left: 50%; top: 6px; width: 4px; height: 8px; margin-left: -2px; background: var(--text); animation: wheel 1.8s steps(4) infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Hero visual: head unit ---------- */
.hero-visual { position: relative; perspective: 1400px; }
.device { position: relative; transform-style: preserve-3d; transform: rotateX(var(--rx, 8deg)) rotateY(var(--ry, -14deg)); transition: transform .8s var(--ease); }
.device-bezel {
  position: relative; padding: 12px;
  background: #151a23;
  box-shadow:
    0 -6px 0 0 #2a3140, 0 6px 0 0 #2a3140, -6px 0 0 0 #2a3140, 6px 0 0 0 #2a3140,
    12px 18px 0 0 var(--px-shadow), 18px 12px 0 0 var(--px-shadow);
}
.hu {
  --hu-bg: #080a0f; --hu-card: #11151d; --hu-line: #232a36; --hu-text: #e8ebf1; --hu-muted: #7d8699;
  aspect-ratio: 16 / 10.5; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px),
    var(--hu-bg);
  color: var(--hu-text); padding: 14px; display: flex; flex-direction: column; gap: 10px;
  font: 500 11px/1.2 var(--font-pixel);
}
.hu-status { display: flex; justify-content: space-between; align-items: center; color: var(--hu-muted); font-weight: 600; letter-spacing: .04em; }
.hu-time { font-size: 14px; color: var(--hu-text); font-variant-numeric: tabular-nums; }
.hu-status-icons { display: flex; gap: 8px; align-items: center; }
.hu-status-icons svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: square; stroke-linejoin: miter; }
.hu-grid { flex: 1; display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; min-height: 0; }
.hu-card {
  position: relative; background: var(--hu-card); padding: 12px; overflow: hidden;
  box-shadow: inset 0 0 0 2px var(--hu-line), inset 0 -4px 0 0 rgba(0, 0, 0, .35);
}
.hu-label { color: var(--hu-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.hu-value { font-weight: 700; font-size: 14px; margin-top: 3px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.hu-sub { color: var(--hu-muted); font-size: 10px; margin-top: 3px; }
.hu-ok { width: 6px; height: 6px; background: #3ddc84; animation: blink 1.2s steps(1) infinite; }
.hu-bt { display: flex; align-items: center; gap: 14px; }
.bt-rings { position: relative; width: 54px; height: 54px; flex: none; display: grid; place-items: center; }
.bt-rings span { position: absolute; inset: 0; border: 3px solid #3b82f6; opacity: 0; animation: bt 2.4s steps(6) infinite; }
.bt-rings span:nth-child(2) { animation-delay: .8s; }
.bt-rings span:nth-child(3) { animation-delay: 1.6s; }
@keyframes bt { 0% { transform: scale(.45); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
.bt-icon {
  position: relative; width: 28px; height: 28px; padding: 5px 7px; background: #3b82f6;
  box-shadow: 3px 3px 0 #1e3a8a;
}
.hu-media { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: box-shadow .15s steps(2); }
.hu-media:hover, .hu-media:focus-visible { box-shadow: inset 0 0 0 2px #ff5c8a, inset 0 -4px 0 0 rgba(0, 0, 0, .35); outline: none; }
.hu-media .hu-label, .hu-media .hu-sub, .hu-media .hu-progress { display: block; }
.hu-media-info { display: block; }
.hu-art { position: relative; display: block; width: 52px; height: 52px; flex: none; box-shadow: 0 0 0 2px #2d3170, 3px 3px 0 2px #000; }
.hu-art-img { display: block; width: 100%; height: 100%; }
.hu-play {
  /* Pixel ▶ triangle over the cover art */
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 10, 15, .45);
  opacity: 0; transition: opacity .15s steps(2);
}
.hu-play::before {
  content: ''; width: 14px; height: 16px; background: #fff;
  clip-path: polygon(0 0, 25% 0, 25% 12.5%, 50% 12.5%, 50% 25%, 75% 25%, 75% 37.5%, 100% 37.5%, 100% 62.5%, 75% 62.5%, 75% 75%, 50% 75%, 50% 87.5%, 25% 87.5%, 25% 100%, 0 100%);
}
.hu-media.is-playing .hu-play::before { width: 14px; clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0); }
.hu-media:hover .hu-play, .hu-media:focus-visible .hu-play, .hu-media.is-playing .hu-play { opacity: 1; }
@media (hover: none) { .hu-play { opacity: .85; } }
.hu-media-info { min-width: 0; flex: 1; }
.hu-eq { display: flex; align-items: flex-end; gap: 2px; height: 12px; margin-top: 5px; }
.hu-eq span { width: 4px; height: 100%; background: #ff5c8a; transform-origin: 50% 100%; transform: scaleY(.25); animation: eq .9s steps(3) infinite alternate paused; }
.hu-media.is-playing .hu-eq span, .hu-media.is-playing .hu-progress span { animation-play-state: running; }
.hu-eq span:nth-child(2) { animation-delay: -.3s; background: #ff8a5c; }
.hu-eq span:nth-child(3) { animation-delay: -.6s; background: #ffb703; }
.hu-eq span:nth-child(4) { animation-delay: -.15s; background: #ff8a5c; }
.hu-eq span:nth-child(5) { animation-delay: -.45s; }
.hu-eq span:nth-child(6) { animation-delay: -.75s; background: #ffb703; }
@keyframes eq { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
.hu-progress {
  margin-top: 6px; height: 4px; background: var(--hu-line); overflow: hidden;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 6px);
  mask: repeating-linear-gradient(90deg, #000 0 4px, transparent 4px 6px);
}
.hu-progress span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5c8a, #ffb703); transform-origin: 0 50%; animation: progress 9s steps(24) infinite paused; }
@keyframes progress { from { transform: scaleX(.05); } to { transform: scaleX(1); } }
.hu-nav { padding: 8px 10px; display: flex; flex-direction: column; }
.hu-map { flex: 1; width: 100%; min-height: 0; }
.map-road { fill: none; stroke: #1f2632; stroke-width: 3; stroke-linecap: square; }
.map-route { fill: none; stroke: #3ddc84; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; stroke-dasharray: 50; stroke-dashoffset: 50; animation: route 4s steps(16) infinite; }
@keyframes route { 0% { stroke-dashoffset: 50; } 70%, 100% { stroke-dashoffset: 0; } }
.map-pin { fill: #ffd166; animation: blink .8s steps(1) infinite; }
.hu-big { font: 700 32px/1.1 var(--font-pixel); margin-top: 4px; color: #67e8f9; text-shadow: 2px 2px 0 #000; }
.hu-fan { display: flex; gap: 3px; margin-top: 10px; }
.hu-fan span { flex: 1; height: 6px; background: var(--hu-line); }
.hu-fan span:nth-child(1) { background: #22d3ee; }
.hu-fan span:nth-child(2) { background: #5eb3f7; }
.hu-fan span:nth-child(3) { background: #8b6cff; animation: blink 1.6s steps(1) infinite; }
.hu-dock { display: flex; justify-content: center; gap: 8px; }
.hu-dock span { width: 26px; height: 6px; background: var(--hu-line); }
.hu-dock .is-on { background: #3ddc84; }

.code-card {
  position: absolute; left: -14%; bottom: -24%; width: min(330px, 70%);
  background: rgba(12, 15, 21, .94);
  box-shadow:
    0 -3px 0 0 #2f3746, 0 3px 0 0 #2f3746, -3px 0 0 0 #2f3746, 3px 0 0 0 #2f3746,
    6px 9px 0 0 #000, 9px 6px 0 0 #000;
  transform: translateZ(60px);
  color: #cdd3de;
}
.code-head { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 2px solid #232a36; font: 500 11px var(--font-pixel); color: #7d8699; }
.code-head i { width: 8px; height: 8px; background: #3a404c; }
.code-head i:nth-child(1) { background: #ff5f57; } .code-head i:nth-child(2) { background: #febc2e; } .code-head i:nth-child(3) { background: #28c840; }
.code-head span { margin-left: 6px; }
.code-card pre { margin: 0; padding: 12px 14px 14px; font: 400 11px/1.6 var(--font-mono); overflow: hidden; white-space: pre; }
.code-card .k { color: #c792ea; } .code-card .f { color: #82aaff; } .code-card .t { color: #ffcb6b; }
.float-chip {
  position: absolute; padding: 7px 13px;
  font: 600 .8rem/1 var(--font-pixel); white-space: nowrap;
  background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--text);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transform: translateZ(90px);
}
.float-chip::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 7px; vertical-align: 1px; background: var(--accent); }
@keyframes hop { 50% { translate: 0 -4px; } }
[data-sprite] svg { display: block; width: 100%; height: 100%; }
.chip-a { top: -5%; left: 8%; }
.chip-a::before { background: #8b6cff; }
.chip-b { top: 16%; right: -7%; }
.chip-b::before { background: #4c8dff; }
.chip-c { bottom: 6%; right: -4%; }
.chip-c::before { background: #3b82f6; }

@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { max-width: 560px; width: 92%; margin: 30px auto 40px; }
  .scroll-hint { display: none; }
}
@media (max-width: 520px) {
  .hu { font-size: 9px; padding: 10px; gap: 8px; }
  .hu-card { padding: 8px; }
  .hu-value { font-size: 11px; }
  .bt-rings { width: 40px; height: 40px; }
  .hu-art { width: 38px; height: 38px; }
  .hu-big { font-size: 24px; }
  .hu-time { font-size: 12px; }
  .code-card { left: -3%; bottom: -34%; width: 74%; }
  .code-card pre { font-size: 9px; padding: 9px 10px; }
  .chip-b { right: -2%; } .chip-c { display: none; }
  .hero-visual { margin-bottom: 110px; }
}

/* ---------- Marquee ---------- */
.marquee {
  position: relative; z-index: 1; overflow: hidden;
  border-block: 1px solid var(--border);
  background: var(--bg-2);
  padding: 20px 0;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; width: max-content; gap: 56px; animation: marquee 40s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee span { font: 600 clamp(1.1rem, 2.2vw, 1.6rem)/1 var(--font-pixel); letter-spacing: .01em; color: var(--faint); white-space: nowrap; display: inline-flex; align-items: center; gap: 56px; transition: color .3s; }
.marquee span:hover { color: var(--text); }
.marquee span::after { content: ''; width: 8px; height: 8px; background: var(--accent); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { position: relative; padding: clamp(90px, 13vw, 160px) 0; }
.section-head { max-width: 780px; margin-bottom: clamp(44px, 6vw, 72px); }
.section-kicker { display: flex; align-items: center; gap: 10px; font: 600 .9rem/1 var(--font-pixel); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 18px; }
.section-kicker::before { content: ''; width: 10px; height: 10px; background: var(--accent); box-shadow: 4px 4px 0 var(--px-shadow); }
.contact-inner .section-kicker { justify-content: center; }
.section-lead { margin-top: 22px; max-width: 62ch; color: var(--muted); font-size: 1.05rem; }
.section-title, .contact-title { font: 700 clamp(2rem, 4.6vw, 3.4rem)/1.06 var(--font-display); letter-spacing: -.035em; text-wrap: balance; }
.mask { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.mask > span { display: block; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(40px, 7vw, 100px); align-items: center; }
.about-photo { position: relative; max-width: 440px; width: 100%; justify-self: center; }
.photo-frame {
  position: relative; padding: 4px; overflow: hidden;
  clip-path: polygon(0 12px, 6px 12px, 6px 6px, 12px 6px, 12px 0, calc(100% - 12px) 0, calc(100% - 12px) 6px, calc(100% - 6px) 6px, calc(100% - 6px) 12px, 100% 12px, 100% calc(100% - 12px), calc(100% - 6px) calc(100% - 12px), calc(100% - 6px) calc(100% - 6px), calc(100% - 12px) calc(100% - 6px), calc(100% - 12px) 100%, 12px 100%, 12px calc(100% - 6px), 6px calc(100% - 6px), 6px calc(100% - 12px), 0 calc(100% - 12px));
  isolation: isolate;
}
/* Rotating gradient border: a layer rotated with transform (GPU-composited, no repaints) */
.photo-frame::before {
  content: ''; position: absolute; inset: -50%; z-index: -1;
  background: conic-gradient(var(--accent), var(--accent-3), var(--accent-2), var(--accent));
  animation: rotate-border 8s linear infinite;
}
@keyframes rotate-border { to { transform: rotate(360deg); } }
.photo-frame picture { display: block; }
.photo-frame img { width: 100%; height: auto; transition: transform .8s var(--ease); }
.about-photo:hover .photo-frame img { transform: scale(1.03); }
.photo-badge {
  position: absolute; right: -14px; bottom: 26px;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font: 600 .88rem/1 var(--font-pixel);
}
.about-text .section-title { margin-bottom: 28px; }
.about-text > p { color: var(--muted); font-size: 1.05rem; max-width: 62ch; }
.about-text > p + p { margin-top: 16px; }
.about-pillars { margin-top: 40px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.about-pillars li { padding: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.about-pillars strong { font: 600 1.02rem var(--font-pixel); color: var(--accent-text); }
.about-pillars span { font-size: .86rem; color: var(--muted); line-height: 1.45; }
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .about-photo { max-width: 300px; }
  .about-pillars { grid-template-columns: 1fr; }
}

/* ---------- Skills ---------- */
.skill-groups { display: grid; gap: 14px; }
.skill-group { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; padding: 22px 0; border-top: 1px solid var(--border); }
.skill-group .skill-group-title { margin: 14px 0 0; }
.skill-group-title { display: flex; align-items: center; gap: 12px; font: 600 1.05rem var(--font-display); margin-bottom: 16px; }
.sg-index { display: grid; place-items: center; width: 26px; height: 26px; font: 600 .9rem var(--font-pixel); color: var(--on-accent); background: var(--accent); box-shadow: 3px 3px 0 var(--px-shadow); }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 20px; }
.tech-card {
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg;
  position: relative; isolation: isolate;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px;
  background: var(--surface);
  transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s var(--ease), border-color .35s, background-color .35s, box-shadow .35s;
  cursor: default;
}
.tech-card.is-tilting { transition: transform .12s linear, border-color .35s, background-color .35s, box-shadow .35s; }
.tech-card::before {
  /* Spotlight that follows the cursor */
  content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: radial-gradient(240px circle at var(--mx) var(--my), color-mix(in srgb, var(--c) 22%, transparent), transparent 65%);
  opacity: 0; transition: opacity .35s;
}
.tech-card::after {
  /* Lit border */
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: radial-gradient(180px circle at var(--mx) var(--my), var(--c), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s;
}
.tech-card:hover, .tech-card:focus-within { --pb: var(--c); }
.tech-card:hover::before, .tech-card:hover::after { opacity: 1; }
.tech-icon {
  display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 12px;
  font: 700 1rem var(--font-pixel);
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent);
  transition: transform .5s var(--ease), box-shadow .5s;
}
[data-theme="light"] .tech-icon { color: color-mix(in srgb, var(--c) 70%, #000); }
.tech-card:hover .tech-icon { transform: translateY(-4px) translateZ(20px); box-shadow: inset 0 0 0 2px var(--c), 4px 4px 0 var(--px-shadow); }
.tech-name { font: 600 1rem/1.2 var(--font-display); }
.tech-desc { font-size: .8rem; color: var(--muted); line-height: 1.4; }
.tech-card:active { transform: scale(.98); }

.skill-extra { margin-top: clamp(40px, 5vw, 64px); display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.extra-block { padding: 26px; }
.extra-block h3 { font: 600 1rem var(--font-display); margin-bottom: 16px; color: var(--muted); }
.extra-block p { margin-top: 14px; font-size: .88rem; color: var(--muted); }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-list { gap: 10px; }
.pill-list li { padding: 5px 11px; font-size: .82rem; background: var(--surface); transition: translate .15s steps(2); }
.pill-list li:hover { --pb: var(--accent); translate: 0 -2px; }
.ai-spark { color: var(--accent-2); display: inline-block; }
@media (max-width: 860px) {
  .skill-group, .skill-extra { grid-template-columns: 1fr; }
  .skill-group { gap: 4px; }
}
@media (max-width: 420px) {
  .tech-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tech-card { padding: 14px; }
}

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.timeline-line {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; background: var(--border-strong); overflow: hidden;
  -webkit-mask: repeating-linear-gradient(180deg, #000 0 8px, transparent 8px 12px);
  mask: repeating-linear-gradient(180deg, #000 0 8px, transparent 8px 12px);
}
.timeline-progress { position: absolute; inset: 0; background: linear-gradient(180deg, var(--accent), var(--accent-3) 50%, var(--accent-2)); transform-origin: 50% 0; transform: scaleY(0); }
.tl-list { display: flex; flex-direction: column; gap: clamp(28px, 4vw, 48px); }
.tl-item { position: relative; display: grid; grid-template-columns: 1fr 1fr; column-gap: 72px; align-items: start; }
.tl-dot {
  position: absolute; left: 50%; top: 26px; width: 16px; height: 16px; margin-left: -8px;
  background: var(--bg); border: 4px solid var(--border-strong); z-index: 1;
  transition: border-color .4s, background-color .4s, box-shadow .4s, transform .5s var(--ease);
}
.tl-item.is-active .tl-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.tl-date { font: 500 .95rem/1 var(--font-pixel); color: var(--faint); padding-top: 28px; text-align: right; transition: color .4s; }
.tl-item.is-active .tl-date { color: var(--accent-text); }
.tl-card {
  position: relative; padding: clamp(22px, 3vw, 30px);
  background: var(--surface);
  transition: translate .15s steps(2);
}
.tl-card:hover { --pb: var(--accent); translate: 0 -4px; }
.tl-item:nth-child(even) .tl-date { grid-column: 2; grid-row: 1; text-align: left; }
.tl-item:nth-child(even) .tl-card { grid-column: 1; grid-row: 1; }
.tl-highlight {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
  padding: 5px 11px; font: 600 .8rem/1.2 var(--font-pixel);
  color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.tl-highlight::before { content: ''; width: 6px; height: 6px; background: currentColor; }
.tl-card h3 { font: 600 1.28rem/1.25 var(--font-display); letter-spacing: -.02em; }
.tl-company { margin-top: 4px; font-size: .9rem; color: var(--accent-text); font-weight: 500; }
.tl-card > p:not(.tl-company):not(.tl-highlight) { margin-top: 14px; color: var(--muted); font-size: .95rem; }
.tl-card > ul:not(.tl-tags) { margin-top: 12px; display: grid; gap: 8px; }
.tl-card > ul:not(.tl-tags) li { position: relative; padding-left: 20px; font-size: .92rem; color: var(--muted); line-height: 1.55; }
.tl-card > ul:not(.tl-tags) li::before { content: ''; position: absolute; left: 2px; top: .55em; width: 6px; height: 6px; background: var(--accent); }
.tl-tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.tl-tags li { padding: 4px 10px; font: 500 .74rem var(--font-mono); color: var(--muted); background: var(--surface-2); }
@media (max-width: 860px) {
  .timeline-line { left: 7px; }
  .tl-item, .tl-item:nth-child(even) { grid-template-columns: 1fr; padding-left: 40px; }
  .tl-dot { left: 7px; top: 3px; }
  .tl-date, .tl-item:nth-child(even) .tl-date { grid-column: 1; grid-row: 1; text-align: left; padding: 0 0 12px; }
  .tl-card, .tl-item:nth-child(even) .tl-card { grid-column: 1; grid-row: 2; }
}

/* ---------- Projects: cartridges ---------- */
.cart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 36px 28px; }
.cart {
  --cc: var(--accent-3);
  position: relative; display: flex; flex-direction: column;
  padding: 20px 0 22px;
  background: var(--surface);
  transition: translate .15s steps(2);
}
.cart[data-context="personal"] { --cc: var(--accent); }
.cart[data-context="edu"] { --cc: var(--accent-2); }
.cart::before {
  /* Grooves along the top of the cartridge */
  content: ''; position: absolute; left: 24px; right: 24px; top: 6px; height: 6px;
  background: repeating-linear-gradient(90deg, var(--px-line) 0 4px, transparent 4px 8px);
}
.cart:hover { --pb: var(--cc); translate: 0 -4px; }
.cart > h3, .cart > p, .cart > ul { margin-inline: 20px; }

/* Illustrated cartridge label */
.cart-art {
  position: relative; display: grid; place-items: center;
  height: 150px; margin: 0 12px 18px; overflow: hidden;
  background:
    radial-gradient(circle at 50% 58%, color-mix(in srgb, var(--cc) 30%, transparent) 0 34%, transparent 35%),
    conic-gradient(color-mix(in srgb, var(--cc) 10%, transparent) 25%, transparent 0 50%, color-mix(in srgb, var(--cc) 10%, transparent) 0 75%, transparent 0) 0 0 / 16px 16px,
    color-mix(in srgb, var(--cc) 14%, var(--bg-2));
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--cc) 45%, transparent);
}
.cart-art::after {
  /* Pixel ground */
  content: ''; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 12px;
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--cc) 40%, transparent) 0 8px, color-mix(in srgb, var(--cc) 25%, transparent) 8px 16px);
}
.cart-icon {
  width: 72px; height: 72px; margin-top: 18px;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, .45));
}
.cart:hover .cart-icon { animation: hop .4s steps(2) infinite; }
.cart-label {
  position: absolute; inset: 10px 10px auto; z-index: 1;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font: 600 .8rem/1 var(--font-pixel);
}
.cart-ctx { padding: 5px 7px; background: var(--cc); color: var(--on-accent); }
[data-theme="dark"] .cart-ctx { color: #04130b; }
.cart-date { padding: 5px 7px; background: color-mix(in srgb, var(--bg) 75%, transparent); color: var(--text); }
.cart h3 { font: 700 1.3rem/1.2 var(--font-pixel); letter-spacing: .01em; }
.cart > p { flex: 1; margin-top: 8px; font-size: .9rem; color: var(--muted); line-height: 1.55; }
.cart-tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.cart-tags li { padding: 3px 8px; font: 500 .72rem var(--font-mono); color: var(--muted); background: var(--surface-2); }

/* ---------- Education ---------- */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 64px); }
.edu-head { font: 600 .9rem/1 var(--font-pixel); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.edu-list li { display: grid; grid-template-columns: 110px 1fr; column-gap: 20px; row-gap: 4px; padding: 20px 0; border-bottom: 1px solid var(--border); transition: padding-left .4s var(--ease); }
.edu-list li:hover { padding-left: 8px; }
.edu-year { grid-row: span 2; font: 500 .9rem/1.5 var(--font-pixel); color: var(--accent-text); }
.edu-list strong { font: 600 1rem/1.4 var(--font-display); }
.edu-list li > span:last-child { font-size: .86rem; color: var(--muted); }
.edu-langs { margin-top: clamp(40px, 5vw, 64px); }
.lang-list { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 24px; }
.lang-list li { display: flex; align-items: center; gap: 14px; padding: 14px 18px 14px 14px; background: var(--surface); }
.lang-code { display: grid; place-items: center; width: 34px; height: 34px; font: 600 .95rem/1 var(--font-pixel); color: var(--on-accent); background: var(--accent); box-shadow: 3px 3px 0 var(--px-shadow); }
.lang-list strong { font: 600 1rem/1.3 var(--font-display); }
.lang-list li > span:last-child { font-size: .88rem; color: var(--muted); }
.lang-more { margin-top: 18px; font-size: .9rem; color: var(--faint); }
@media (max-width: 860px) { .edu-grid { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .lang-list { flex-direction: column; } }
@media (max-width: 480px) { .edu-list li { grid-template-columns: 1fr; } .edu-year { grid-row: auto; } }

/* ---------- Contact ---------- */
.contact { overflow: hidden; }
.contact::before {
  content: ''; position: absolute; left: 50%; top: 55%; width: min(900px, 120vw); aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%);
  pointer-events: none;
}
.contact-inner { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact-title { font-size: clamp(2.4rem, 7vw, 5.2rem); }
.contact-text { margin-top: 22px; max-width: 56ch; color: var(--muted); font-size: 1.08rem; }
.contact-mail { margin-top: 36px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.mail-link {
  position: relative; font: 600 clamp(1.1rem, 3vw, 1.8rem)/1.2 var(--font-display); letter-spacing: -.02em;
  word-break: break-all;
}
.mail-link::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform: scaleX(0); transform-origin: right; transition: transform .6s var(--ease); }
.mail-link:hover::after { transform: scaleX(1); transform-origin: left; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; font: 600 .85rem/1 var(--font-pixel); background: var(--surface); transition: background-color .25s; }
.copy-btn:hover { background: var(--surface-2); --pb: var(--accent); }
.copy-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.contact-actions { margin-top: 44px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; justify-content: center; }

.btn-cv {
  height: 60px; padding: 0 32px; font-size: 1rem;
  color: var(--on-accent);
  background: var(--accent);
}
.btn-cv:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn-cv-shine { position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transform: translateX(-120%); animation: shine 3.4s var(--ease) infinite; }
@keyframes shine { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.btn-cv:hover .cv-icon { animation: bounce .8s var(--ease) infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
.btn-cv svg { width: 20px; height: 20px; }

.socials { display: flex; gap: 20px; }
.social {
  display: grid; place-items: center; width: 56px; height: 56px;
  background: var(--surface);
  transition: background-color .3s, color .3s, translate .1s steps(1);
}
.social svg { width: 21px; height: 21px; fill: currentColor; }
.social svg.stroke { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.social:hover { background: var(--text); color: var(--bg); --pb: var(--text); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; font-size: .85rem; color: var(--faint); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; }
.to-top { color: var(--muted); transition: color .25s; }
.footer-droid { display: inline-flex; align-items: center; gap: 10px; font: 500 .9rem/1 var(--font-pixel); color: var(--faint); transition: color .2s; }
.footer-droid-sprite { width: 26px; height: 24px; }
.footer-droid:hover, .footer-droid:focus-visible { color: var(--accent-text); }
.footer-droid:hover .footer-droid-sprite, .footer-droid:focus-visible .footer-droid-sprite { animation: hop .35s steps(2) infinite; }
.footer-droid-text { animation: blink 2.4s steps(1) infinite; }
.to-top:hover { color: var(--accent-text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 150;
  padding: 12px 18px; font: 500 .92rem/1.2 var(--font-pixel);
  background: var(--text); color: var(--bg);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Shared pixel frame ----------
   Border with stepped corners and a hard shadow, built with box-shadow
   (clip-path would clip the shadow). --pb = border, --ps = shadow. */
.btn, .icon-btn, .copy-btn, .social, .nav-logo-mark, .hero-eyebrow, .float-chip, .photo-badge,
.about-pillars li, .tech-card, .extra-block, .tl-card, .cart, .toast, .game-box, .game-close, .music, .music-close, .board-ok, .board-play,
.hero-tags li, .pill-list li, .tl-tags li, .cart-tags li, .tl-highlight, .lang-list li {
  --pb: var(--px-line);
  --ps: var(--px-shadow);
  border: 0; border-radius: 0;
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--pb),
    0 var(--px) 0 0 var(--pb),
    calc(var(--px) * -1) 0 0 0 var(--pb),
    var(--px) 0 0 0 var(--pb),
    var(--px) calc(var(--px) * 2) 0 0 var(--ps),
    calc(var(--px) * 2) var(--px) 0 0 var(--ps);
}
/* Small chips: 2px stroke and no shadow */
.hero-tags li, .pill-list li, .tl-tags li, .cart-tags li, .tl-highlight, .float-chip { --px: 2px; --ps: transparent; }
.hero-eyebrow, .photo-badge, .icon-btn, .copy-btn, .nav-logo-mark, .lang-list li { --px: 3px; }
.btn-primary { --pb: var(--text); }
.btn-primary:hover { --pb: var(--accent); }
.btn-cv { --pb: var(--accent); }
.btn:active, .social:active, .icon-btn:active, .copy-btn:active { translate: var(--px) var(--px); --ps: transparent; }
.icon-btn:hover { --pb: var(--accent); }
.toast { --pb: var(--text); }

/* ---------- "It's Time" mini player ---------- */
.music {
  --pb: #ff5c8a;
  position: fixed; right: 16px; bottom: 16px; z-index: 140;
  width: min(360px, calc(100vw - 32px)); padding: 10px; background: var(--bg-2);
}
.music[hidden] { display: none; }
.music-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.music-title { font: 600 .9rem/1.2 var(--font-pixel); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-close { --px: 3px; flex: none; width: 30px; height: 30px; display: grid; place-items: center; font: 600 .9rem/1 var(--font-pixel); background: var(--surface); }
.music-close:hover { --pb: #ff5c8a; }
.music-frame { height: 152px; border-radius: 12px; overflow: hidden; background: #282828; }
.music-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- Easter egg: Droid Runner ---------- */
.game {
  width: min(820px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px);
  padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible;
}
.game::backdrop { background: rgba(3, 5, 8, .8); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.game-box { --pb: var(--accent); padding: clamp(12px, 2.5vw, 20px); background: var(--bg-2); }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.game-title { font: 700 clamp(1.1rem, 3vw, 1.4rem)/1 var(--font-pixel); color: var(--accent-text); letter-spacing: .04em; }
.game-close { --px: 3px; width: 36px; height: 36px; display: grid; place-items: center; font: 600 1rem/1 var(--font-pixel); background: var(--surface); }
.game-close:hover { --pb: var(--accent); }
.game-hud { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; font: 500 clamp(.8rem, 2vw, .95rem)/1 var(--font-pixel); color: var(--muted); }
.game-hud b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.game-level { color: var(--accent-text); }
.game-level.is-up { animation: blink .2s steps(1) infinite; }
.game-stage { position: relative; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
.game-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.game-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; image-rendering: pixelated; image-rendering: crisp-edges; }
.game-msg {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; padding: 16px;
  text-align: center; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.game-msg[hidden] { display: none; }
.game-msg-title { font: 700 clamp(1.5rem, 6vw, 2.6rem)/1 var(--font-pixel); color: var(--accent-text); text-shadow: 4px 4px 0 var(--px-shadow); }
.game-msg-text { font: 500 clamp(.8rem, 2.2vw, 1rem)/1.3 var(--font-pixel); animation: blink 1.1s steps(1) infinite; }
.game-help { margin-top: 12px; font-size: .8rem; color: var(--faint); }

/* Leaderboard: initials entry and HIGH SCORES table (over the canvas) */
.game-board {
  position: absolute; inset: 0; z-index: 2;
  display: grid; place-content: safe center; justify-items: center; gap: 6px; padding: 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  font-family: var(--font-pixel); text-align: center; overflow: auto; cursor: default;
}
.game-board[hidden], .board-entry[hidden], .board-table[hidden] { display: none; }
.board-entry, .board-table { display: grid; justify-items: center; gap: clamp(4px, 1.2vw, 10px); }
.board-title { font: 700 clamp(1rem, 3.6vw, 1.7rem)/1 var(--font-pixel); color: var(--accent-text); text-shadow: 3px 3px 0 var(--px-shadow); animation: blink 1s steps(1) infinite; }
.board-sub { font-size: clamp(.72rem, 2vw, .95rem); color: var(--muted); }
.initials { display: flex; gap: clamp(8px, 2.5vw, 18px); }
.slot { display: grid; justify-items: center; gap: 2px; }
.slot-char {
  display: grid; place-items: center; width: clamp(30px, 7vw, 52px); height: clamp(34px, 8vw, 58px);
  font: 700 clamp(1.4rem, 5vw, 2.4rem)/1 var(--font-pixel); color: var(--text);
  border-bottom: 4px solid var(--border-strong);
}
.slot.is-active .slot-char { color: var(--accent-text); border-color: var(--accent); animation: blink .8s steps(1) infinite; }
.slot-up, .slot-down { width: 30px; height: 22px; font-size: .75rem; color: var(--muted); }
.slot-up:hover, .slot-down:hover { color: var(--accent-text); }
.board-ok, .board-play {
  --px: 3px; margin-top: 4px; padding: 6px 16px;
  font: 600 clamp(.8rem, 2vw, .95rem)/1 var(--font-pixel); background: var(--accent); color: var(--on-accent);
}
.board-list { display: grid; gap: 1px; min-width: min(260px, 70vw); font-size: clamp(.68rem, 2.1vw, .95rem); line-height: 1.25; }
.board-list li { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 12px; text-align: left; font-variant-numeric: tabular-nums; }
.board-list li b { font-weight: 600; letter-spacing: .12em; }
.board-list li.is-me { color: var(--accent-text); animation: blink 1s steps(1) infinite; }
.board-empty { display: block !important; text-align: center !important; color: var(--muted); }
@media (max-width: 520px) {
  .game-board { gap: 2px; padding: 6px; }
  .board-entry, .board-table { gap: 3px; }
  .slot-up, .slot-down { height: 16px; }
  .slot-char { height: 30px; border-bottom-width: 3px; }
  .board-ok, .board-play { margin-top: 0; padding: 4px 14px; }
}
.board-status { min-height: 1em; font-size: clamp(.7rem, 1.8vw, .85rem); color: var(--muted); }

/* ---------- Initial animation state (only when JS/GSAP are active) ---------- */
.js-anim [data-hero], .js-anim .hero-visual, .js-anim .reveal { opacity: 0; }
.js-anim .hero-name .split { opacity: 0; }
.js-anim .hero-name.is-split .split { opacity: 1; }
.js-anim .mask > span { transform: translateY(105%); }
.js-anim .tl-card, .js-anim .tl-date { opacity: 0; }

/* ---------- View transitions ---------- */
.no-tx *, .no-tx *::before, .no-tx *::after, .no-tx { transition: none !important; }
/* Language: short crossfade */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }
/* Theme: the new snapshot is revealed cell by cell (mask set from JS);
   the "hold" animation only keeps the transition alive while it runs. */
html.vt-pixel::view-transition-old(root),
html.vt-pixel::view-transition-new(root) { animation: vt-hold .72s linear both; mix-blend-mode: normal; }
html.vt-pixel::view-transition-new(root) { z-index: 1; }
@keyframes vt-hold { from { opacity: 1; } to { opacity: 1; } }

/* ---------- Animations paused off-screen (JS adds .is-offscreen) ---------- */
.is-offscreen, .is-offscreen::before, .is-offscreen::after, .is-offscreen *, .is-offscreen *::before, .is-offscreen *::after { animation-play-state: paused !important; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
  .device { transform: none; }
}
