/* ============================================================
   Solar System — sections.css
   ------------------------------------------------------------
   Visual system for the multi-section landing + Explorer mode, built
   on the shared fixed cosmic field (main.css) and the glass/pill/orrery
   primitives (components.css). Seven sections, each one floating glass
   .panel card, ~96–120px vertical rhythm, generous negative space.

   Kept hooks (consumed by js/sections.js, js/explorer.js, js/reveal.js):
     .scroll .topbar .section(+--*) .section__card .reveal
     .scroll-cue .sun-feature .sun-visual .readout  body.is-exploring
   ============================================================ */

/* ── reveal (JS adds .is-visible as elements enter view) ──
   Gated on html.js (set by an inline script in index.html) so that
   with JavaScript disabled nothing is hidden — the no-JS baseline. */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ── fixed nav — a restrained 2-zone glass pill (brand · links) ──
   supports the map, never competes with it. ── */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 30; padding: 14px var(--pad); }
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 9px 10px 9px 18px; border-radius: var(--r-pill);
  background: linear-gradient(150deg, rgba(18,65,74,.4), rgba(8,17,15,.56));
  border: 1px solid var(--glass-brd); box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
}
.topbar .nav__links a[aria-current] {
  color: var(--text-hi); background: rgba(255,255,255,.07); font-weight: 600;
}
/* five nav items plus the brand can exceed the pill just above the mobile
   breakpoint; wrapping is always preferable to spilling out of the rounded edge */
.topbar__inner { flex-wrap: wrap; row-gap: 6px; }

/* ── section scaffold ── */
.scroll { display: block; }
.section {
  position: relative; z-index: 0; /* local stacking context for the ambient glows below */
  min-height: 100vh; min-height: 100svh; scroll-margin-top: 84px;
  display: grid; place-items: center;
  padding: var(--space-section-y) var(--pad) clamp(64px, 9vh, 110px);
}
.section--intro { padding-top: clamp(116px, 17vh, 210px); }
.section__card { position: relative; }
.section__card--bare { background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; text-align: center; }

.section__head { margin-bottom: clamp(20px, 3vw, 34px); max-width: 60ch; }
.section__title { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -.02em; }
.section__lead { margin-top: 14px; color: var(--text-mid); font-size: clamp(1rem, 1.2vw, 1.14rem); max-width: 56ch; }

/* ── 1 · Intro — the strongest focal point on the page ── */
.section--intro::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  /* Earth-blue glow at the top echoes the planet we just arrived at — a colour
     callback that eases the cinematic-intro → content hand-off — over the teal. */
  background:
    radial-gradient(42vw 34vw at 50% -8%, rgba(74,159,216,.14), transparent 60%),
    radial-gradient(46vw 46vw at 26% 30%, rgba(30,110,126,.16), transparent 68%);
}
.section--intro .section__card { max-width: min(960px, 100%); }
/* the page's one unmistakable focal peak — the system's own big-display
   voice (cf. the journey watermark) turned up: larger ceiling, tighter
   confident tracking + leading. No new colour; emphasis is size + weight. */
.intro__title { font-size: clamp(2.9rem, 8.4vw, 6rem); letter-spacing: -.04em; line-height: .94; margin-top: 12px; }
.intro__title .accent { color: var(--accent); }
.intro__lead { margin-top: 22px; color: var(--text-mid); font-size: clamp(1.02rem, 1.4vw, 1.24rem); max-width: 58ch; }
.intro__actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }

/* (The old #warp "transition" section was removed — its cinematic bridge
   role is now handled by the scroll-scrubbed intro beat in css/journey.css.) */

/* ── 3 · Main menu (hero + orrery) — spacing/rhythm only; the
   .hero/.orrery/.readout primitives themselves live in components.css ── */
.section--menu .selector { margin-top: clamp(20px, 4vh, 40px); }
/* the no-JS primary CTA jumps to #planets; clear the fixed topbar like .section does */
#planets { scroll-margin-top: 84px; }

/* Simplify the explore model to Orbit + arrows: with JS on, drop the
   "The eight planets" heading + duplicate link list. The list stays in the
   DOM as the no-JS / screen-reader path to planet pages (the orbit links are
   JS-injected, so without JS this is the ONLY way in) — only its visual
   duplication goes. The .selector footer itself remains so its NASA
   source-tag keeps crediting the data beneath the map. */
.js .section--menu .selector__label,
.js .section--menu .selector__list { display: none; }
.js .section--menu .selector { border-top: 0; padding-top: 0; margin-top: clamp(12px, 2vh, 20px); }

/* ── 4 · The Sun ── */
.section--sun::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(42vw 42vw at 76% 28%, rgba(245,185,66,.09), transparent 70%);
}
.sun-feature { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); gap: var(--space-stack-lg); align-items: center; }
.sun-feature__figure { display: grid; place-items: center; }
.sun-feature__data { display: grid; gap: 18px; }
.section--sun .dash-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }

/* Sun — layered plasma sphere: a real texture (assets/textures/sun.jpg)
   under two independent, slow, low-opacity granulation passes (CSS
   gradients only — no images required, no filters). Same graceful
   fallback pattern as .planet-orb: if the .jpg is absent, that layer is
   simply transparent and the gradient sphere underneath still reads as
   a convincing Sun. Perfectly circular at every size (aspect-ratio: 1). */
.sun-visual {
  --tex: url("../assets/textures/sun.jpg");
  position: relative; width: min(66%, 340px); aspect-ratio: 1; border-radius: 50%; isolation: isolate;
}
.sun-visual__core {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  background-image:
    var(--tex),
    radial-gradient(circle at 40% 35%, #fffaf0 0%, #ffe6ad 12%, var(--accent) 42%, var(--accent-warm) 74%, #8a4310 100%);
  background-size: cover, auto;
  background-position: center, 0 0;
  background-repeat: no-repeat, no-repeat;
  box-shadow:
    0 0 50px 10px rgba(245,185,66,.38),
    0 0 130px 34px rgba(255,155,61,.2),
    inset 0 0 54px 10px rgba(138,67,16,.4);
  animation: sun-breathe 10s ease-in-out infinite;
}
.sun-visual__core::before,
.sun-visual__core::after {
  content: ""; position: absolute; inset: -12%; border-radius: 50%;
  mix-blend-mode: overlay; pointer-events: none; background-repeat: repeat;
}
.sun-visual__core::before {
  background-image:
    radial-gradient(circle, rgba(255,255,255,.55) 0 10%, transparent 11%),
    radial-gradient(circle, rgba(255,255,255,.38) 0 8%, transparent 9%);
  background-size: 22% 22%, 15% 15%;
  background-position: 0 0, 12% 40%;
  opacity: .38;
  animation: sun-drift-a 34s linear infinite;
}
.sun-visual__core::after {
  background-image: radial-gradient(circle, rgba(120,50,10,.6) 0 9%, transparent 10%);
  background-size: 27% 27%;
  opacity: .28;
  mix-blend-mode: multiply;
  animation: sun-drift-b 48s linear infinite reverse;
}
@keyframes sun-breathe {
  0%, 100% { box-shadow: 0 0 50px 10px rgba(245,185,66,.38), 0 0 130px 34px rgba(255,155,61,.2), inset 0 0 54px 10px rgba(138,67,16,.4); }
  50%      { box-shadow: 0 0 64px 15px rgba(245,185,66,.48), 0 0 152px 40px rgba(255,155,61,.26), inset 0 0 54px 10px rgba(138,67,16,.4); }
}
@keyframes sun-drift-a { to { background-position: 100% 30%, -20% 140%; } }
@keyframes sun-drift-b { to { background-position: 130% 70%; } }

/* ── 5 · System statistics ── */
.section--stats .dash-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.section--stats .dash-grid .stat__value { font-size: clamp(1.7rem, 2.6vw, 2.3rem); }

/* ── 6 · Missions ── */
.section--missions .mission-list { gap: 12px; }

/* ── 7 · Conclusion — calm, centred, intimate measure ── */
.section--outro .section__card { max-width: min(820px, 100%); text-align: center; }
.section--outro .section__lead { margin-inline: auto; }
.section--outro .intro__actions { justify-content: center; }
.section--outro .source-tag { justify-content: center; margin-top: 6px; }

/* ── scroll cue ── */
.scroll-cue { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); width: 26px; height: 42px; border: 1px solid var(--glass-brd-strong); border-radius: 999px; display: grid; justify-items: center; padding-top: 7px; transition: border-color .25s var(--ease), opacity .25s var(--ease); }
.scroll-cue:hover { border-color: var(--accent); }
.scroll-cue__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-mid); animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) { .scroll-cue__dot { animation: none; opacity: .8; } }

@media (max-width: 820px) {
  .sun-feature { grid-template-columns: 1fr; }
  .sun-feature__figure { order: -1; }
  .sun-visual { width: min(56%, 260px); }
}
@media (max-width: 460px) {
  .section { padding-inline: 10px; }
  body.is-exploring .readout { padding: 16px 18px; }
}

/* ============================================================
   Explorer mode — the map goes full-viewport and dominant; the
   surrounding chrome recedes. body.is-exploring is toggled by
   js/explorer.js. Non-essential chrome (topbar, every other section,
   the intro lede/selector) is removed from layout AND the a11y tree via
   display:none — instant, and the correct choice for focus/tab-order.
   Two things get an authored motion instead of an instant cut:
     • the orrery grows via its own typed --size custom property
       (registered in main.css) — width/height simply read it, so it
       stays perfectly square through the whole animation;
     • the menu card sheds its glass framing via ordinary transitionable
       properties (padding/radius/shadow/blur).
   The explorer panel gets a real enter/exit motion too: modern browsers
   animate display via `allow-discrete` + @starting-style; browsers
   without that support get the same instant, fully functional show/hide
   as a safe fallback — nothing here depends on the enhancement working.
   ============================================================ */
body.is-exploring { overflow: hidden; }
/* .journey is hidden too: it is not a .section, and its sticky stage would
   otherwise stay pinned at the viewport top and bleed the Earth hero through
   the Explorer overlay's semi-transparent field. */
body.is-exploring .journey,
body.is-exploring .topbar,
body.is-exploring .section:not(.section--menu),
body.is-exploring .scroll-cue,
body.is-exploring .section--menu .hero__lede,
body.is-exploring .section--menu .selector { display: none; }

body.is-exploring .section--menu {
  position: fixed; inset: 0; min-height: 0; padding: 0; z-index: 40;
}
.section--menu > .section__card {
  transition: padding .5s var(--ease), border-radius .5s var(--ease),
    box-shadow .5s var(--ease), backdrop-filter .5s var(--ease);
}
body.is-exploring .section--menu > .section__card {
  max-width: none; width: 100%; height: 100%; margin: 0; border: 0; border-radius: 0;
  background: radial-gradient(120% 120% at 50% 40%, rgba(10,30,38,.4), rgba(8,17,15,.72));
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  display: grid; place-items: center; padding: clamp(20px, 4vw, 48px);
}
body.is-exploring .hero { display: grid; grid-template-columns: 1fr; place-items: center; }
body.is-exploring .hero__orrery { width: 100%; }
body.is-exploring .orrery { --size: min(84vmin, 720px); margin-inline: auto; }

/* Explorer mode: the ONE shared preview panel (#readout) detaches from the
   orrery corner and anchors to the bottom-LEFT of the viewport — deliberately
   off the centre so the map and its planets stay clear. Combined with the
   panel's pointer-events:none (components.css), it reads as an informational
   overlay, never an obstacle between the visitor and the next planet. Only
   left/bottom/width change; the glass is inherited from .readout. */
body.is-exploring .readout {
  position: fixed; left: clamp(16px, 3vw, 32px); top: auto; right: auto;
  bottom: calc(clamp(16px, 4vh, 40px) + env(safe-area-inset-bottom, 0px));
  width: min(360px, calc(100vw - 32px)); z-index: 42;
  transform: none;
  transition: opacity .35s var(--ease), transform .35s var(--ease),
    box-shadow .3s var(--ease), border-color .3s var(--ease);
}
