/* ==========================================================================
   Vean Portfolio — dark terminal / industrial
   Tokens first, then layers. Every custom property used below is defined here.
   ========================================================================== */
:root {
  /* surfaces */
  --bg: #050807;
  --bg2: #0a0e0c;
  --surface: #0e1311;
  --surface2: #141a17;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-hi: rgba(0, 255, 156, 0.42);

  /* ink */
  --text: #e7efeb;
  --fg: #e7efeb;
  --muted: #93a09a;
  --faint: #767f79;

  /* accent */
  --accent: #00ff9c;
  --accent-glow: rgba(0, 255, 156, 0.13);
  --accent-line: rgba(0, 255, 156, 0.35);
  --danger: #ff7b7b;
  --grad: linear-gradient(112deg, #00ff9c 0%, #58ffc4 42%, #00c47a 100%);

  /* geometry */
  /* One shape scale. Every radius in the sheet comes from these or is a
     deliberate circle (50%) / pill (999px). Add a step here, never a literal. */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 18px;
  --radius-pill: 999px;
  --maxw: 1180px;

  /* type */
  --font-head: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* the scrolled nav is 63px tall; anchor offsets must match it or the section
     behind the gap shows through. One token so the two cannot drift apart. */
  --nav-h: 64px;

  /* motion: one easing family, three weights */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-swift: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 0.34s;
  --dur-slow: 0.75s;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; }
em { font-style: normal; color: var(--accent); }

/* .btn sets display:inline-flex, which outranks [hidden]. Without this every
   <button hidden> stays on screen. */
[hidden] { display: none !important; }

/* Keyboard users get an outline; pointer users never see it. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection { background: var(--accent); color: #04120c; }
::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1c2421; border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: #2a3531; }

.mono { font-family: var(--font-mono); }
.dim { color: var(--faint); }
.accent { color: var(--accent); }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ===== Background layers ===== */
.grid-bg {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 40%, transparent 100%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 70% 45% at 50% -10%, rgba(0, 255, 156, 0.06), transparent 65%);
}

/* ===== Custom cursor ===== */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; pointer-events: none;
  border-radius: 50%; transform: translate(-50%, -50%);
  opacity: 0; z-index: 10000;
  will-change: transform;
}
.cursor-dot {
  width: 5px; height: 5px; background: var(--accent);
  box-shadow: 0 0 8px rgba(0, 255, 156, 0.9), 0 0 22px rgba(0, 255, 156, 0.4);
}
.cursor-ring {
  width: 36px; height: 36px;
  border: 1.5px solid rgba(0, 255, 156, 0.5);
  transition:
    width var(--dur) var(--ease), height var(--dur) var(--ease),
    border-color var(--dur) var(--ease), background var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), opacity 0.3s ease;
}
.cursor-ring.active {
  width: 52px; height: 52px;
  border-color: rgba(0, 255, 156, 0.95);
  background: rgba(0, 255, 156, 0.06);
  box-shadow: 0 0 26px rgba(0, 255, 156, 0.18), inset 0 0 14px rgba(0, 255, 156, 0.06);
}
.cursor-ring.down {
  width: 26px; height: 26px;
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 255, 156, 0.35);
}
body.has-cursor, body.has-cursor * { cursor: none; }

/* ===== Background music ===== */
.bg-music { position: absolute; width: 0; height: 0; pointer-events: none; visibility: hidden; }
.music-toggle {
  position: fixed; bottom: 22px; right: 22px; z-index: 900;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.55); border: 1px solid var(--border);
  color: var(--accent);
  opacity: 0; transform: translateY(6px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease),
    background 0.22s ease, border-color 0.22s ease;
}
body.has-music .music-toggle { opacity: 0.7; transform: none; }
.music-toggle:hover { opacity: 1; background: rgba(0, 255, 156, 0.12); border-color: var(--border-hi); }
.music-toggle:active { transform: scale(0.94); }
.music-toggle svg { width: 20px; height: 20px; transition: opacity 0.2s ease; }
.music-toggle .icon-off { position: absolute; opacity: 0; }
.music-toggle.paused .icon-on { opacity: 0; }
.music-toggle.paused .icon-off { opacity: 1; }

/* progress bar: scaleX so it never triggers layout */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  background: var(--accent); z-index: 300;
  transform: scaleX(0); transform-origin: 0 50%;
  box-shadow: 0 0 10px rgba(0, 255, 156, 0.6);
  will-change: transform;
}

/* ===== Film grain ===== */
.noise {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== Preloader ===== */
.preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.55s var(--ease), visibility 0.55s;
}
.preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot { width: min(520px, 88vw); }
.boot-brand {
  font-family: var(--font-head); font-weight: 700; font-size: 20px;
  letter-spacing: 0.2em; color: var(--text);
  margin-bottom: 18px;
}
.boot-brand .accent { animation: blink 1s steps(1) infinite; }
.boot-lines {
  font-family: var(--font-mono); font-size: 13px; line-height: 1.9;
  color: var(--muted); min-height: 90px;
}
.boot-lines div { animation: bootLine 0.32s var(--ease) both; }
@keyframes bootLine {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}
.boot-lines .ok { color: var(--accent); }
.boot-lines .cmd { color: var(--text); }
.boot-bar { height: 2px; background: #1a211e; margin-top: 22px; border-radius: var(--radius-pill); overflow: hidden; }
.boot-bar-fill {
  height: 100%; width: 0%; background: var(--accent);
  transition: width 0.25s var(--ease-swift);
  box-shadow: 0 0 12px rgba(0, 255, 156, 0.6);
}
.boot-status {
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
  margin-top: 10px; text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ===== Nav ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(20px, 5vw, 48px);
  transition: background 0.35s ease, border-color 0.35s ease, padding 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  border-bottom: 1px solid var(--border);
  padding: 12px clamp(20px, 5vw, 48px);
}
/* backdrop blur lives on a pseudo-element, not the nav itself: an element with
   backdrop-filter becomes the containing block for position:fixed descendants,
   which collapsed the mobile drawer (fixed, top:0 bottom:0) to nav height and
   left everything below it transparent */
.nav.scrolled::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: rgba(5, 8, 7, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 600; font-size: 18px;
  letter-spacing: -0.01em;
}
.nav-logo-mark { width: 22px; height: 22px; border-radius: var(--radius-sm); object-fit: cover; }
.nav-word { font-weight: 700; letter-spacing: 0.16em; }
.nav-cursor { color: var(--accent); margin-left: 2px; animation: blink 1s steps(1) infinite; }

.nav-links { position: relative; display: flex; gap: 2px; }
.nav-ind {
  position: absolute; top: 50%; left: 0;
  height: 32px; width: 0;
  transform: translateY(-50%);
  border-radius: var(--radius-md);
  background: rgba(0, 255, 156, 0.09);
  border: 1px solid rgba(0, 255, 156, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: left var(--dur) var(--ease), width var(--dur) var(--ease), opacity 0.3s ease;
}
.nav-ind.on { opacity: 1; }

.nav-link {
  position: relative; z-index: 1;
  padding: 8px 14px; font-size: 14px; color: var(--muted);
  border-radius: var(--radius-md);
  transition: color 0.24s ease;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--accent); }
.nav-link::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }

.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-status {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px rgba(0, 255, 156, 0.8);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.86); } }

.nav-burger {
  display: none; flex-direction: column; gap: 5px;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  /* opaque surface: the nav is transparent until .scrolled, so a bare button
     disappears over the hero on mobile */
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: background 0.24s ease, border-color 0.24s ease, transform 0.2s var(--ease-swift);
}
.nav-burger:hover { background: var(--surface); border-color: var(--border-hi); }
.nav-burger:active { transform: scale(0.94); }
.nav-burger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-burger.open { background: var(--surface); border-color: var(--border-hi); }
.nav-burger span {
  width: 20px; height: 2px; background: var(--text); border-radius: var(--radius-pill);
  transition: transform 0.32s var(--ease), opacity 0.24s ease;
}
.nav-burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  position: relative; min-height: 100vh;
  display: flex; align-items: center;
  padding: 140px clamp(20px, 6vw, 60px) 90px;
}
.hero-inner { max-width: min(1500px, 94vw); margin: 0 auto; width: 100%; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 56px; align-items: center;
}
.hero-photo {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  transform: translate3d(0, var(--py, 0px), 0);
  will-change: transform;
}

/* ---- WebGL ID card ---- */
.card3d-stage {
  position: relative;
  width: min(560px, 40vw, calc((100vh - 200px) * 0.6667));
  aspect-ratio: 2 / 3;
  cursor: grab;
  touch-action: pan-y;
  filter: drop-shadow(0 34px 54px rgba(0, 0, 0, 0.66));
}
.card3d-stage.grabbing { cursor: grabbing; }
.card3d-stage::before {
  content: ""; position: absolute; inset: -14% -10%;
  background: radial-gradient(closest-side, rgba(0, 255, 156, 0.17), transparent 72%);
  filter: blur(26px); z-index: -1; pointer-events: none;
}
.card3d-stage canvas {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%;
  opacity: 0; transition: opacity 0.6s var(--ease);
}
.card3d-stage.ready canvas { opacity: 1; }

.card3d-fallback { display: none; }
.card3d-stage.no-webgl .card3d-fallback,
.card3d-stage:not(.ready) .card3d-fallback {
  display: block; position: absolute; inset: 0;
  border-radius: var(--radius-xl); overflow: hidden;
  border: 1px solid var(--border-strong);
  background: linear-gradient(165deg, #0c211a, #040c09);
}
.card3d-fallback img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; display: block; }
.card3d-stage.ready .card3d-fallback { display: none; }

.card3d-stage::after {
  content: ""; position: absolute; inset: 6% 8%;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(0, 255, 156, 0.5);
  opacity: 0; pointer-events: none; z-index: 3;
}
.card3d-stage.music-on::after { animation: beatRing 1.8s cubic-bezier(0.25, 1, 0.4, 1) infinite; }
@keyframes beatRing {
  0% { opacity: 0.5; transform: scale(0.97); }
  70% { opacity: 0; transform: scale(1.11); }
  100% { opacity: 0; transform: scale(1.11); }
}

.stage-hint {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--faint); opacity: 0;
  transition: opacity 0.6s var(--ease) 0.5s;
}
.card3d-stage.ready ~ .stage-hint { opacity: 1; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
  letter-spacing: 0.08em; margin-bottom: 22px;
}
.eyebrow .mono { color: var(--accent); }

/* line-mask reveal: each line slides out of its own clipping box */
.hero-title {
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(32px, 5.5vw, 60px);
  line-height: 1.12; letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.08em; }
.hero-title .line-i {
  display: block;
  transform: translateY(110%);
  transition: transform 1s var(--ease);
  transition-delay: calc(var(--li, 0) * 110ms + 80ms);
}
.hero-title.visible .line-i { transform: none; }

.hello { color: var(--text); }
.hero-name { display: flex; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.hero-name .mono { font-size: 18px; }

.glitch {
  position: relative;
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(46px, 8vw, 92px); line-height: 1;
  letter-spacing: -0.03em; color: var(--accent);
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
}
.glitch::before { color: #00ffd5; animation: glitch-1 6s infinite steps(1); }
.glitch::after { color: #00c47a; animation: glitch-2 6s infinite steps(1); }
@keyframes glitch-1 {
  0%, 92%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  93% { opacity: 0.85; transform: translate(-3px, -2px); clip-path: inset(10% 0 60% 0); }
  95% { opacity: 0.85; transform: translate(3px, 1px); clip-path: inset(55% 0 15% 0); }
  97% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
}
@keyframes glitch-2 {
  0%, 90%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
  91% { opacity: 0.85; transform: translate(3px, 2px); clip-path: inset(60% 0 8% 0); }
  94% { opacity: 0.85; transform: translate(-3px, -1px); clip-path: inset(20% 0 65% 0); }
  96% { opacity: 0; transform: none; clip-path: inset(0 0 0 0); }
}

.hero-role {
  margin-top: 18px;
  font-family: var(--font-mono); font-size: clamp(15px, 2.4vw, 19px);
  color: var(--text);
}
.hero-role .dim { color: var(--faint); }
.caret { display: inline-block; color: var(--accent); animation: blink 1.06s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-desc { margin-top: 22px; max-width: 620px; color: var(--muted); font-size: 17px; }
.hero-cta { margin-top: 34px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 24px; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 500;
  will-change: transform;
  transition:
    transform 0.32s var(--ease-soft),
    box-shadow 0.3s ease,
    background 0.24s ease,
    border-color 0.24s ease,
    color 0.24s ease;
}
.btn svg { width: 18px; height: 18px; flex: none; }
/* magnetic pull lives in --tx/--ty so CSS hover and JS never fight over transform */
.btn:not(.btn-block):hover {
  transform: translate3d(var(--tx, 0px), calc(var(--ty, 0px) - 2px), 0);
}
.btn-primary {
  background: var(--accent); color: #04120c; font-weight: 600;
  box-shadow: 0 0 0 1px rgba(0, 255, 156, 0.4), 0 6px 30px rgba(0, 255, 156, 0.22);
}
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(0, 255, 156, 0.6), 0 10px 40px rgba(0, 255, 156, 0.32); }
.btn-primary:active { transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) scale(0.98); }
.btn-ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: progress; transform: none !important; }

.hero-stats { display: flex; gap: clamp(24px, 5vw, 60px); margin-top: 60px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-num {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.hero-scroll {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.12em;
}
.hero-scroll span {
  width: 1px; height: 34px;
  background: linear-gradient(var(--accent), transparent);
  animation: scrollHint 1.9s var(--ease) infinite;
}
@keyframes scrollHint {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ===== Sections ===== */
.section { padding: 110px clamp(20px, 6vw, 60px); scroll-margin-top: var(--nav-h); }
.section-head { max-width: 760px; margin-bottom: 56px; }
.section-head h2, .contact h2 {
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(28px, 4.4vw, 46px); line-height: 1.15;
  letter-spacing: -0.02em; margin-bottom: 16px;
}
.section-sub { color: var(--muted); font-size: 17px; max-width: 620px; }
.section-head, .showcase-grid, .showcase-more, .stack-grid,
.about-grid, .contact-inner, .gb-grid {
  max-width: var(--maxw); margin-left: auto; margin-right: auto;
}

/* ===== Reveal ===== */
.reveal {
  opacity: 0; transform: translateY(26px); filter: blur(5px);
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease),
    filter var(--dur-slow) var(--ease);
  transition-delay: var(--rv-d, 0ms);
}
.reveal.visible { opacity: 1; transform: none; filter: blur(0); }

/* hero entrance: fade + rise, no blur (blur on a 92px glyph looks like a
   rendering glitch while it settles) */
.hero-anim {
  opacity: 0; transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
  transition-delay: var(--rv-d, 0ms);
}
.hero-anim.visible { opacity: 1; transform: none; }

/* ===== Showcase ===== */
.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 22px;
}
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer;
  /* opacity/filter are here on purpose: .card comes after .reveal in the sheet
     and the transition shorthand resets every property, so leaving them out
     made the reveal snap instead of fade. */
  transition:
    opacity var(--dur-slow) var(--ease),
    filter var(--dur-slow) var(--ease),
    transform 0.5s var(--ease-soft),
    border-color 0.3s ease,
    box-shadow 0.5s ease;
  transition-delay: var(--rv-d, 0ms);
  /* No permanent will-change here. Six cards at 379x523 would pin ~5.2 MPx of
     GPU backing store for a transform that only runs during the entrance.
     The promotion is scoped to the state that actually animates. */
}
.card:hover,
.card.reveal:not(.visible) {
  will-change: transform;
}
.card:hover {
  border-color: var(--accent-line);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 255, 156, 0.1);
}
/* card.reveal holds the transform for the entrance; hover must not be clipped
   by the reveal's translateY, so the lift moves to the preview/body layer */
.card.reveal.visible:hover { transform: translateY(-6px); }

/* sweep highlight */
.card::before {
  content: ""; position: absolute; top: 0; left: -80%;
  width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  transform: skewX(-18deg);
  transition: left 0.8s var(--ease);
  z-index: 2; pointer-events: none;
}
.card:hover::before { left: 130%; }

/* top rule */
.card::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0; transition: opacity 0.32s ease; z-index: 3; pointer-events: none;
}
.card:hover::after { opacity: 1; }

.card-preview {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(0, 255, 156, 0.1), transparent 60%),
    var(--surface2);
  display: flex; flex-direction: column;
  border-bottom: 1px solid var(--border);
}
/* cursor-following glow, painted under the screenshot's transparent edges */
.card-preview::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 40%),
    rgba(0, 255, 156, 0.12), transparent 62%);
  opacity: 0; transition: opacity 0.35s ease;
}
.card:hover .card-preview::after { opacity: 1; }

.preview-bar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border);
}
.pdot { width: 9px; height: 9px; border-radius: 50%; }
.pdot.r { background: #ff5f56; }
.pdot.y { background: #ffbd2e; }
.pdot.g { background: #27c93f; }
.preview-url {
  margin-left: 8px; font-size: 11px; color: var(--faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-shot { flex: 1; overflow: hidden; position: relative; background: #000; z-index: 0; }
.preview-shot img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  display: block;
  transition: transform 0.65s var(--ease-soft);
}
.card:hover .preview-shot img { transform: scale(1.045); }

.card-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-tech {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent);
  background: var(--accent-glow); padding: 4px 10px; border-radius: var(--radius-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-index {
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums; flex: none;
}
.card h3 {
  font-family: var(--font-head); font-size: 20px; font-weight: 600;
  letter-spacing: -0.01em;
}
.card p { color: var(--muted); font-size: 14.5px; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.tag::before { content: "#"; color: var(--accent); opacity: 0.6; }
.card-link {
  margin-top: 4px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--accent); font-weight: 500; align-self: flex-start;
  transition: gap 0.28s var(--ease);
}
.card-link:hover { gap: 11px; }
.card-link svg { width: 16px; height: 16px; transition: transform 0.28s var(--ease); }
.card-link:hover svg { transform: translate(1px, -1px); }
.showcase-more { margin-top: 40px; display: flex; justify-content: center; }

/* ===== Stack ===== */
.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.stack-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px;
  transition: border-color 0.3s ease, transform 0.4s var(--ease-soft), background 0.3s ease;
}
.stack-card:hover {
  border-color: rgba(0, 255, 156, 0.3);
  background: var(--surface2);
}
.stack-card.reveal.visible:hover { transform: translateY(-3px); }
.stack-card h3 {
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
  margin-bottom: 18px; text-transform: uppercase; letter-spacing: 0.08em;
}
.stack-card ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.stack-card li {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 14.5px;
  opacity: 0; transform: translateX(-12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.stack-card.visible li { opacity: 1; transform: none; }
.stack-card.visible li:nth-child(1) { transition-delay: 0.08s; }
.stack-card.visible li:nth-child(2) { transition-delay: 0.14s; }
.stack-card.visible li:nth-child(3) { transition-delay: 0.20s; }
.stack-card.visible li:nth-child(4) { transition-delay: 0.26s; }
.stack-card.visible li:nth-child(5) { transition-delay: 0.32s; }
.stack-card.visible li:nth-child(6) { transition-delay: 0.38s; }
.stack-card.visible li:nth-child(7) { transition-delay: 0.44s; }
.stack-card.visible li:nth-child(8) { transition-delay: 0.50s; }
.stack-card li::before { content: "\25B8"; color: var(--accent); font-size: 11px; }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: start; }
.about-body { color: var(--muted); font-size: 16.5px; }
.about-body p + p { margin-top: 16px; }
.about-body strong { color: var(--text); }
.about-facts { list-style: none; margin-top: 28px; display: flex; flex-direction: column; gap: 10px; }
.about-facts li {
  display: flex; gap: 16px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 13px;
  transition: border-color 0.28s ease, background 0.28s ease;
}
.about-facts li:hover { border-color: rgba(0, 255, 156, 0.28); background: var(--surface2); }
.about-facts li span:first-child { color: var(--faint); min-width: 80px; }

/* ===== Contact ===== */
.contact { padding-bottom: 140px; }
.contact-inner { text-align: center; }
.eyebrow.center { justify-content: center; display: flex; align-items: center; gap: 8px; }
.contact h2 { font-size: clamp(30px, 5vw, 52px); }
.contact .section-sub { margin: 0 auto 34px; }

.compose {
  max-width: 640px; margin: 0 auto; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  transition: border-color 0.3s ease, box-shadow 0.4s ease;
}
.compose:focus-within {
  border-color: rgba(0, 255, 156, 0.34);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 255, 156, 0.12);
}
.compose-bar {
  display: flex; align-items: center; gap: 6px; padding: 12px 16px;
  background: rgba(0, 0, 0, 0.3); border-bottom: 1px solid var(--border);
}
.compose-title { margin-left: 8px; font-size: 12px; color: var(--muted); }
.compose-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.compose-row { display: flex; align-items: center; gap: 12px; }
.compose-row label { flex: 0 0 76px; font-size: 12px; color: var(--faint); text-align: right; }
.compose-row input, .compose-row textarea {
  flex: 1; min-width: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 11px 14px;
  color: var(--text); font-family: var(--font-body); font-size: 14.5px;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.compose-row input:focus, .compose-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 255, 156, 0.12);
}
.compose-row.grow { align-items: flex-start; }
.compose-row textarea { min-height: 130px; resize: vertical; line-height: 1.5; }
.compose-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}
.compose-foot .mono { font-size: 12px; }
.compose-note { margin-top: 16px; font-size: 13px; color: var(--accent); min-height: 18px; }
.hp { position: absolute; left: -9999px; }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--border); padding: 16px clamp(20px, 6vw, 60px); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.footer-left { display: flex; align-items: center; gap: 12px; }
.footer-right { display: flex; align-items: center; gap: 16px; font-size: 11px; color: var(--faint); }
.status-mode {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: var(--accent); background: var(--accent-glow);
  padding: 3px 8px; border-radius: var(--radius-xs); letter-spacing: 0.06em;
}
.footer-brand { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.16em; font-size: 15px; }
.footer-brand .accent { color: var(--accent); animation: blink 1s steps(1) infinite; }
.status-file { font-family: var(--font-mono); font-size: 12px; }

/* ===== Marquee ===== */
.marquee {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  padding: 13px 0;
}
.marquee-track {
  display: flex; width: max-content;
  animation: marquee 34s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-group { display: flex; align-items: center; gap: 30px; padding-right: 30px; }
.marquee-group span {
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
  text-transform: uppercase; letter-spacing: 0.16em; white-space: nowrap;
}
.marquee-group i { font-style: normal; color: var(--accent); opacity: 0.35; font-size: 11px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ===== Guestbook ===== */
/* Guestbook is the last section in <main> and shorter than the viewport, so the
   document ran out of scroll before it could bring the section top under the
   nav: clicking "Guestbook" stopped 126px short and Contact still filled the
   screen. Reserving a viewport of room lets scrollIntoView honour
   scroll-margin-top. */
.guestbook {
  padding-top: 0;
  min-height: calc(100vh - var(--nav-h));
}
.gb-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 22px; align-items: start; }
.gb-form-panel, .gb-list-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: border-color 0.3s ease;
}
.gb-form-panel:focus-within { border-color: rgba(0, 255, 156, 0.3); }
.gb-form { display: flex; flex-direction: column; gap: 14px; }
.gb-field { display: flex; flex-direction: column; gap: 7px; }
.gb-field label {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint);
}
.gb-field input, .gb-field textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 14px; resize: vertical;
  transition: border-color 0.24s ease, background 0.24s ease, box-shadow 0.24s ease;
}
.gb-field input:focus, .gb-field textarea:focus {
  border-color: rgba(0, 255, 156, 0.5);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 255, 156, 0.1);
}
.gb-field input::placeholder, .gb-field textarea::placeholder { color: var(--faint); }
.gb-photo-row { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.file-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 9px 14px; border-radius: var(--radius-md); font-size: 12.5px; color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px dashed var(--border-strong);
  transition: border-color 0.26s ease, color 0.26s ease, background 0.26s ease;
}
.file-btn svg { width: 15px; height: 15px; }
.file-btn:hover {
  border-color: rgba(0, 255, 156, 0.45);
  color: var(--text); background: rgba(255, 255, 255, 0.075);
}
.gb-photo-hint { font-size: 10.5px; letter-spacing: 0.04em; }
.gb-photo-preview {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border-strong);
  animation: gbIn 0.35s var(--ease) both;
}
.gb-note { min-height: 14px; font-size: 11px; color: var(--muted); }
.gb-note.ok { color: var(--accent); }
.gb-note.err { color: var(--danger); }

.gb-list-wrap { display: flex; flex-direction: column; gap: 14px; }
.gb-list { display: flex; flex-direction: column; gap: 11px; }
.gb-item {
  display: flex; gap: 13px; padding: 15px 17px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--border);
  transition: border-color 0.28s ease, transform 0.32s var(--ease-soft), background 0.28s ease;
  animation: gbIn 0.45s var(--ease) both;
}
@keyframes gbIn {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.gb-item:hover {
  border-color: rgba(0, 255, 156, 0.32);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}
.gb-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden;
  display: grid; place-items: center; color: var(--accent);
  background: linear-gradient(140deg, rgba(0, 255, 156, 0.26), rgba(0, 255, 156, 0.14));
  border: 1px solid var(--border-strong);
  font-family: var(--font-head); font-weight: 700; font-size: 13px;
}
.gb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gb-main { flex: 1; min-width: 0; }
.gb-meta { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.gb-name { font-size: 14px; font-weight: 600; }
.gb-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.gb-text {
  margin-top: 4px; font-size: 14px; color: var(--muted);
  line-height: 1.6; overflow-wrap: anywhere;
}
.gb-empty {
  padding: 38px 20px; text-align: center; color: var(--faint);
  border: 1px dashed var(--border); border-radius: var(--radius); font-size: 13.5px;
}
.gb-skel {
  height: 76px; border-radius: var(--radius);
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Modal ===== */
body.modal-open { overflow: hidden; }

.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0s 0.3s;
}
.modal.open { opacity: 1; visibility: visible; transition: opacity 0.3s var(--ease); }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(3, 6, 5, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-wrap {
  position: relative; z-index: 2;
  width: min(920px, 100%);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.38s var(--ease);
}
.modal.open .modal-wrap { transform: translateY(0) scale(1); }
.modal-panel {
  max-height: 88vh; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 255, 156, 0.08);
}
.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.55); border: 1px solid var(--border);
  color: var(--fg);
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.3s var(--ease);
}
.modal-close:hover {
  background: rgba(0, 255, 156, 0.12);
  border-color: var(--border-hi);
  transform: rotate(90deg);
}
.modal-close svg { width: 18px; height: 18px; }

/* photo lightbox */
.modal-photo { padding: 30px 26px; text-align: center; }
.modal-photo img {
  width: min(420px, 82vw); height: min(420px, 82vw);
  border-radius: 50%; object-fit: cover; display: block; margin: 0 auto;
  border: 2px solid var(--border-strong);
  box-shadow: 0 0 60px rgba(0, 255, 156, 0.22);
}
.modal-photo .modal-meta { margin-top: 22px; display: flex; flex-direction: column; gap: 6px; }
.modal-photo .modal-title { font-family: var(--font-head); font-size: 24px; font-weight: 600; }
.modal-photo .modal-meta .mono { font-size: 12px; }

/* project lightbox */
.modal-project { display: flex; flex-direction: column; }
.modal-project .modal-shot { border-bottom: 1px solid var(--border); background: #000; }
.modal-project .modal-shot img {
  width: 100%; display: block; max-height: 420px;
  object-fit: cover; object-position: top;
}
.modal-project .modal-body {
  padding: 26px; display: flex; flex-direction: column;
  align-items: flex-start; gap: 14px;
}
.modal-project h3 { font-family: var(--font-head); font-size: 26px; font-weight: 600; }
.modal-project p { color: var(--muted); font-size: 15px; line-height: 1.6; }
.modal-project .card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-project .modal-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .nav-links {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(280px, 80vw);
    background: #070b09;
    flex-direction: column; gap: 6px;
    padding: 90px 24px 24px;
    transform: translateX(100%);
    visibility: hidden;
    border-left: 1px solid var(--border);
    z-index: 1; /* the drawer is positioned; keep it under .nav-right so the
                   close (X) button is never painted over */
    transition: transform 0.38s var(--ease), visibility 0s 0.38s;
  }
  .nav-links.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.38s var(--ease), visibility 0s;
  }
  .nav-ind { display: none; }
  .nav-link { font-size: 18px; padding: 12px 14px; }
  .nav-burger { display: flex; }
  /* above the open drawer, so the X closes the menu instead of hiding behind it */
  .nav-right { position: relative; z-index: 2; }
  .nav-status { display: none; }

  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding-top: 104px; }
  .hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero-photo { order: -1; margin-inline: calc(-1 * clamp(20px, 6vw, 60px)); }
  .card3d-stage { width: min(420px, calc(100vw - 16px)); margin: 0 auto; }
  .gb-grid { grid-template-columns: 1fr; }
  .stage-hint { display: none; }
}

@supports not (aspect-ratio: 2 / 3) {
  .card3d-stage { height: min(396px, 86vw); }
}

@media (max-width: 480px) {
  .showcase-grid { grid-template-columns: 1fr; }
  .hero-cta .btn { flex: 1; justify-content: center; }
  .compose-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .compose-row label { text-align: left; flex: none; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal, .hero-anim { opacity: 1; transform: none; filter: none; }
  .hero-title .line-i { transform: none; }
  .stack-card li { opacity: 1; transform: none; }
  .marquee-track { animation: none; }
  .cursor-dot, .cursor-ring { display: none; }
}
