:root {
  --bg: #080808;
  --bg-2: #0c0c0c;
  --surface: #141414;
  --surface-2: #1a1a1a;
  --text: #f2efe8;
  --text-dim: rgba(242, 239, 232, 0.62);
  --text-mute: rgba(242, 239, 232, 0.42);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --accent: #00c4a7;
  --accent-soft: rgba(0, 196, 167, 0.14);

  --display: "Clash Display", "DM Serif Display", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --container: 1280px;
  --pad-x: clamp(20px, 5vw, 64px);
  --section-y: clamp(80px, 12vw, 160px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  cursor: none;
}

/* Hide cursor only on devices that support fine pointer */
@media (pointer: coarse) { body { cursor: auto; } .cursor { display: none !important; } }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: none; }
img { display: block; max-width: 100%; }

/* ---------- Grain overlay ---------- */
.grain {
  position: fixed; inset: 0; z-index: 100;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.9'/></svg>");
}

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed; left: 0; top: 0;
  width: 8px; height: 8px;
  background: var(--text);
  border-radius: 999px;
  pointer-events: none;
  z-index: 400;
  transform: translate(-50%, -50%);
  transition: width .25s ease, height .25s ease, background .25s ease, opacity .25s ease;
  mix-blend-mode: difference;
}
.cursor.hover {
  width: 44px; height: 44px;
  background: var(--accent);
  mix-blend-mode: normal;
  opacity: 0.85;
}
.cursor.in-modal {
  width: 12px; height: 12px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0,196,167,0.18);
  mix-blend-mode: normal;
}
.cursor-ring {
  position: fixed; left: 0; top: 0;
  width: 36px; height: 36px;
  border: 1px solid rgba(242, 239, 232, 0.35);
  border-radius: 999px;
  pointer-events: none;
  z-index: 399;
  transform: translate(-50%, -50%);
  transition: opacity .25s ease, transform .15s ease, border-color .25s ease;
}
.cursor-ring.hover { opacity: 0; }
.cursor-ring.in-modal {
  width: 56px; height: 56px;
  border-color: var(--accent);
  border-width: 1.5px;
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--pad-x);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, rgba(8,8,8,0.85), rgba(8,8,8,0.0));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transform: translateY(-8px);
  animation: fadeDown .9s .15s ease forwards;
}
.nav__logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 500;
}
.nav__mark {
  width: 22px; height: 22px;
  display: block;
  flex-shrink: 0;
  border-radius: 5px;
  box-shadow: 0 0 0 0 rgba(0, 196, 167, 0.5);
  transition: transform .35s cubic-bezier(.7,.1,.2,1), box-shadow .35s ease;
}
.nav__logo:hover .nav__mark {
  transform: rotate(-8deg) scale(1.06);
  box-shadow: 0 0 16px 0 rgba(0, 196, 167, 0.45);
}
.nav__links {
  display: flex; gap: 28px; align-items: center;
}
.nav__links a {
  position: relative;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  transition: color .25s ease;
}
.nav__links a:hover { color: var(--text); }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -4px;
  height: 1px; background: var(--accent);
  transition: right .35s cubic-bezier(.7,.1,.2,1);
}
.nav__links a:hover::after { right: 0; }
.nav__cta {
  color: var(--text);
  border: 1px solid var(--line-2);
  padding: 8px 14px;
  border-radius: 999px;
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.nav__cta:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Hamburger (mobile) ---------- */
.nav__burger {
  display: none;
  width: 36px; height: 36px;
  position: relative;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  align-items: center; justify-content: center;
  transition: border-color .25s ease;
}
.nav__burger:hover { border-color: var(--accent); }
.nav__burger span {
  position: absolute;
  left: 9px; right: 9px;
  height: 1px;
  background: var(--text);
  transition: transform .35s cubic-bezier(.7,.1,.2,1), opacity .2s ease, top .25s ease;
}
.nav__burger span:nth-child(1) { top: 14px; }
.nav__burger span:nth-child(2) { top: 20px; }
.nav.is-open .nav__burger span { background: var(--accent); }
.nav.is-open .nav__burger span:nth-child(1) { top: 17px; transform: rotate(45deg); }
.nav.is-open .nav__burger span:nth-child(2) { top: 17px; transform: rotate(-45deg); }

@media (max-width: 720px) {
  .nav__burger { display: inline-flex; }
  .nav__links {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 28px;
    padding: 80px 32px 80px;
    background: var(--bg-2);
    transform: translateX(100%);
    transition: transform .5s cubic-bezier(.7,.1,.2,1);
    z-index: 89;
    border-left: 1px solid var(--accent);
  }
  .nav.is-open .nav__links { transform: translateX(0); }
  .nav__links a {
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(36px, 10vw, 64px);
    letter-spacing: -0.02em;
    color: var(--text);
  }
  .nav__links a::after { display: none; }
  .nav__links .nav__cta {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 12px 18px;
    margin-top: 12px;
    border: 1px solid var(--accent);
    color: var(--accent);
  }
  .nav__links .nav__count {
    display: block;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--text-mute);
    text-transform: uppercase;
    margin-top: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    width: 100%;
  }
}
@media (min-width: 721px) { .nav__count { display: none; } }

/* ---------- Hero meta: simpler on small screens ---------- */
@media (max-width: 640px) {
  .hero__meta > span:nth-child(2),
  .hero__meta > span:nth-child(3) { display: none; }
}

/* ---------- Hero portrait: cap and center on phones ---------- */
@media (max-width: 720px) {
  .hero__portrait .slot-wrap {
    max-width: min(58vw, 320px);
    margin: 0 auto;
    aspect-ratio: 4 / 5;
  }
  .hero__portrait__cap {
    max-width: min(58vw, 320px);
    margin: 14px auto 0;
    font-size: 9px;
  }
  /* tilt is also auto-disabled on coarse pointers via JS */
}
@media (pointer: coarse) {
  .hero__portrait .slot-wrap { transform: none !important; }
}

/* ---------- Touch-only project tap indicator ---------- */
.project__tap { display: none; }
@media (hover: none) {
  .project__tap {
    display: grid;
    place-items: center;
    position: absolute;
    top: 22px; right: 22px;
    width: 36px; height: 36px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--bg);
    font-size: 16px;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 0 0 4px rgba(0,196,167,0.12);
  }
  /* on touch, make the project bottom CTA always feel "primary" */
  .project__view { color: var(--accent); }
  .project::before { transform: scaleX(1) !important; opacity: 0.35; }
}

@keyframes fadeDown {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Layout ---------- */
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--pad-x); }
section { padding: var(--section-y) 0; position: relative; }
section + section { border-top: 1px solid var(--line); }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  display: inline-flex; align-items: center; gap: 12px;
  margin-bottom: 28px;
}
.eyebrow::before {
  content: ""; width: 28px; height: 1px; background: var(--accent);
}
.eyebrow .num { color: var(--accent); }

.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 64px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  max-width: 14ch;
}
.section-head p {
  color: var(--text-dim);
  max-width: 38ch;
  font-size: clamp(15px, 1.2vw, 17px);
}

/* ---------- Scroll-tied background (whole site) ---------- */
.scrollbg {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.scrollbg__word {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(220px, 38vw, 620px);
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: rgba(255,255,255,0.025);
  white-space: nowrap;
  will-change: transform, opacity;
  transition: opacity .45s ease;
}
.scrollbg__rail {
  position: fixed;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  z-index: 80;
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.18em; color: var(--text-mute);
  text-transform: uppercase;
  mix-blend-mode: difference;
}
.scrollbg__rail .track {
  width: 1px; height: 220px;
  background: rgba(255,255,255,0.12);
  position: relative;
  overflow: hidden;
}
.scrollbg__rail .track i {
  position: absolute; left: 0; right: 0; top: 0;
  background: var(--accent);
  height: var(--p, 0%);
  transition: height .12s linear;
}
.scrollbg__rail .num { color: var(--text); font-weight: 500; }
.scrollbg__rail .section-name {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin-top: 4px;
  color: var(--text-dim);
  transition: color .35s ease;
}
@media (max-width: 760px) { .scrollbg__rail { display: none; } }

section { position: relative; z-index: 1; }
main, footer { position: relative; z-index: 1; }
section > .wrap { position: relative; z-index: 2; }

/* Top scroll progress bar */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
  z-index: 95;
  pointer-events: none;
  opacity: 0.85;
}

.section__bignum {
  position: absolute;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(180px, 28vw, 460px);
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: rgba(255,255,255,0.03);
  pointer-events: none;
  z-index: 0;
  left: -2vw; bottom: 6vw;
  white-space: nowrap;
  will-change: transform;
}
.section__bignum.right { left: auto; right: -2vw; bottom: auto; top: 6vw; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex; align-items: center;
  padding-top: 120px;
  padding-bottom: 80px;
  position: relative;
  overflow: hidden;
  border-top: 0;
}
.hero__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
}
@media (max-width: 980px) {
  .hero__layout { grid-template-columns: 1fr; gap: 56px; }
  .hero__portrait { margin-top: 0; align-self: auto; }
}
.hero__portrait {
  position: relative;
  opacity: 0; transform: translateY(20px);
  animation: fadeUp 1s 1.0s cubic-bezier(.2,.7,.2,1) forwards;
  align-self: center;
  margin-top: clamp(-110px, -7vw, -60px);
}
.hero__portrait .slot-wrap {
  position: relative;
  aspect-ratio: 4 / 5;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.hero__portrait .depth img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
  will-change: transform, filter;
}

@keyframes cyber-float {
  0%, 100% { transform: translate(0, -4px); }
  50%      { transform: translate(0, 4px); }
}
@keyframes cyber-glitch {
  0%, 86%, 100% {
    filter:
      contrast(1.05) brightness(0.98)
      drop-shadow(-2px 0 0 rgba(0, 196, 167, 0.65));
    clip-path: inset(0 0 0 0);
  }
  88% {
    filter:
      contrast(1.25) brightness(1.08)
      drop-shadow(-6px 0 0 rgba(0, 196, 167, 0.9));
    clip-path: inset(20% 0 30% 0);
  }
  90% {
    filter:
      contrast(0.95) brightness(0.9)
      drop-shadow(4px 0 0 rgba(0, 196, 167, 0.75));
    clip-path: inset(0 0 0 0);
  }
  92% {
    filter:
      contrast(1.2) brightness(1.02)
      drop-shadow(-3px 0 0 rgba(0, 196, 167, 0.9));
    clip-path: inset(55% 0 12% 0);
  }
  94% {
    filter:
      contrast(1.05) brightness(0.98)
      drop-shadow(-2px 0 0 rgba(0, 196, 167, 0.65));
    clip-path: inset(0 0 0 0);
  }
}
.hero__portrait .slot-wrap::after {
  content: "";
  position: absolute; inset: 0;
  background:
    /* static scanlines */
    repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0 1px, transparent 1px 3px),
    /* corner gradient + bottom fade */
    linear-gradient(135deg, rgba(0,196,167,0.20), rgba(8,8,8,0) 55%),
    linear-gradient(180deg, rgba(8,8,8,0.0) 50%, rgba(8,8,8,0.55));
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 2;
}
.hero__portrait .slot-wrap::before {
  content: "";
  position: absolute; inset: 0;
  /* sweeping scanline */
  background: linear-gradient(180deg,
    transparent 0%,
    transparent 45%,
    rgba(0,196,167,0.35) 49%,
    rgba(255,255,255,0.55) 50%,
    rgba(0,196,167,0.35) 51%,
    transparent 55%,
    transparent 100%);
  background-size: 100% 220%;
  background-repeat: no-repeat;
  animation: portrait-scan 4.5s linear infinite;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 3;
}
@keyframes portrait-scan {
  0%   { background-position: 0 -110%; opacity: 0; }
  6%   { opacity: 0.9; }
  94%  { opacity: 0.9; }
  100% { background-position: 0 110%; opacity: 0; }
}
.hero__portrait .corner {
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--accent);
  z-index: 4;
}
.hero__portrait .corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hero__portrait .corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.hero__portrait .corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.hero__portrait .corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.hero__portrait__cap {
  margin-top: 16px;
  display: flex; justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  max-width: 500px; margin-left: auto;
}
.hero__portrait__cap b { color: var(--accent); font-weight: 500; }

/* ---------- Repositioned portrait caption (vertical + chip) ---------- */
.hero__portrait .stack .cap-vert {
  position: absolute;
  right: -30px;
  top: 0;
  bottom: 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-mute);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  pointer-events: none;
  z-index: 8;
}
.hero__portrait .stack .cap-vert b { color: var(--accent); font-weight: 500; }
.hero__portrait .stack .cap-vert .dash { color: var(--accent); letter-spacing: 0; }
.hero__portrait .stack .cap-vert i.tick {
  width: 6px; height: 1px;
  background: var(--accent);
  font-style: normal;
  display: inline-block;
}
.hero__portrait .stack .cap-chip {
  position: absolute;
  left: 0;
  bottom: -26px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--line-2);
  background: rgba(8,8,8,0.6);
  backdrop-filter: blur(4px);
  z-index: 8;
  white-space: nowrap;
}
.hero__portrait .stack .cap-chip .dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s infinite;
}
.hero__portrait .stack .cap-chip b { color: var(--accent); font-weight: 500; }

@media (max-width: 720px) {
  .hero__portrait .stack .cap-vert { display: none; }
  .hero__portrait .stack .cap-chip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -22px;
  }
}
.hero__bg {
  position: absolute; inset: -10% -5% -5% -5%;
  background:
    radial-gradient(60% 50% at 80% 20%, rgba(0,196,167,0.10), transparent 60%),
    radial-gradient(40% 40% at 10% 80%, rgba(0,196,167,0.06), transparent 60%);
  z-index: 0;
  will-change: transform;
}
.hero__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  z-index: 0;
  will-change: transform;
}
.hero .wrap { position: relative; z-index: 2; width: 100%; }
.hero__meta {
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 12px;
  color: var(--text-mute); letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 48px;
  flex-wrap: wrap; gap: 12px;
}
.hero__meta .status {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-dim);
}
.hero__meta .status .pulse {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(0,196,167,0.6);
  animation: pulse 2s infinite;
}
.hero__meta .status .pulse.is-off {
  background: #c9a04a;
  animation: pulseAmber 2.6s infinite;
}
@keyframes pulseAmber {
  0%   { box-shadow: 0 0 0 0 rgba(201,160,74,0.55); }
  70%  { box-shadow: 0 0 0 12px rgba(201,160,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(201,160,74,0); }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0,196,167,0.55); }
  70% { box-shadow: 0 0 0 12px rgba(0,196,167,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,196,167,0); }
}

.hero__headline {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(40px, 7.6vw, 116px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* ---------- Word rotator ---------- */
.rotator {
  display: inline-block;
  position: relative;
  vertical-align: top;
  height: 1em;
  overflow: visible;
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
  padding-right: 0.12em;
}
.rotator__inner {
  display: inline-block;
  position: relative;
}
.rotator__word {
  display: inline-block;
  white-space: nowrap;
  /* No CSS transitions — JS effects drive the swap motion */
}
.rotator__word.is-in { opacity: 1; }
.rotator__word.is-out,
.rotator__word.is-next { opacity: 0; }
.rotator__period {
  color: var(--accent);
  font-style: italic;
  display: inline-block;
}
.rotator__caret {
  display: inline-block;
  width: 0.06em;
  height: 0.85em;
  background: var(--accent);
  margin-left: 0.08em;
  vertical-align: -0.06em;
  animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.hero__headline .line {
  display: block;
  clip-path: polygon(-50% 0, 150% 0, 150% 100%, -50% 100%);
}
.hero__headline .line > span {
  display: block;
  transform: translateY(110%);
  opacity: 0;
  animation: lineUp .9s cubic-bezier(.2,.7,.2,1) forwards;
}
.hero__headline .line:nth-child(1) span { animation-delay: .35s; }
.hero__headline .line:nth-child(2) span { animation-delay: .50s; }
.hero__headline .line:nth-child(3) span { animation-delay: .65s; }
.hero__headline .line:nth-child(4) span { animation-delay: .80s; }
@keyframes lineUp {
  to { transform: translateY(0); opacity: 1; }
}
.hero__headline .accent {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

/* ---------- Discipline meta (Data / Web / Story / Film) ---------- */
.hero__sub {
  margin-top: 44px;
  display: inline-flex;
  gap: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--text);
  text-transform: uppercase;
  opacity: 0; transform: translateY(8px);
  animation: fadeUp .9s 1.0s ease forwards;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 2px 0;
}
.hero__sub .disc {
  display: inline-flex; align-items: center;
  gap: 14px;
  padding: 14px 22px;
  position: relative;
  font-weight: 500;
  transition: color .35s ease, background .35s ease;
}
.hero__sub .disc:first-child { padding-left: 0; }
.hero__sub .disc:not(:last-child)::after {
  content: ""; position: absolute; right: 0; top: 50%;
  width: 1px; height: 18px;
  background: rgba(255,255,255,0.14);
  transform: translateY(-50%);
}
.hero__sub .disc__num {
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.22em;
  font-weight: 400;
}
.hero__sub .disc__sq {
  width: 7px; height: 7px;
  background: var(--accent);
  display: inline-block;
  transform: rotate(45deg);
  animation: discPulse 2.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(0,196,167,0.55);
}
.hero__sub .disc:nth-child(1) .disc__sq { animation-delay: 0s; }
.hero__sub .disc:nth-child(2) .disc__sq { animation-delay: .35s; }
.hero__sub .disc:nth-child(3) .disc__sq { animation-delay: .70s; }
.hero__sub .disc:nth-child(4) .disc__sq { animation-delay: 1.05s; }
@keyframes discPulse {
  0%, 100% { transform: rotate(45deg) scale(1); background: var(--accent); box-shadow: 0 0 0 0 rgba(0,196,167,0.55); }
  50%      { transform: rotate(45deg) scale(1.45); background: #00e6c2; box-shadow: 0 0 0 6px rgba(0,196,167,0); }
}
.hero__sub .disc:hover { color: var(--accent); }
.hero__sub .disc:hover .disc__num { color: var(--accent); }
@media (max-width: 720px) {
  .hero__sub { font-size: 11px; letter-spacing: 0.22em; }
  .hero__sub .disc { padding: 11px 14px; gap: 10px; }
  .hero__sub .disc:first-child { padding-left: 0; }
}

.hero__actions {
  margin-top: 56px;
  display: flex; align-items: center; gap: 28px;
  flex-wrap: wrap;
  opacity: 0; transform: translateY(8px);
  animation: fadeUp .9s 1.15s ease forwards;
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 14px;
  padding: 18px 28px 18px 30px;
  border: 1px solid var(--text);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-radius: 999px;
  overflow: hidden;
  isolation: isolate;
  transition: color .35s ease, border-color .35s ease;
}
.btn::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform .5s cubic-bezier(.7,.1,.2,1);
  z-index: -1;
}
.btn:hover { color: var(--bg); border-color: var(--accent); }
.btn:hover::before { transform: translateY(0); }
.btn svg { transition: transform .35s ease; }
.btn:hover svg { transform: translate(4px, -4px); }

.btn--ghost {
  border-color: var(--line-2);
  color: var(--text-dim);
}
.btn--ghost:hover { color: var(--text); border-color: var(--text); }
.btn--ghost::before { background: transparent; }

.hero__scroll {
  position: absolute; left: var(--pad-x); bottom: 36px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-mute);
  display: inline-flex; align-items: center; gap: 12px;
  z-index: 2;
  opacity: 0;
  animation: fadeUp .9s 1.3s ease forwards;
}
.hero__scroll .bar {
  position: relative;
  width: 1px; height: 40px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
}
.hero__scroll .bar::after {
  content: "";
  position: absolute; left: 0; right: 0; top: -40px; height: 40px;
  background: var(--accent);
  animation: scrollBar 2.4s ease-in-out infinite;
}
@keyframes scrollBar {
  0% { top: -40px; } 100% { top: 100%; }
}
.hero__index {
  position: absolute; right: var(--pad-x); bottom: 36px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; color: var(--text-mute);
  text-transform: uppercase;
  z-index: 2;
  opacity: 0;
  animation: fadeUp .9s 1.3s ease forwards;
}
.hero__index b { color: var(--text); font-weight: 500; }

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0; transform: translateY(40px);
  transition: opacity 1s cubic-bezier(.2,.7,.2,1), transform 1s cubic-bezier(.2,.7,.2,1);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }
.reveal[data-delay="5"] { transition-delay: .40s; }

/* ---------- Services ---------- */
.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.service {
  background: var(--bg);
  padding: 44px 36px 36px;
  position: relative;
  min-height: 360px;
  display: flex; flex-direction: column;
  transition: background .45s ease;
}
.service:hover { background: var(--surface); }
.service__num .service__count {
  color: var(--accent);
  font-weight: 500;
}
.service__num {
  font-family: var(--mono); font-size: 12px;
  color: var(--text-mute); letter-spacing: 0.16em;
  margin-bottom: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.service__num .arrow {
  width: 28px; height: 28px;
  border-radius: 999px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  color: var(--text-mute);
  transition: transform .35s ease, color .35s ease, border-color .35s ease, background .35s ease;
}
.service:hover .arrow {
  transform: rotate(-45deg);
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.service__icon {
  width: 36px; height: 36px; margin-bottom: 24px;
  color: var(--accent);
}
.service h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.service p {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.6;
  max-width: 36ch;
}
.service__tags {
  margin-top: auto;
  padding-top: 24px;
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-mute); letter-spacing: 0.08em;
}
.service__top {
  position: absolute; top: 0; left: 0;
  height: 2px; width: 0;
  background: var(--accent);
  transition: width .5s cubic-bezier(.7,.1,.2,1);
}
.service:hover .service__top { width: 100%; }

/* ---------- Projects ---------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 28px;
}
.project {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 36px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), border-color .35s ease, background .45s ease;
  min-height: 380px;
}
.project:hover {
  transform: translateY(-6px);
  border-color: rgba(0,196,167,0.4);
  background: var(--surface-2);
}
.project::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .6s cubic-bezier(.2,.7,.2,1);
}
.project:hover::before { transform: scaleX(1); }

.project--wide { grid-column: span 8; }
.project--half { grid-column: span 4; }
.project--med { grid-column: span 6; }
@media (max-width: 980px) {
  .project--wide, .project--half, .project--med { grid-column: span 12; }
}

.project__head {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-mute); letter-spacing: 0.16em;
  margin-bottom: 64px;
}
.project__head .cat { color: var(--accent); }

.project__visual {
  height: 220px;
  margin: 0 -36px 32px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 14px),
    radial-gradient(70% 80% at 50% 50%, rgba(0,196,167,0.08), transparent 60%);
  position: relative;
  overflow: hidden;
}
.project__visual.var-1 {
  background:
    radial-gradient(circle at 30% 40%, rgba(0,196,167,0.12), transparent 60%),
    linear-gradient(180deg, #0f0f0f, #181818);
}
.project__visual.var-2 {
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 32px),
    linear-gradient(180deg, #101010, #161616);
}
.project__visual.var-3 {
  background:
    conic-gradient(from 220deg at 70% 60%, rgba(0,196,167,0.18), rgba(0,0,0,0) 50%),
    #0f0f0f;
}
.project__visual.var-4 {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 18px),
    linear-gradient(180deg, #131313, #0d0d0d);
}
.project__visual::after {
  content: attr(data-label);
  position: absolute; left: 16px; bottom: 14px;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.18em; color: var(--text-mute);
  text-transform: uppercase;
}

/* Tiny illustrative diagrams inside each visual */
.viz {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: rgba(242,239,232,0.75);
}
.viz .bars {
  display: flex; align-items: end; gap: 14px; height: 60%;
}
.viz .bars i {
  width: 18px; background: rgba(242,239,232,0.18);
  border-top: 2px solid var(--accent);
  display: block;
}
.viz .lines {
  width: 70%; height: 70%;
  background:
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(0,196,167,0.6) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.5) 0 1.5px, transparent 2px),
    radial-gradient(circle at 50% 70%, rgba(255,255,255,0.5) 0 1.5px, transparent 2px),
    radial-gradient(circle at 80% 40%, rgba(0,196,167,0.9) 0 2px, transparent 3px);
  background-repeat: no-repeat;
}
.viz .browser {
  width: 78%; height: 70%;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #0a0a0a;
  display: grid;
  grid-template-rows: 24px 1fr;
}
.viz .browser .top {
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 6px; padding: 0 10px;
}
.viz .browser .top i {
  width: 7px; height: 7px; border-radius: 999px;
  background: rgba(255,255,255,0.15);
}
.viz .browser .body {
  padding: 16px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.viz .browser .body span {
  background: rgba(255,255,255,0.06);
  height: 100%;
  border-radius: 2px;
}
.viz .browser .body span.acc { background: rgba(0,196,167,0.35); }

.viz .frames {
  display: flex; gap: 10px;
}
.viz .frames i {
  width: 60px; height: 36px;
  border: 1px solid var(--line-2);
  position: relative;
}
.viz .frames i::after {
  content: ""; position: absolute; inset: 6px;
  background: linear-gradient(135deg, rgba(0,196,167,0.4), transparent 60%);
}

.project h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(24px, 2.5vw, 36px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 14px;
  max-width: 22ch;
}
.project p {
  color: var(--text-dim);
  font-size: 15px;
  max-width: 50ch;
  margin-bottom: 24px;
}
.project__foot {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-mute); letter-spacing: 0.12em;
  text-transform: uppercase;
}
.project__tags {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.project__tags span {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 10px;
  letter-spacing: 0.14em;
}
.project__view {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text);
  transition: color .25s ease;
}
.project:hover .project__view { color: var(--accent); }

/* ---------- Stats ---------- */
.stats {
  margin-top: 96px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat {
  padding: 40px 28px;
  border-left: 1px solid var(--line);
  position: relative;
}
.stat:first-child { border-left: 0; }
.stat__num {
  font-family: var(--mono);
  font-size: clamp(40px, 5vw, 72px);
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat__num .plus { font-size: 0.6em; color: var(--text-dim); }
.stat__label {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
}
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(4) { border-top: 1px solid var(--line); }
}

/* ---------- Skills ---------- */
.skills {
  display: grid; grid-template-columns: 1fr 1px 1fr;
  gap: 64px;
}
.skills__divider { background: var(--line); }
.skills h3 {
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 32px;
}
.skills h3 span { color: var(--accent); margin-right: 12px; }
.skill-list {
  list-style: none;
  display: flex; flex-direction: column;
}
.skill-list li {
  display: flex; align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: -0.01em;
  position: relative;
  transition: color .35s ease, padding-left .35s ease;
  cursor: none;
}
.skill-list li::before {
  content: "";
  width: 0; height: 1px; background: var(--accent);
  margin-right: 0;
  transition: width .4s cubic-bezier(.7,.1,.2,1), margin-right .4s ease;
}
.skill-list li:hover { color: var(--accent); }
.skill-list li:hover::before { width: 28px; margin-right: 16px; }
.skill-list li span {
  margin-left: auto;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-mute);
  text-transform: uppercase;
}
@media (max-width: 820px) {
  .skills { grid-template-columns: 1fr; gap: 48px; }
  .skills__divider { display: none; }
}

.marquee {
  margin-top: 80px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
  position: relative;
}
.marquee__track {
  display: flex; gap: 48px;
  width: max-content;
  animation: scroll-x 38s linear infinite;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.marquee__track .acc { color: var(--accent); }
@keyframes scroll-x {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.marquee + .marquee .marquee__track {
  animation-direction: reverse;
  animation-duration: 44s;
}

.skills__quote {
  margin-top: 56px;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(20px, 2.2vw, 32px);
  color: var(--text-dim);
  max-width: 30ch;
  letter-spacing: -0.01em;
}
.skills__quote em { color: var(--accent); font-style: italic; }

/* ---------- Experience ---------- */
.exp {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 80px;
}
@media (max-width: 820px) {
  .exp { grid-template-columns: 1fr; gap: 32px; }
}
.exp__sticky {
  position: sticky; top: 100px; height: max-content;
  font-family: var(--mono); font-size: 12px;
  color: var(--text-mute); letter-spacing: 0.16em;
  text-transform: uppercase;
}
.exp__sticky .badge {
  display: inline-block;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 16px;
  color: var(--text-dim);
}
.role {
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: 140px 1fr;
  gap: 32px;
  position: relative;
  transition: padding-left .4s ease;
}
.role:first-child { padding-top: 0; }
.role:hover { padding-left: 16px; }
.role__date {
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.14em; color: var(--accent);
  padding-top: 12px;
}
.role h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(24px, 2.6vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}
.role h4 {
  font-family: var(--sans); font-weight: 400;
  font-size: 14px; color: var(--text-dim);
  margin-bottom: 18px;
}
.role ul {
  list-style: none;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 15px; color: var(--text-dim);
  max-width: 60ch;
}
.role ul li {
  padding-left: 22px; position: relative;
}
.role ul li::before {
  content: ""; position: absolute; left: 0; top: 11px;
  width: 10px; height: 1px; background: var(--accent);
}
@media (max-width: 640px) {
  .role { grid-template-columns: 1fr; gap: 12px; }
}

/* ---------- Contact ---------- */
.contact {
  position: relative; overflow: hidden;
}
.contact__bg {
  position: absolute; inset: 0;
  background: radial-gradient(50% 60% at 50% 60%, rgba(0,196,167,0.08), transparent 70%);
  pointer-events: none;
}

/* ---------- Orbital compass (smooth ambient motion) ---------- */
.orbital {
  position: absolute;
  top: 50%;
  right: clamp(-80px, -2vw, 60px);
  transform: translateY(-50%);
  width: clamp(280px, 32vw, 460px);
  aspect-ratio: 1;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
  mix-blend-mode: screen;
}
.orbital svg { width: 100%; height: 100%; display: block; overflow: visible; }
.orbital .ring   { fill: none; stroke: rgba(0,196,167,0.28); stroke-width: 1; }
.orbital .ring--dashed { stroke-dasharray: 3 6; stroke: rgba(242,239,232,0.18); }
.orbital .ring--accent { stroke: rgba(0,196,167,0.55); stroke-dasharray: 1 9; }
.orbital .tick   { stroke: rgba(242,239,232,0.4); stroke-width: 1; }
.orbital .arc    { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(0,196,167,0.55)); }
.orbital .dot    { fill: var(--accent); filter: drop-shadow(0 0 8px rgba(0,196,167,0.7)); }
.orbital .crosshair { stroke: rgba(0,196,167,0.45); stroke-width: 1; }
.orbital .label  {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.32em;
  fill: rgba(242,239,232,0.55);
  text-transform: uppercase;
}
.orbital .label.acc { fill: var(--accent); }

.orbital .spin-slow   { transform-origin: 50% 50%; animation: orbSpin 60s linear infinite; }
.orbital .spin-med    { transform-origin: 50% 50%; animation: orbSpin 38s linear infinite reverse; }
.orbital .spin-fast   { transform-origin: 50% 50%; animation: orbSpin 22s linear infinite; }
.orbital .sweep       { transform-origin: 50% 50%; animation: orbSpin 14s cubic-bezier(.6,.05,.4,.95) infinite; }
.orbital .orbiter     { transform-origin: 50% 50%; animation: orbSpin 18s linear infinite; }
.orbital .orbiter-2   { transform-origin: 50% 50%; animation: orbSpin 28s linear infinite reverse; }
.orbital .pulse-core  { transform-origin: 50% 50%; animation: orbPulse 3.4s ease-in-out infinite; }
.orbital .tick-fade   { animation: orbTickFade 7s ease-in-out infinite; transform-origin: 50% 50%; }

@keyframes orbSpin    { to { transform: rotate(360deg); } }
@keyframes orbPulse   {
  0%, 100% { transform: scale(1);   opacity: 0.9; }
  50%      { transform: scale(1.6); opacity: 0.35; }
}
@keyframes orbTickFade {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .orbital .spin-slow, .orbital .spin-med, .orbital .spin-fast,
  .orbital .sweep, .orbital .orbiter, .orbital .orbiter-2,
  .orbital .pulse-core, .orbital .tick-fade { animation: none; }
}

@media (max-width: 820px) {
  .orbital {
    position: relative;
    top: auto; right: auto;
    transform: none;
    width: min(70vw, 360px);
    margin: 48px auto 8px;
    opacity: 0.6;
  }
}
.contact .wrap { position: relative; z-index: 1; }
.contact h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(56px, 11vw, 200px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  text-wrap: balance;
  margin-bottom: 28px;
}
.contact h2 em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}
.contact__sub {
  color: var(--text-dim);
  font-size: clamp(16px, 1.4vw, 20px);
  max-width: 46ch;
  margin-bottom: 64px;
}
.email {
  display: inline-block;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(28px, 5vw, 72px);
  letter-spacing: -0.025em;
  position: relative;
  padding-bottom: 8px;
  line-height: 1.05;
}
.email::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--line-2);
}
.email::before {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px; background: var(--accent);
  transition: right .55s cubic-bezier(.7,.1,.2,1);
}
.email:hover { color: var(--accent); }
.email:hover::before { right: 0; }

.contact__meta {
  margin-top: 64px;
  display: flex; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.14em; color: var(--text-mute);
  text-transform: uppercase;
}
.contact__meta a {
  color: var(--text-dim);
  transition: color .25s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.contact__meta a:hover { color: var(--accent); }
.contact__links { display: flex; gap: 28px; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.footer {
  padding: 36px var(--pad-x);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-mute); letter-spacing: 0.16em;
  text-transform: uppercase;
  flex-wrap: wrap; gap: 12px;
}
.footer a:hover { color: var(--accent); }

/* ---------- New: per-section rail segments ---------- */
.scrollbg__rail .segments {
  display: flex; flex-direction: column;
  gap: 3px;
  height: 220px;
  width: 2px;
}
.scrollbg__rail .seg {
  flex: 1;
  width: 100%;
  background: rgba(255,255,255,0.12);
  position: relative;
  overflow: hidden;
  transition: background .35s ease;
}
.scrollbg__rail .seg::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--p, 0%);
  background: var(--accent);
  transition: height .12s linear;
}
.scrollbg__rail .seg.is-active { background: rgba(0,196,167,0.22); }

/* ---------- New: active nav link ---------- */
.nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after { right: 0; }

/* ---------- New: copy toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 36px;
  transform: translate(-50%, 24px);
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 14px 20px;
  display: inline-flex; align-items: center; gap: 14px;
  border-radius: 999px;
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: transform .45s cubic-bezier(.2,.7,.2,1), opacity .35s ease;
  box-shadow: 0 10px 40px rgba(0, 196, 167, 0.18);
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast .dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* ---------- New: portrait magnetic tilt ---------- */
.hero__portrait .slot-wrap {
  transform: perspective(900px) rotateX(0deg) rotateY(0deg);
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
  transform-style: preserve-3d;
}
.hero__portrait .slot-wrap.is-tilt {
  transition: transform .08s linear;
}


.hero__portrait { perspective: 1400px; --px: 0; --py: 0; --mx: 50%; --my: 50%; }
.hero__portrait .stack {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin-left: auto;
  aspect-ratio: 4 / 5;
}

.hero__portrait .stack::before,
.hero__portrait .stack > .net {
  content: "";
  position: absolute;

  inset: -26% -22% -22% -28%;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(0,196,167,0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,196,167,0.10) 1px, transparent 1px),
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  /* Base grid is very dim. The cursor-driven ".net" sibling above adds the glow. */
  opacity: 0.55;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(0,0,0,0.55) 35%, rgba(0,0,0,0.25) 70%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(0,0,0,0.55) 35%, rgba(0,0,0,0.25) 70%, transparent 100%);
  /* Drift gently with the cursor for parallax cohesion */
  transform: translate3d(calc(var(--px) * -10px), calc(var(--py) * -8px), 0);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
}
.hero__portrait .stack.is-tilt::before { transition: transform .08s linear; }

.hero__portrait .stack > .net {
  z-index: 1;
  opacity: 1;
  background-image:
    linear-gradient(to right, rgba(0,196,167,0.55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,196,167,0.55) 1px, transparent 1px),
    linear-gradient(to right, rgba(255,255,255,0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  mask-image: radial-gradient(circle 220px at var(--mx) var(--my),
                              rgba(0,0,0,1) 0%,
                              rgba(0,0,0,0.6) 35%,
                              rgba(0,0,0,0) 80%);
  -webkit-mask-image: radial-gradient(circle 220px at var(--mx) var(--my),
                              rgba(0,0,0,1) 0%,
                              rgba(0,0,0,0.6) 35%,
                              rgba(0,0,0,0) 80%);
  filter: drop-shadow(0 0 6px rgba(0,196,167,0.35));
  transition: mask-position .08s linear, -webkit-mask-position .08s linear, opacity .35s ease;
}
.hero__portrait .stack:not(.is-hot) > .net { opacity: 0; }

/* Soft accent ring orbiting behind the upper-left of the frame */
.hero__portrait .stack::after {
  content: "";
  position: absolute;
  width: 58%;
  aspect-ratio: 1;
  top: -14%;
  left: -18%;
  border: 1px solid rgba(0,196,167,0.18);
  border-radius: 999px;
  z-index: 0;
  pointer-events: none;
  transform: translate3d(calc(var(--px) * -14px), calc(var(--py) * -10px), 0);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.hero__portrait .stack.is-tilt::after { transition: transform .08s linear; }
.hero__portrait .stack .slot-wrap {
  position: absolute;
  inset: 0;
  max-width: none;
  margin: 0;
  z-index: 5;
}

.hero__portrait .depth {
  position: absolute;
  inset: -6%;
  pointer-events: none;
  will-change: transform;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  z-index: 1;
}
.hero__portrait .stack.is-tilt .depth { transition: transform .08s linear; }

.hero__portrait .depth img:not([src]),
.hero__portrait .depth img[src=""] { opacity: 0; }

/* — back plate: city / room / sky (largest parallax, slight blur) */
.hero__portrait .depth--bg {
  inset: -10%;
  z-index: 1;
  transform: translate3d(calc(var(--px) * -22px), calc(var(--py) * -16px), 0) scale(1.04);
  filter: blur(0.4px) brightness(0.92) contrast(1.05);
}
/* — subject layer: the person, cutout PNG with transparent background */
.hero__portrait .depth--mid {
  inset: -4%;
  z-index: 3;
  transform: translate3d(calc(var(--px) * 6px), calc(var(--py) * 4px), 0) scale(1.02);
}
.hero__portrait .depth--mid img {
  filter: contrast(1.05) brightness(1.02)
          drop-shadow(-2px 0 0 rgba(0, 196, 167, 0.55));
  animation: cyber-glitch 7s steps(1) infinite;
  will-change: filter;
  /* Subject is a cutout PNG — show full figure, don't crop */
  object-fit: contain;
}
/* — foreground prop: camera, hand, frame element (most travel, with cursor) */
.hero__portrait .depth--fg {
  inset: -8%;
  z-index: 4;
  transform: translate3d(calc(var(--px) * 26px), calc(var(--py) * 18px), 0) scale(1.05);
}
.hero__portrait .depth--fg img {
  filter: contrast(1.1) brightness(1.05);
  /* Foreground prop is also a cutout PNG */
  object-fit: contain;
}

/* — front HUD: floating metadata + crosshair (subtle parallax, top of stack) */
.hero__portrait .layer {
  position: absolute;
  pointer-events: none;
  will-change: transform;
  transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
.hero__portrait .stack.is-tilt .layer { transition: transform .08s linear; }
.hero__portrait .layer--hud {
  inset: 0;
  /* Lift above EVERYTHING in the stack — frame, parallax layers, grid, scanlines. */
  z-index: 20;
}
.hero__portrait .layer--hud .hud__badge {
  position: absolute;
  /* Sit INSIDE the frame, top-right, like the reference image. */
  top: 14px; right: 14px;
  background: var(--accent);
  color: #07120f;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 6px 10px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(0,196,167,0.45),
    0 6px 22px rgba(0,196,167,0.35);
  z-index: 2;
  /* Float above the photo with the cursor, like the foreground prop. */
  transform: translate3d(calc(var(--px) * 14px), calc(var(--py) * 10px), 0);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  will-change: transform, filter;
  animation: hudBadgeGlow 2.6s ease-in-out infinite;
}
@keyframes hudBadgeGlow {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(0,196,167,0.45),
      0 0 14px rgba(0,196,167,0.35),
      0 0 28px rgba(0,196,167,0.15);
    filter: brightness(1);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(0,196,167,0.7),
      0 0 24px rgba(0,196,167,0.65),
      0 0 56px rgba(0,196,167,0.4);
    filter: brightness(1.08);
  }
}
.hero__portrait .stack.is-tilt .layer--hud .hud__badge { transition: transform .08s linear; }
.hero__portrait .layer--hud .hud__meta {
  position: absolute;
  /* Sit OUTSIDE the frame, bottom-left, like the reference. */
  bottom: -22px; left: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(0,196,167,0.3);
  white-space: nowrap;
  z-index: 2;
  /* Parallax drift so it floats with the rest of the HUD. */
  transform: translate3d(calc(var(--px) * 10px), calc(var(--py) * 8px), 0);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
}
.hero__portrait .stack.is-tilt .layer--hud .hud__meta { transition: transform .08s linear; }
.hero__portrait .layer--hud .hud__cross {
  position: absolute;
  /* Crosshair tucked inside frame at bottom-left, matching reference. */
  bottom: 14px; left: 14px;
  width: 22px; height: 22px;
  z-index: 2;
  /* Same parallax as the meta caption below so the '+' floats with it. */
  transform: translate3d(calc(var(--px) * 10px), calc(var(--py) * 8px), 0);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
}
.hero__portrait .stack.is-tilt .layer--hud .hud__cross { transition: transform .08s linear; }
.hero__portrait .layer--hud .hud__cross::before,
.hero__portrait .layer--hud .hud__cross::after {
  content: ""; position: absolute; background: var(--accent);
  box-shadow: 0 0 8px rgba(0,196,167,0.6);
}
.hero__portrait .layer--hud .hud__cross::before {
  left: 50%; top: 0; bottom: 0; width: 1px; transform: translateX(-50%);
}
.hero__portrait .layer--hud .hud__cross::after {
  top: 50%; left: 0; right: 0; height: 1px; transform: translateY(-50%);
}

@media (max-width: 720px) {
  .hero__portrait .layer--hud { display: none; }
  .hero__portrait .stack { max-width: min(58vw, 320px); margin: 0 auto; }
  .hero__portrait .depth { transform: none !important; }
}
@media (pointer: coarse) {
  .hero__portrait .layer--hud { display: none; }
  .hero__portrait .depth { transform: none !important; }
}

/* ---------- New: project case study overlay ---------- */
.cs {
  position: fixed; inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.cs.is-open { pointer-events: auto; opacity: 1; }
.cs__backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 8, 8, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cs__panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(960px, 92vw);
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform .55s cubic-bezier(.7,.1,.2,1);
}
.cs.is-open .cs__panel { transform: translateX(0); }
.cs__panel::-webkit-scrollbar { width: 4px; }
.cs__panel::-webkit-scrollbar-thumb { background: rgba(0,196,167,0.4); }
.cs__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--bg-2);
  z-index: 2;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.cs__progress {
  position: absolute;
  left: 0; right: 0;
  bottom: -1px;  /* sit on top of the border-bottom line */
  height: 2px;
  background: rgba(255,255,255,0.06);
  z-index: 3;
  overflow: hidden;
}
.cs__progress i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width .08s linear;
  box-shadow: 0 0 8px rgba(0,196,167,0.6);
}
.cs__nav {
  display: flex; align-items: center; gap: 8px;
}
.cs__nav button:not(.cs__close) {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  color: var(--text-dim);
  font-size: 13px;
  transition: color .25s ease, border-color .25s ease, background .25s ease;
  cursor: none;
}
.cs__nav button:not(.cs__close):hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.cs__nav button:not(.cs__close):disabled { opacity: 0.35; cursor: not-allowed; }
.cs__nav .cs__close { margin-left: 6px; }
.cs__head .cs__pid { color: var(--accent); }
.cs__close {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text-dim);
  transition: color .25s ease, border-color .25s ease, background .25s ease;
}
.cs__close:hover { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.cs__body { padding: 56px 36px 80px; }
.cs__cat {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em;
  color: var(--accent); text-transform: uppercase;
  margin-bottom: 18px;
}
.cs__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.0;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
  text-wrap: balance;
}
.cs__lede {
  font-size: clamp(16px, 1.4vw, 19px);
  color: var(--text-dim);
  max-width: 60ch;
  margin-bottom: 48px;
  line-height: 1.55;
}
.cs__visual {
  height: 320px;
  margin: 0 -36px 56px;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.02) 0 1px, transparent 1px 14px),
    radial-gradient(70% 80% at 50% 50%, rgba(0,196,167,0.10), transparent 60%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.cs__visual.var-1 { background: radial-gradient(circle at 30% 40%, rgba(0,196,167,0.14), transparent 60%), linear-gradient(180deg, #0f0f0f, #181818); }
.cs__visual.var-2 { background: repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 32px), linear-gradient(180deg, #101010, #161616); }
.cs__visual.var-3 { background: conic-gradient(from 220deg at 70% 60%, rgba(0,196,167,0.20), rgba(0,0,0,0) 50%), #0f0f0f; }
.cs__visual.var-4 { background: repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 2px, transparent 2px 18px), linear-gradient(180deg, #131313, #0d0d0d); }
.cs__visual span.label {
  position: absolute; left: 24px; bottom: 18px;
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.18em; color: var(--text-mute);
  text-transform: uppercase;
}
.cs__grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px 48px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}
.cs__grid h4 {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-mute);
  font-weight: 400;
}
.cs__grid div p { color: var(--text-dim); font-size: 15px; line-height: 1.65; max-width: 60ch; }
.cs__grid div p + p { margin-top: 12px; }
.cs__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cs__tags span {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}
.cs__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 48px;
}
.cs__metric { background: var(--bg-2); padding: 24px 20px; }
.cs__metric b {
  display: block;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 28px;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.cs__metric span {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
@media (max-width: 640px) {
  .cs__grid { grid-template-columns: 1fr; gap: 8px 0; }
  .cs__body { padding: 36px 24px 60px; }
  .cs__visual { margin: 0 -24px 40px; }
}

.project { cursor: none; }
.project[data-pid] { user-select: none; }
.service[data-sid] { cursor: none; user-select: none; }

/* ---------- New: terminal easter egg ---------- */
.term {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translate(-50%, calc(100% + 32px));
  width: min(720px, 92vw);
  height: 320px;
  background: rgba(8, 10, 12, 0.96);
  border: 1px solid var(--accent);
  border-radius: 6px;
  box-shadow: 0 20px 80px rgba(0,196,167,0.18);
  z-index: 220;
  display: flex; flex-direction: column;
  transition: transform .45s cubic-bezier(.7,.1,.2,1);
  font-family: var(--mono);
  overflow: hidden;
}
.term.is-on { transform: translate(-50%, 0); }
.term__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.term__head .dots { display: flex; gap: 6px; }
.term__head .dots i {
  width: 9px; height: 9px; border-radius: 999px;
  background: rgba(255,255,255,0.15);
}
.term__head .dots i:first-child { background: var(--accent); }
.term__head .hint { color: var(--text-mute); }
.term__body {
  flex: 1;
  padding: 14px 18px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}
.term__body .out { color: var(--text-dim); white-space: pre-wrap; }
.term__body .out .acc { color: var(--accent); }
.term__body .out .you { color: var(--text); }
.term__line {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px 14px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
}
.term__line .prompt { color: var(--accent); }
.term__line input {
  flex: 1;
  background: transparent;
  border: 0; outline: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  caret-color: var(--accent);
}

/* ---------- New: tweaks panel ---------- */
.tw {
  position: fixed;
  right: 28px; bottom: 28px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  z-index: 210;
  padding: 18px 18px 20px;
  font-family: var(--mono);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .35s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.tw.is-on { opacity: 1; transform: translateY(0); pointer-events: auto; }
.tw__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-mute);
}
.tw__head b { color: var(--accent); font-weight: 500; }
.tw__close {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--text-dim);
  font-size: 12px;
  transition: color .25s ease, border-color .25s ease;
}
.tw__close:hover { color: var(--accent); border-color: var(--accent); }
.tw__row { margin-bottom: 14px; }
.tw__row:last-child { margin-bottom: 0; }
.tw__row > label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.tw__seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: rgba(255,255,255,0.04);
  padding: 3px;
  border-radius: 4px;
}
.tw__seg button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 7px 0;
  color: var(--text-dim);
  background: transparent;
  border-radius: 3px;
  text-transform: capitalize;
  transition: background .2s ease, color .2s ease;
}
.tw__seg button.is-on { background: var(--accent); color: var(--bg); }
.tw__seg button:hover:not(.is-on) { color: var(--text); }
.tw__swatches {
  display: flex; gap: 8px;
}
.tw__swatches button {
  flex: 1;
  height: 32px;
  border-radius: 4px;
  border: 2px solid transparent;
  position: relative;
  transition: border-color .2s ease, transform .2s ease;
}
.tw__swatches button.is-on { border-color: var(--text); transform: scale(1.04); }

/* Motion intensity classes — multiplied via CSS animation-duration scaling */
html.motion-calm .marquee__track { animation-duration: 60s; }
html.motion-calm .pulse { animation-duration: 3.6s; }
html.motion-calm .scrollbg__word { transition-duration: .7s; }
html.motion-max .marquee__track { animation-duration: 18s; }
html.motion-max .pulse { animation-duration: 1.1s; }
html.motion-max .hero__bg, html.motion-max .hero__grid { animation: hero-jitter 8s infinite; }
@keyframes hero-jitter {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(-12deg) saturate(1.2); }
}

::selection { background: var(--accent); color: var(--bg); }

/* ---------- Wiggle-on-hover (hero "look", contact "work") ---------- */
.wiggle {
  display: inline-block;
  position: relative;
}
.wiggle .ch {
  display: inline-block;
  transform-origin: 50% 80%;
  will-change: transform;
}
.wiggle:hover .ch,
.wiggle.is-hot .ch {
  animation: chWiggle 0.7s cubic-bezier(.4,.1,.3,1) both;
  animation-delay: calc(var(--i, 0) * var(--stagger, 0.05s));
}
@keyframes chWiggle {
  0%   { transform: translateY(0) rotate(0deg); }
  20%  { transform: translateY(-0.18em) rotate(-7deg); }
  40%  { transform: translateY(0.05em)  rotate(6deg); }
  60%  { transform: translateY(-0.10em) rotate(-3deg); }
  80%  { transform: translateY(0.02em)  rotate(2deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.email.reveal { will-change: transform; transform-origin: left center; }
.email.reveal.in {
  animation: emailNod 2s cubic-bezier(.5, 0, .2, 1) 1.1s 1 none;
}
.email.reveal.in::before {
  animation: emailSweep 1.6s cubic-bezier(.7, .1, .2, 1) 1.45s 1 none;
}
@keyframes emailNod {
  0%   { transform: translateY(0) rotate(0); }
  18%  { transform: translateY(-8px) rotate(-1.2deg); }
  34%  { transform: translateY(2px) rotate(0.5deg); }
  50%  { transform: translateY(-4px) rotate(-0.4deg); }
  66%  { transform: translateY(1px) rotate(0.2deg); }
  82%  { transform: translateY(-1px) rotate(0); }
  100% { transform: translateY(0) rotate(0); }
}
@keyframes emailSweep {
  0%        { right: 100%; }
  40%, 55%  { right: 0%; }
  100%      { right: 100%; }
}

.email.reveal.in {
  position: relative;
}
@media (prefers-reduced-motion: reduce) {
  .email.reveal.in,
  .email.reveal.in::before { animation: none; }
}

.nav__burger {
  z-index: 95;
  position: relative;
}

@media (max-width: 720px) {
  .nav__burger span:nth-child(1) { top: 18px; }
  .nav__burger span:nth-child(2) { top: 24px; }
  .nav.is-open .nav__burger span:nth-child(1) { top: 21px; }
  .nav.is-open .nav__burger span:nth-child(2) { top: 21px; }
}

@media (max-width: 720px) {
  .nav__links {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    /* Use dynamic viewport height where supported for iOS Safari */
    min-height: 100vh;
    flex-direction: column;
    justify-content: center;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 88px 28px 48px !important;
    background: var(--bg-2);
    background-image:
      radial-gradient(circle at 100% 0%, rgba(0,196,167,0.08), transparent 55%),
      linear-gradient(180deg, transparent 0%, rgba(0,196,167,0.03) 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 89;
  }
  .nav__links a {
    display: block !important;
    width: 100%;
    font-family: var(--display);
    font-weight: 500;
    font-size: clamp(30px, 8.5vw, 48px) !important;
    letter-spacing: -0.02em !important;
    color: var(--text) !important;
    padding: 18px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: color .25s ease, padding-left .35s ease, border-color .35s ease;
  }
  .nav__links a:active,
  .nav__links a:hover {
    color: var(--accent) !important;
    padding-left: 10px !important;
    border-bottom-color: rgba(0, 196, 167, 0.4);
  }
  /* The count is the first child — make it a small header on top of the list */
  .nav__links .nav__count {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.22em;
    color: var(--accent);
    text-transform: uppercase;
    padding: 0 0 20px !important;
    margin: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    width: 100%;
  }
  /* CTA button — styled distinctly at the bottom */
  .nav__links .nav__cta {
    border-bottom: 1px solid rgba(0, 196, 167, 0.4) !important;
    color: var(--accent) !important;
    border-radius: 0;
    background: transparent;
  }
}
@media (max-width: 720px) and (max-height: 640px) {
  /* Short screens: shrink type so all 5 items + count fit without scroll */
  .nav__links a { font-size: clamp(24px, 7vw, 36px) !important; padding: 14px 0 !important; }
  .nav__links { padding: 78px 28px 36px !important; }
}

@media (max-width: 720px) {
  .hero__sub {
    font-size: 10px;
    letter-spacing: 0.16em;
    gap: 0;
    width: 100%;
    justify-content: space-between;
  }
  .hero__sub .disc {
    padding: 10px 8px;
    gap: 6px;
    flex: 1 1 auto;
    justify-content: center;
  }
  .hero__sub .disc__num { font-size: 9px; letter-spacing: 0.14em; }
  .hero__sub .disc__sq { width: 5px; height: 5px; }
  .hero__sub .disc:first-child { padding-left: 8px; }
  .hero__sub .disc:not(:last-child)::after { height: 12px; }
}
@media (max-width: 380px) {
  .hero__sub { font-size: 9px; letter-spacing: 0.1em; }
  .hero__sub .disc { padding: 9px 4px; gap: 5px; }
  .hero__sub .disc__num { display: none; } /* drop numbers on tiny screens */
}


@media (max-width: 720px) {
  .orbital { display: none; }
}
/* Keep it on tablet but smaller and overlapping the heading region */
@media (min-width: 721px) and (max-width: 980px) {
  .orbital {
    position: absolute;
    top: 0; right: -8vw;
    transform: none;
    width: min(46vw, 320px);
    margin: 0;
    opacity: 0.5;
  }
}

/* ---------- FIX 4: Footer centered on mobile ---------- */
@media (max-width: 720px) {
  .footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
    gap: 10px;
  }
}

@media (max-width: 720px) {
  .cs__head { padding: 14px 20px; }
  .cs__body { padding: 36px 20px 60px; }
  .cs__visual { margin: 0 -20px 32px; }
  .cs__title { font-size: clamp(28px, 7vw, 40px); }
  .cs__nav button:not(.cs__close) { width: 36px; height: 36px; }
  .cs__close { padding: 8px 12px; font-size: 11px; }
}
@media (max-width: 480px) {
  .cs__head { padding: 12px 16px; }
  .cs__panel { width: 100vw; border-left: none; }
}

@supports (height: 100svh) {
  .hero { min-height: 100svh; }
}

/* ---------- Prevent iOS auto-zoom on form inputs (font-size < 16px) ---------- */
@media (max-width: 720px) {
  input, textarea, select, button { font-size: max(16px, 1em); }
}

/* ---------- Tablet (≤980px) ---------- */
@media (max-width: 980px) {
  /* Hero portrait shouldn't lift into headline once stacked single-column */
  .hero__portrait { margin-top: 0; }
  /* Tighten the giant background number that can cause horizontal overflow */
  .section__bignum { font-size: clamp(140px, 32vw, 320px); }
  /* Section title spacing */
  .section-head { margin-bottom: 44px; }
  .section-head h2 { font-size: clamp(36px, 7vw, 64px); }
  /* Hero baseline padding */
  .hero { padding-top: 96px; padding-bottom: 64px; }
}

/* ---------- Phone (≤720px) ---------- */
@media (max-width: 720px) {
  /* Section rhythm — pull in the giant gaps on phones */
  :root { --section-y: clamp(64px, 14vw, 96px); }

  /* Eyebrow + section head */
  .eyebrow { margin-bottom: 20px; font-size: 11px; }
  .section-head { margin-bottom: 32px; gap: 16px; }
  .section-head h2 { font-size: clamp(34px, 9vw, 52px); max-width: 100%; }
  .section-head p { font-size: 14px; }

  /* Hero typography + spacing */
  .hero__headline { font-size: clamp(38px, 11vw, 64px); line-height: 0.98; }
  .hero__meta { margin-bottom: 28px; font-size: 11px; }
  .hero__sub { margin-top: 28px; }
  .hero__actions { margin-top: 32px; gap: 14px; width: 100%; }
  .hero__actions .btn { width: 100%; justify-content: center; }
  /* Don't let scroll indicator overlap content on short phones */
  .hero__scroll { display: none; }
  .hero__index { right: 20px; bottom: 16px; font-size: 10px; }

  /* Button comfort + tap target */
  .btn { padding: 16px 22px; min-height: 48px; font-size: 11px; }

  /* Services — single column, less padding */
  .services__grid { grid-template-columns: 1fr; }
  .service { padding: 32px 22px 28px; min-height: 0; }
  .service__num { margin-bottom: 32px; }
  .service h3 { font-size: clamp(20px, 5.5vw, 26px); }
  .service p { font-size: 14px; }

  /* Projects — already span 12 at ≤980, but tighten padding + visual */
  .projects__grid { gap: 18px; }
  .project { padding: 24px 20px; min-height: 0; }
  .project__head { margin-bottom: 40px; font-size: 10px; }
  .project__visual { height: 160px; margin: 0 -20px 24px; }
  .project__foot { font-size: 10px; flex-wrap: wrap; gap: 12px; }
  .project__tags span { padding: 4px 8px; font-size: 9px; }
  .project__tap { width: 40px; height: 40px; top: 16px; right: 16px; }

  /* Skills — slightly smaller, less side padding feel */
  .skill-list li { padding: 14px 0; font-size: 18px; }
  .skill-list li span { font-size: 10px; }
  .skills__quote { margin-top: 36px; font-size: 18px; }
  .marquee { margin-top: 48px; padding: 16px 0; }
  .marquee__track { font-size: 12px; gap: 32px; }

  /* Experience / roles */
  .exp__sticky { position: static; margin-bottom: 24px; }
  .role { padding: 28px 0; gap: 8px; }
  .role:hover { padding-left: 0; }   /* disable hover-shift on phones */
  .role h3 { font-size: clamp(22px, 6vw, 28px); }
  .role h4 { font-size: 13px; margin-bottom: 12px; }
  .role ul { font-size: 14px; }

  /* Stats — comfortable padding */
  .stats { margin-top: 56px; }
  .stat { padding: 28px 16px; }
  .stat__num { font-size: clamp(32px, 9vw, 48px); }
  .stat__label { font-size: 10px; }

  /* Contact */
  .contact h2 { font-size: clamp(44px, 13vw, 80px); margin-bottom: 20px; }
  .contact__sub { font-size: 15px; margin-bottom: 40px; }
  /* Email is long — break it cleanly + smaller on phones */
  .email {
    font-size: clamp(22px, 7vw, 36px);
    word-break: break-all;
    overflow-wrap: anywhere;
    display: block;
    line-height: 1.15;
  }
  .contact__meta { margin-top: 40px; font-size: 11px; gap: 16px; }
  .contact__links { gap: 18px; }

  /* Footer — stack neatly, centered on mobile (see FIX 4 above) */
  .footer {
    padding: 28px var(--pad-x);
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center;
    gap: 10px;
    font-size: 10px;
  }

  /* Nav burger — minimum 44px tap target */
  .nav__burger { width: 44px; height: 44px; }

  /* Tighten side padding on very narrow phones */
  :root { --pad-x: clamp(16px, 5vw, 24px); }

  /* Hide heavy fixed decorations to save paint cost + screen real estate */
  .scrollbg__word { font-size: clamp(180px, 50vw, 320px); opacity: 0.5; }
}

/* ---------- Small phone (≤480px) ---------- */
@media (max-width: 480px) {
  :root { --pad-x: 16px; }
  .nav { padding: 14px var(--pad-x); }
  .hero__headline { font-size: clamp(34px, 12vw, 52px); }
  .section-head h2 { font-size: clamp(30px, 10vw, 44px); }
  .contact h2 { font-size: clamp(38px, 14vw, 60px); }
  .project__visual { height: 140px; }
  /* Hide big background numbers entirely on tiny screens */
  .section__bignum { display: none; }
}

/* ---------- Landscape phones: collapse hero min-height ---------- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .hero { min-height: auto; padding-top: 88px; padding-bottom: 56px; }
  .hero__scroll { display: none; }
}

/* ---------- Touch devices: disable hover-only effects that confuse taps ---------- */
@media (hover: none) {
  .project:hover { transform: none; }
  .service:hover { background: var(--bg); }
  .skill-list li:hover { color: inherit; }
  .skill-list li:hover::before { width: 0; margin-right: 0; }
  .role:hover { padding-left: 0; }
}

/* ---------- Prevent any stray horizontal overflow on mobile ---------- */
@media (max-width: 720px) {
  html, body { max-width: 100vw; overflow-x: hidden; }
  .marquee, .scrollbg { max-width: 100vw; }
}
