/* =====================================================================
   style.css — LOOK & FEEL
   WHY:  CSS variables (--name) hold colours in one place, so the
         dark/light theme is just swapping variable values.
   FLOW: index.html links this in <head>; main.js changes
         data-theme on <html> → the [data-theme="light"] block applies.
   ===================================================================== */

/* ---------- 1. Theme colours ---------- */
:root {
  --bg: #090b12;          /* page background (deep space) */
  --bg2: #141826;         /* cards */
  --text: #f2f4fa;
  --muted: #b3bccf;       /* contrast ≈ 9:1 on --bg */
  --accent: #ff8a3d;      /* orange (same as the rest of the site) */
  --accent2: #c8a8ff;
  --border: #2a3248;
  --radius: 14px;
}
[data-theme="light"] {
  --bg: #f4f6fc;
  --bg2: #ffffff;
  --text: #121a33;
  --muted: #47506b;
  --accent: #b35c00;      /* darker orange so text on white stays readable */
  --accent2: #1d4fc4;
  --border: rgba(0,0,0,.12);
}
/* Canvas stays dark even in light mode — space is dark! */

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }               /* width includes padding → easier layout */
html { scroll-behavior: smooth; }           /* nav links glide instead of jump */
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .3s, color .3s;   /* smooth theme switch */
}
h1, h2, h3 { line-height: 1.2; }
a { color: var(--accent2); }
section { max-width: 1100px; margin: 0 auto; padding: 64px 20px; }
.hint { color: var(--muted); margin-top: -6px; }

/* keyboard focus ring — visible outline for Tab users */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--accent); color: #000; padding: 8px 12px; z-index: 99; }

/* ---------- 3. Buttons ---------- */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  background: var(--accent); color: #1a1000; font-weight: 600;
  padding: 12px 22px; border-radius: 999px; text-decoration: none;
  font-size: 1rem; transition: transform .15s, box-shadow .15s;
}
[data-theme="light"] .btn { color: #fff; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(255,181,46,.35); }
.btn.small { padding: 8px 14px; font-size: .9rem; }

/* ---------- 4. Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;            /* stays on top while scrolling */
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);                        /* frosted glass effect */
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
nav { display: flex; align-items: center; gap: 18px; }
nav a { color: var(--text); text-decoration: none; }
nav a:hover { color: var(--accent); }
.menu-btn { display: none; background: none; border: 0; color: var(--text); font-size: 1.6rem; cursor: pointer; }

/* ---------- 5. Hero ---------- */
.hero { text-align: center; padding: 110px 20px 70px; }
.hero h1 {
  font-size: clamp(2.4rem, 7vw, 4.5rem);   /* clamp = auto size between phone and desktop */
  margin: 0 0 12px;
  background: linear-gradient(105deg, #ff8a3d, #f0457a 50%, #9b4dff);
  -webkit-background-clip: text; background-clip: text; color: transparent;  /* gradient text */
}
.hero h1 span { display: block; font-size: .45em; }
.hero p { max-width: 620px; margin: 0 auto 28px; color: var(--muted); font-size: 1.1rem; }

/* ---------- 6. Explorer (canvas + info panel) ---------- */
.explorer-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.canvas-wrap {
  height: 560px; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(circle at center, #111a3d, #03050d);
  border: 1px solid var(--border);
}
canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.info {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.info.show { animation: fadeIn .4s ease; }          /* re-plays on every new planet */
.info-head { display: flex; align-items: center; gap: 12px; }
.info-head h3 { font-size: 1.6rem; margin: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.fun { border-left: 3px solid var(--accent); padding-left: 10px; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 18px 0 10px; }
input[type="range"] { accent-color: var(--accent); width: 160px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--bg2); color: var(--text);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: .95rem;
}
.chip::before {                                     /* coloured dot = planet colour from main.js */
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--dot); margin-right: 6px;
}
.chip.active, .chip:hover { border-color: var(--accent); }

/* ---------- 7. Video ---------- */
video { width: 100%; max-width: 760px; border-radius: var(--radius); border: 1px solid var(--border); background: #000; }

/* ---------- 8. Quiz ---------- */
.quiz-box { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 640px; }
.quiz-progress { color: var(--muted); margin: 0; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quiz-opt {
  padding: 12px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer; font-size: 1rem;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--accent); }
.quiz-opt.right { background: #1f7a3a; color: #fff; border-color: #1f7a3a; }
.quiz-opt.wrong { background: #a52a2a; color: #fff; border-color: #a52a2a; }

.elements li { margin-bottom: 4px; }

/* ---------- 9. Footer ---------- */
footer { text-align: center; padding: 40px 20px; border-top: 1px solid var(--border); color: var(--muted); }
footer strong { color: var(--text); }
.watermark { opacity: .9; }
.small { font-size: .85rem; }

/* ---------- 10. Animations ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s, transform .7s; }
.reveal.visible { opacity: 1; transform: none; }   /* main.js adds .visible on scroll */
@media (prefers-reduced-motion: reduce) {           /* respect users who turn off motion */
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- 11. Mobile (responsive) ---------- */
@media (max-width: 800px) {
  .explorer-grid { grid-template-columns: 1fr; }   /* panel goes below canvas */
  .canvas-wrap { height: 380px; }
  .menu-btn { display: block; }
  nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; padding: 16px; background: var(--bg2); border-bottom: 1px solid var(--border);
  }
  nav.open { display: flex; }                       /* main.js toggles .open */
  .quiz-options { grid-template-columns: 1fr; }
}
