/* ==========================================================
   Stage One Cloud — index (3D flythrough)
   ========================================================== */
:root {
  --ink: #02040c;
  --sky: #7dd3fc;
  --sky-dim: rgba(125, 211, 252, 0.55);
  --rose: #f472b6;
  --text: #f1f5f9;
  --muted: rgba(241, 245, 249, 0.62);
  --glass: rgba(4, 10, 28, 0.55);
  --line: rgba(255, 255, 255, 0.1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

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

html { background: var(--ink); }
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Background ---------- */
.bg-video {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: -3;
  transform: scale(var(--bg-scale, 1));
  transition: filter 0.6s ease;
}
.bg-shade {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 50% 50%, rgba(2,4,12,0.25) 0%, rgba(2,4,12,0.78) 70%, rgba(2,4,12,0.95) 100%),
    linear-gradient(to bottom, rgba(2,4,12,0.55), transparent 25%, transparent 75%, rgba(2,4,12,0.7));
}

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 3rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(2, 5, 18, 0.45);
  z-index: 300;
}
.nav-logo {
  font-size: 1.05rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--sky); text-decoration: none; white-space: nowrap;
}
.nav-links { display: flex; align-items: center; gap: 0.25rem; }
.nav-links a {
  color: var(--muted); text-decoration: none;
  font-size: 0.88rem; padding: 0.4rem 0.85rem; border-radius: 6px;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.07); }
.nav-links a.nav-cta {
  color: var(--ink); background: var(--sky); font-weight: 600; margin-left: .5rem;
}
.nav-links a.nav-cta:hover { background: #bae6fd; }

.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 6px; background: none; border: none; }
.hamburger span { display: block; width: 22px; height: 2px; background: rgba(255,255,255,0.75); border-radius: 2px; transition: transform .3s, opacity .3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.mobile-menu {
  display: none; position: fixed; inset: 0; z-index: 250;
  background: rgba(2, 5, 18, 0.96); backdrop-filter: blur(16px);
  flex-direction: column; align-items: center; justify-content: center; gap: 2rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 1.5rem; font-weight: 600; }
.mobile-menu a:hover { color: var(--sky); }

/* ---------- 3D scene ---------- */
#viewport {
  position: fixed; inset: 0;
  perspective: 1000px;
  overflow: hidden;
}
#world {
  position: absolute; top: 50%; left: 50%;
  width: 0; height: 0;
  transform-style: preserve-3d;
}

/* data particles */
.node {
  position: absolute;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--c, var(--sky));
  box-shadow: 0 0 12px 2px var(--c, var(--sky));
  pointer-events: none;
  will-change: transform, opacity;
}
.node.sq { border-radius: 1px; width: 26px; height: 2px; margin: -1px 0 0 -13px; }

/* text stages floating in depth */
.stage {
  position: absolute; left: 0; top: 0;
  width: min(760px, 86vw);
  text-align: center;
  pointer-events: none;
  will-change: transform, opacity;
}
.stage-hero h1 {
  font-size: clamp(2.8rem, 7.5vw, 6rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  text-shadow: 0 0 50px rgba(125,211,252,0.45), 0 2px 10px rgba(0,0,0,0.9);
}
.stage-hero h1 span {
  background: linear-gradient(100deg, var(--sky) 10%, #c4b5fd 55%, var(--rose) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 24px rgba(196,181,253,0.35));
}
.eyebrow, .chapter-num {
  font-family: var(--mono);
  font-size: 0.78rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--sky-dim); margin-bottom: 1.1rem;
}
.lede {
  margin: 1.4rem auto 0; max-width: 560px;
  font-size: clamp(1rem, 1.8vw, 1.2rem); line-height: 1.6; color: rgba(241,245,249,0.8);
  text-shadow: 0 1px 8px rgba(0,0,0,0.9);
}
.stage-chapter {
  width: min(460px, 80vw);
  text-align: left;
  padding: 1.6rem 1.8rem;
  border-left: 2px solid var(--sky);
  background: linear-gradient(90deg, rgba(4,10,28,0.7), rgba(4,10,28,0));
}
.stage-chapter .chapter-num { margin-bottom: .5rem; color: var(--sky); }
.stage-chapter h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 750; letter-spacing: -0.01em; }
.stage-chapter p:last-child { margin-top: .6rem; color: var(--muted); line-height: 1.6; font-size: .98rem; }

/* destination cards */
.card {
  position: absolute; left: 0; top: 0;
  width: 370px;
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(125,211,252,0.22);
  background: var(--glass);
  backdrop-filter: blur(6px);
  color: var(--text); text-decoration: none;
  box-shadow: 0 0 40px rgba(0,180,255,0.15), 0 20px 50px rgba(0,0,0,0.5);
  transition: border-color .25s, box-shadow .25s;
  will-change: transform, opacity;
}
.card:hover, .card:focus-visible {
  border-color: rgba(125,211,252,0.7);
  box-shadow: 0 0 60px rgba(0,180,255,0.35), 0 20px 50px rgba(0,0,0,0.5);
  outline: none;
}
.card-media { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #0a1224; }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s; }
.card:hover .card-media img, .card:hover .card-media video { transform: scale(1.06); }
.card-body { padding: 1rem 1.15rem 1.2rem; }
.card-kicker { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--sky-dim); }
.card-title { font-size: 1.15rem; font-weight: 700; margin-top: .3rem; display: flex; justify-content: space-between; align-items: center; }
.card-title::after { content: "→"; color: var(--sky); transition: transform .2s; }
.card:hover .card-title::after { transform: translateX(4px); }
.card-badge {
  position: absolute; top: .7rem; right: .7rem;
  font-size: .66rem; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 100px;
  background: rgba(2,4,12,0.75); border: 1px solid rgba(255,255,255,0.2); color: var(--muted);
}

/* ---------- Depth rail ---------- */
.rail {
  position: fixed; right: 2rem; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 1.6rem;
  z-index: 200; padding-left: 1px;
}
.rail::before, .rail-fill {
  content: ""; position: absolute; right: 4px; top: 5px; width: 1px;
}
.rail::before { bottom: 5px; background: rgba(255,255,255,0.15); }
.rail-fill { height: 0; background: var(--sky); box-shadow: 0 0 8px var(--sky); transition: height .1s linear; }
.rail button {
  position: relative; z-index: 1;
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.4); background: var(--ink);
  cursor: pointer; align-self: flex-end; transition: background .2s, border-color .2s, transform .2s;
}
.rail button span {
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; opacity: 0; transition: opacity .2s;
}
.rail:hover button span, .rail button.active span { opacity: 1; }
.rail button.active { background: var(--sky); border-color: var(--sky); transform: scale(1.25); }
.rail button:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }

/* ---------- Scroll hint ---------- */
#scroll-hint {
  position: fixed; bottom: 2.2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  z-index: 150; transition: opacity .6s ease;
}
#scroll-hint > span { font-family: var(--mono); font-size: .72rem; color: var(--muted); letter-spacing: .2em; text-transform: uppercase; }
.scroll-arrow {
  width: 22px; height: 22px;
  border-right: 2px solid var(--sky-dim); border-bottom: 2px solid var(--sky-dim);
  transform: rotate(45deg); animation: bounce 1.8s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: rotate(45deg) translateY(0); opacity: .4; }
  50% { transform: rotate(45deg) translateY(6px); opacity: 1; }
}
.skip {
  margin-top: .4rem; background: none; border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: .78rem; padding: .35rem .9rem; border-radius: 100px; cursor: pointer;
  transition: color .2s, border-color .2s;
}
.skip:hover { color: #fff; border-color: var(--sky-dim); }
#scroll-hint.hidden { opacity: 0; pointer-events: none; }

/* ---------- Fade ---------- */
#fade-overlay {
  position: fixed; inset: 0; background: #000; opacity: 0;
  pointer-events: none; z-index: 500; transition: opacity .8s ease;
}
#fade-overlay.active { opacity: 1; pointer-events: all; }

/* ---------- Static mode (reduced motion / no JS fallback) ---------- */
body.static { overflow-y: auto; }
body.static #viewport { position: relative; perspective: none; overflow: visible; padding: 8rem 1.5rem 4rem; }
body.static #world { position: static; width: auto; height: auto; transform: none !important; display: flex; flex-direction: column; align-items: center; gap: 2.5rem; }
body.static .stage, body.static .card { position: relative; transform: none !important; opacity: 1 !important; }
body.static .node, body.static .rail, body.static #scroll-hint { display: none; }
body.static .card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; width: min(1100px, 100%); }
body.static .card { width: auto; }
.static-cards { position: fixed; bottom: 2rem; left: 0; right: 0; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.static-cards a { color: var(--sky); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .card { width: 340px; }
  .rail { right: 1rem; }
}
@media (max-width: 640px) {
  .nav { padding: 1rem 1.25rem; }
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .card { width: 200px; }
  .card-body { padding: .75rem .9rem .9rem; }
  .card-title { font-size: 1rem; }
  .rail button span { display: none; }
  .stage-chapter { padding: 1.2rem 1.3rem; }
}
