/* Explore an Elliptic Curve: structure of the page (layout, spacing, states). Loaded after
   film.css (tokens, fonts, label styles). The visual theme stays minimal on purpose:
   brand/brand.css maps its look onto these class names.
   Stage left (sticky, always 16:9), reading column right; stacked below 900 px. */
html, body { height: auto; min-height: 100%; }
body.explore-page {
  background: var(--surface-low); color: var(--text);
  font: 400 17px/1.68 "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 20; padding: 6px 12px; background: var(--surface); color: var(--text); }
.skip-link:focus { left: 8px; }

.layout { display: grid; grid-template-columns: minmax(0, 64fr) minmax(0, 36fr); }

/* ---- stage */
.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; padding: 0 0 0 1vw;
  /* the canvas colour, fading into the page on the reading side: the animation has no visible edge */
  background: linear-gradient(90deg, #070B16 0 88%, transparent);
}
.stage-inner { width: min(100%, calc((100svh - 64px) * 16 / 9)); display: flow-root; }
.film.player { height: auto; aspect-ratio: 16 / 9; }
.film.player:focus-visible { outline: 1px solid var(--silver); outline-offset: 2px; }
.controls { display: flex; align-items: center; gap: 6px; margin-top: 12px; min-height: 32px; }
.control {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border-radius: 50%;
  border: 1px solid var(--outline); background: transparent; color: var(--silver); cursor: pointer;
}
.control svg { fill: currentColor; }
.control:hover { color: var(--text); border-color: var(--text-dim); }
.control:focus-visible, .chapter-tab:focus-visible, .index a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.control:disabled { opacity: .3; cursor: default; }
.control-play .icon-play { display: none; }
.control-play.is-paused .icon-play { display: inline; }
.control-play.is-paused .icon-pause { display: none; }
.chapter-tabs { flex: 1; display: flex; align-items: center; gap: 4px; margin-left: 8px; min-width: 0; }
.chapter-name, .chapter-tab {
  font: 500 11px "Inter", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--text-dim);
  white-space: nowrap;
}
.chapter-tab { padding: 6px 10px; border: 0; border-bottom: 1px solid transparent; background: none; cursor: pointer; }
.chapter-tab + .chapter-tab::before { content: "·"; margin: 0 10px 0 -14px; color: var(--outline); }
.chapter-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--silver); }

/* ---- reading column */
.reading { padding: 6vh 4.5vw 45vh 2vw; outline: none; }
.page-title {
  margin: 0 0 .9em; font: 600 clamp(30px, 2.9vw, 46px) / 1.12 "Cinzel", serif; letter-spacing: .03em; text-wrap: balance;
}
.phase { max-width: 34em; min-height: 72vh; padding-bottom: calc(8vh + 3em); scroll-margin-top: 8vh; opacity: .5; transition: opacity .45s ease; }
.phase.is-active, .phase:focus-within { opacity: 1; }
.phase-intro { min-height: 60vh; padding-top: 6vh; scroll-margin-top: 0; }
.prose h2 { margin: 0 0 .7em; font: 500 clamp(24px, 2vw, 31px) / 1.2 "Cinzel", serif; letter-spacing: .03em; text-wrap: balance; }
.prose h2.math { font-family: "Inter", sans-serif; font-weight: 400; letter-spacing: .01em; }
.prose h3 { margin: 1.6em 0 .4em; font: 600 1em "Inter", sans-serif; }
.prose p, .prose ul { margin: 0 0 1.05em; }
.prose ul { padding-left: 1.2em; }
.prose strong { font-weight: 600; }
.prose a, .contents a, .pager a, .fork a { color: inherit; text-underline-offset: 3px; }
.prose .aside { font-size: .93em; color: var(--text-dim); padding-left: 1em; border-left: 1px solid var(--outline); }
/* Equations: Unicode math in a serif; STIX Two when the reader has it. */
.prose .eq, .prose .m { font-family: "STIX Two Text", "STIX Two Math", "Cambria Math", Cambria, Georgia, serif; }
.prose .eq { display: block; margin: 1.1em 0 1.3em; text-align: center; font-size: 1.32em; line-height: 1.4; }
.prose .m { font-size: 1.1em; white-space: nowrap; }
.prose .c-teal { color: var(--teal); } .prose .c-violet { color: var(--violet); } .prose .c-sky { color: var(--sky); }
.prose .c-silver { color: var(--silver); } .prose .c-amber { color: var(--amber); }

.contents { list-style: none; margin: 1.6em 0 0; padding: 0; font-size: .95em; }
.contents li { padding: .15em 0; }
.contents-badge { margin-left: .6em; font-size: .82em; color: var(--text-dim); }
/* (brand review) no repeated "Inside the calculation" suffix in the side index; the badge on the section marks it */
.fork { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2.2em 0 0; }
.fork-option { display: block; padding: 14px 16px; border: 1px solid var(--outline); border-radius: 12px; text-decoration: none; }
.fork-option:hover, .fork-option:focus-visible { border-color: var(--text-dim); outline: none; }
.fork-label { display: block; font-weight: 600; }
.fork-note { display: block; font-size: .88em; color: var(--text-dim); }
.pager { display: flex; justify-content: space-between; gap: 1em; margin-top: 2.2em; font-size: .88em; color: var(--text-dim); }
.pager-next { margin-left: auto; text-align: right; }

/* ---- phase index: a quiet rail of marks; names show on hover and focus */
.index { position: fixed; right: 14px; top: 50%; transform: translateY(-50%); z-index: 4; }
.index ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
/* the moons, the track and the hover labels: brand.css (.ex-rail.ex-rail--marks) */
.index ul { gap: 2px; }

/* ---- narrow: stage on top (sticky, 16:9), text scrolls below */
@media (max-width: 899px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .stage { height: auto; padding: 0; display: block; z-index: 5; background: var(--selune-sys-color-surface, #070B16); }
  .stage-inner { width: 100%; }
  .controls { margin: 0; padding: 6px 12px 8px; }
  .reading { padding: 8px 20px 55vh; }
  .phase-intro { padding-top: 20px; }
  .page-title { font-size: 28px; }
  .phase { min-height: 60vh; scroll-margin-top: calc(var(--stage-h, 300px) + 16px); }
  .fork { grid-template-columns: 1fr; }
  .index { display: none; }
  .reading .ex-closing { min-height: 80vh; scroll-margin-top: calc(var(--stage-h, 300px) + 16px); }
}
@media (prefers-reduced-motion: reduce) { .phase { transition: none; } }
/* captions: the chapter's name already sits under the stage, so the small label above the title goes (no eyebrows) */
.explore-page .cap-kicker { display: none; }
.ex-closing { max-width: 34em; min-height: 60vh; scroll-margin-top: 8vh; }
/* the masthead lives in the reading column: a smaller emblem and title than the brand default */
.page-header.ex-masthead { gap: 22px; margin-bottom: 56px; }
.page-header .ex-emblem { width: clamp(72px, 6.2vw, 108px); }
.page-title.ex-display { margin: 0; font-size: clamp(28px, 2.6vw, 42px); }
/* the way to the Wonder page: a quiet pill under the title, the Silverfire icon and one word */
.ex-mast-text { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; min-width: 0; }
.wonder-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 4px 16px 4px 5px; border: 1px solid var(--outline); border-radius: 999px;
  background: rgba(14, 22, 40, .55); color: var(--text-dim); text-decoration: none;
  font: 500 12px/1 "Inter", sans-serif; letter-spacing: .16em; text-transform: uppercase;
  transition: border-color .16s ease;
}
.wonder-btn img { display: block; width: 28px; height: 28px; border-radius: 50%; }
.wonder-btn:hover { color: var(--text); border-color: var(--text-dim); background: rgba(20, 30, 54, .7); }
.wonder-btn:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }

/* restrained top-of-reading-column navigation & theme switch */
.ex-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: 34em;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--outline);
  font: 500 12.5px/1.3 "Inter", system-ui, sans-serif;
  letter-spacing: .02em;
  color: var(--text-dim);
}
.ex-crumb {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ex-crumb a {
  color: var(--text);
  text-decoration: none;
}
.ex-crumb a:hover, .ex-crumb a:focus-visible {
  color: var(--sky);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ex-crumb-sep { color: var(--outline); user-select: none; }
.ex-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--outline);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 500 12px/1 "Inter", system-ui, sans-serif;
  letter-spacing: .03em;
  cursor: pointer;
  transition: border-color .16s ease;
}
.ex-theme-btn:hover { border-color: var(--sky); color: var(--sky); }
.ex-theme-btn:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.ex-theme-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* quiet closing links inside #closing */
.ex-closing-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 28px;
  font: 500 13.5px/1.4 "Inter", system-ui, sans-serif;
  color: var(--text-dim);
}
.ex-closing-links a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--outline);
  transition: color .18s ease, text-decoration-color .18s ease;
}
.ex-closing-links a:hover, .ex-closing-links a:focus-visible {
  color: var(--sky);
  text-decoration-color: currentColor;
}
.ex-closing-sep { color: var(--outline); user-select: none; }

@media (prefers-reduced-motion: reduce) { .wonder-btn, .ex-crumb a, .ex-theme-btn, .ex-closing-links a { transition: none; } }


