/* ═══════════════════════════════════════════════════════════════
   styles.css — Isochron, the globe.
   One figure: the globe on the paper, and under it the figure bar with
   the live caption and the dial. No surfaces of their own; a hairline
   rule divides the bar from the scene.
   Shared: the colophon and caption (base.css), the about panel, toasts.
   ═══════════════════════════════════════════════════════════════ */

body.sim-body { --margin-w: 372px; }

html {
  font-size: clamp(14px, 1.5vw, 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.sim-body { background: var(--bg-canvas); }

.planet {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--margin-w);
  grid-template-rows: minmax(0, 1fr);
}

.globe {
  margin: 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ───── Over the globe: the view ───── */
.globe-head {
  position: absolute;
  z-index: 3;
  top: 17px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.globe-head-row { display: flex; align-items: center; height: 32px; }
.map-picker[hidden] { display: none; }
.map-picker { gap: 12px; }
.map-picker .view-btn { font-size: var(--font-sm); font-style: italic; }
.view-picker { display: flex; align-items: center; gap: 15px; }
.view-btn {
  border: 0;
  padding: 4px 0 3px;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-text);
  font-size: var(--font-base);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline 1px transparent;
  text-underline-offset: 0.32em;
  transition: color 0.15s var(--ease-out), text-decoration-color 0.15s var(--ease-out);
}
.view-btn:hover { color: var(--text); }
.view-btn[aria-checked="true"] { color: var(--accent); text-decoration-color: var(--accent); }
.view-btn:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.view-btn:disabled { color: var(--text-muted); opacity: 0.4; cursor: default; }

.key-btn {
  margin-left: 15px;
  padding: 4px 0 3px 15px;
  border: 0;
  border-left: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-family: var(--font-text);
  font-size: var(--font-base);
  font-style: italic;
  cursor: pointer;
  transition: color 0.15s var(--ease-out);
}
.key-btn:hover, .key-btn[aria-pressed="true"] { color: var(--text); }
.key-btn:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }

/* The key: the view's symbols on a veil of the paper, at the globe's lower left. */
.globe-key {
  position: absolute;
  z-index: 3;
  left: 20px;
  bottom: 14px;
  padding: 8px 10px 6px;
  background: color-mix(in srgb, var(--bg-canvas) 88%, transparent);
  pointer-events: none;
}
.globe-key[hidden] { display: none; }
.globe-key canvas { display: block; }

/* ───── The margin: figures ───── */
.margin {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg-canvas);
}
.margin-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 58px;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--border);
}
.margin-tabs .tab-btn {
  padding: 0 0 15px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-text);
  font-size: 0.98rem;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 -1px 0 transparent;
  transition: color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.margin-tabs .tab-btn:hover { color: var(--text); }
.margin-tabs .tab-btn.active { color: var(--accent); box-shadow: inset 0 -1px 0 var(--accent); }
.margin-tabs .tab-btn:focus-visible { outline: 1.5px solid var(--accent); outline-offset: -2px; }
.margin-panels {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 10px 20px 28px;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.margin-head {
  margin: 1.3rem 0 0.5rem;
  font-size: var(--font-base);
  font-style: italic;
  font-weight: 400;
  color: var(--text-muted);
}
.fig { margin: 0.6rem 0 1.4rem; }
.fig .caption { margin: 0.45rem 0 0; font-size: 0.95rem; }
.fig-canvas { display: block; width: 100%; }
.fig-tall { height: 300px; }
.fig-strip { height: 58px; }
.fig-record { height: 330px; }
.fig-orbit { height: 230px; }
.fig-model { height: 600px; }
.fig-people { height: 280px; }
.fig-states { height: 200px; }
.fig-ages { height: 250px; }
.fig-system { height: 340px; }

/* ───── The scenarios beside the caption, and the follow dial's switch ───── */
.scenario-picker { display: inline-flex; gap: 10px; margin-right: 6px; vertical-align: baseline; }
.scenario-picker .view-btn { padding: 0; font-size: inherit; font-style: normal; }
.new-planet { padding: 0; margin-right: 6px; font-size: inherit; font-style: normal; }
.follow-btn {
  flex: 0 0 auto;
  border: 0;
  padding: 0;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-text);
  font-size: var(--font-base);
  font-style: italic;
  cursor: pointer;
  text-decoration: underline 1px transparent;
  text-underline-offset: 0.32em;
  transition: color 0.15s var(--ease-out), text-decoration-color 0.15s var(--ease-out);
}
.follow-btn[hidden] { display: none; }
.follow-btn:hover { color: var(--text); }
.follow-btn[aria-pressed="true"] { color: var(--accent); text-decoration-color: var(--accent); }
.follow-btn:disabled { opacity: 0.4; cursor: default; }
.follow-btn:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 2px; }
.zone-key { display: block; width: 100%; height: 116px; }

.globe-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  touch-action: none;
}

.globe-stage > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.globe-notice[hidden] { display: none; }
.globe-notice {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-style: italic;
  color: var(--text-muted);
}

/* ───── The figure bar: caption and dial ───── */
.figure-bar {
  display: flex;
  flex-wrap: wrap;           /* a narrow stage puts the dial under the caption rather than squeezing it */
  align-items: center;
  gap: 8px 24px;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--border);
}

.globe-caption {
  flex: 1 1 18rem;
  min-width: 0;
  margin: 0;
}

.dial {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.dial-label { font-style: italic; }

.dial output {
  min-width: 5.5em;
  color: var(--text);
  font-variant-numeric: lining-nums tabular-nums;
}

/* A hairline track with a ring for a thumb. */
.dial input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 180px;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.dial input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--text-muted);
}
.dial input[type="range"]::-moz-range-track {
  height: 1px;
  background: var(--text-muted);
}
.dial input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -5px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: var(--bg-canvas);
}
.dial input[type="range"]::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 1px solid var(--text);
  border-radius: 50%;
  background: var(--bg-canvas);
}
.dial input[type="range"]:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

@media (max-width: 860px) {
  /* The body stays locked (shared); the planet scrolls, the globe first. */
  .planet {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .globe { height: 78vh; height: 78svh; }
  .margin { border-left: 0; border-top: 1px solid var(--border); }
  .margin-panels { overflow: visible; }
}

@media (max-width: 600px) {
  .globe-head { top: 52px; right: 16px; }
  .figure-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 16px 12px; }
  .globe-caption { flex: 0 0 auto; }   /* in a column the wide screen's 18rem basis would be a height */
  .dial input[type="range"] { flex: 1 1 auto; width: auto; }
  .margin-tabs { gap: 12px; padding: 0 10px 0 14px; }
  .margin-tabs .tab-btn { font-size: 0.95rem; }
}
