/* ══════════════════════════════════════════
   Krishna — Mission Log
   NASA-Prospect-inspired scroll journey
   ══════════════════════════════════════════ */

:root {
  --bg: #05070f;
  --text: #e8ecf4;
  --text-dim: #97a0b5;
  --accent: #6c8cff;
  --accent-2: #a56cff;
  --warning: #ffb84d;
  --ok: #4dd8a0;
  --line: rgba(255, 255, 255, 0.14);
  --gradient: linear-gradient(120deg, var(--accent), var(--accent-2));
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

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

::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #232c4a; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ══════════ STARFIELD (fixed behind everything) ══════════ */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(60, 80, 180, 0.10), transparent),
    var(--bg);
}
.star-layer {
  position: absolute;
  inset: 0;
  will-change: transform;
}
/* stars are 1px box-shadows generated in script.js on a seed dot */
.star-dot {
  position: absolute;
  top: 0; left: 0;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: transparent;
}
#stars1 { animation: drift 240s linear infinite; opacity: 0.9; }
#stars2 { animation: drift 160s linear infinite reverse; opacity: 0.7; }
#stars3 { animation: twinkle 7s ease-in-out infinite alternate; opacity: 0.8; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-60px, -120px, 0); }
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.95; } }

/* Everything above the starfield */
.topbar, .mission-track, main, .hero, .footer { position: relative; z-index: 2; }

/* ══════════ TOP BAR ══════════ */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1.4rem, 5vw, 4rem);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.topbar.scrolled {
  background: rgba(5, 7, 15, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.45);
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.nav-logo span { color: var(--accent); }
.topbar-link {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.25s;
}
.topbar-link:hover { color: var(--accent); }

/* ══════════ MISSION TRACK (right rail) ══════════ */
.mission-track {
  position: fixed;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  height: 62vh;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}
.track-line {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--line) 12%, var(--line) 88%, transparent);
}
.track-dot {
  position: relative;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid var(--text-dim);
  background: var(--bg);
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.track-dot:hover { transform: scale(1.35); }
.track-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(108, 140, 255, 0.8);
}
.track-dot::after {
  content: attr(data-label);
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: var(--text);
  background: rgba(5, 7, 15, 0.85);
  border: 1px solid var(--line);
  padding: 0.15rem 0.7rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.track-dot:hover::after { opacity: 1; }
.track-rocket {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%) rotate(135deg);
  font-size: 1.05rem;
  filter: drop-shadow(0 0 6px rgba(108, 140, 255, 0.7));
  transition: top 0.15s linear;
  z-index: 2;
}

/* ══════════ JOURNEY SECTIONS ══════════ */
.journey-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: clamp(4rem, 8vw, 7rem) clamp(1.5rem, 7vw, 6rem);
  overflow: hidden;
}

.interplanet {
  min-height: 46vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}
.status-type {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 2.2vw, 1.25rem);
  letter-spacing: 0.5em;
  color: var(--text-dim);
  text-align: center;
  padding: 0 1.5rem;
}

/* Chapter layout: text one side, planet the other */
.chapter {
  position: relative;
  z-index: 3;
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.chapter-left  { margin: 0 auto 0 clamp(0rem, 8vw, 8rem); text-align: left; }
.chapter-right { margin: 0 clamp(0rem, 8vw, 8rem) 0 auto; text-align: left; }
.chapter-wide  { max-width: 1050px; }

.chapter-code {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.45em;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.chapter-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6.5vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0.03em;
  margin-bottom: 1.8rem;
  color: var(--text);
}
.warning-type {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  color: var(--warning);
  border: 1px solid rgba(255, 184, 77, 0.4);
  padding: 0.25rem 0.9rem;
  margin-bottom: 1.1rem;
  animation: warnblink 2.6s ease-in-out infinite;
}
@keyframes warnblink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* NASA-style dialogue box */
.dialogue {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.9rem 0.4rem;
  max-width: 560px;
  margin: 0 auto;
}
.chapter-left .dialogue, .chapter-right .dialogue { margin: 0; }
.dialogue p { color: var(--text-dim); font-size: 1.02rem; }
.dialogue strong { color: var(--text); }
.separator {
  width: 46px;
  height: 1px;
  background: var(--gradient);
  margin: 1.4rem auto;
}
.dialogue-left .separator, .chapter-left .separator, .chapter-right .separator { margin-left: 0; }
.important-type {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  letter-spacing: 0.1em;
  line-height: 1.15;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 0.5rem;
}
.sidekick-type { font-size: 0.86rem !important; letter-spacing: 0.08em; opacity: 0.75; }

/* ══════════ PLANETS (pure CSS) ══════════ */
.planet {
  position: absolute;
  border-radius: 50%;
  z-index: 1;
  will-change: transform;
}
.planet-right { right: clamp(-8rem, -2vw, 0rem); top: 50%; margin-top: -19vmin; }
.planet-left  { left:  clamp(-8rem, -2vw, 0rem); top: 50%; margin-top: -19vmin; }

.planet-sun {
  width: 72vmin; height: 72vmin;
  left: 50%; top: -46vmin;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 60%, #fff7d6, #ffd75e 34%, #ff9e3d 62%, #ff6a00 88%);
  box-shadow: 0 0 140px 50px rgba(255, 150, 40, 0.35), 0 0 300px 120px rgba(255, 120, 20, 0.12);
  animation: pulse 7s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 140px 50px rgba(255,150,40,0.35), 0 0 300px 120px rgba(255,120,20,0.12); }
  50%      { box-shadow: 0 0 170px 65px rgba(255,150,40,0.45), 0 0 340px 140px rgba(255,120,20,0.16); }
}

.planet-mercury {
  width: 30vmin; height: 30vmin; margin-top: -15vmin;
  background: radial-gradient(circle at 32% 28%, #cabfae, #8a7f74 52%, #453e36 92%);
  box-shadow: inset -18px -14px 40px rgba(0,0,0,0.55), 0 0 60px 6px rgba(160,150,130,0.12);
}
.planet-venus {
  width: 38vmin; height: 38vmin;
  background: radial-gradient(circle at 34% 30%, #fbe9c0, #dfa95f 50%, #7c4c20 94%);
  box-shadow: inset -20px -16px 50px rgba(60,30,0,0.5), 0 0 70px 10px rgba(230,180,90,0.15);
}
.planet-earth {
  width: 42vmin; height: 42vmin; margin-top: -21vmin;
  background:
    radial-gradient(circle at 62% 34%, rgba(255,255,255,0.45) 0 6%, transparent 12%),
    radial-gradient(circle at 30% 62%, rgba(255,255,255,0.28) 0 4%, transparent 9%),
    radial-gradient(circle at 44% 40%, rgba(90, 200, 120, 0.5) 0 9%, transparent 16%),
    radial-gradient(circle at 34% 30%, #bfe6ff, #3f8fe0 44%, #1c4f9e 72%, #081d46 96%);
  box-shadow: inset -22px -18px 55px rgba(0,0,30,0.6), 0 0 80px 12px rgba(80,150,255,0.2);
}
.planet-mars {
  width: 34vmin; height: 34vmin; margin-top: -17vmin;
  background: radial-gradient(circle at 33% 29%, #f4bd93, #d1603a 48%, #6e2814 94%);
  box-shadow: inset -20px -14px 45px rgba(40,5,0,0.55), 0 0 70px 8px rgba(230,110,60,0.16);
}
.planet-jupiter {
  width: 58vmin; height: 58vmin; margin-top: -29vmin;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.25), transparent 45%),
    repeating-linear-gradient(8deg,
      #d9b98c 0 6%, #b78a5c 6% 11%, #e8d3ae 11% 18%,
      #a2714b 18% 22%, #d9b98c 22% 30%, #c49a6b 30% 37%);
  box-shadow: inset -26px -20px 70px rgba(40,15,0,0.6), 0 0 90px 14px rgba(220,170,110,0.16);
}
.planet-saturn {
  width: 42vmin; height: 42vmin;
  background: radial-gradient(circle at 33% 28%, #f6e3b6, #d9b774 50%, #7c5c2e 94%);
  box-shadow: inset -20px -16px 55px rgba(50,25,0,0.55), 0 0 80px 10px rgba(230,200,130,0.15);
}
.planet-saturn::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 200%; height: 46%;
  transform: translate(-50%, -50%) rotate(-18deg);
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
    transparent 56%,
    rgba(235, 205, 145, 0.9) 58%, rgba(235, 205, 145, 0.25) 63%,
    rgba(200, 170, 110, 0.7) 66%, transparent 71%);
}
.planet-neptune {
  width: 38vmin; height: 38vmin; margin-top: -19vmin;
  background: radial-gradient(circle at 34% 30%, #b8dcff, #3b6fe0 46%, #1b2f8a 74%, #060e35 96%);
  box-shadow: inset -20px -16px 55px rgba(0,0,40,0.6), 0 0 80px 12px rgba(80,120,255,0.18);
}

/* ══════════ HERO / LAUNCH PAD ══════════ */
.hero { justify-content: center; text-align: center; }
.grid-floor {
  position: absolute;
  inset: auto 0 0 0;
  height: 42vh;
  z-index: 1;
  background-image:
    linear-gradient(rgba(108, 140, 255, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 140, 255, 0.15) 1px, transparent 1px);
  background-size: 56px 56px;
  transform: perspective(500px) rotateX(58deg) scale(1.6);
  transform-origin: bottom;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.8), transparent 85%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.8), transparent 85%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 3; max-width: 860px; }
.mission-title {
  font-family: var(--font-display);
  font-size: clamp(5rem, 17vw, 12rem);
  line-height: 0.95;
  letter-spacing: 0.06em;
  background: linear-gradient(120deg, #fff 30%, var(--accent) 70%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero .chapter-code { letter-spacing: 0.4em; }
.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3.6vw, 2.2rem);
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin: 1rem 0 1.2rem;
  min-height: 1.4em;
  font-weight: 400;
}
.hero-subtitle .typing { color: var(--text); }
.cursor { color: var(--accent); animation: blink 0.9s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-desc { color: var(--text-dim); max-width: 560px; margin: 0 auto 2.4rem; }
.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-decoration: none;
  padding: 0.8rem 2.1rem;
  border-radius: 999px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s, border-color 0.25s;
  display: inline-block;
}
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 8px 28px rgba(108, 140, 255, 0.35);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 14px 38px rgba(108, 140, 255, 0.5); }
.btn-ghost {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--accent); background: rgba(108, 140, 255, 0.1); }
.btn-lg { padding: 1rem 2.6rem; font-size: 1.2rem; }

.scroll-hint {
  position: absolute;
  bottom: 2.2rem; left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  opacity: 0.7;
  transition: opacity 0.3s;
}
.scroll-hint:hover { opacity: 1; }
.mouse {
  width: 26px; height: 42px;
  border: 2px solid var(--text-dim);
  border-radius: 14px;
  display: flex; justify-content: center;
  padding-top: 7px;
}
.wheel { width: 3px; height: 8px; background: var(--accent); border-radius: 3px; animation: wheel 1.8s ease-in-out infinite; }
@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ══════════ STATS ══════════ */
.stat-strip { display: flex; gap: 2.8rem; margin-top: 2rem; flex-wrap: wrap; }
.stat { display: block; }
.stat-num, .stat-plus {
  font-family: var(--font-display);
  font-size: 2.6rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.stat-label {
  display: block;
  color: var(--text-dim);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

/* ══════════ MISSION MAP / SYSTEMS ══════════ */
.map-section, .contact-section { justify-content: center; }
.map-section .chapter-title, .contact-section .chapter-title { text-align: center; }
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.3rem;
  margin-top: 1.2rem;
  text-align: left;
}
.system-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.6rem 1.5rem 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.system-card:hover { transform: translateY(-5px); border-color: rgba(108, 140, 255, 0.45); }
.system-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: 0.16em;
  margin-bottom: 0.5rem;
}
.system-card p { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 0.9rem; }
.system-status {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  color: var(--ok);
}

/* ══════════ CONTACT ══════════ */
.contact-inner { text-align: center; }
.contact-lead { color: var(--text-dim); max-width: 540px; margin: -0.6rem auto 2.4rem; }
.socials { display: flex; justify-content: center; gap: 2rem; margin-top: 2.6rem; }
.socials a {
  font-family: var(--font-display);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: 0.22em;
  transition: color 0.25s, transform 0.25s;
}
.socials a:hover { color: var(--accent); transform: translateY(-2px); }

/* ══════════ FOOTER ══════════ */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  border-top: 1px solid var(--line);
}

/* ══════════ STARDUST TRAIL ══════════ */
#stardust { position: fixed; inset: 0; z-index: 99; pointer-events: none; }

/* ══════════ REVEAL ══════════ */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.systems-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.systems-grid .reveal:nth-child(3) { transition-delay: 0.16s; }
.systems-grid .reveal:nth-child(4) { transition-delay: 0.08s; }
.systems-grid .reveal:nth-child(5) { transition-delay: 0.16s; }
.systems-grid .reveal:nth-child(6) { transition-delay: 0.24s; }

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 900px) {
  .mission-track { display: none; }
  .chapter-left, .chapter-right { margin: 0 auto; text-align: center; }
  .chapter-left .dialogue, .chapter-right .dialogue { margin: 0 auto; }
  .dialogue-left .separator, .chapter-left .separator, .chapter-right .separator { margin-left: auto; }
  .planet-left, .planet-right {
    opacity: 0.34;
    left: 50%; right: auto;
    transform: translateX(-50%);
  }
  .stat-strip { justify-content: center; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .planet, .grid-floor { transform: none !important; }
  .planet-sun { transform: translateX(-50%) !important; }
}
