:root {
  --navy-950: #040915;
  --navy-900: #071230;
  --navy-800: #0D1D45;
  --gold: #D6B265;
  --gold-hi: #F2DDA0;
  --gold-lo: #8A6A2C;
  --ivory: #F3EEE2;
  --text: #C6CCDD;
  --muted: #8E98B4;
  --line: rgba(214, 178, 101, .22);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Manrope", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(20px, 5vw, 72px);
  --col: min(34rem, 40vw);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--navy-900);
  color: var(--ivory);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
@media (hover: hover) and (pointer: fine) { body, a { cursor: none; } }

a { color: inherit; }
em { font-style: italic; color: var(--gold-hi); }
h1, h2, h3 { font-weight: 400; }

#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; display: block; }

.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(70% 60% at 66% 40%, rgba(40, 70, 150, .16) 0%, transparent 60%),
    radial-gradient(130% 100% at 50% 50%, transparent 48%, rgba(2, 5, 14, .72) 100%);
}
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
@keyframes grain { 0% { transform: translate(0, 0); } 50% { transform: translate(-3%, 2%); } 100% { transform: translate(2%, -3%); } }

/* ---------- loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 60; background: var(--navy-950);
  display: grid; place-items: center; align-content: center; gap: 18px;
  transition: opacity 1s ease, visibility 1s;
}
.loader__mark { font-family: var(--serif); font-size: 44px; letter-spacing: -.02em; }
.loader__num { font-family: var(--serif); font-size: clamp(80px, 14vw, 180px); line-height: 1; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.loader__bar { width: min(260px, 60vw); height: 1px; background: rgba(214, 178, 101, .15); overflow: hidden; }
.loader__bar span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .3s ease; }
.loader__cap { margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.is-ready .loader { opacity: 0; visibility: hidden; }

/* ---------- cursor ---------- */
.cursor { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; display: none; }
@media (hover: hover) and (pointer: fine) { .cursor { display: block; } }
.cursor__dot, .cursor__ring { position: absolute; left: 0; top: 0; border-radius: 50%; transform: translate(-50%, -50%); }
.cursor__dot { width: 6px; height: 6px; background: var(--gold-hi); }
.cursor__ring {
  width: 38px; height: 38px; border: 1px solid rgba(214, 178, 101, .6);
  transition: width .4s var(--ease), height .4s var(--ease), background .4s, border-color .4s;
}
.cursor.is-hover .cursor__ring { width: 84px; height: 84px; background: rgba(214, 178, 101, .14); border-color: var(--gold); }
.cursor__label {
  position: absolute; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold-hi); opacity: 0; transition: opacity .3s;
}
.cursor.is-hover .cursor__label { opacity: 1; }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; padding: 22px var(--gutter);
}
.nav__mark { font-family: var(--serif); font-size: 30px; text-decoration: none; letter-spacing: -.02em; }
.nav__links { display: flex; gap: clamp(14px, 2.4vw, 36px); align-items: center; }
.nav__links a { font-size: 13px; letter-spacing: .04em; text-decoration: none; color: var(--muted); transition: color .3s; }
.nav__links a:hover { color: var(--ivory); }
.nav__links .nav__cta { color: var(--navy-950); background: var(--gold); padding: 9px 18px; border-radius: 999px; font-weight: 600; }
.nav__links .nav__cta:hover { color: var(--navy-950); background: var(--gold-hi); }

/* ---------- hud ---------- */
.hud {
  position: fixed; left: var(--gutter); top: 50%; transform: translateY(-50%); z-index: 20;
  display: flex; gap: 14px; align-items: stretch; opacity: 0; transition: opacity .6s;
}
.is-scrolled .hud { opacity: 1; }
.hud__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: rgba(142, 152, 180, .5); }
.hud__list li { transition: color .4s, transform .4s var(--ease); }
.hud__list li span { margin-right: 8px; }
.hud__list li.is-on { color: var(--gold-hi); transform: translateX(4px); }
.hud__track { width: 1px; background: rgba(214, 178, 101, .15); position: relative; order: -1; }
.hud__fill { position: absolute; top: 0; left: 0; width: 1px; height: 0; background: var(--gold); }
.hud-coords {
  position: fixed; right: var(--gutter); bottom: 22px; z-index: 20; font-family: var(--mono); font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase; color: rgba(142, 152, 180, .55);
}

main { position: relative; z-index: 2; }

.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
  display: flex; align-items: center; gap: 10px; margin: 0 0 28px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); }

/* ---------- intro ---------- */
.act--intro { min-height: 100svh; position: relative; }
.hero {
  min-height: 100svh; padding: 0 var(--gutter) clamp(48px, 10vh, 110px);
  display: flex; flex-direction: column; justify-content: flex-end;
}
.hero__prompt {
  font-family: var(--mono); font-size: 13px; color: var(--gold-hi); margin: 0 0 18px; min-height: 1.6em;
  letter-spacing: .02em; display: flex; align-items: center; gap: 2px;
}
.hero__prompt-k { color: var(--gold); margin-right: 6px; }
.caret { display: inline-block; width: 8px; height: 1.1em; background: var(--gold); margin-left: 3px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.no-webgl .hero__prompt { display: none; }
.outro__lead { max-width: 34rem; margin: -12px 0 32px; color: var(--text); font-weight: 300; font-size: clamp(15px, 1.2vw, 18px); }
.hero__title {
  font-family: var(--serif); font-size: clamp(56px, 10.5vw, 176px); line-height: .9; letter-spacing: -.035em; margin: 0; max-width: 11ch;
}
.line { display: block; overflow: hidden; padding-bottom: .06em; }
.line > span { display: inline-block; will-change: transform; }
.hero__sub { max-width: 31rem; margin: 32px 0 0; font-size: clamp(16px, 1.3vw, 19px); color: var(--text); font-weight: 300; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 28px; font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.hero__meta span { padding-left: 14px; border-left: 1px solid var(--line); }
.hero__meta a { color: var(--gold-hi); text-decoration: none; }
.scroll-cue {
  position: absolute; right: var(--gutter); bottom: clamp(48px, 10vh, 110px); font-family: var(--mono); font-size: 11px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 12px; writing-mode: vertical-rl;
}
.scroll-cue span { width: 1px; height: 64px; background: linear-gradient(var(--gold), transparent); animation: cue 2s ease-in-out infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- sticky acts ---------- */
.act--games { height: 560vh; }
.act--systems { height: 340vh; }
.act--web { height: 520vh; }
.act__sticky {
  position: sticky; top: 0; height: 100svh; padding: 120px var(--gutter) 64px calc(var(--gutter) + 120px);
  display: flex; flex-direction: column; justify-content: center; gap: 28px; pointer-events: none;
}
.act__sticky a, .act__sticky .cert { pointer-events: auto; }
.act__head { max-width: var(--col); }
.chapter__num {
  font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold);
  margin: 0 0 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.chapter__title { font-family: var(--serif); font-size: clamp(44px, 5.6vw, 92px); line-height: .95; letter-spacing: -.03em; margin: 0; }
.chapter__lead { font-size: clamp(15px, 1.15vw, 17px); color: var(--text); font-weight: 300; margin: 0 0 18px; }
.chapter__lead strong { color: var(--ivory); font-weight: 600; }
.chapter__law { font-family: var(--mono); font-size: 13px; color: var(--gold-hi); margin: 0 0 22px; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

/* steps (games) and works (web): stacked, one at a time */
.steps, .works { list-style: none; margin: 0; padding: 0; position: relative; max-width: var(--col); min-height: 15rem; }
.step, .work {
  position: absolute; inset: 0 0 auto 0; opacity: 0; transform: translateY(24px);
  transition: opacity .7s var(--ease), transform .9s var(--ease);
}
.step.is-on, .work.is-on { opacity: 1; transform: none; }
.step__k, .work__tag { display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-hi); margin-bottom: 14px; }
.step p, .work p { margin: 0 0 16px; color: var(--text); font-weight: 300; font-size: clamp(15px, 1.15vw, 17px); }
.step strong { color: var(--ivory); font-weight: 600; }
.prompt {
  display: block; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--gold-hi);
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 18, 48, .6);
}
.prompt::before { content: "> "; color: var(--gold); }
.facts { display: flex; gap: 32px; margin: 8px 0 0; }
.facts div { display: grid; }
.facts dt { font-family: var(--serif); font-size: 48px; line-height: 1; color: var(--gold-hi); }
.facts dd { margin: 4px 0 0; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.work h3 { font-family: var(--serif); font-size: clamp(34px, 3.4vw, 54px); line-height: 1; margin: 0 0 14px; letter-spacing: -.02em; }

.sys { max-width: var(--col); }
.sys__more { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 26px; }
.sys__more article { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 18, 48, .55); }
.sys__more h3 { font-family: var(--sans); font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.sys__more p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.note { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: rgba(142, 152, 180, .6); margin: 18px 0 0; }

/* ---------- proof ---------- */
.act--proof { min-height: 100svh; padding: 18vh var(--gutter) 10vh calc(var(--gutter) + 120px); display: flex; align-items: center; }
.proof { width: 100%; }
.proof .chapter__title { margin-bottom: 48px; max-width: 12ch; }
.certs { display: grid; grid-template-columns: 1fr; gap: 14px; max-width: 34rem; }
.certs .cert img { display: none; }
.no-webgl .certs { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 1100px; }
.no-webgl .certs .cert img { display: block; }
.cert {
  position: relative; display: block; text-decoration: none; padding: 26px; border-radius: 22px;
  border: 1px solid var(--line); background: linear-gradient(160deg, rgba(20, 38, 90, .55), rgba(7, 18, 48, .7));
  backdrop-filter: blur(6px); overflow: hidden; transition: border-color .4s, transform .6s var(--ease);
}
.cert::after {
  content: ""; position: absolute; inset: 0; background: radial-gradient(400px 200px at var(--mx, 50%) var(--my, 0%), rgba(214, 178, 101, .14), transparent 60%);
  opacity: 0; transition: opacity .4s; pointer-events: none;
}
.cert:hover { border-color: rgba(214, 178, 101, .6); transform: translateY(-4px); }
.cert:hover::after { opacity: 1; }
.cert img { width: 72px; height: 72px; border-radius: 16px; margin-bottom: 22px; }
.cert__k { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.cert h3 { font-family: var(--serif); font-size: 30px; line-height: 1.05; margin: 8px 0 8px; }
.cert p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.cert__v { display: inline-block; margin-top: 18px; font-family: var(--mono); font-size: 11px; color: var(--gold-hi); letter-spacing: .1em; }

/* ---------- contact ---------- */
.act--contact { min-height: 100svh; }
.outro { min-height: 100svh; padding: 0 var(--gutter) 48px calc(var(--gutter) + 120px); display: flex; flex-direction: column; justify-content: center; }
.outro__title { font-family: var(--serif); font-size: clamp(56px, 9vw, 150px); line-height: .9; letter-spacing: -.035em; margin: 0 0 40px; max-width: 12ch; }
.outro__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; padding: 15px 26px; border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; font-weight: 500; font-size: 15px; transition: background .3s, color .3s, border-color .3s;
}
.btn:hover { border-color: var(--gold); }
.btn--gold { background: var(--gold); color: var(--navy-950); border-color: var(--gold); font-weight: 600; }
.btn--gold:hover { background: var(--gold-hi); }
.outro__foot { margin-top: 80px; font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  :root { --col: 100%; }
  .hud, .hud-coords, .scroll-cue { display: none; }
  .nav__links a:not(.nav__cta) { display: none; }
  .hero__title { max-width: none; }
  .act__sticky { padding: 90px var(--gutter) 28px; justify-content: flex-end; gap: 14px; }
  .act__sticky::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 62%; z-index: -1;
    background: linear-gradient(180deg, rgba(4, 9, 21, 0), rgba(4, 9, 21, .9) 30%);
  }
  .act__head .chapter__num { margin-bottom: 10px; }
  .chapter__title { font-size: clamp(34px, 9vw, 52px); }
  .steps, .works { min-height: 14rem; }
  .sys__more { grid-template-columns: 1fr; }
  .sys__more article:last-child, .note { display: none; }
  .act--proof, .outro { padding-left: var(--gutter); }
  .outro { justify-content: flex-end; padding-top: 50vh; }
  .no-webgl .outro { padding-top: 14vh; }
  .certs, .no-webgl .certs { grid-template-columns: 1fr; }
  .act--proof { padding-top: 46vh; }
  .no-webgl .act--proof { padding-top: 14vh; }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .scroll-cue span { animation: none; }
}

/* ---------- no WebGL: a clean static portfolio ---------- */
.no-webgl #stage, .no-webgl .cursor, .no-webgl .hud { display: none; }
.no-webgl body, .no-webgl a { cursor: auto; }
.no-webgl .act--intro {
  background: url("../img/hamza-alsoud.webp") right 6vw center / auto 72vh no-repeat;
}
.no-webgl .act--games, .no-webgl .act--systems, .no-webgl .act--web { height: auto; }
.no-webgl .act__sticky { position: relative; height: auto; min-height: 0; padding-top: 14vh; padding-bottom: 6vh; opacity: 1 !important; pointer-events: auto; }
.no-webgl .steps, .no-webgl .works { min-height: 0; display: grid; gap: 28px; }
.no-webgl .step, .no-webgl .work { position: static; opacity: 1; transform: none; }
.no-webgl .act--games .act__sticky::after {
  content: ""; display: block; width: min(320px, 70vw); aspect-ratio: 1360 / 2048; border-radius: 18px;
  background: url("../img/game/concept.webp") center / cover; border: 1px solid var(--line);
}
@media (max-width: 900px) {
  .no-webgl .act--intro { background-position: center 70px; background-size: auto 46vh; }
}
