/* =========================================================
   Farshid Khojasteh — homepage
   Dark theme, violet ribbon aesthetic (cerebrium-inspired)
   ========================================================= */

:root {
  --bg:        #0a0611;
  --bg-2:      #0d0818;
  --bg-alt:    #100a1d;
  --panel:     rgba(255, 255, 255, 0.03);
  --panel-2:   rgba(255, 255, 255, 0.05);
  --border:    rgba(255, 255, 255, 0.08);
  --border-2:  rgba(168, 130, 255, 0.22);

  --nav-bg:      rgba(10, 6, 17, 0.72);
  --nav-menu-bg: rgba(10, 6, 17, 0.97);

  --text:      #ece9f5;
  --muted:     #b3adc7;
  --dim:       #8b84a3;

  --violet:    #8b5cf6;
  --violet-2:  #7c3aed;
  --violet-lo: #5b21b6;
  --pink:      #ff4fa3;
  --pink-2:    #e0399a;

  --grad-hl:   linear-gradient(90deg, #ff5fae, #b06bff);
  --grad-btn:  linear-gradient(90deg, #e0399a, #8b5cf6);

  --maxw: 1180px;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

/* ---------- LIGHT theme ---------- */
[data-theme="light"] {
  --bg:        #f5f3fb;
  --bg-2:      #ece7f6;
  --bg-alt:    #efeaf7;
  --panel:     rgba(26, 16, 54, 0.035);
  --panel-2:   rgba(26, 16, 54, 0.06);
  --border:    rgba(26, 16, 54, 0.12);
  --border-2:  rgba(124, 58, 237, 0.32);
  --text:      #191233;
  --muted:     #4c4566;
  --dim:       #6f6890;
  --nav-bg:      rgba(245, 243, 251, 0.82);
  --nav-menu-bg: rgba(245, 243, 251, 0.98);
}

/* ---------- GOLD & SILVER theme ---------- */
[data-theme="gold"] {
  --bg:        #0e0c08;
  --bg-2:      #13100a;
  --bg-alt:    #17130b;
  --panel:     rgba(230, 193, 90, 0.05);
  --panel-2:   rgba(230, 193, 90, 0.09);
  --border:    rgba(230, 193, 90, 0.20);
  --border-2:  rgba(207, 210, 214, 0.38);
  --text:      #f4eeda;
  --muted:     #cabf9f;
  --dim:       #9a9179;
  --violet:    #e6c15a;   /* accent -> gold   */
  --violet-2:  #c9a13f;
  --violet-lo: #8a6d22;
  --pink:      #d8dbe0;   /* accent -> silver */
  --pink-2:    #b7bbc2;
  --grad-hl:   linear-gradient(90deg, #f3d67a, #cfd2d6);
  --grad-btn:  linear-gradient(90deg, #c9a13f, #e9e2c9);
  --nav-bg:      rgba(14, 12, 8, 0.75);
  --nav-menu-bg: rgba(14, 12, 8, 0.98);
}

/* theme toggle button */
.theme-toggle { cursor: pointer; border: 0; background: none; }
.theme-toggle svg { display: none; }
[data-theme="dark"]  .theme-toggle .ic-dark  { display: block; }
[data-theme="light"] .theme-toggle .ic-light { display: block; }
[data-theme="gold"]  .theme-toggle .ic-gold  { display: block; }
:root:not([data-theme]) .theme-toggle .ic-dark { display: block; }

/* smooth cross-fade when switching themes */
body, .nav.is-stuck, .marquee, .section--alt, .footer,
.card, .pub, .chip, .metric, .role, .software, .profile {
  transition: background-color .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
}

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

html { scroll-behavior: smooth; }

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

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

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* --------------------------- NAV --------------------------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: background .3s var(--ease), border-color .3s var(--ease), backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.brand__mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--grad-btn);
  font-size: .82rem; font-weight: 800; letter-spacing: .5px;
  box-shadow: 0 4px 18px rgba(224, 57, 154, .35);
}
.brand__name { font-size: .98rem; letter-spacing: -0.01em; color: var(--text); }

.nav__links { display: flex; gap: 28px; margin-left: auto; }
.nav__links a {
  font-size: .92rem; color: var(--muted); font-weight: 500;
  position: relative; transition: color .2s;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  width: 0; height: 2px; background: var(--grad-hl); transition: width .25s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { width: 100%; }

.nav__actions { display: flex; align-items: center; gap: 6px; }
.icon-link {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 9px;
  color: var(--muted); transition: color .2s, background .2s;
}
.icon-link:hover { color: var(--text); background: var(--panel-2); }

.nav__toggle {
  display: none; flex-direction: column; gap: 5px;
  width: 40px; height: 40px; border: 0; background: none; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav__toggle span {
  width: 22px; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .3s var(--ease), opacity .2s;
}
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --------------------------- HERO --------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 120px 24px 80px;
}
.hero__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block; z-index: 0;
}
/* CSS fallback (shown when WebGL unavailable — bands.js sets body.no-webgl) */
.hero__fallback {
  position: absolute; inset: 0; z-index: 0; display: none;
  background:
    radial-gradient(60% 80% at 78% 42%, rgba(224, 57, 154, .45), transparent 60%),
    radial-gradient(70% 90% at 88% 55%, rgba(124, 58, 237, .5), transparent 62%),
    radial-gradient(90% 120% at 100% 60%, rgba(91, 33, 182, .55), transparent 70%),
    var(--bg);
}
.no-webgl .hero__canvas { display: none; }
.no-webgl .hero__fallback { display: block; }

.hero__vignette {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, var(--bg) 0%, var(--bg) 20%, transparent 62%),
    linear-gradient(0deg, var(--bg) 2%, transparent 30%);
}
/* animated Möbius strip on the right side of the hero */
.hero__mobius {
  position: absolute; z-index: 2; pointer-events: none;
  top: 50%; right: -2%;
  width: 640px; height: 640px;
  max-width: 56vw;
  transform: translateY(-50%);
  filter: drop-shadow(0 24px 60px rgba(139, 92, 246, .35));
}

/* math-symbol splash (bursts from the ribbons while holding the mouse) */
.hero__splash {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  width: 100%; height: 100%;
}

.hero__content { position: relative; z-index: 2; max-width: 680px; }

/* hero photo + interactive name */
.hero__photo {
  position: relative;
  width: 184px; height: 184px;
  margin-bottom: 28px;
}
/* rotating violet→pink gradient ring */
.hero__photo::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  background: conic-gradient(from 0deg,
    #ff4fa3, #b06bff, #7c3aed, #8b5cf6, #e0399a, #ff4fa3);
  animation: ringspin 7s linear infinite;
  z-index: 0;
}
/* soft outer glow */
.hero__photo::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  box-shadow: 0 22px 60px rgba(224, 57, 154, .45),
              0 0 42px rgba(139, 92, 246, .35);
  z-index: 0; pointer-events: none;
}
.hero__photo img {
  position: relative; z-index: 1;
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; display: block;
  border: 5px solid var(--bg);
  background: var(--bg-2);
}
@keyframes ringspin { to { transform: rotate(360deg); } }
.hero__name {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.05;
  margin-bottom: 18px; white-space: nowrap;
}
/* JS wraps each character in .ltr; this is the interactive layer */
.hero__name.is-split { display: inline-flex; flex-wrap: wrap; }
.hero__name .ltr {
  display: inline-block; will-change: transform;
  background: linear-gradient(180deg, var(--text), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  transition: color .3s;
}
.hero__name .ltr--space { width: .32em; }
.hero__eyebrow {
  font-size: .82rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--violet); font-weight: 600; margin-bottom: 20px;
}
.hero__title {
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.03;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.hl {
  background: var(--grad-hl);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  position: relative;
}
.hero__sub {
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  color: var(--muted); max-width: 560px; margin-bottom: 36px;
}
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 24px; border-radius: 10px;
  font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .25s, background .25s, border-color .25s;
  border: 1px solid transparent;
}
.btn--sm { padding: 9px 16px; font-size: .86rem; }
.btn--primary {
  background: var(--grad-btn); color: #fff;
  box-shadow: 0 6px 22px rgba(224, 57, 154, .32);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(224, 57, 154, .45); }
.btn--ghost {
  background: var(--panel); color: var(--text); border-color: var(--border);
}
.btn--ghost:hover { border-color: var(--border-2); background: var(--panel-2); transform: translateY(-2px); }

/* motto card — centered between the photo and the Möbius strip */
@property --creedAng { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

.creed {
  position: absolute; z-index: 3; margin: 0;
  left: 50%; top: 20%; transform: translate(-50%, -50%);
  width: clamp(230px, 25vw, 340px);
  padding: 26px 28px; border-radius: 18px;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--text); text-align: center;
  font-family: Georgia, "Times New Roman", serif; font-style: italic;
  font-size: clamp(1rem, 1.35vw, 1.28rem); line-height: 1.55;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45), 0 0 40px rgba(139, 92, 246, .18);
  pointer-events: none; isolation: isolate;
}
/* a light that walks around the border */
.creed::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2px; z-index: -1;
  background: conic-gradient(from var(--creedAng),
    transparent 0deg, transparent 205deg,
    rgba(255, 150, 214, .15) 245deg,
    rgba(255, 150, 214, .95) 300deg,
    #ffffff 330deg,
    rgba(185, 140, 255, .95) 350deg,
    transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: creedWalk 4.5s linear infinite;
}
/* static base border under the moving light */
.creed::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -2;
  border: 1px solid rgba(255, 255, 255, .10);
}
@keyframes creedWalk { to { --creedAng: 360deg; } }

/* "hold to reshape" hint pill — centered in the hero */
.hint {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 4; pointer-events: none;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 11px 20px 11px 15px; border-radius: 999px;
  font-size: .88rem; font-weight: 500; color: var(--text); white-space: nowrap;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(139, 92, 246, .12);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
/* gradient glow ring */
.hint::before {
  content: ""; position: absolute; inset: -1px; border-radius: 999px; z-index: -1;
  padding: 1px; background: linear-gradient(90deg, rgba(224,57,154,.6), rgba(139,92,246,.6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .55; animation: hintGlow 2.6s ease-in-out infinite;
}
@keyframes hintGlow { 0%, 100% { opacity: .35; } 50% { opacity: .8; } }
/* little animated mouse icon */
.hint__ico {
  position: relative; width: 17px; height: 25px; flex: 0 0 auto;
  border: 2px solid currentColor; border-radius: 9px; opacity: .9;
}
.hint__ico::after {
  content: ""; position: absolute; left: 50%; top: 4px; width: 2px; height: 6px;
  background: currentColor; border-radius: 2px; transform: translateX(-50%);
  animation: hintClick 1.4s ease-in-out infinite;
}
@keyframes hintClick { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.hint kbd {
  font-family: var(--mono); font-size: .74rem; font-weight: 600; color: #fff;
  padding: 2px 7px; border-radius: 6px; background: var(--grad-btn);
}
.hint.is-hidden { opacity: 0; transform: translateX(-50%) translateY(12px); }

.hero__scroll {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 2; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--dim); display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.hero__scroll span {
  width: 1px; height: 40px;
  background: linear-gradient(var(--violet), transparent);
  animation: scrollpulse 2s var(--ease) infinite;
}
@keyframes scrollpulse { 0%,100% { opacity: .3; transform: scaleY(.6); } 50% { opacity: 1; transform: scaleY(1); } }

/* --------------------------- MARQUEE --------------------------- */
.marquee {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden;
  padding: 22px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee__track {
  display: flex; gap: 56px; width: max-content;
  animation: marquee 34s linear infinite;
}
.marquee__track span {
  color: var(--dim); font-weight: 600; font-size: 1.02rem; letter-spacing: .01em;
  white-space: nowrap; transition: color .2s;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track span:hover { color: var(--text); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* --------------------------- METRICS --------------------------- */
.metrics { padding: 72px 0 8px; }
.metrics__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
}
.metric {
  text-align: center; padding: 28px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), transparent);
}
.metric__num {
  font-family: var(--mono);
  font-size: clamp(2rem, 4vw, 3rem); font-weight: 700;
  background: var(--grad-hl); -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.02em;
}
.metric__label { color: var(--muted); font-size: .9rem; margin-top: 6px; }
.metrics__note { text-align: center; color: var(--dim); font-size: .82rem; margin-top: 20px; }
.metrics__note a { color: var(--violet); }

/* --------------------------- SECTIONS --------------------------- */
.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.kicker {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--violet); font-weight: 700; margin-bottom: 14px;
}
.section__title {
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; margin-bottom: 22px;
}
.lede { font-size: 1.12rem; color: var(--text); margin-bottom: 18px; }
.body { color: var(--muted); font-size: 1rem; }
.body strong, .lede strong { color: var(--text); }
em { color: var(--violet); font-style: normal; }

.grid-2 { display: grid; grid-template-columns: 1.25fr .85fr; gap: 56px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; }

.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), transparent);
  transition: border-color .25s, transform .25s var(--ease), background .25s;
}

/* profile card */
.profile { padding: 32px; }
.profile__avatar {
  width: 68px; height: 68px; border-radius: 16px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.5rem; letter-spacing: 1px;
  background: var(--grad-btn); color: #fff;
  box-shadow: 0 8px 26px rgba(139, 92, 246, .38);
  margin-bottom: 18px;
}
.profile__name { font-size: 1.25rem; font-weight: 700; }
.profile__role { color: var(--violet); font-size: .92rem; margin-bottom: 18px; }
.profile__list { list-style: none; display: grid; gap: 10px; }
.profile__list li {
  display: flex; justify-content: space-between; gap: 16px;
  font-size: .9rem; color: var(--text);
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.profile__list li:last-child { border-bottom: 0; padding-bottom: 0; }
.profile__list span { color: var(--dim); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.chip {
  padding: 10px 18px; border-radius: 999px; font-size: .92rem; font-weight: 500;
  color: var(--muted); border: 1px solid var(--border);
  background: var(--panel); transition: color .2s, border-color .2s, background .2s, transform .2s var(--ease);
}
.chip:hover {
  color: var(--text); border-color: var(--border-2);
  background: rgba(139, 92, 246, .1); transform: translateY(-3px);
}

/* publications */
.pub__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.pubs { list-style: none; display: grid; gap: 14px; }
.pub {
  display: flex; gap: 22px; align-items: center;
  padding: 22px 26px; border: 1px solid var(--border); border-radius: 14px;
  background: linear-gradient(180deg, var(--panel), transparent);
  transition: border-color .25s, transform .25s var(--ease), background .25s;
}
.pub:hover { border-color: var(--border-2); transform: translateX(6px); background: var(--panel-2); }
.pub__cite {
  flex: 0 0 auto; width: 76px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding-right: 22px; border-right: 1px solid var(--border);
}
.pub__count {
  font-family: var(--mono); font-size: 1.5rem; font-weight: 700;
  background: var(--grad-hl); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.pub__cite > span:last-child { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.pub__title { font-size: 1.06rem; font-weight: 600; margin-bottom: 4px; line-height: 1.35; }
.pub__meta { font-size: .88rem; color: var(--muted); }
.pub__meta em { color: var(--violet); font-style: italic; }
.pub--new { border-color: var(--border-2); background: rgba(139, 92, 246, .06); }
.pub--new .pub__count { font-size: 1rem; }

/* editorial roles */
.role { padding: 26px; }
.role__tag { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--pink); font-weight: 700; margin-bottom: 12px; }
.role__name { font-size: 1.08rem; font-weight: 600; line-height: 1.4; }
.role:hover { border-color: var(--border-2); transform: translateY(-4px); }

/* awards + talks */
.awards, .talks { list-style: none; display: grid; gap: 14px; margin-top: 18px; }
.awards li, .talks li {
  font-size: .95rem; color: var(--muted);
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.awards li:last-child, .talks li:last-child { border-bottom: 0; }
.awards span, .talks__city {
  display: inline-block; min-width: 92px; color: var(--violet); font-weight: 600;
  font-family: var(--mono); font-size: .82rem;
}
.talks__city { min-width: 150px; }

/* software */
.software { display: block; padding: 34px; }
.software:hover { border-color: var(--border-2); transform: translateY(-4px); }
.software__top { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.software__name { font-family: var(--mono); font-size: 1.3rem; font-weight: 600; color: var(--text); }
.software__stack { font-size: .82rem; color: var(--dim); font-family: var(--mono); }
.software__desc { color: var(--muted); max-width: 640px; margin-bottom: 18px; }
.software__link { color: var(--pink); font-weight: 600; font-size: .92rem; }

/* --------------------------- SCROLL SCENES --------------------------- */
.scene {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: clip;
  isolation: isolate;
}
.scene__bg {
  position: absolute; inset: -12% 0;
  background-size: cover; background-position: center;
  z-index: 0; will-change: transform;
  transform: scale(1.12);
  filter: saturate(0.95) brightness(0.82);
}
.scene__overlay {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(10,6,17,.45) 18%, rgba(10,6,17,.5) 82%, var(--bg) 100%),
    radial-gradient(70% 90% at 50% 50%, rgba(124,58,237,.22), transparent 72%);
}
.scene--bright .scene__overlay {
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(10,6,17,.72) 22%, rgba(10,6,17,.74) 80%, var(--bg) 100%),
    radial-gradient(70% 90% at 50% 50%, rgba(124,58,237,.28), transparent 70%);
}
.scene--black .scene__overlay {
  background:
    linear-gradient(180deg, var(--bg) 0%, rgba(10,6,17,.15) 22%, rgba(10,6,17,.2) 80%, var(--bg) 100%),
    radial-gradient(65% 85% at 50% 50%, rgba(224,57,154,.16), transparent 72%);
}
/* shift the red Möbius render toward the site's pink/violet palette */
.scene--mobius .scene__bg {
  filter: saturate(1.05) brightness(0.9) contrast(1.03) hue-rotate(310deg);
}
.scene__inner {
  position: relative; z-index: 2; text-align: center;
  max-width: 780px; padding: 0 24px;
  opacity: 0; transform: translateY(46px);
  will-change: opacity, transform;
}
.scene__kicker {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .18em;
  color: var(--pink); font-weight: 700; margin-bottom: 18px;
}
.scene__title {
  font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 800;
  letter-spacing: -0.025em; line-height: 1.08; margin-bottom: 20px;
}
.scene__title .hl { background: var(--grad-hl); -webkit-background-clip: text; background-clip: text; color: transparent; }
.scene__text {
  font-size: clamp(1rem, 1.5vw, 1.2rem); color: var(--muted); max-width: 620px; margin: 0 auto;
}
.scene__index {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
  z-index: 2; font-family: var(--mono); font-size: .78rem; letter-spacing: .3em;
  color: var(--dim); text-transform: uppercase;
}

/* --------------------------- FOOTER --------------------------- */
.footer { position: relative; overflow: hidden; padding-top: 96px; background: var(--bg-2); border-top: 1px solid var(--border); }
.footer__bands {
  position: absolute; inset: 0; z-index: 0; opacity: .5; pointer-events: none;
  background:
    radial-gradient(50% 60% at 85% 0%, rgba(224, 57, 154, .3), transparent 60%),
    radial-gradient(60% 80% at 100% 20%, rgba(124, 58, 237, .35), transparent 65%);
}
.footer__inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; padding-bottom: 64px; }
.footer__meta dl { display: grid; grid-template-columns: auto; gap: 4px; }
.footer__meta dt { color: var(--violet); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-top: 18px; }
.footer__meta dt:first-child { margin-top: 0; }
.footer__meta dd { color: var(--muted); font-size: .95rem; }
.footer__meta a:hover { color: var(--text); }
.footer__bottom {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--border);
  color: var(--dim); font-size: .88rem; flex-wrap: wrap;
}
.footer__socials { display: flex; gap: 22px; }
.footer__socials a { color: var(--muted); transition: color .2s; }
.footer__socials a:hover { color: var(--text); }

/* --------------------------- INTRO CURTAIN --------------------------- */
.intro {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--bg);
  transition: transform .9s var(--ease), opacity .6s ease .2s;
}
.intro.is-done { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.intro__logo {
  width: 78px; height: 78px; border-radius: 18px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.7rem; letter-spacing: 1px; color: #fff;
  background: var(--grad-btn);
  box-shadow: 0 12px 46px rgba(224, 57, 154, .5);
  animation: introPulse 1.15s var(--ease) infinite;
}
.intro__bar {
  position: absolute; bottom: 16%; left: 50%; transform: translateX(-50%);
  width: 160px; height: 2px; border-radius: 2px; overflow: hidden;
  background: rgba(255, 255, 255, .1);
}
.intro__bar::after {
  content: ""; position: absolute; inset: 0; width: 40%;
  background: var(--grad-hl); border-radius: 2px;
  animation: introLoad 1s var(--ease) infinite;
}
@keyframes introPulse { 0%, 100% { transform: scale(1); opacity: .82; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes introLoad { 0% { left: -40%; } 100% { left: 100%; } }

/* --------------------------- SCROLL PROGRESS --------------------------- */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  z-index: 200; background: var(--grad-btn);
  box-shadow: 0 0 14px rgba(224, 57, 154, .6);
  will-change: width;
}

/* text selection + keyboard focus */
::selection { background: rgba(224, 57, 154, .35); color: #fff; }
a:focus-visible, .btn:focus-visible, button:focus-visible {
  outline: 2px solid var(--pink); outline-offset: 3px; border-radius: 8px;
}

/* nav active link */
.nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after { width: 100%; }

/* hero staggered entrance (revealed after the intro curtain) */
.hero__photo, .hero__name, .hero__eyebrow, .hero__sub, .hero__cta {
  opacity: 0; transform: translateY(28px);
  transition: opacity .85s var(--ease), transform .85s var(--ease);
}
body.loaded .hero__photo   { opacity: 1; transform: none; transition-delay: .05s; }
body.loaded .hero__name    { opacity: 1; transform: none; transition-delay: .16s; }
body.loaded .hero__eyebrow { opacity: 1; transform: none; transition-delay: .30s; }
body.loaded .hero__sub     { opacity: 1; transform: none; transition-delay: .40s; }
body.loaded .hero__cta     { opacity: 1; transform: none; transition-delay: .50s; }

/* --------------------------- REVEAL --------------------------- */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity .8s var(--ease), transform .8s var(--ease), filter .8s var(--ease);
  transition-delay: var(--rd, 0s);
}
.reveal.r-left  { transform: translateX(-46px); }
.reveal.r-right { transform: translateX(46px); }
.reveal.r-zoom  { transform: scale(.9); }
.reveal.r-blur  { filter: blur(16px); opacity: 0; }
.reveal.is-in { opacity: 1; transform: none; filter: none; }

/* magnetic buttons + card tilt need smooth return */
.btn { will-change: transform; }
.tilt { transform-style: preserve-3d; will-change: transform; }
.tilt.is-tilting { transition: none; }

/* --------------------------- RESPONSIVE --------------------------- */
@media (max-width: 900px) {
  .nav__links {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; gap: 0;
    background: var(--nav-menu-bg); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 24px;
    transform: translateY(-130%); transition: transform .35s var(--ease);
    margin-left: 0;
  }
  .nav__links.is-open { transform: translateY(0); }
  .nav__links a { padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 1rem; }
  .nav__toggle { display: flex; }
  .brand__name { display: none; }

  .grid-2, .grid-3, .footer__inner { grid-template-columns: 1fr; gap: 34px; }
  .metrics__grid { grid-template-columns: repeat(2, 1fr); }
  .pub__head { flex-direction: column; align-items: flex-start; }
  .hero { padding-top: 100px; }
  .hero__vignette { background: linear-gradient(0deg, var(--bg) 6%, var(--bg) 30%, transparent 80%); }
  .hero__mobius {
    top: auto; bottom: -4%; right: 50%; transform: translateX(50%);
    width: 420px; height: 420px; max-width: 92vw; opacity: .5; z-index: 1;
  }
  .hint {
    white-space: normal; text-align: center; max-width: 88vw;
    font-size: .8rem; bottom: 84px;
  }
  .creed {
    left: 50%; top: auto; bottom: 22%; transform: translateX(-50%);
    width: min(86vw, 440px); font-size: 1rem; padding: 20px 22px;
  }
}

@media (max-width: 480px) {
  .metrics__grid { grid-template-columns: 1fr; }
  .pub { flex-direction: column; align-items: flex-start; gap: 14px; }
  .pub__cite { flex-direction: row; width: auto; border-right: 0; padding-right: 0; gap: 8px; align-items: baseline; }
}

/* --------------------------- MOTION PREFERENCE --------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; filter: none; transition: none; }
  .marquee__track { animation: none; }
  .intro { display: none; }
  .hero__photo, .hero__name, .hero__eyebrow, .hero__sub, .hero__cta { opacity: 1; transform: none; }
}

/* =========================================================
   CONTACT MODAL + FORM
   ========================================================= */
.modal {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center; padding: 24px;
  opacity: 0; visibility: hidden;
  transition: opacity .3s var(--ease), visibility .3s var(--ease);
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 3, 10, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative; z-index: 1;
  width: min(92vw, 520px); max-height: 90vh; overflow-y: auto;
  padding: 34px 34px 30px;
  border: 1px solid var(--border-2); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 60px rgba(139, 92, 246, .14);
  transform: translateY(16px) scale(.98);
  transition: transform .3s var(--ease);
}
.modal.is-open .modal__panel { transform: translateY(0) scale(1); }

.modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); transition: color .2s, border-color .2s, background .2s;
}
.modal__close:hover { color: var(--text); border-color: var(--border-2); background: var(--panel-2); }

.modal__title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; letter-spacing: -.01em; }
.modal__sub { color: var(--muted); font-size: .94rem; margin-bottom: 22px; }

/* form fields */
.form { display: grid; gap: 16px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label {
  font-size: .76rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--violet);
}
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--dim); }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--border-2); background: var(--panel-2);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .16);
}
.field textarea { resize: vertical; min-height: 130px; }

/* honeypot — hidden from real users */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form__actions { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.form__actions .btn { width: 100%; }

.form__status { font-size: .9rem; min-height: 1.2em; }
.form__status.is-error { color: var(--pink); }
.form__status.is-ok { color: var(--violet); }

.btn[aria-busy="true"] { opacity: .7; pointer-events: none; }

@media (max-width: 480px) {
  .modal__panel { padding: 28px 22px 24px; }
  .form__row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .modal, .modal__panel { transition: none; }
}
