/* ════════════════════════════════════════════════════════════════
   CosmosVerse — Shared Design System
   ════════════════════════════════════════════════════════════════ */

:root {
  --bg: #020308;
  --bg-2: #050a18;
  --bg-3: #07101e;
  --border: rgba(80, 160, 240, 0.14);
  --border-strong: rgba(80, 160, 240, 0.28);
  --accent: #7dd3fc;
  --accent-warm: #fbbf24;
  --text: #e2ecf7;
  --text-dim: rgba(180, 200, 230, 0.62);
  --text-faint: rgba(120, 160, 210, 0.4);
  --serif: 'Fraunces', 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Courier New', monospace;
}

body.chapter-solar    { --accent: #7dd3fc; }
body.chapter-blackhole{ --accent: #c084fc; }
body.chapter-galaxy   { --accent: #f0abfc; }
body.chapter-timeline { --accent: #fbbf24; }
body.chapter-stars    { --accent: #fb923c; }
body.chapter-exo      { --accent: #86efac; }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-weight: 300;
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(40, 80, 180, 0.08), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(120, 40, 180, 0.06), transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(20, 40, 100, 0.04), transparent 70%);
  z-index: -1;
  pointer-events: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; color: inherit; cursor: pointer; }

/* NAV */
nav.cv-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(2, 3, 8, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.cv-logo {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: 0.5px;
  color: var(--text);
  flex-shrink: 0;
}
.cv-logo span { color: var(--accent); }
.cv-nav-links {
  display: flex;
  gap: 22px;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.cv-nav-links a {
  color: var(--text-dim);
  transition: color 0.2s;
  white-space: nowrap;
}
.cv-nav-links a:hover { color: var(--accent); }
.cv-nav-links a.active { color: var(--accent); }
.cv-menu-toggle {
  display: none;
  width: 28px;
  height: 22px;
  position: relative;
  cursor: pointer;
  background: none;
  border: none;
}
.cv-menu-toggle span {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: var(--text);
  transition: all 0.3s;
}
.cv-menu-toggle span:nth-child(1) { top: 4px; }
.cv-menu-toggle span:nth-child(2) { top: 11px; }
.cv-menu-toggle span:nth-child(3) { top: 18px; }
body.menu-open .cv-menu-toggle span:nth-child(1) { top: 11px; transform: rotate(45deg); }
body.menu-open .cv-menu-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .cv-menu-toggle span:nth-child(3) { top: 11px; transform: rotate(-45deg); }

@media (max-width: 960px) {
  nav.cv-nav { padding: 14px 18px; }
  .cv-menu-toggle { display: block; }
  .cv-nav-links {
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    flex-direction: column;
    gap: 24px;
    align-items: center;
    justify-content: center;
    background: rgba(2, 3, 8, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    font-size: 14px;
    letter-spacing: 3px;
  }
  body.menu-open .cv-nav-links { opacity: 1; pointer-events: auto; }
}

/* HERO */
.hero {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 120px 24px 80px;
  text-align: center;
  position: relative;
}
.hero-eyebrow {
  font-size: 10px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeUp 0.8s 0.2s forwards;
}
.hero-eyebrow::before, .hero-eyebrow::after {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--accent);
  vertical-align: middle;
  margin: 0 16px;
  opacity: 0.6;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(44px, 8vw, 110px);
  line-height: 1.0;
  letter-spacing: -0.02em;
  max-width: 1000px;
  color: var(--text);
  opacity: 0;
  animation: fadeUp 1s 0.4s forwards;
}
.hero h1 .accent {
  font-style: normal;
  color: var(--accent);
  font-weight: 500;
}
.hero-sub {
  margin-top: 32px;
  max-width: 580px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.85;
  letter-spacing: 0.3px;
  opacity: 0;
  animation: fadeUp 1s 0.7s forwards;
}
.hero-scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-faint);
  opacity: 0;
  animation: fadeUp 1s 1s forwards, bob 2.4s 1.5s infinite;
  cursor: pointer;
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(6px); } }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* SECTION HEADERS */
.section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.section-label::before {
  content: '';
  display: inline-block;
  width: 22px; height: 1px;
  background: var(--accent);
  opacity: 0.5;
}
.section-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--text);
  max-width: 760px;
}
.section-title .accent { color: var(--accent); font-style: normal; font-weight: 500; }
.section-desc {
  margin-top: 22px;
  font-size: 13px;
  color: var(--text-dim);
  max-width: 580px;
  line-height: 1.85;
}

/* CANVAS FRAME */
.canvas-frame {
  position: relative;
  width: 100%;
  height: min(82vh, 760px);
  min-height: 540px;
  background: #010308;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 30, 60, 0.5), inset 0 0 0 1px rgba(125, 211, 252, 0.04);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.canvas-frame:active { cursor: grabbing; }
.canvas-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(125,211,252,0.05) 0%, transparent 12%, transparent 88%, rgba(125,211,252,0.05) 100%);
  z-index: 4;
}
.canvas-frame canvas { display: block; width: 100%; height: 100%; }

.hud-corner {
  position: absolute;
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.45);
  pointer-events: none;
  z-index: 6;
}
.hud-tl { top: 18px; left: 22px; }
.hud-tr { top: 18px; right: 22px; text-align: right; color: var(--text-faint); }
.hud-bl { bottom: 18px; left: 22px; color: var(--text-faint); }
.hud-br { bottom: 18px; right: 22px; color: var(--text-faint); }

/* INFO PANEL */
.info-panel {
  position: absolute;
  right: -340px;
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  background: rgba(1, 4, 16, 0.96);
  border: 1px solid rgba(80, 160, 240, 0.22);
  border-radius: 12px;
  padding: 22px 20px 20px;
  color: #c5dbf2;
  transition: right 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 20;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.info-panel.open { right: 16px; }
.info-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 24px;
  color: var(--accent);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  line-height: 1.1;
}
.info-type {
  font-size: 9px;
  color: rgba(100, 160, 220, 0.55);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(60, 130, 200, 0.14);
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 10.5px;
  border-bottom: 1px solid rgba(60, 130, 200, 0.08);
}
.stat-label { color: rgba(130, 170, 220, 0.65); }
.stat-value { color: #cfe1f5; font-weight: 400; }
.info-fact {
  margin-top: 14px;
  font-size: 11px;
  color: rgba(100, 180, 240, 0.62);
  line-height: 1.8;
  font-style: italic;
}
.info-close {
  position: absolute;
  top: 10px; right: 12px;
  color: rgba(100, 150, 210, 0.4);
  font-size: 13px;
  padding: 4px;
  line-height: 1;
}
.info-close:hover { color: var(--accent); }

.item-list {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 10;
}
.item-btn {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.28);
  padding: 4px 10px 4px 11px;
  border-left: 1.5px solid transparent;
  text-align: left;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
}
.item-btn:hover { color: rgba(125, 211, 252, 0.7); border-left-color: rgba(125, 211, 252, 0.3); }
.item-btn.active { color: var(--accent); border-left-color: var(--accent); }

.tooltip {
  position: absolute;
  background: rgba(1, 8, 28, 0.92);
  border: 1px solid rgba(80, 160, 240, 0.3);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 30;
  white-space: nowrap;
}

/* CARDS */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.cv-card {
  background: linear-gradient(180deg, rgba(15, 25, 50, 0.4), rgba(8, 14, 30, 0.4));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px 24px 28px;
  position: relative;
  transition: all 0.3s;
  overflow: hidden;
  display: block;
}
.cv-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
}
.cv-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.cv-card:hover::before { opacity: 0.6; }
.cv-card.featured {
  border-color: rgba(125, 211, 252, 0.3);
  background: linear-gradient(180deg, rgba(20, 40, 80, 0.4), rgba(8, 14, 30, 0.4));
}
.cv-card.featured::before { opacity: 0.4; }
.card-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 14px;
  letter-spacing: 1px;
}
.card-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  color: var(--text);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.card-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.75;
  margin-bottom: 16px;
}
.card-tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.card-tag.live {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(125, 211, 252, 0.05);
  opacity: 0.9;
}

/* PAGE CONTAINER */
.chapter-page {
  padding: 90px 24px 60px;
  max-width: 1320px;
  margin: 0 auto;
}
.chapter-header {
  text-align: center;
  margin-bottom: 36px;
  padding-top: 24px;
}
.chapter-header .section-label { justify-content: center; }
.chapter-header .section-title { margin: 0 auto; }
.chapter-header .section-desc { margin: 22px auto 0; }

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 60px 24px;
  max-width: 1200px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  gap: 24px;
}
.chapter-nav-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.3s;
  min-width: 200px;
}
.chapter-nav-link:hover {
  border-color: var(--border-strong);
  background: rgba(125, 211, 252, 0.03);
}
.chapter-nav-link .small {
  font-size: 9px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.chapter-nav-link .big {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--accent);
}
.chapter-nav-link.next { text-align: right; }
.chapter-nav-link.disabled { opacity: 0.3; pointer-events: none; }

/* FOOTER */
footer.cv-footer {
  border-top: 1px solid var(--border);
  padding: 40px 32px;
  text-align: center;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 40px;
}
.cv-footer .credit {
  font-family: var(--serif);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.5px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.cv-footer .credit span { color: var(--accent); }

@media (max-width: 720px) {
  .canvas-frame { height: 70vh; min-height: 480px; border-radius: 10px; }
  .info-panel { width: calc(100% - 32px); max-width: 280px; }
  .item-list { left: 10px; }
  .item-btn { font-size: 8.5px; padding: 3px 8px; }
  .hud-corner { font-size: 8px; }
  .chapter-page { padding: 80px 16px 40px; }
  .chapter-nav { flex-direction: column; padding: 40px 16px; }
  .chapter-nav-link { width: 100%; }
}
