/* ============================================================
   PORTFOLIO — styles.css
   Cyber-tech / Marathon aesthetic
   Sections: Reset · Tokens · Utilities · Loader · Nav ·
             Hero · Skills · History · Projects · Contact ·
             Footer · Responsive
============================================================ */

/* ── 1. RESET & BASE ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  scrollbar-width: none; /* Firefox — hide scrollbar */
}

body {
  background: #000;
  color: #e8e8e8;
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none; /* custom cursor handled in JS */
  -ms-overflow-style: none; /* IE 11 — hide scrollbar */
}

/* Restore default cursor on mobile */
@media (hover: none) {
  body { cursor: auto; }
  #cursor-glow { display: none; }
}

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

ul { list-style: none; }

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

/* ── 2. DESIGN TOKENS ── */
:root {
  --clr-bg:        #000000;
  --clr-surface:   #0a0a0a;
  --clr-border:    rgba(255,255,255,0.08);
  --clr-text:      #e8e8e8;
  --clr-dim:       #888;
  --clr-accent:    #c8c8c8;    /* silver */
  --clr-white:     #ffffff;
  --clr-glow:      rgba(200,200,200,0.15);

  --ff-mono:       'Share Tech Mono', monospace;
  --ff-sans:       'Space Grotesk', sans-serif;

  --fw-light:      300;
  --fw-regular:    400;
  --fw-medium:     500;
  --fw-semibold:   600;
  --fw-bold:       700;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     16px;

  --transition:    0.3s ease;

  --nav-h:         64px;
  --section-pad:   clamp(80px, 10vw, 140px);
}

/* ── 3. UTILITIES ── */
.accent { color: var(--clr-white); }

.monospace {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

/* Scanlines overlay */
.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
}

.scanlines.faint {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 4px,
    rgba(0,0,0,0.13) 4px,
    rgba(0,0,0,0.13) 5px
  );
}

/* Glitch text animation */
.glitch-text {
  position: relative;
  display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.glitch-text::before {
  color: var(--clr-white);
  clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
  transform: translateX(-3px);
  animation: glitch-before 4s infinite steps(1);
}

.glitch-text::after {
  color: #aaa;
  clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
  transform: translateX(3px);
  animation: glitch-after 4s infinite steps(1);
}

@keyframes glitch-before {
  0%,89%,100% { opacity: 0; transform: translateX(0); }
  90%  { opacity: 0.8; transform: translateX(-4px) skewX(-2deg); }
  92%  { opacity: 0; }
  94%  { opacity: 0.6; transform: translateX(3px); }
  96%  { opacity: 0; }
}

@keyframes glitch-after {
  0%,90%,100% { opacity: 0; transform: translateX(0); }
  91%  { opacity: 0.7; transform: translateX(4px) skewX(2deg); }
  93%  { opacity: 0; }
  95%  { opacity: 0.5; transform: translateX(-3px); }
  97%  { opacity: 0; }
}

/* Section shared styles */
section {
  position: relative;
  padding: var(--section-pad) 0;
  overflow: hidden;
}

.section-inner {
  width: min(1200px, 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.section-header {
  margin-bottom: clamp(40px, 6vw, 72px);
}

.section-tag {
  display: block;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--clr-dim);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.section-sub {
  color: var(--clr-dim);
  font-size: 1rem;
  max-width: 500px;
}

/* Buttons */
.btn-primary,
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.05em;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--clr-white);
  color: #000;
}

.btn-primary:hover {
  background: var(--clr-accent);
  box-shadow: 0 0 24px rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--clr-white);
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-outline:hover {
  border-color: var(--clr-white);
  background: rgba(255,255,255,0.05);
  transform: translateY(-1px);
}

.btn-resume {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--clr-dim);
  border: 1px solid var(--clr-border);
  background: transparent;
  transition: color var(--transition), border-color var(--transition), transform var(--transition);
}

.btn-resume:hover {
  color: var(--clr-white);
  border-color: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

/* ── 4. LOADER ── */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#loader-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#number-rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Individual glitching numbers — created in JS */
.rain-num {
  position: absolute;
  font-family: var(--ff-mono);
  font-size: clamp(10px, 1.5vw, 18px);
  color: rgba(255,255,255,0.6);
  user-select: none;
  transition: none;
  animation: num-flicker 0.8s infinite alternate;
}

@keyframes num-flicker {
  0%   { opacity: 0.2; }
  30%  { opacity: 0.9; }
  60%  { opacity: 0.4; }
  100% { opacity: 0.7; }
}

/* Symbol blocks */
.symbol-block {
  position: absolute;
  font-family: var(--ff-mono);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.08);
  white-space: pre;
  pointer-events: none;
  user-select: none;
  max-width: 220px;
}

.symbol-block.top-left {
  top: 60px;
  left: 40px;
}

.symbol-block.bottom-right {
  bottom: 80px;
  right: 40px;
  text-align: right;
}

/* Loader progress — centered over the 3D shape */
#loader-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

#loader-label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--clr-dim);
  margin-bottom: 8px;
}

#loader-percent {
  display: block;
  font-family: var(--ff-mono);
  font-size: clamp(3rem, 10vw, 8rem);
  font-weight: var(--fw-bold);
  color: var(--clr-white);
  line-height: 1;
  text-shadow: 0 0 40px rgba(255,255,255,0.3);
  transform-origin: center center;
  animation: pct-glitch 0.18s infinite steps(1);
}

@keyframes pct-glitch {
  0%   { transform: translateX(0);  }
  25%  { transform: translateX(2px);  }
  50%  { transform: translateX(0);    }
  75%  { transform: translateX(-1px); }
  100% { transform: translateX(0);    }
}

/* ── Binary cascade columns ── */
#binary-cascade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.bin-col {
  position: absolute;
  top: 0;
  font-family: var(--ff-mono);
  font-size: 11px;
  line-height: 1.6;
  color: rgba(255,255,255,0.22);
  white-space: pre;
  pointer-events: none;
  user-select: none;
  animation: bin-fall linear infinite;
  will-change: transform, opacity;
}

@keyframes bin-fall {
  from { transform: translateY(-110%); }
  to   { transform: translateY(110vh); }
}

/* ── Hex data panels ── */
#hex-panels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.hex-panel {
  position: absolute;
  font-family: var(--ff-mono);
  font-size: 9px;
  line-height: 1.7;
  color: rgba(255,255,255,0.11);
  white-space: pre;
  letter-spacing: 0.05em;
  user-select: none;
  pointer-events: none;
}

/* ── Error / system message feed ── */
#error-feed {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, 92vw);
  pointer-events: none;
  overflow: hidden;
  height: 88px;
  z-index: 6;
}

.error-line {
  position: absolute;
  left: 0;
  right: 0;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.13em;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: err-slide 0.25s ease forwards;
}

@keyframes err-slide {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.error-line.crit { color: rgba(255,120,120,0.65); }
.error-line.warn { color: rgba(255,210,80,0.55); }
.error-line.info { color: rgba(180,255,255,0.4); }

/* ── Glitch corruption block overlay ── */
#glitch-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  overflow: hidden;
}

.glitch-block {
  position: absolute;
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ── 5. NAVIGATION ── */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  padding: 0 clamp(20px, 4vw, 60px);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

#nav.scrolled {
  background: rgba(0,0,0,0.85);
  border-color: var(--clr-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.nav-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  color: var(--clr-white);
  transition: filter var(--transition);
}

.nav-logo:hover {
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.55));
}

/* Animated sun icon in nav */
.nav-sun-icon {
  width: 24px;
  height: 24px;
  animation: navSunSpin 22s linear infinite;
}

@keyframes navSunSpin {
  to { transform: rotate(360deg); }
}

.nav-links {
  display: flex;
  gap: 36px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-links a {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--clr-dim);
  transition: color var(--transition);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--clr-white);
  transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--clr-white);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: 4px 0;
  z-index: 1100;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--clr-white);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
  transform-origin: left center;
}

.hamburger.open span:nth-child(1) { transform: rotate(45deg) translateY(-1px); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translateY(1px); }

/* Mobile drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.97);
  z-index: 1050;
  flex-direction: column;
  align-items: stretch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.mobile-drawer.open {
  opacity: 1;
  pointer-events: all;
}

/* Drawer header — mirrors the site nav bar */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
  padding: 0 clamp(20px, 5vw, 48px);
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}

.drawer-tag {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--clr-dim);
}

.drawer-close {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--clr-dim);
  background: transparent;
  border: 1px solid var(--clr-border);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}

.drawer-close:hover {
  color: var(--clr-white);
  border-color: rgba(255,255,255,0.28);
}

/* Nav list */
.mobile-drawer ul {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  padding: 0 clamp(20px, 6vw, 48px);
}

.mobile-drawer li {
  border-bottom: 1px solid var(--clr-border);
}

.mobile-drawer li:first-child {
  border-top: 1px solid var(--clr-border);
}

.mobile-drawer .drawer-link {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--ff-mono);
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clr-dim);
  padding: 20px 0;
  transition: color var(--transition);
}

.mobile-drawer .drawer-link:hover {
  color: var(--clr-white);
}

.drawer-num {
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  color: rgba(255,255,255,0.18);
  transition: color var(--transition);
  position: relative;
  top: 1px;
}

.mobile-drawer .drawer-link:hover .drawer-num {
  color: rgba(255,255,255,0.5);
}

/* Stagger slide-in */
.mobile-drawer.open li {
  animation: drawerItemIn 0.3s ease forwards;
  opacity: 0;
}
.mobile-drawer.open li:nth-child(1) { animation-delay: 0.04s; }
.mobile-drawer.open li:nth-child(2) { animation-delay: 0.09s; }
.mobile-drawer.open li:nth-child(3) { animation-delay: 0.14s; }
.mobile-drawer.open li:nth-child(4) { animation-delay: 0.19s; }
.mobile-drawer.open li:nth-child(5) { animation-delay: 0.24s; }

@keyframes drawerItemIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── 6. HERO ── */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: var(--nav-h);
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0; /* faded in by loader exit crossfade */
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 40px 20px;
}

.hero-eyebrow {
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--clr-dim);
  margin-bottom: 20px;
  opacity: 0; /* animated in */
}

.hero-name {
  font-size: clamp(3.5rem, 9vw, 9rem);
  font-weight: var(--fw-bold);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 20px;
  opacity: 0; /* animated in */
}

.hero-tagline {
  font-size: clamp(1rem, 2vw, 1.3rem);
  color: var(--clr-dim);
  margin-bottom: 40px;
  font-weight: var(--fw-light);
  opacity: 0; /* animated in */
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  opacity: 0; /* animated in */
}

/* HUD corner decorations */
.hud-corner {
  position: absolute;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.hud-corner.top-left  { top: calc(var(--nav-h) + 24px); left: clamp(20px, 4vw, 60px); }
.hud-corner.bottom-right { bottom: 32px; right: clamp(20px, 4vw, 60px); text-align: right; }

/* Cursor glow */
#cursor-glow {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 9990;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
}

/* ═══════════════════════════════════════════════════════════
   NODE ACQUIRE — Aim trainer minigame
═══════════════════════════════════════════════════════════ */

/* Trigger button — subtle HUD pip in bottom-left of hero */
#node-acq-trigger {
  position: absolute;
  bottom: 34px;
  left: clamp(20px, 4vw, 60px);
  z-index: 20;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.35);
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  padding: 6px 11px;
  cursor: none;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
}
#node-acq-trigger:hover {
  border-color: rgba(255,255,255,0.5);
  color: rgba(255,255,255,0.85);
  box-shadow: 0 0 14px rgba(255,255,255,0.06);
}
.naq-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  transform: translateY(4px);
  background: rgba(10,10,10,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  padding: 5px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}
#node-acq-trigger:hover .naq-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.trigger-icon {
  font-size: 0.88rem;
  animation: trigger-pulse 2.4s ease-in-out infinite;
}
@keyframes trigger-pulse {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 0.85; }
}

/* Overlay — covers full hero */
#node-acq-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,0.78);
  display: none;
  overflow: hidden;
  cursor: none; /* hide default — reticle takes over */
}
#node-acq-overlay.naq-active {
  pointer-events: all;
}

/* Native crosshair on buttons/targets so they still feel clickable */
.naq-target,
.naq-action-btn,
.naq-close-btn { cursor: none; }

/* While the game overlay is active, fully suppress the JS cursor elements */
body.naq-playing #cursor-dot,
body.naq-playing #cursor-ring { display: none !important; }

/* DOM reticle — follows mouse during active play */
#naq-reticle {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  width: 36px;
  height: 36px;
  transform: translate(-50%, -50%);
  will-change: transform;
  /* hidden on touch devices */
}
#naq-reticle .rct-h,
#naq-reticle .rct-v {
  position: absolute;
  background: rgba(255,255,255,0.82);
}
/* Horizontal bar — two segments with gap in centre */
#naq-reticle .rct-h-l { width: 10px; height: 1px; top: 50%; left: 0;    transform: translateY(-50%); }
#naq-reticle .rct-h-r { width: 10px; height: 1px; top: 50%; right: 0;   transform: translateY(-50%); }
#naq-reticle .rct-v-t { height: 10px; width: 1px; left: 50%; top: 0;    transform: translateX(-50%); }
#naq-reticle .rct-v-b { height: 10px; width: 1px; left: 50%; bottom: 0; transform: translateX(-50%); }
/* Outer circle */
#naq-reticle .rct-ring {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.45);
}
/* Centre dot */
#naq-reticle .rct-dot {
  position: absolute;
  width: 3px; height: 3px;
  background: #fff;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  box-shadow: 0 0 5px rgba(255,255,255,0.7);
}
/* Squeeze on hit — added via JS */
#naq-reticle.rct-fire {
  animation: rct-fire 0.14s ease-out forwards;
}
@keyframes rct-fire {
  0%   { transform: translate(-50%,-50%) scale(1.0); }
  40%  { transform: translate(-50%,-50%) scale(0.6); }
  100% { transform: translate(-50%,-50%) scale(1.0); }
}
.naq-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 3px,
    rgba(0,0,0,0.07) 3px, rgba(0,0,0,0.07) 4px
  );
}

/* HUD top bar */
#naq-hud-top {
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 6vw, 80px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  z-index: 10;
  background: rgba(0,0,0,0.4);
}
.naq-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.naq-stat-label {
  font-family: var(--ff-mono);
  font-size: 0.52rem;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.3);
}
#naq-score, #naq-combo, #naq-timer {
  font-family: var(--ff-mono);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.08em;
  transition: color 0.12s;
}
#naq-timer.naq-urgency {
  color: rgba(255,90,90,1);
  animation: naq-timer-flash 0.45s steps(1) infinite;
}
@keyframes naq-timer-flash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* Start / End screens */
.naq-screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.naq-screen.naq-visible { display: flex; }

.naq-screen-inner {
  text-align: center;
  padding: clamp(32px, 5vw, 52px) clamp(24px, 5vw, 48px);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.65);
  max-width: 460px;
  width: 92%;
  position: relative;
}
/* Corner brackets on panel */
.naq-screen-inner::before,
.naq-screen-inner::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-style: solid;
  border-color: rgba(255,255,255,0.35);
}
.naq-screen-inner::before { top: -1px;    left: -1px;   border-width: 2px 0 0 2px; }
.naq-screen-inner::after  { bottom: -1px; right: -1px;  border-width: 0 2px 2px 0; }

.naq-screen-title,
.naq-screen-label {
  font-family: var(--ff-mono);
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  letter-spacing: 0.28em;
  color: #fff;
  margin-bottom: 14px;
}
.naq-screen-sub {
  font-family: var(--ff-mono);
  font-size: 0.67rem;
  line-height: 1.9;
  color: rgba(255,255,255,0.42);
  letter-spacing: 0.08em;
  margin-bottom: 30px;
}
.naq-big-score {
  font-family: var(--ff-mono);
  font-size: clamp(2.6rem, 7vw, 4.5rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  text-shadow: 0 0 30px rgba(255,255,255,0.35);
}
.naq-grade {
  font-family: var(--ff-mono);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  letter-spacing: 0.3em;
  margin-bottom: 8px;
  font-weight: 700;
}
.naq-grade.S { color: #fff;                text-shadow: 0 0 22px rgba(255,255,255,0.9); }
.naq-grade.A { color: rgba(180,255,180,1); text-shadow: 0 0 16px rgba(180,255,180,0.5); }
.naq-grade.B { color: rgba(160,200,255,1); text-shadow: 0 0 12px rgba(160,200,255,0.45); }
.naq-grade.C { color: rgba(255,215,100,1); text-shadow: 0 0 10px rgba(255,215,100,0.4); }
.naq-grade.D { color: rgba(255,120,120,1); }

.naq-end-stats {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.42);
  margin-bottom: 26px;
  line-height: 2.1;
}
.naq-action-btn {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  padding: 13px 20px;
  cursor: none;
  margin-bottom: 12px;
  transition: background 0.2s, box-shadow 0.2s;
}
.naq-action-btn:hover {
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 18px rgba(255,255,255,0.09);
}
.naq-close-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.3);
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  cursor: none;
  padding: 6px;
  transition: color 0.2s;
}
.naq-close-btn:hover { color: rgba(255,255,255,0.75); }

/* Target field */
#naq-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* Individual target node */
.naq-target {
  position: absolute;
  pointer-events: all;
  cursor: none;
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  animation: naq-target-spawn 0.18s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
@keyframes naq-target-spawn {
  to { transform: translate(-50%, -50%) scale(1); }
}
.naq-target-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.88);
  animation: naq-ring-decay linear forwards;
}
@keyframes naq-ring-decay {
  0%   { opacity: 1;   border-color: rgba(255,255,255,0.88); box-shadow: 0 0 8px rgba(255,255,255,0.25); }
  65%  { opacity: 0.75; border-color: rgba(255,255,255,0.55); box-shadow: none; }
  100% { opacity: 0.15; border-color: rgba(255,100,100,0.5);  }
}
/* Outer pulse ring */
.naq-target-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  animation: naq-pulse-ring 1.2s ease-out infinite;
}
@keyframes naq-pulse-ring {
  0%   { transform: scale(1);   opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}
/* Crosshair lines */
.naq-target-cross {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.naq-target-cross::before,
.naq-target-cross::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.45);
}
.naq-target-cross::before { width: 1px; height: 34%; left: 50%; top: 33%; transform: translateX(-50%); }
.naq-target-cross::after  { height: 1px; width: 34%; top: 50%; left: 33%; transform: translateY(-50%); }
/* Center dot */
.naq-target-dot {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 6px rgba(255,255,255,0.7);
}

/* Hit burst rings */
.naq-burst {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.75);
  transform: translate(-50%, -50%);
  animation: naq-burst-out 0.42s ease-out forwards;
}
@keyframes naq-burst-out {
  from { width: 8px;  height: 8px;  opacity: 0.9; }
  to   { width: 88px; height: 88px; opacity: 0; }
}

/* Floating score popup */
.naq-score-pop {
  position: absolute;
  pointer-events: none;
  font-family: var(--ff-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.1em;
  transform: translate(-50%, -50%);
  animation: naq-score-pop 0.72s ease-out forwards;
  z-index: 30;
  white-space: nowrap;
}
@keyframes naq-score-pop {
  0%   { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 44px)); }
}

/* Combo flash */
#naq-hit-feed {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 25;
  height: 42px;
  overflow: hidden;
}
.naq-combo-flash {
  font-family: var(--ff-mono);
  font-size: clamp(0.85rem, 2.5vw, 1.2rem);
  letter-spacing: 0.22em;
  color: #fff;
  animation: naq-combo-flash 0.62s ease-out forwards;
}
@keyframes naq-combo-flash {
  0%   { opacity: 0; transform: scale(0.65) translateY(8px); }
  28%  { opacity: 1; transform: scale(1.06) translateY(0); }
  100% { opacity: 0; transform: scale(1) translateY(-6px); }
}

/* ── 7. SKILLS ── */
#skills {
  background: var(--clr-bg);
  position: relative;
}

/* Dot-matrix grid on black sections */
#skills::before,
#contact::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(
    circle, rgba(255,255,255,0.05) 1px, transparent 1px
  );
  background-size: 32px 32px;
}

/* Corner HUD bracket — contact bottom-right */
#contact::after {
  content: '';
  position: absolute;
  bottom: 40px; right: 40px;
  width: 60px; height: 60px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  border-right: 1px solid rgba(255,255,255,0.07);
  pointer-events: none;
  z-index: 0;
}

.ascii-bg {
  position: absolute;
  top: 0; right: 0;
  width: 40%;
  height: 100%;
  font-family: var(--ff-mono);
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255,255,255,0.025);
  white-space: pre;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  padding: 40px;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.skill-card {
  padding: 20px 16px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  text-align: center;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  cursor: default;
  opacity: 0; /* animated in */
  transform: translateY(20px);
  position: relative;
  overflow: visible;
}

.skill-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.skill-card:hover {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.04);
  transform: translateY(-4px);
}

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

/* Skill tooltip */
.skill-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: 220px;
  background: #0d0d0d;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  line-height: 1.55;
  color: var(--clr-dim);
  letter-spacing: 0.03em;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  white-space: normal;
}

/* Arrow */
.skill-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(255,255,255,0.12);
}

.skill-card:hover .skill-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.skill-icon {
  display: block;
  margin-bottom: 10px;
  height: 28px;
}

.skill-icon img {
  width: 28px;
  height: 28px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.7;
}

.skill-icon-fb {
  font-size: 1.6rem;
  opacity: 0.35;
  display: none;
}

.skill-name {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--clr-text);
}

.skill-level {
  display: block;
  font-size: 0.65rem;
  color: var(--clr-dim);
  margin-top: 6px;
  font-family: var(--ff-mono);
}

/* ── 8. ABOUT ── */
#about {
  background: var(--clr-surface);
  position: relative;
}

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.about-bio p {
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
  line-height: 1.85;
  color: rgba(232,232,232,0.78);
  max-width: 52ch;
}

.about-currently {
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-left: 1px solid var(--clr-border);
  padding-left: clamp(24px, 3vw, 40px);
}

.currently-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.currently-label {
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: rgba(255,255,255,0.3);
}

.currently-value {
  font-size: 0.92rem;
  color: rgba(232,232,232,0.85);
  line-height: 1.5;
}

@media (max-width: 680px) {
  .about-layout {
    grid-template-columns: 1fr;
  }
  .about-currently {
    border-left: none;
    border-top: 1px solid var(--clr-border);
    padding-left: 0;
    padding-top: 24px;
  }
}

/* ── 9. PROJECTS ── */
#projects {
  background: var(--clr-surface);
  position: relative;
}

.projects-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 48px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-dim);
  font-size: 1.1rem;
  pointer-events: none;
}

#project-search {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 40px;
  color: var(--clr-text);
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  transition: border-color var(--transition);
  outline: none;
}

#project-search::placeholder { color: var(--clr-dim); }

#project-search:focus {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
}

.filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  padding: 8px 18px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--clr-dim);
  background: transparent;
  transition: all var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--clr-white);
  color: var(--clr-white);
  background: rgba(255,255,255,0.05);
}

/* Sort buttons — identical visual language to filter-btn */
.controls-divider {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.15);
  letter-spacing: 0.1em;
  padding: 0 2px;
  user-select: none;
}

.project-result-count {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.06em;
  margin-left: auto;
  white-space: nowrap;
  user-select: none;
}

.sort-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sort-btn {
  padding: 8px 18px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--clr-dim);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.sort-btn:hover,
.sort-btn.active {
  border-color: var(--clr-white);
  color: var(--clr-white);
  background: rgba(255,255,255,0.05);
}

.sort-btn.active {
  box-shadow: 0 0 8px rgba(255,255,255,0.06);
}

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.project-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  opacity: 0;           /* animated in */
  transform: translateY(30px);
  position: relative;
  cursor: pointer;
}

.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--transition);
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

.project-card:hover {
  transform: translateY(-6px) rotate(0.3deg);
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 0 12px rgba(255,255,255,0.08);
}

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

/* Thumb overlay icon */
.project-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
  position: relative;
}

.project-thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  transition: opacity var(--transition);
}

.project-type-icon {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
}

.project-card:hover .project-thumb-overlay { opacity: 1; }

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  filter: saturate(0.7) brightness(0.85);
}

.project-card:hover .project-thumb img {
  transform: scale(1.04);
  filter: saturate(1) brightness(1);
}

/* Placeholder thumb for cards without image */
.project-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ff-mono);
  font-size: 2rem;
  color: rgba(255,255,255,0.08);
  background: repeating-linear-gradient(
    45deg,
    #111 0px, #111 20px,
    #131313 20px, #131313 40px
  );
}

/* Contain variant — full image visible, SVG fills background */
.project-thumb--contain {
  background-size: cover;
  background-position: center;
}
.project-thumb--contain::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 0;
}
.project-thumb--contain img {
  object-fit: contain;
  position: relative;
  z-index: 1;
}
.project-thumb--contain .card-expand-hint {
  z-index: 2;
}

.project-body {
  padding: 20px;
  position: relative;
  z-index: 2;
}

.project-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: var(--ff-mono);
  text-transform: uppercase;
}

.project-category {
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  color: var(--clr-dim);
}

.project-date {
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.42);
  margin-left: 12px;
  white-space: nowrap;
  text-align: right;
}

.project-title {
  font-size: 1.05rem;
  font-weight: var(--fw-semibold);
  margin-bottom: 8px;
  line-height: 1.3;
}

.project-desc {
  font-size: 0.85rem;
  color: var(--clr-dim);
  line-height: 1.65;
  margin-bottom: 16px;
}

.project-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.stack-tag {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--clr-border);
  border-radius: 3px;
  padding: 3px 8px;
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--clr-accent);
}

.stack-tag--clickable {
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.stack-tag--clickable:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.3);
}
.stack-tag--clickable:focus-visible {
  outline: 1px solid rgba(255,255,255,0.4);
  outline-offset: 2px;
}

.project-links {
  display: flex;
  gap: 10px;
}

.project-link {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  transition: all var(--transition);
}

.project-link.primary {
  background: var(--clr-white);
  color: #000;
}

.project-link.primary:hover {
  background: var(--clr-accent);
}

.project-link.secondary {
  border: 1px solid var(--clr-border);
  color: var(--clr-dim);
}

.project-link.secondary:hover {
  border-color: rgba(255,255,255,0.3);
  color: var(--clr-white);
}

/* Open hint */
.project-open-hint {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: transparent;
  transition: color var(--transition);
  margin-top: 4px;
}

.project-card:hover .project-open-hint {
  color: var(--clr-dim);
}

/* Expand / click hint icon at top-right of card thumbnail */
.card-expand-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  color: rgba(255,255,255,0.3);
  pointer-events: none;
  transition: color var(--transition), transform var(--transition);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-expand-hint svg { width: 100%; height: 100%; }
.project-card:hover .card-expand-hint {
  color: rgba(255,255,255,0.85);
  transform: scale(1.15);
}

.no-results {
  text-align: center;
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  color: var(--clr-dim);
  padding: 48px 0;
}

/* ── Project Modal ── */
#project-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#project-modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
}

.modal-panel {
  position: relative;
  z-index: 1;
  background: #080808;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  width: min(740px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: none;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--clr-dim);
  background: transparent;
  border: 1px solid var(--clr-border);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  z-index: 10;
}

.modal-close:hover {
  color: var(--clr-white);
  border-color: rgba(255,255,255,0.3);
}

.modal-media {
  width: 100%;
  background: #000;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
}

/* YouTube */
.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  background: #000;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Image gallery — always contain so the full image is visible */
.img-gallery {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000 center / cover no-repeat;
  overflow: hidden;
  user-select: none;
}

.img-gallery::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 0;
  pointer-events: none;
}

.img-gallery.video-gallery::before {
  display: none;
}

.video-gallery {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.gallery-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  position: relative;
  z-index: 1;
  background: #000;
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  transform-origin: center;
  will-change: transform;
  cursor: zoom-in;
  display: block;
}

.img-gallery.zoomed      .gallery-img { cursor: grab; }
.img-gallery.is-dragging .gallery-img { cursor: grabbing; }

/* Zoom controls */
.gallery-zoom-controls {
  position: absolute;
  bottom: 10px;
  left: 14px;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 4px;
}

.gallery-zoom-btn {
  width: 26px;
  height: 26px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), border-color var(--transition);
}

.gallery-zoom-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.35); }

.gallery-zoom-label {
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  min-width: 28px;
  text-align: center;
  padding: 0 2px;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--clr-dim);
  font-size: 1rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  z-index: 5;
  border-radius: var(--radius-sm);
}

.gallery-nav:hover { color: var(--clr-white); border-color: rgba(255,255,255,0.3); }
.gallery-nav.prev  { left: 12px; }
.gallery-nav.next  { right: 12px; }

.gallery-counter {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
}

/* Modal text area */
.modal-info {
  padding: 22px 26px 28px;
}

.modal-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: var(--ff-mono);
  text-transform: uppercase;
}

.modal-category {
  display: inline;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--clr-dim);
}

.modal-date {
  display: inline;
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.42);
  margin-left: 12px;
  white-space: nowrap;
  text-align: right;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: var(--fw-semibold);
  margin-bottom: 12px;
  line-height: 1.3;
  padding-right: 72px;
}

.modal-desc {
  font-size: 0.86rem;
  color: var(--clr-dim);
  line-height: 1.7;
  margin-bottom: 18px;
}

.modal-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.modal-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── 10. CONTACT ── */
#contact {
  background: var(--clr-bg);
  position: relative;
}

.contact-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 64px;
  align-items: start;
}

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--clr-dim);
  text-transform: uppercase;
}

.form-group input,
.form-group textarea {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--clr-text);
  font-family: var(--ff-sans);
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
  transition: border-color var(--transition), background var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.05);
}

.form-group input.error,
.form-group textarea.error {
  border-color: rgba(255,80,80,0.5);
}

.form-submit { align-self: flex-start; min-width: 160px; justify-content: center; }

.form-status {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--clr-dim);
  min-height: 20px;
}

.form-status.success { color: #7fff7f; }
.form-status.error   { color: #ff7f7f; }

/* Social links */
.contact-links-title {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--clr-dim);
  margin-bottom: 24px;
  text-transform: uppercase;
}

.social-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: all var(--transition);
}

.social-link:hover {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.03);
  transform: translateX(4px);
}

.social-icon {
  font-family: var(--ff-mono);
  font-size: 0.9rem;
  color: var(--clr-dim);
  width: 24px;
  text-align: center;
}

/* ── 11. FOOTER ── */
#footer {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  padding: 28px 0;
}

.footer-inner {
  width: min(1200px, 92vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-copy {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--clr-dim);
}

.footer-tag {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.15);
}

/* ── 12. RESPONSIVE ── */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .mobile-drawer { display: flex; }

  .contact-layout {
    grid-template-columns: 1fr;
  }

  .contact-links { order: -1; }
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .projects-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-wrap {
    max-width: 100%;
    width: 100%;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }

  .hud-corner { display: none; }

  .symbol-block { display: none; }

  .timeline { padding-left: 20px; }
  .timeline-item::before { left: -26px; }
}

/* ============================================================
   LOW PERFORMANCE MODE
   Toggle via #low-perf-btn in nav. Hides all decorative effects
   while keeping all content and portfolio functionality intact.
============================================================ */

/* Nav actions wrapper (holds low-perf btn + hamburger) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Low-perf toggle button */
.low-perf-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--clr-dim);
  font-family: var(--ff-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
}
.low-perf-toggle:hover {
  color: var(--clr-white);
  border-color: rgba(255,255,255,0.45);
}
.lite-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 220px;
  background: rgba(10,10,10,0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.55);
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  pointer-events: none;
  text-align: left;
  white-space: normal;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
}
.lite-tooltip strong {
  display: block;
  color: rgba(255,255,255,0.8);
  margin-bottom: 5px;
  letter-spacing: 0.08em;
}
.lite-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  right: 14px;
  width: 8px;
  height: 8px;
  background: rgba(10,10,10,0.96);
  border-left: 1px solid rgba(255,255,255,0.12);
  border-top: 1px solid rgba(255,255,255,0.12);
  transform: rotate(45deg);
}
.low-perf-toggle:hover .lite-tooltip,
.low-perf-toggle.lite-hint-visible .lite-tooltip {
  opacity: 1;
  transform: translateY(0);
}
.low-perf-toggle[aria-pressed="true"] {
  color: var(--clr-white);
  border-color: var(--clr-white);
  background: rgba(255,255,255,0.07);
}

/* Stop sun spin in low-perf mode */
body.low-perf .nav-sun-icon { animation: none; }

/* ── body.low-perf: hide all purely decorative elements ── */
body.low-perf #hero-canvas,
body.low-perf .scanlines,
body.low-perf .ascii-bg,
body.low-perf #cursor-glow,
body.low-perf #cursor-dot,
body.low-perf #cursor-ring,
body.low-perf .hud-corner,
body.low-perf .scroll-side-label,
body.low-perf .hero-fx-overlay { display: none !important; }

/* Dot-matrix pseudo-element decorations on black sections */
body.low-perf #skills::before,
body.low-perf #contact::before { display: none !important; }

/* Disable glitch-text CSS pseudo-animations */
body.low-perf .glitch-text::before,
body.low-perf .glitch-text::after { display: none !important; }

/* Restore system cursor (body has cursor:none globally) */
body.low-perf,
body.low-perf * { cursor: auto !important; }

/* Hero solid background when 3D canvas is hidden */
body.low-perf #hero { background: var(--clr-bg); }

/* ── 13. SCROLLBAR — hidden but scroll still works ── */
::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

/* ── 14. SELECTION ── */
::selection {
  background: rgba(255,255,255,0.15);
  color: var(--clr-white);
}

/* ── 15. REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── 16. CUSTOM CURSOR ── */

/* Hide the large glow since the new system replaces it */
#cursor-glow { display: none; }

/* Main cursor dot — snaps immediately to pointer */
#cursor-dot {
  position: fixed;
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10001;
  transform: translate(-50%, -50%);
  transition: width 0.18s ease, height 0.18s ease, background 0.18s ease, opacity 0.18s ease;
  will-change: left, top;
  mix-blend-mode: difference;
}

/* Outer lagged ring */
#cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease, border-width 0.25s ease;
  will-change: left, top;
}

/* Corner-bracket accent on ring */
#cursor-ring::before,
#cursor-ring::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  border-color: rgba(255, 255, 255, 0.7);
  border-style: solid;
}
#cursor-ring::before {
  top: -1px; left: -1px;
  border-width: 1px 0 0 1px;
}
#cursor-ring::after {
  bottom: -1px; right: -1px;
  border-width: 0 1px 1px 0;
}

/* Hover state */
#cursor-ring.hovering {
  width: 54px;
  height: 54px;
  border-color: rgba(255, 255, 255, 0.9);
}
#cursor-dot.hovering {
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
}

/* Click pulse */
#cursor-ring.clicking {
  width: 28px;
  height: 28px;
  border-color: rgba(255, 255, 255, 1);
}

@media (hover: none) {
  body         { cursor: auto; }
  #cursor-dot,
  #cursor-ring { display: none; }
}

/* ── 17. SCROLL SIDE LABELS ── */
.scroll-side-label {
  position: fixed;
  top: 50%;
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.15);
  pointer-events: none;
  z-index: 400;
  opacity: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  white-space: nowrap;
  user-select: none;
  will-change: opacity;
}

.scroll-side-label--left {
  left: clamp(8px, 1.5vw, 20px);
  transform: translateY(-50%) rotate(180deg);
}

.scroll-side-label--right {
  right: clamp(8px, 1.5vw, 20px);
  transform: translateY(-50%);
}

@media (max-width: 900px) {
  .scroll-side-label { display: none; }
}

/* ── 18. ASCII FLASH OVERLAY ── */
.ascii-flash-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  font-family: var(--ff-mono);
  font-size: 10px;
  line-height: 1.45;
  color: #fff;
  white-space: pre;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}

/* ── 19. SCAN SWEEP LINE ── */
.scan-sweep-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 20%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.12) 80%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 20;
  top: 0;
  will-change: top, opacity;
}

/* ── 20. SIDE SCROLL TEXT GLITCH ── */
/* Momentary highlighted side label glitch on active */
.scroll-side-label.active {
  color: rgba(255, 255, 255, 0.35);
  animation: label-glitch 3s infinite steps(1);
}

@keyframes label-glitch {
  0%, 88%, 100% { transform: translateY(-50%) rotate(180deg) skewY(0deg);   opacity: 1;   }
  89%            { transform: translateY(-50%) rotate(180deg) skewY(-3deg);  opacity: 0.4; }
  91%            { transform: translateY(-50%) rotate(180deg) skewY(0deg);   opacity: 0.9; }
  93%            { transform: translateY(-50%) rotate(180deg) skewY(1.5deg); opacity: 0.5; }
}
.scroll-side-label--right.active {
  animation-name: label-glitch-right;
}
@keyframes label-glitch-right {
  0%, 88%, 100% { transform: translateY(-50%) skewY(0deg);   opacity: 1;   }
  89%            { transform: translateY(-50%) skewY(-3deg);  opacity: 0.4; }
  91%            { transform: translateY(-50%) skewY(0deg);   opacity: 0.9; }
  93%            { transform: translateY(-50%) skewY(1.5deg); opacity: 0.5; }
}

/* ── 21. CLICK RIPPLE ── */
/* Rings and char bursts are fully JS-driven; this contains pointer-event safety */
.click-ripple-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  top: 0; left: 0;
  width: 4px; height: 4px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

