/* ============ Iris design tokens ============ */
:root {
  --bg: #020409;
  --panel: rgba(4, 6, 12, 0.82);
  --line: rgba(255, 255, 255, 0.08);
  --red: #527CEE;
  --red-deep: #24377D;
  --text: #F5F2F0;
  --text-dim: #8A8482;
  --radius: 28px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

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

::selection {
  background: rgba(82, 124, 238, 0.85);
  color: #fff;
}

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

::-webkit-scrollbar {
  width: 9px;
}

::-webkit-scrollbar-track {
  background: #020409;
}

::-webkit-scrollbar-thumb {
  background: rgba(82, 124, 238, 0.35);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(82, 124, 238, 0.6);
}

html {
  scroll-behavior: auto; /* Lenis drives smoothing */
}

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

/* Background canvas sits at the base layer; content goes above it
   with z-index: 1 (negative z-index breaks in Safari). */
#iris-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* The travelling iris — a small ember that journeys through sections. */
#orb {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(circle, #8CA8F8 0%, #527CEE 45%, rgba(82, 124, 238, 0) 72%);
  box-shadow: 0 0 28px 8px rgba(82, 124, 238, 0.45);
  pointer-events: none;
  opacity: 0;
  z-index: 1;
}

main, header, footer {
  position: relative;
  z-index: 1;
}

/* ============ The horizontal 3D world ============ */
/* Desktop: scenes sit side by side; JS pins the world and scrubs the
   track horizontally. Mobile / reduced-motion: scenes stack vertically. */
.world {
  overflow: hidden;
}

.track {
  display: flex;
  height: 100vh;
  perspective: 1600px;
}

.scene {
  flex: 0 0 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 90px 0 40px;
}

.scene .container {
  will-change: transform, opacity;
}

@media (max-width: 900px) {
  .track {
    display: block;
    height: auto;
    perspective: none;
  }

  /* Apple-style keynote beats: each scene is a tall wrapper, its
     content sticks to the screen while scroll drives the moment. */
  .scene {
    display: block;
    height: auto;
    min-height: 145vh;
    min-height: 145dvh;
    padding: 0;
    position: relative;
  }

  .scene .container,
  .scene .manifest-stage {
    position: sticky;
    top: 9dvh;
    margin: 0 auto;
    min-height: 0;
  }

  .scene-hero { min-height: 125dvh; }
  .scene-manifest { min-height: 250dvh; }
  #platform { min-height: 175dvh; }
  #how { min-height: 230dvh; }
  #contact { min-height: 115dvh; }

  /* Tracks: two tall cards — flows naturally instead of sticking. */
  #tracks { min-height: 0; padding: 12dvh 0; }
  #tracks .container { position: static; }

  .scene-hero .container {
    top: 16dvh;
  }

  .scene-manifest .manifest-stage {
    top: 0;
    height: 100dvh;
    display: grid;
    place-items: center;
  }

  /* Phone performance diet: solid panels, still grain. */
  .scene .container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(3, 5, 11, 0.88);
  }
  .scene .container--bare {
    background: transparent;
  }
  body::after {
    animation: none;
    opacity: 0.3;
  }
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.mono {
  font-family: var(--mono);
}

/* ============ Nav ============ */
.nav {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1240px, 94vw);
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(3, 5, 10, 0.6);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 10;
  opacity: 0;
  transform: translateX(-50%) translateY(-140%);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s;
}

.nav.is-in {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.nav.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-140%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.mark {
  width: 30px;
  height: 30px;
}

.wordmark {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 28px;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.25s;
}

.nav-links a:hover {
  color: var(--text);
}

.lang-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s;
}

.lang-toggle:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ============ Buttons & pills ============ */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
  will-change: transform;
}

.btn-lg {
  padding: 16px 34px;
  font-size: 17px;
}

.btn-primary {
  background: linear-gradient(90deg, #4370E6, #6288F5);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(90deg, #4E7AEA, #6F92F7);
}

.btn-ghost {
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

/* ============ Hero ============ */
.hero-title {
  font-size: clamp(56px, 9.5vw, 136px);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.hero-title .line {
  display: block;
  overflow: hidden;
}

.hero-title .line > span {
  display: inline-block;
  white-space: nowrap;
}

.dot {
  color: var(--red);
  font-style: normal;
}

.hero-sub {
  margin-top: 32px;
  max-width: 520px;
  font-size: 20px;
  color: var(--text-dim);
}

.hero-cta {
  display: flex;
  gap: 16px;
  margin-top: 44px;
}

/* ============ Manifest ============ */
.manifest-stage {
  display: grid;
  place-items: center;
  text-align: center;
}

.manifest-line {
  grid-area: 1 / 1;
  font-size: clamp(34px, 5.2vw, 72px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 16ch;
  opacity: 0;
}

.manifest-line em {
  font-style: normal;
  color: var(--red);
}

.manifest-small {
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 500;
  color: var(--text-dim);
  max-width: 34ch;
}

.manifest-line em,
.manifest-small em {
  color: var(--red);
}

/* ============ Cinematic vignette ============ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  background: radial-gradient(ellipse 130% 110% at 50% 45%,
    transparent 58%, rgba(0, 0, 0, 0.42) 100%);
}

/* ============ Journey progress bar ============ */
.journey-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 60;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  box-shadow: 0 0 12px rgba(82, 124, 238, 0.55);
  pointer-events: none;
}

/* ============ Film grain overlay ============ */
body::after {
  content: "";
  position: fixed;
  inset: -120px;
  z-index: 30;
  pointer-events: none;
  background: url("../assets/grain.png");
  opacity: 0.45;
  animation: grain 9s steps(10) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-42px, 28px); }
  20%  { transform: translate(30px, -35px); }
  30%  { transform: translate(-25px, -20px); }
  40%  { transform: translate(38px, 22px); }
  50%  { transform: translate(-30px, 40px); }
  60%  { transform: translate(22px, -30px); }
  70%  { transform: translate(-40px, 12px); }
  80%  { transform: translate(28px, 34px); }
  90%  { transform: translate(-18px, -38px); }
  100% { transform: translate(0, 0); }
}

/* ============ Panels ============ */
.scene .container {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(40px, 5vw, 76px);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-height: 84vh;
  overflow: visible;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 30px 80px rgba(0, 0, 0, 0.45);
}

.container--bare,
.scene .container--bare {
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.section-title {
  font-size: clamp(38px, 4.6vw, 60px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.06;
  margin-bottom: 40px;
}

/* ============ The eye ============ */
.eye-section .container {
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.eye-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 72px;
  align-items: center;
}

.eye-visual {
  margin: 0;
  position: relative;
}

/* Press-and-hold pupil: dilates under the finger. */
.pupil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 33%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #000 56%, rgba(0, 0, 0, 0) 74%);
  pointer-events: none;
}

.eye-visual img {
  display: block;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0 0 140px rgba(82, 124, 238, 0.22);
  will-change: transform;
}

.eye-text {
  color: var(--text-dim);
  font-size: 20px;
  max-width: 40ch;
}

/* Aperture ring echo — the eye's shape lingers into the next section. */
#how .container {
  position: relative;
  overflow: hidden;
}

#how .container::before {
  content: "";
  position: absolute;
  top: -140px;
  right: -100px;
  width: 460px;
  height: 460px;
  border: 1px solid rgba(82, 124, 238, 0.14);
  border-radius: 50%;
  pointer-events: none;
}

#how .container::after {
  content: "";
  position: absolute;
  top: -60px;
  right: -20px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(82, 124, 238, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

/* ============ Steps ============ */
.steps {
  display: flex;
  gap: 40px;
}

.steps-rail {
  width: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex-shrink: 0;
}

.steps-progress {
  width: 100%;
  height: 0%;
  background: var(--red);
}

.steps-list {
  list-style: none;
  display: grid;
  gap: 34px;
}

.step {
  max-width: 560px;
  opacity: 0.35;
  transition: opacity 0.5s;
}

.step.is-active {
  opacity: 1;
}

.step h3 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.step p {
  color: var(--text-dim);
}

/* ============ Cards / tracks ============ */
.tracks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px;
  transition: border-color 0.3s;
  will-change: transform;
}

.card:hover {
  border-color: rgba(82, 124, 238, 0.4);
}

.track-card h3 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.track-card p {
  color: var(--text-dim);
}

/* ============ Stats ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px;
}

.stat-value {
  display: block;
  font-size: clamp(44px, 5vw, 64px);
  font-weight: 500;
  color: var(--red);
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 15px;
}

/* ============ Final CTA ============ */
.cta-final .container {
  text-align: center;
  padding-top: 110px;
  padding-bottom: 110px;
}

.cta-final .section-title {
  margin-bottom: 16px;
}

.cta-sub {
  color: var(--text-dim);
  margin-bottom: 40px;
  font-size: 20px;
}

/* ============ Mobile scene progress dots ============ */
.scene-dots {
  position: fixed;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 15;
  pointer-events: none;
}

.scene-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
}

.scene-dots span.on {
  background: var(--red);
  box-shadow: 0 0 10px rgba(82, 124, 238, 0.8);
  transform: scale(1.35);
}

@media (max-width: 900px) {
  .scene-dots { display: flex; }
}

/* ============ Mobile sticky CTA (thumb zone) ============ */
.mobile-cta {
  display: none;
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  text-align: center;
  padding: 17px 24px;
  font-size: 17px;
  box-shadow: 0 8px 32px rgba(82, 124, 238, 0.35);
  transform: translateY(160%);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-cta.is-on {
  transform: translateY(0);
}

.mobile-cta.is-off {
  transform: translateY(160%);
}

@media (max-width: 900px) {
  .mobile-cta { display: block; }
}

/* ============ Footer ============ */
.footer {
  padding: 48px 0 0;
  overflow: hidden;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 40px;
}

.footer .mono {
  color: var(--text-dim);
  font-size: 13px;
}

.footer-giant {
  text-align: center;
  white-space: nowrap;
  font-size: clamp(64px, 23vw, 360px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 0.78;
  transform: translateY(0.08em);
  user-select: none;
}

/* Gradient is clipped per letter — clipping on the parent breaks in
   Chrome once the spans carry GSAP transforms. */
.footer-giant span {
  display: inline-block;
  background: linear-gradient(180deg, rgba(82, 124, 238, 0.6) 0%, rgba(82, 124, 238, 0.05) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============ Reduced motion ============ */
html.reduced-motion body::after {
  animation: none;
}

html.reduced-motion #orb {
  display: none;
}

html.reduced-motion .track,
html.reduced-motion .world .track {
  display: block;
  height: auto;
  perspective: none;
}

html.reduced-motion .scene {
  height: auto;
  min-height: 100vh;
}

html.reduced-motion .manifest-stage {
  display: block;
}

html.reduced-motion .manifest-line {
  opacity: 1;
  margin: 28px auto;
}

html.reduced-motion .step {
  opacity: 1;
}


/* ============ Responsive ============ */
/* Big screens: let the world breathe wider. */
@media (min-width: 1500px) {
  .container {
    width: min(1340px, 88vw);
  }
  .scene .container {
    padding: clamp(56px, 4.5vw, 96px);
  }
  .hero-sub {
    font-size: 22px;
    max-width: 560px;
  }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav { top: 12px; padding: 10px 14px; }
  .lang-toggle { margin-left: auto; }
  .nav > .btn-primary { display: none; } /* the thumb-zone CTA replaces it */
  .hero-title { font-size: clamp(34px, 9.6vw, 48px); }
  .section-title { font-size: clamp(30px, 8.8vw, 44px); }
  .tracks-grid, .stats-grid { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: flex-start; }
  .eye-grid { grid-template-columns: 1fr; gap: 44px; }
  .eye-visual img { max-width: 320px; }
  .scene .container { max-height: none; }
  .section-title { margin-bottom: 36px; }
  .steps { gap: 22px; }
  .step h3 { font-size: 24px; }
  .card { padding: 28px; }
  .stat { padding: 26px; }
  .hero-sub { font-size: 18px; }
  .footer-inner { flex-direction: column; gap: 14px; align-items: flex-start; }
}

/* Phone held sideways: no room for sticky beats — flow naturally. */
@media (max-width: 900px) and (max-height: 520px) {
  .scene,
  .scene-hero,
  .scene-manifest,
  #platform,
  #how,
  #contact {
    min-height: 0;
    padding: 64px 0;
  }
  .scene .container,
  .scene .manifest-stage {
    position: static;
  }
  .scene-manifest .manifest-stage {
    height: auto;
    display: block;
  }
  .manifest-line {
    opacity: 1;
    margin: 22px auto;
  }
  .scene-dots,
  .mobile-cta {
    display: none;
  }
}
