/* =========================================================================
   AVAZ RAVSHANOV — ORBIT (v3)
   Cinematic 3D-scroll portfolio. Ink black · emerald · cream.
   Display: Anton · Body: Instrument Sans · Data: JetBrains Mono
   ========================================================================= */

:root {
  --ink: #050706;
  --ink-2: #0a0f0c;
  --cream: #f4efe6;
  --cream-dim: rgba(244, 239, 230, 0.66);
  --emerald: #17e68f;
  --emerald-deep: #0b8f57;
  --emerald-glow: rgba(23, 230, 143, 0.35);
  --line: rgba(244, 239, 230, 0.14);
  --font-display: 'Anton', 'Arial Narrow', sans-serif;
  --font-body: 'Instrument Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --pad: clamp(1.25rem, 4vw, 4rem);
}

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

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--emerald); color: var(--ink); }

.display { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; }
.mono { font-family: var(--font-mono); font-weight: 400; }

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

:focus-visible {
  outline: 2px solid var(--emerald);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- grain ---------- */
.grain {
  position: fixed;
  inset: -100px;
  z-index: 90;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.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-jitter 0.9s steps(3) infinite;
}
@keyframes grain-jitter {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-40px, 25px); }
  66% { transform: translate(30px, -35px); }
  100% { transform: translate(0, 0); }
}

/* ---------- loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  transition: opacity 0.6s ease, visibility 0.6s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-inner { display: flex; flex-direction: column; gap: 0.9rem; align-items: flex-start; width: min(320px, 70vw); }
.loader-name { font-size: 0.72rem; letter-spacing: 0.32em; color: var(--cream-dim); }
.loader-pct { font-size: 2.4rem; color: var(--emerald); font-weight: 600; }
.loader-bar { width: 100%; height: 1px; background: var(--line); overflow: hidden; }
.loader-fill { display: block; width: 0%; height: 100%; background: var(--emerald); transition: width 0.2s ease; }

/* ---------- header ---------- */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--pad);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
}
.site-head.is-hidden {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}
.head-brand {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.head-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); display: inline-block; }
.head-nav { display: flex; gap: 1.8rem; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; }
.head-nav a { color: var(--cream-dim); transition: color 0.25s; }
.head-nav a:hover { color: var(--emerald); }
.head-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
  background: rgba(5, 7, 6, 0.4);
  backdrop-filter: blur(8px);
}
.head-cta:hover { border-color: var(--emerald); color: var(--emerald); }
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 var(--emerald-glow);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--emerald-glow); }
  70% { box-shadow: 0 0 0 9px rgba(23, 230, 143, 0); }
  100% { box-shadow: 0 0 0 0 rgba(23, 230, 143, 0); }
}

/* ---------- hero ---------- */
.hero { height: 480vh; position: relative; }
.hero-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
#orbitCanvas, .orbit-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* author `display:block` above would otherwise override the UA's [hidden] rule —
   this line is what keeps the poster from covering the live canvas */
.orbit-fallback[hidden] { display: none; }
.hero-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 90% at 50% 42%, transparent 40%, rgba(5, 7, 6, 0.72) 100%),
    linear-gradient(to bottom, rgba(5, 7, 6, 0.55) 0%, transparent 22%, transparent 62%, rgba(5, 7, 6, 0.92) 100%);
  pointer-events: none;
}
.hero-copy {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: clamp(3.5rem, 9vh, 7rem);
  z-index: 3;
}
.hero-eyebrow {
  font-size: clamp(0.62rem, 0.75vw, 0.78rem);
  letter-spacing: 0.34em;
  color: var(--emerald);
  margin-bottom: 1.1rem;
  text-shadow: 0 0 14px rgba(5, 7, 6, 0.95), 0 1px 3px rgba(5, 7, 6, 1), 0 0 4px rgba(5, 7, 6, 0.9);
}
.hero-name {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(3.4rem, 13.5vw, 12.5rem);
  line-height: 0.88;
  letter-spacing: 0.005em;
  display: flex;
  flex-direction: column;
}
.hero-line { display: block; overflow: hidden; }
.hero-line-accent { color: var(--emerald); }
.hero-line .ch { display: inline-block; will-change: transform; }
.hero-sub {
  margin-top: 1.4rem;
  max-width: 34ch;
  font-size: clamp(1.05rem, 1.5vw, 1.4rem);
  line-height: 1.4;
  color: var(--cream-dim);
}
.hero-sub em { font-style: normal; color: var(--emerald); }
.hero-hint {
  position: absolute;
  right: var(--pad);
  bottom: clamp(3.5rem, 9vh, 7rem);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.6rem;
  letter-spacing: 0.4em;
  color: var(--cream-dim);
  writing-mode: vertical-rl;
}
.hint-line { width: 1px; height: 64px; background: linear-gradient(to bottom, var(--emerald), transparent); }

/* ---------- stats ---------- */
.stats {
  position: relative;
  z-index: 4;
  background: var(--ink);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: clamp(4rem, 9vw, 8rem) var(--pad);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
}
.stat { border-left: 1px solid var(--line); padding-left: clamp(1rem, 2vw, 2rem); }
.stat-num {
  display: block;
  font-size: clamp(2.6rem, 6vw, 5.5rem);
  line-height: 1;
  color: var(--cream);
}
.stat-num .accent { color: var(--emerald); }
.stat-label {
  display: block;
  margin-top: 0.9rem;
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  color: var(--cream-dim);
  max-width: 24ch;
  line-height: 1.7;
}

/* ---------- shared media sections ---------- */
.bg-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bg-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(5, 7, 6, 0.88) 0%, rgba(5, 7, 6, 0.45) 55%, rgba(5, 7, 6, 0.65) 100%),
    linear-gradient(to bottom, rgba(5, 7, 6, 0.85) 0%, rgba(5, 7, 6, 0.25) 30%, rgba(5, 7, 6, 0.25) 70%, rgba(5, 7, 6, 0.9) 100%);
}
.bg-scrim-deep {
  background:
    linear-gradient(to bottom, rgba(5, 7, 6, 0.92) 0%, rgba(5, 7, 6, 0.55) 40%, rgba(5, 7, 6, 0.75) 100%);
}
.section-eyebrow {
  font-size: clamp(0.62rem, 0.75vw, 0.78rem);
  letter-spacing: 0.34em;
  color: var(--emerald);
}

/* ---------- pillars ---------- */
.pillars { height: 420vh; position: relative; }
.pillars-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.pillars-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--pad);
}
.pillar-track { position: relative; margin-top: 2.2rem; min-height: 46vh; }
.pillar {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  opacity: 0;
  visibility: hidden;
}
/* No-JS / no-GSAP fallback: first pillar stays readable (html.gsap is set by main.js
   once the scroll engine actually initializes) */
html:not(.gsap) .pillar:first-child {
  position: relative;
  inset: auto;
  opacity: 1;
  visibility: visible;
}
.pillar-index {
  font-size: clamp(0.9rem, 1.4vw, 1.3rem);
  color: var(--emerald);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}
.pillar-title {
  font-size: clamp(2.6rem, 7.5vw, 7rem);
  line-height: 0.95;
  max-width: 14ch;
  letter-spacing: 0.005em;
}
.pillar-desc {
  margin-top: 1.6rem;
  max-width: 44ch;
  font-size: clamp(1.02rem, 1.3vw, 1.3rem);
  color: var(--cream-dim);
}
.pillar-progress {
  display: flex;
  gap: 0.6rem;
  margin-top: 2.5rem;
}
.pp-step {
  width: 42px;
  height: 2px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.pp-step::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--emerald);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.pp-step.is-on::after { transform: scaleX(1); }

/* ---------- work ---------- */
.work { position: relative; }
.work-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.work-content {
  position: relative;
  z-index: 3;
  margin-top: -100vh;
  padding: clamp(5rem, 12vh, 9rem) var(--pad) clamp(6rem, 14vh, 10rem);
}
.work-heading {
  font-size: clamp(3rem, 9vw, 8.5rem);
  line-height: 0.9;
  margin-top: 1.2rem;
}
.work-cards {
  margin-top: clamp(3rem, 7vh, 5.5rem);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 2rem);
}
.card {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-height: clamp(300px, 40vh, 420px);
  padding: clamp(1.4rem, 2.2vw, 2.2rem);
  border: 1px solid var(--line);
  background: rgba(5, 7, 6, 0.55);
  backdrop-filter: blur(6px);
  transition: border-color 0.35s ease, background 0.35s ease, box-shadow 0.35s ease;
  will-change: transform;
}
.card:hover {
  border-color: var(--emerald);
  background: rgba(10, 15, 12, 0.75);
  box-shadow: 0 24px 60px -24px var(--emerald-glow);
}
.card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--cream-dim);
}
.card-year { color: var(--emerald); }
.card-title {
  font-size: clamp(2.4rem, 4.2vw, 4rem);
  line-height: 1;
  transition: color 0.35s ease;
}
.card:hover .card-title { color: var(--emerald); }
.card-pitch { color: var(--cream-dim); font-size: 1rem; max-width: 34ch; }
.card-go {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  color: var(--cream);
}
.card-arrow {
  color: var(--emerald);
  display: inline-block;
  transition: transform 0.3s ease;
}
.card:hover .card-arrow { transform: translate(4px, -4px); }

/* ---------- finale ---------- */
.finale {
  position: relative;
  z-index: 4;
  background: var(--ink);
  border-top: 1px solid var(--line);
  padding: clamp(6rem, 14vh, 10rem) var(--pad) 2.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.finale-heading {
  font-size: clamp(3rem, 10.5vw, 10rem);
  line-height: 0.92;
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.35em;
  max-width: 12ch;
}
.fw { display: inline-block; overflow: hidden; }
.fw .ch { display: inline-block; will-change: transform; }
.fw-accent { color: var(--emerald); }
.finale-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: clamp(2.5rem, 6vh, 4.5rem);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.05rem 2.1rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.btn:hover { transform: translateY(-3px); }
.btn:active { transform: translateY(-1px); }
.btn-solid {
  background: var(--emerald);
  color: var(--ink);
  border: 1px solid var(--emerald);
}
.btn-solid:hover { box-shadow: 0 18px 44px -14px var(--emerald-glow); }
.btn-ghost {
  border: 1px solid var(--line);
  color: var(--cream);
}
.btn-ghost:hover { border-color: var(--emerald); color: var(--emerald); }

.site-foot {
  margin-top: auto;
  padding-top: clamp(4rem, 10vh, 7rem);
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
}
.foot-links a { color: var(--cream-dim); transition: color 0.25s; }
.foot-links a:hover { color: var(--emerald); }
.foot-note { font-size: 0.62rem; letter-spacing: 0.18em; color: rgba(244, 239, 230, 0.62); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .head-nav { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); row-gap: 3rem; }
  .work-cards { grid-template-columns: 1fr; }
  .card { min-height: 0; }
  .hero { height: 380vh; }
  .pillars { height: 340vh; }
  .pillar-track { min-height: 54vh; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .finale-heading { max-width: 100%; }
  .hero-hint { display: none; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .pulse-dot { animation: none; }
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
