/* ============================================================
   Mohsen Raje — Personal Portfolio
   Premium minimal aesthetic · scroll-driven hero · English LTR
   ============================================================ */

:root {
  /* Palette */
  --bg-0: #06070a;
  --bg-1: #0a0c12;
  --bg-2: #11141c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text-0: #f6f7fa;
  --text-1: #c8ccd9;
  --text-2: #8a90a3;
  --text-3: #5c6273;

  --accent: #5ec8ff;
  --accent-2: #8a7bff;
  --accent-warm: #ffb86b;
  --accent-glow: rgba(94, 200, 255, 0.4);
  --cyan: #5ec8ff;

  /* Type */
  --font-sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-fa: "Estedad", "Vazirmatn", Tahoma, system-ui, sans-serif;

  /* Layout */
  --container: 1280px;
  --gutter: clamp(20px, 4vw, 40px);

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur: 700ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 108px;
}

body {
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: transparent; cursor: pointer; color: inherit; }

::selection { background: var(--accent); color: var(--bg-0); }

/* Keyboard focus — visible ring for accessibility (mouse clicks unaffected) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
a:focus-visible,
button:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--bg-0);
  background: var(--text-0);
  font-size: 13px;
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform .2s var(--ease);
}
.skip-link:focus {
  transform: translateY(0);
}
.fa-page .skip-link {
  left: auto;
  right: 12px;
}

/* Ambient body glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1000px 700px at 80% 5%, rgba(94, 200, 255, 0.07), transparent 60%),
    radial-gradient(800px 600px at 10% 95%, rgba(138, 123, 255, 0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

.num {
  font-family: var(--font-mono);
  font-size: 0.7em;
  color: var(--text-3);
  margin-right: 8px;
  font-weight: 500;
  letter-spacing: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: 20px 0;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  background: linear-gradient(to bottom, rgba(6, 7, 10, 0.55), rgba(6, 7, 10, 0.0));
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(6, 7, 10, 0.7);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--border);
}

.nav-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  transition: color .25s var(--ease), background .25s var(--ease);
}
.lang-switch a:hover,
.lang-switch a.is-active {
  color: var(--bg-0);
  background: var(--text-0);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 54px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(94, 200, 255, 0.26);
  background: #071019;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24), 0 0 22px rgba(94, 200, 255, 0.1);
}
.brand-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  filter: drop-shadow(0 14px 28px rgba(94, 200, 255, 0.12));
}
.brand-logo--photo {
  max-width: none;
  transform: scale(1.72);
  transform-origin: 50% 48%;
}
.brand-mark {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.brand:hover .brand-mark {
  color: var(--text-0);
}

.nav-links {
  display: flex;
  gap: 32px;
  font-size: 14px;
  color: var(--text-1);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.nav-links a {
  position: relative;
  transition: color .25s var(--ease);
  padding: 4px 0;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background: var(--text-0);
  transition: width .3s var(--ease);
}
.nav-links a:hover { color: var(--text-0); }
.nav-links a:hover::after { width: 100%; }
/* Current section indicator */
.nav-links a.is-current { color: var(--text-0); }
.nav-links a.is-current::after { width: 100%; background: var(--accent); }
.nav-links a.is-current .num { color: var(--accent); }

/* Mobile menu toggle (hamburger) — hidden on desktop */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  position: relative;
  z-index: 60;
  cursor: pointer;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--border-strong); }
.nav-toggle-bar {
  width: 18px;
  height: 1.5px;
  background: var(--text-0);
  border-radius: 2px;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.site-header.is-open .nav-toggle-bar:nth-child(1) { transform: translateY(3.25px) rotate(45deg); }
.site-header.is-open .nav-toggle-bar:nth-child(2) { transform: translateY(-3.25px) rotate(-45deg); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-1);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}
.status-dot {
  width: 8px; height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.6);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================================
   SCENES — scroll-driven sticky video stages
   Each scene: 280vh tall, sticky inner at 100vh
   Hero is 320vh for longer scrub
   ============================================================ */
.scene {
  position: relative;
  height: 250vh;
  width: 100%;
  z-index: 1;
}
.scene-hero { height: 300vh; }

.scene-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.video-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--bg-0);
  overflow: hidden;
}

/* Per-scene atmospheric gradient mesh */
.video-stage::before {
  content: "";
  position: absolute;
  inset: -10%;
  z-index: 0;
  opacity: 0.78;
  filter: blur(50px) saturate(120%);
  background-size: 200% 200%;
  animation: meshDrift 30s ease-in-out infinite alternate;
  pointer-events: none;
}
.scene-hero .video-stage::before {
  background-image:
    radial-gradient(40% 35% at 18% 22%, rgba(94, 200, 255, 0.5), transparent 70%),
    radial-gradient(38% 32% at 82% 28%, rgba(138, 123, 255, 0.45), transparent 70%),
    radial-gradient(45% 40% at 70% 80%, rgba(60, 140, 220, 0.4), transparent 70%),
    radial-gradient(35% 30% at 22% 78%, rgba(94, 200, 255, 0.3), transparent 70%);
}
.scene-about .video-stage::before {
  background-image:
    radial-gradient(45% 40% at 15% 30%, rgba(80, 130, 230, 0.45), transparent 70%),
    radial-gradient(40% 35% at 85% 40%, rgba(94, 200, 255, 0.4), transparent 70%),
    radial-gradient(50% 40% at 50% 90%, rgba(120, 100, 220, 0.35), transparent 70%);
}
.scene-skills .video-stage::before {
  background-image:
    radial-gradient(40% 35% at 20% 25%, rgba(94, 200, 255, 0.45), transparent 70%),
    radial-gradient(38% 32% at 80% 30%, rgba(255, 184, 107, 0.28), transparent 70%),
    radial-gradient(45% 40% at 75% 85%, rgba(94, 200, 255, 0.38), transparent 70%),
    radial-gradient(35% 30% at 20% 80%, rgba(255, 184, 107, 0.25), transparent 70%);
}
@keyframes meshDrift {
  0%   { background-position: 0% 0%; transform: rotate(0deg) scale(1); }
  50%  { background-position: 100% 50%; transform: rotate(6deg) scale(1.05); }
  100% { background-position: 50% 100%; transform: rotate(-4deg) scale(1.02); }
}

/* Faint tech grid */
.video-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(70% 70% at 50% 50%, black, transparent 100%);
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, black, transparent 100%);
}

/* Live canvas particle layer */
.scene-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  pointer-events: none;
}

/* Scroll-scrub MP4 fallback (used only if frame canvas isn't present) */
.scene-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  background: transparent;
  z-index: 2;
}
.scene-about .scene-bg {
  opacity: 0.18;
}
.scene-about .video-overlay {
  background:
    linear-gradient(90deg, rgba(6, 7, 10, 0) 0%, rgba(6, 7, 10, 0.02) 38%, rgba(6, 7, 10, 0.58) 66%, rgba(6, 7, 10, 0.9) 100%),
    radial-gradient(66% 72% at 78% 44%, rgba(6, 7, 10, 0.04), rgba(6, 7, 10, 0.46) 100%);
}
@media (min-aspect-ratio: 16/9) {
  .scene-video { object-position: 50% 8%; }
}
@media (max-aspect-ratio: 5/4) {
  .scene-video { object-position: 50% 30%; }
}

/* Image-sequence frame scrubber canvas — Apple-style smooth scrub */
.scene-frames {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: block;
  background: transparent;
}
.scene-hero .scene-frames {
  top: calc(104px + env(safe-area-inset-top));
  right: 0;
  left: 0;
  bottom: auto;
  /* Explicit height (not auto) — a <canvas> with height:auto collapses to
     its bitmap aspect ratio and squishes the frame, badly on mobile. */
  height: calc(100% - 46px - env(safe-area-inset-top));
}
.scene-frames--about {
  right: auto;
  top: 90px;
  bottom: auto;
  height: calc(100% - 90px);
  width: min(58vw, 980px);
  opacity: 1;
  filter: saturate(1.18) contrast(1.12) brightness(1.16);
  transform: translateX(-1vw) scale(1.02);
  transform-origin: left center;
  -webkit-mask-image: linear-gradient(90deg, black 0%, black 78%, rgba(0, 0, 0, 0.78) 88%, transparent 100%);
  mask-image: linear-gradient(90deg, black 0%, black 78%, rgba(0, 0, 0, 0.78) 88%, transparent 100%);
}

/* Subtle loading indicator that fades when sequence is fully buffered */
.frame-loader {
  position: absolute;
  left: var(--gutter);
  bottom: 24px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(6, 7, 10, 0.55);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  pointer-events: none;
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.frame-loader-label { color: var(--text-3); }
.frame-loader [data-frame-progress] { color: var(--accent); font-weight: 500; }
.frame-loader.done { opacity: 0; transform: translateY(8px); }

/* Film grain */
.film-grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.10;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.7 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 280px 280px;
  animation: grainShift 1.2s steps(6) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Center darkening for legibility */
.video-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(50% 40% at 50% 55%, rgba(6, 7, 10, 0.55) 0%, rgba(6, 7, 10, 0.25) 60%, transparent 100%),
    radial-gradient(80% 80% at 50% 50%, transparent 50%, rgba(6, 7, 10, 0.65) 100%);
}

/* ---------- Hero typography ---------- */
.hero-content {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 0 var(--gutter);
  max-width: 1100px;
  width: 100%;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-1);
  margin: 0 0 24px;
}
.kicker.centered { text-align: center; }
.kicker .num { color: var(--accent); }

.hero-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(72px, 13vw, 200px);
  line-height: 0.92;
  letter-spacing: -0.045em;
  margin: 0 0 24px;
  color: transparent;
  -webkit-text-stroke: 0;
  background: linear-gradient(180deg, #ffffff 0%, #d0d8eb 70%, #5ec8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 80px rgba(94, 200, 255, 0.08);
}
.hero-title span {
  display: block;
}

.hero-sub {
  font-size: clamp(15px, 1.4vw, 18px);
  color: var(--text-1);
  font-weight: 400;
  letter-spacing: -0.01em;
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.55;
}

.hero-cta {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Side meta block (hero only) */
.hero-meta {
  position: absolute;
  right: var(--gutter);
  bottom: 48px;
  display: flex;
  gap: 32px;
  z-index: 5;
  font-family: var(--font-mono);
}
.meta-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.meta-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
}
.meta-value {
  font-size: 13px;
  color: var(--text-1);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 24px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: all .3s var(--ease);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary {
  background: #ffffff;
  color: var(--bg-0);
  box-shadow: 0 18px 50px rgba(255, 255, 255, 0.16);
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 0 32px var(--accent-glow);
}
.btn-ghost {
  background: rgba(9, 14, 22, 0.78);
  border-color: rgba(94, 200, 255, 0.34);
  color: var(--text-0);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 16px 48px rgba(94, 200, 255, 0.12);
}
.btn-ghost:hover {
  background: rgba(94, 200, 255, 0.14);
  border-color: rgba(94, 200, 255, 0.58);
}

/* ---------- Scroll hint ---------- */
.scroll-hint {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  margin: 26px auto 0;
  padding: 8px 12px 12px;
  border-radius: 999px;
  background: rgba(5, 8, 13, 0.62);
  border: 1px solid rgba(94, 200, 255, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #d7ecff;
  text-shadow: 0 0 18px rgba(94, 200, 255, 0.3);
}
.scroll-line {
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  background: transparent;
  transform: rotate(45deg);
  animation: scroll-pulse 2.2s infinite var(--ease);
}
@keyframes scroll-pulse {
  0%, 100% { opacity: 0.35; transform: translateY(-2px) rotate(45deg); }
  50% { opacity: 1; transform: translateY(3px) rotate(45deg); }
}

/* ---------- Generic scene content ---------- */
.scene-content {
  position: relative;
  z-index: 5;
  max-width: 680px;
  padding: 0 var(--gutter);
}
.scene-content--right { margin-left: auto; margin-right: 6vw; }
.scene-content--left  { margin-right: auto; margin-left: 6vw; }
.scene-skills .scene-content--left {
  max-width: 1180px;
  margin-left: 6vw;
  margin-right: 6vw;
}
.scene-contact {
  height: auto;
  min-height: 100vh;
  overflow: hidden;
}
.scene-contact .scene-sticky {
  position: relative;
  top: auto;
  height: auto;
  min-height: 100vh;
  display: block;
  place-items: initial;
  overflow: hidden;
  padding: clamp(52px, 5vw, 72px) 0 0;
}
.scene-contact .scene-content--contact {
  max-width: 1180px;
  width: min(1180px, calc(100% - (var(--gutter) * 2)));
  margin: 0 auto;
  padding-inline: 0;
  display: grid;
  gap: 0;
}
.terminal-logo-watermark {
  position: absolute;
  left: 50%;
  bottom: -10%;
  z-index: 2;
  width: min(940px, 76vw);
  height: auto;
  transform: translateX(-50%);
  opacity: 0.075;
  filter: saturate(0.7) contrast(1.2) hue-rotate(8deg);
  mix-blend-mode: screen;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 38%, transparent 76%);
  mask-image: radial-gradient(ellipse at center, #000 38%, transparent 76%);
}
.scene-content--center {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}
.scene-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: clamp(40px, 6.5vw, 88px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 0 0 24px;
  color: var(--text-0);
}
.scene-title.huge {
  font-size: clamp(52px, 8vw, 116px);
  font-weight: 700;
}
.scene-title em {
  font-style: italic;
  font-weight: 400;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.scene-text {
  font-size: clamp(15px, 1.2vw, 17px);
  color: var(--text-1);
  margin: 0 0 28px;
  max-width: 580px;
  line-height: 1.65;
}
.scene-content--center .scene-text { margin-left: auto; margin-right: auto; }
/* ---------- Stats (about) ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num {
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-family: var(--font-sans);
  color: var(--text-0);
  line-height: 1;
  min-height: 1em;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

/* ---------- Skills grid (scene 3) ---------- */
.systems-stage {
  position: relative;
  min-height: 560px;
  padding: clamp(8px, 2.8vw, 34px) 0;
  margin: -4px 0 22px;
  isolation: isolate;
}
.systems-stage::before {
  content: "";
  position: absolute;
  top: -90px;
  bottom: -80px;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0.55;
  background:
    linear-gradient(90deg, rgba(94, 200, 255, 0.14), transparent 18%, transparent 82%, rgba(138, 123, 255, 0.12)),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 74px);
  mask-image: linear-gradient(180deg, transparent 0%, black 16%, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 16%, black 88%, transparent 100%);
}
.systems-video {
  position: absolute;
  top: -142px;
  bottom: -132px;
  left: 50%;
  width: 100vw;
  overflow: hidden;
  border-radius: 0;
  opacity: 0.56;
  transform: translateX(-50%);
  transform-origin: center;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 10%, black 92%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, black 10%, black 92%, transparent 100%);
}
.systems-video::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 34% 24%, rgba(94, 200, 255, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(2, 5, 10, 0.18), rgba(2, 5, 10, 0.72));
}
.systems-video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  filter: saturate(1.18) contrast(1.12) brightness(0.68);
}
.skills-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 28px;
}
.skills-grid--6 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 880px;
}
.skills-grid--8 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 1180px;
  gap: 12px;
}
.skill-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  min-height: 238px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(13, 18, 28, 0.88), rgba(7, 10, 16, 0.7)),
    rgba(7, 10, 16, 0.84);
  border: 1px solid rgba(94, 200, 255, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.16);
  transition: all .3s var(--ease);
}
.skill-rank {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: 500;
}
.skill-card:hover .skill-rank { color: var(--accent); }
.skill-card:hover {
  border-color: var(--border-strong);
  background: rgba(10, 12, 18, 0.85);
  transform: translateY(-2px);
}
.skill-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(94, 200, 255, 0.1);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}
.skill-icon::before {
  font-size: 12px;
}
.systems-stage .skill-card:nth-of-type(1) .skill-icon::before { content: "OP"; }
.systems-stage .skill-card:nth-of-type(2) .skill-icon::before { content: "BI"; }
.systems-stage .skill-card:nth-of-type(3) .skill-icon::before { content: "CV"; }
.systems-stage .skill-card:nth-of-type(4) .skill-icon::before { content: "PM"; }
.systems-stage .skill-card:nth-of-type(5) .skill-icon::before { content: "WP"; }
.systems-stage .skill-card:nth-of-type(6) .skill-icon::before { content: "TR"; }
.systems-stage .skill-card:nth-of-type(7) .skill-icon::before { content: "FX"; }
.systems-stage .skill-card:nth-of-type(8) .skill-icon::before { content: "3D"; }
.skill-card h3 {
  font-size: 16px;
  margin: 0 0 6px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.skill-card p {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.55;
}
.skill-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 16px;
}
.skill-tech span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid rgba(94, 200, 255, 0.18);
  border-radius: 5px;
  color: #bfe9ff;
  background: rgba(94, 200, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.25;
  letter-spacing: 0;
  white-space: nowrap;
}
.skills-contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 24px;
  align-items: center;
  margin-top: 18px;
  padding: 22px;
  border-radius: 12px;
  border: 1px solid rgba(94, 200, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(94, 200, 255, 0.09), rgba(138, 123, 255, 0.06)),
    rgba(7, 10, 16, 0.78);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.scene-contact .skills-contact {
  margin-top: 0;
}
.skills-contact .kicker {
  margin-bottom: 8px;
}
.skills-contact h3 {
  margin: 0 0 8px;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1;
  letter-spacing: -0.025em;
}
.skills-contact p {
  margin: 0;
  max-width: 640px;
  color: var(--text-1);
  line-height: 1.55;
}
.skills-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.skills-proof span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #d8f2ff;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(94, 200, 255, 0.24);
  background: rgba(94, 200, 255, 0.08);
}
.skills-contact-actions {
  display: grid;
  gap: 10px;
}
/* Primary Telegram CTA — high-contrast, on-brand accent */
.tg-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 15px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--bg-0);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 28px var(--accent-glow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .25s var(--ease);
}
.tg-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 42px var(--accent-glow);
  filter: brightness(1.05);
}
.tg-cta svg { flex: none; }
.compact-mail {
  width: 100%;
  justify-content: space-between;
  margin: 0;
  padding: 15px 18px;
  font-size: clamp(18px, 1.8vw, 24px);
}
.compact-contact {
  max-width: none;
  margin: 0;
}

/* ---------- Work section ---------- */
.work-section {
  position: relative;
  z-index: 2;
  padding: 86px 0 58px;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 88% 12%, rgba(94, 200, 255, 0.12), transparent 62%),
    radial-gradient(720px 520px at 16% 86%, rgba(138, 123, 255, 0.14), transparent 66%),
    linear-gradient(180deg, #06070a 0%, #090d16 48%, #06070a 100%);
}
.systems-section {
  scroll-margin-top: 108px;
}
.work-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(94, 200, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 200, 255, 0.08) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: radial-gradient(80% 70% at 50% 30%, black, transparent 100%);
  -webkit-mask-image: radial-gradient(80% 70% at 50% 30%, black, transparent 100%);
}
.systems-section::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.34;
  background:
    linear-gradient(115deg, transparent 0%, rgba(94, 200, 255, 0.13) 32%, transparent 54%),
    linear-gradient(180deg, transparent 0%, rgba(255, 255, 255, 0.035) 50%, transparent 100%);
  background-size: 180% 100%, 100% 100%;
  animation: systemsSweep 18s ease-in-out infinite alternate;
}
@keyframes systemsSweep {
  from { background-position: 0% 0%, 0 0; }
  to { background-position: 100% 0%, 0 0; }
}

.section-head {
  margin-bottom: 64px;
  max-width: 720px;
}
.section-head--work {
  margin-top: 96px;
}
.systems-section > .container > .section-head:not(.section-head--work) {
  margin-bottom: 22px;
}
#work,
#about,
#skills,
#skills-contact {
  scroll-margin-top: 108px;
}
.section-title {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 8px 0 16px;
  color: var(--text-0);
}
.section-sub {
  color: var(--text-2);
  font-size: 16px;
  max-width: 480px;
  line-height: 1.6;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.22);
}

.work-card {
  background: rgba(6, 7, 10, 0.72);
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: background .3s var(--ease);
  cursor: pointer;
  position: relative;
  min-height: 270px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.work-card:hover {
  background: var(--bg-1);
}

.work-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.work-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(94, 200, 255, 0.08);
  border: 1px solid rgba(94, 200, 255, 0.2);
}
.work-year {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.work-card h3 {
  font-size: 22px;
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-0);
  margin-top: auto;
}
.work-card p {
  font-size: 14px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.6;
}
.work-arrow {
  position: absolute;
  top: 36px;
  right: 36px;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-1);
  transition: all .3s var(--ease);
}
.work-card:hover .work-arrow {
  background: var(--text-0);
  color: var(--bg-0);
  transform: rotate(-45deg);
}

/* Flagship card spans both columns */
.work-card--feature {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(94, 200, 255, 0.06), rgba(138, 123, 255, 0.04));
  border-bottom: 1px solid var(--border);
  min-height: 330px;
}
.work-card--feature::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 200px at 80% 0%, rgba(94, 200, 255, 0.08), transparent 60%);
  pointer-events: none;
}
.work-card--feature h3 { font-size: 28px; }

.legacy-work-section,
.legacy-work-grid,
.legacy-portfolio-stack,
.legacy-site-footer {
  display: none !important;
}

/* Stack-at-a-glance row */
.stack-grid {
  margin-top: 80px;
  text-align: center;
}
.portfolio-stack {
  position: relative;
  margin-top: clamp(56px, 7vw, 96px);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid rgba(94, 200, 255, 0.16);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(94, 200, 255, 0.08), rgba(138, 123, 255, 0.045)),
    rgba(6, 9, 14, 0.72);
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.terminal-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(94, 200, 255, 0.2);
  border-radius: 16px 16px 0 0;
  background:
    linear-gradient(135deg, rgba(94, 200, 255, 0.075), rgba(138, 123, 255, 0.035)),
    rgba(6, 9, 14, 0.74);
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.terminal-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(720px 280px at 50% 0%, rgba(94, 200, 255, 0.12), transparent 68%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, 76px 100%;
  opacity: 0.55;
}
.terminal-shell > * {
  position: relative;
  z-index: 1;
}
.terminal-portfolio {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.terminal-portfolio::before {
  display: none;
}
.terminal-shell .skills-contact {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  margin: 0 clamp(24px, 4vw, 48px);
  padding: clamp(24px, 3.2vw, 38px) 0;
  border: 0;
  border-top: 1px solid rgba(94, 200, 255, 0.16);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.portfolio-stack::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(620px 220px at 50% 0%, rgba(94, 200, 255, 0.14), transparent 62%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: auto, 76px 100%;
  opacity: 0.55;
}
.portfolio-stack > * {
  position: relative;
  z-index: 1;
}
.portfolio-copy {
  display: grid;
  justify-items: center;
  margin: 0 auto 28px;
  max-width: 760px;
}
.portfolio-copy .section-title {
  margin-top: 0;
}
.portfolio-copy .section-sub {
  max-width: 660px;
  margin: 0;
  text-align: center;
}
.stack-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  margin: 24px 0 36px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.stack-cell {
  background: var(--bg-0);
  padding: 28px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: background .3s var(--ease);
}
.stack-cell:hover { background: var(--bg-1); }
.stack-num {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-0);
  line-height: 1;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 26px 0 36px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--border);
}
.capability-cell {
  min-width: 0;
  padding: 24px 22px 22px;
  background: rgba(5, 9, 15, 0.94);
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
.capability-cell:hover {
  background: rgba(10, 18, 28, 0.98);
  box-shadow: inset 0 2px 0 rgba(70, 190, 255, 0.48);
}
.capability-code {
  display: block;
  min-height: 30px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.capability-cell h3 {
  margin: 7px 0 10px;
  color: var(--text-0);
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}
.capability-cell p {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
}
.capability-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
}
.capability-tags span {
  padding: 5px 8px;
  border: 1px solid rgba(73, 184, 240, 0.2);
  border-radius: 4px;
  background: rgba(23, 63, 88, 0.22);
  color: #a9dcf7;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}
.fa-page .capability-code {
  font-family: var(--font-fa);
  letter-spacing: 0;
  text-transform: none;
}
.fa-page .capability-cell h3,
.fa-page .capability-cell p { letter-spacing: 0; }
.stack-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: center;
}
.stack-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-0);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all .3s var(--ease);
  margin-top: 12px;
}
.stack-cta:hover {
  background: var(--text-0);
  color: var(--bg-0);
  transform: translateY(-1px);
}

/* ---------- Contact ---------- */
.big-mail {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-sans);
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 16px 0 32px;
  padding: 18px 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-0);
  transition: all .3s var(--ease);
  text-decoration: none;
}
.big-mail:hover {
  background: var(--text-0);
  color: var(--bg-0);
  border-color: var(--text-0);
}
.big-mail svg {
  transition: transform .3s var(--ease);
}
.big-mail:hover svg {
  transform: translateX(4px);
}

/* Contact rows (phone / telegram / studio) */
.contact-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 440px;
  margin: 8px auto 24px;
}
.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  transition: all .25s var(--ease);
  text-decoration: none;
}
.contact-row:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.contact-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}
.contact-value {
  font-size: 14px;
  color: var(--text-0);
  font-weight: 500;
  letter-spacing: -0.005em;
}

/* Inline link inside paragraphs */
.link-inline {
  color: var(--text-0);
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 1px;
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.link-inline:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Persian / RTL variant ---------- */
.fa-page {
  direction: rtl;
  font-family: "Estedad", var(--font-sans);
}
.fa-page .nav-links,
.fa-page .status-badge,
.fa-page .kicker,
.fa-page .meta-label,
.fa-page .meta-value,
.fa-page .stat-label,
.fa-page .work-tag,
.fa-page .work-year,
.fa-page .stack-label,
.fa-page .contact-label,
.fa-page .skills-proof span,
.fa-page .footer-inner {
  letter-spacing: 0;
}
.fa-page .num {
  margin-right: 0;
  margin-left: 8px;
}
.fa-page .hero-title,
.fa-page .scene-title,
.fa-page .section-title,
.fa-page .work-card h3,
.fa-page .skill-card h3,
.fa-page .skills-contact h3 {
  font-family: "Estedad", var(--font-sans);
  letter-spacing: 0;
}
.fa-page .hero-title {
  font-size: clamp(72px, 11.5vw, 176px);
  line-height: 0.98;
  font-weight: 800;
}
.fa-page .scene-title {
  font-size: clamp(36px, 4.85vw, 64px);
  line-height: 1.08;
}
.fa-page .section-title {
  font-size: clamp(34px, 4.8vw, 58px);
  line-height: 1.1;
}
.fa-page .systems-section > .container > .section-head:not(.section-head--work) {
  margin-bottom: 4px;
}
.fa-page .systems-stage {
  padding-top: 0;
  margin-top: -20px;
}
.fa-page .hero-sub,
.fa-page .scene-text,
.fa-page .section-sub,
.fa-page .work-card p,
.fa-page .skill-card p,
.fa-page .skills-contact p {
  letter-spacing: 0;
}
.fa-page .scene-text,
.fa-page .section-sub {
  max-width: 640px;
}
.fa-page .skill-rank,
.fa-page .work-arrow {
  right: auto;
  left: 16px;
}
.fa-page .work-arrow {
  left: 36px;
}
.fa-page .work-card-head,
.fa-page .contact-row {
  direction: rtl;
}
.fa-page .big-mail svg,
.fa-page .btn svg,
.fa-page .stack-cta svg {
  transform: scaleX(-1);
}
.fa-page .big-mail:hover svg {
  transform: scaleX(-1) translateX(4px);
}
.fa-page .contact-value {
  direction: ltr;
}

.socials {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 0.05em;
}
.socials a {
  color: var(--text-1);
  transition: color .25s var(--ease);
  position: relative;
}
.socials a:hover { color: var(--text-0); }
.socials span { color: var(--text-3); }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  z-index: 2;
  padding: 36px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-0);
}
.terminal-footer {
  width: auto;
  margin: 0 clamp(24px, 4vw, 48px);
  padding: 22px 0 28px;
  border-top: 1px solid rgba(94, 200, 255, 0.16);
  background: transparent;
}
.terminal-footer.footer-inner {
  display: flex;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 0.04em;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-meta { color: var(--text-3); margin: 0; }
.footer-inner p { margin: 0; }
.footer-meta a {
  color: var(--text-2);
  transition: color .25s var(--ease);
}
.footer-meta a:hover { color: var(--text-0); }

/* ---------- Side scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0;
  right: 0;
  width: 2px;
  height: 100vh;
  z-index: 60;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.04);
}
.scroll-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: height .15s linear;
}

/* ---------- Reveal ---------- */
[data-fade] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
  will-change: opacity, transform;
}
[data-fade].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .brand { position: relative; z-index: 60; }
  .nav-actions { gap: 8px; position: relative; z-index: 60; }
  .status-badge { padding: 6px 10px; font-size: 11px; }

  /* Full-screen overlay menu.
     Sized in viewport units (not inset:0) because the header's
     backdrop-filter makes it the containing block for this fixed panel —
     inset:0 would collapse to the header's height. */
  .nav-links {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: var(--gutter);
    margin: 0;
    background: rgba(6, 7, 10, 0.985);
    backdrop-filter: blur(26px) saturate(140%);
    -webkit-backdrop-filter: blur(26px) saturate(140%);
    z-index: 40;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity .35s var(--ease), transform .35s var(--ease);
  }
  .site-header.is-open .nav-links {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
  .nav-links a {
    font-size: clamp(28px, 9vw, 44px);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-0);
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links a::after { display: none; }
  .nav-links a .num {
    font-size: 14px;
    color: var(--accent);
    vertical-align: super;
  }
  body.nav-open { overflow: hidden; }
  .work-grid { grid-template-columns: 1fr; }
  .work-card--feature { grid-column: 1; }
  .scene-content--right,
  .scene-content--left { margin: 0; padding-inline: var(--gutter); }
  .scene-frames--about {
    opacity: 0.32;
    mask-image: linear-gradient(180deg, black 0%, transparent 78%);
    -webkit-mask-image: linear-gradient(180deg, black 0%, transparent 78%);
  }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .hero-meta { display: none; }
  .skills-grid--6 { grid-template-columns: repeat(2, 1fr); }
  .skills-grid--8 { grid-template-columns: repeat(2, 1fr); }
  .systems-stage {
    min-height: auto;
  }
  /* Keep the ambient video, but as a clean uniformly-darkened backdrop:
     normal blend (no bright "screen" glow / stray circle) + a strong
     dark veil so the cards always read clearly on top. */
  .systems-video {
    display: block;
    top: -24px;
    bottom: -24px;
    left: 50%;
    width: 100vw;
    opacity: 1;
    mix-blend-mode: normal;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 13%, #000 87%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 13%, #000 87%, transparent 100%);
  }
  .systems-video::after {
    background: linear-gradient(180deg, rgba(4, 7, 12, 0.7), rgba(4, 7, 12, 0.82));
  }
  .systems-video video {
    object-position: 50% 50%;
    filter: saturate(1.08) contrast(1.06) brightness(0.6);
  }
  .stack-row { grid-template-columns: repeat(3, 1fr); }
  .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stack-num { font-size: 28px; }
  .terminal-shell .skills-contact {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  :root {
    --gutter: 22px;
  }
  .site-header {
    padding: calc(10px + env(safe-area-inset-top)) 0 10px;
    background: linear-gradient(to bottom, rgba(6, 7, 10, 0.92), rgba(6, 7, 10, 0.44) 70%, transparent);
  }
  .site-header.is-scrolled {
    background: rgba(6, 7, 10, 0.82);
  }
  .nav-inner {
    align-items: center;
  }
  .brand-logo {
    width: 100%;
    height: 100%;
  }
  .brand {
    width: 58px;
    height: 50px;
  }
  .scene {
    height: 220vh;
  }
  .scene-hero {
    height: 300vh;
  }
  .scene-sticky {
    height: 100svh;
    min-height: 680px;
  }
  .scene-hero .scene-sticky {
    place-items: start center;
  }
  .scene-hero .scene-frames {
    top: calc(82px + env(safe-area-inset-top));
    bottom: auto;
    height: calc(100% - 52px - env(safe-area-inset-top));
  }
  .scene-hero .video-overlay {
    background:
      linear-gradient(180deg, rgba(6, 7, 10, 0.18) 0%, rgba(6, 7, 10, 0.18) 34%, rgba(6, 7, 10, 0.58) 66%, rgba(6, 7, 10, 0.82) 100%),
      radial-gradient(80% 70% at 50% 46%, rgba(6, 7, 10, 0.1), rgba(6, 7, 10, 0.62) 100%);
  }
  .hero-content {
    margin-top: clamp(162px, 25svh, 208px);
    padding-inline: 20px;
  }
  .status-badge { display: none; }
  .lang-switch {
    font-size: 10px;
  }
  .lang-switch a {
    min-width: 28px;
    height: 26px;
    padding: 0 7px;
  }
  .hero-title {
    font-size: clamp(52px, 16vw, 76px);
    line-height: 0.9;
    letter-spacing: -0.025em;
    margin-bottom: 18px;
  }
  .hero-sub {
    max-width: 320px;
    font-size: 14px;
    line-height: 1.45;
    margin-bottom: 24px;
  }
  .hero-cta {
    gap: 8px;
  }
  .btn {
    padding: 12px 18px;
  }
  .scroll-hint {
    margin-top: 20px;
    padding: 7px 12px;
    background: rgba(6, 9, 14, 0.72);
  }
  .scene-about .scene-sticky {
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }
  .scene-about .scene-frames--about {
    inset: calc(76px + env(safe-area-inset-top)) 0 auto 0;
    width: 100%;
    height: clamp(180px, 28svh, 220px);
    opacity: 0.86;
    filter: saturate(1.15) contrast(1.12) brightness(1.14);
    transform: none;
    mask-image: linear-gradient(180deg, black 0%, black 66%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, black 0%, black 66%, transparent 100%);
  }
  .scene-about .scene-bg {
    opacity: 0.16;
  }
  .scene-about .video-overlay {
    background:
      linear-gradient(180deg, rgba(6, 7, 10, 0.02) 0%, rgba(6, 7, 10, 0.08) 34%, rgba(6, 7, 10, 0.68) 58%, rgba(6, 7, 10, 0.96) 100%),
      radial-gradient(90% 80% at 50% 23%, rgba(94, 200, 255, 0.08), transparent 58%);
  }
  .scene-about .scene-content--right {
    width: 100%;
    padding: 0 22px 28px;
  }
  .scene-about .scene-title {
    font-size: clamp(34px, 10.2vw, 46px);
    line-height: 0.98;
    margin-bottom: 18px;
  }
  .scene-about .scene-text {
    font-size: 14px;
    line-height: 1.58;
    margin-bottom: 22px;
  }
  .scene-about .kicker {
    margin-bottom: 14px;
  }
  .stats {
    padding-top: 18px;
    margin-top: 22px;
  }
  .stat-num {
    font-size: 33px;
  }
  .stat-label {
    font-size: 9px;
    letter-spacing: 0.15em;
  }
  .skills-grid, .skills-grid--6 { grid-template-columns: 1fr; }
  /* Two compact columns of skill tiles → ~half the scroll on phones. */
  .skills-grid--8 {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .systems-stage {
    padding: 0 0 6px;
  }
  .skills-grid {
    margin-top: 18px;
  }
  .skill-card {
    min-height: 0;
    padding: 18px;
    border-radius: 9px;
    background:
      linear-gradient(180deg, rgba(10, 15, 24, 0.82), rgba(5, 9, 15, 0.74)),
      rgba(7, 10, 16, 0.68);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }
  .skill-card h3 {
    font-size: 16px;
    line-height: 1.35;
    margin-bottom: 8px;
  }
  .skill-card p {
    font-size: 13px;
    line-height: 1.65;
  }
  .skill-tech {
    padding-top: 14px;
  }
  .skill-tech span {
    font-size: 9.5px;
  }
  .skill-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 10px;
  }
  .skill-rank {
    top: 10px;
    right: 11px;
    font-size: 9px;
  }
  .portfolio-stack {
    margin-top: 44px;
    padding: 24px 18px;
    border-radius: 12px;
  }
  .scene-contact {
    height: auto;
    min-height: 0;
  }
  .scene-contact .scene-sticky {
    height: auto;
    min-height: 0;
    padding-top: 38px;
  }
  .scene-contact .scene-content--contact {
    width: calc(100% - 28px);
    padding-inline: 0;
  }
  .terminal-shell {
    border-radius: 12px 12px 0 0;
  }
  .terminal-portfolio {
    margin-top: 0;
    padding: 26px 18px;
  }
  .terminal-shell .skills-contact {
    margin-inline: 18px;
    padding: 26px 0;
    gap: 22px;
  }
  .terminal-footer {
    margin-inline: 18px;
    padding: 20px 0 24px;
  }
  .terminal-logo-watermark {
    bottom: 4%;
    width: 150vw;
    opacity: 0.055;
  }
  .portfolio-copy {
    margin-bottom: 22px;
  }
  .stack-row { grid-template-columns: repeat(2, 1fr); }
  .stack-cell { padding: 20px 8px; }
  /* Two compact columns → about half the scroll on phones. */
  .capability-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 22px 0 28px;
  }
  .capability-cell { padding: 14px 13px; }
  .capability-code { min-height: 0; font-size: 9px; }
  .capability-cell h3 { font-size: 13.5px; margin: 6px 0 7px; line-height: 1.25; }
  .capability-cell p { font-size: 11.5px; line-height: 1.5; }
  .capability-tags { margin-top: 10px; gap: 4px; }
  .capability-tags span { font-size: 8px; padding: 4px 6px; }
  .work-card { padding: 24px; min-height: 200px; }
  .work-card--feature h3 { font-size: 22px; }
  .work-arrow { top: 24px; right: 24px; }
  .fa-page .hero-title {
    font-size: clamp(58px, 18vw, 84px);
    line-height: 1.02;
  }
  .fa-page .work-arrow {
    right: auto;
    left: 24px;
  }
  .work-section { padding: 80px 0 44px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .contact-row { padding: 12px 16px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-fade] { opacity: 1 !important; transform: none !important; transition: none !important; }
  /* Stop every ambient/looping animation for motion-sensitive users */
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .film-grain,
  .video-stage::before { animation: none !important; }
  .systems-video video { display: none; }
}
