/* A quiet opening, set apart from the derivation in either theme. */
.blog-post-content .orbit-opening { margin: 1.5rem 0; padding-left: 1rem; border-left: 1px solid #999; }
.blog-post-content .orbit-opening p { margin: 0 0 0.5em; font-size: 1em; }
.blog-post-content .orbit-opening p:last-child { margin-bottom: 0; }

/* Size ASCII cells against each figure, keeping the text and vector overlay aligned.
   Leave a little width for font rounding; these diagrams are not scrolling code blocks. */
/* Moving diagram elements must not become the browser's scroll anchor. */
.orbit-demo { margin: 24px 0; container-type: inline-size; overflow-anchor: none; }
.orbit-body-labels { display: grid; grid-template-columns: 1fr 1fr; text-align: center; font: 12px "Courier New", monospace; }
.blog-post-content .orbit-demo pre { width: 100%; margin: 8px 0; padding: 0; border: 0; background: transparent !important; color: inherit; font-family: "Courier New", Courier, monospace; font-size: min(8px, 1cqw); line-height: 1; letter-spacing: 0; white-space: pre; overflow: clip; overflow-wrap: normal; word-break: normal; text-shadow: none; }
.orbit-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font: 13px "Courier New", monospace; }
.orbit-controls button { padding: 4px 0; border: 0; background: none; color: inherit; text-decoration: underline; font: inherit; cursor: pointer; }
.orbit-controls input { flex: 1 1 100px; min-width: 80px; max-width: 220px; accent-color: #777; }
.orbit-controls output { min-width: 4ch; }
.orbit-demo figcaption { margin-top: 12px; font-size: 0.8125rem; opacity: 0.75; }
html[data-theme="retro"] .orbit-controls button { color: #0000ee; }

/* Reserve the complete ASCII grid independently of its changing text. Without
   this boundary, replacing a frame can invalidate the document's scroll range
   during iOS momentum scrolling. */
.orbit-scene-wrap { position: relative; font: min(8px, 1cqw)/1 "Courier New", Courier, monospace; width: 160ch; height: 66em; max-width: 100%; margin: 8px auto; contain: size layout paint; overflow: clip; }
/* Safari can round fractional line heights per row. Size the SVG against the
   actual text height, not rows * font-size. This shared inner layer stays out
   of document flow, so its text metrics cannot change the reserved page space. */
.orbit-scene-grid { position: absolute; inset: 0 0 auto; }
.blog-post-content .orbit-scene-wrap pre { width: 100%; margin: 0; font: inherit; }
#orbit-axes, #axis-orbit-axes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#orbit-axes [hidden], #axis-orbit-axes [hidden] { display: none; }
#orbit-axes line, #axis-orbit-axes line { stroke-width: 1.25px; vector-effect: non-scaling-stroke; }
.orbit-normal { stroke: currentColor; opacity: 0.65; }
.orbit-spin-axis { stroke: #508cdb; }
html[data-theme="retro"] .orbit-spin-axis { stroke: #0000ee; }
.orbit-axes-switch { display: inline-flex; align-items: center; gap: 6px; }
.orbit-controls .orbit-axes-switch input { flex: none; min-width: 0; width: auto; margin: 0; }

#orbit-surface-marker, #axis-orbit-surface-marker { fill: #e22b32; stroke: #fff; stroke-width: 0.75px; vector-effect: non-scaling-stroke; }

/* Extra reserved rows let the full Sun and corona move through both solstices. */
.axis-orbit-wrap { height: 86em; }
#axis-orbit-axes .earth-study-sun-vector line { stroke: currentColor; stroke-width: 1.5px; }
#axis-orbit-axes text { fill: currentColor; font: 1.6px "Courier New", monospace; }
#axis-orbit-axes .earth-study-normal line { stroke: currentColor; stroke-width: 0.8px; }
#axis-orbit-declination-arc { fill: none; stroke: currentColor; stroke-width: 0.8px; vector-effect: non-scaling-stroke; }
#axis-orbit-axes #axis-orbit-declination-label { font: italic 2.4px Georgia, serif; text-anchor: middle; dominant-baseline: middle; }

.orbit-slider-row { display: grid; grid-template-columns: 15ch minmax(0, 1fr) 6ch; align-items: start; gap: 10px; flex-basis: 100%; max-width: 560px; }
.orbit-controls .orbit-slider-row input { width: 100%; min-width: 0; max-width: none; margin: 0; }
.orbit-season-control { display: grid; grid-template-columns: 1fr auto; gap: 6px; flex-basis: 100%; max-width: 560px; }
.orbit-controls .orbit-season-control input { grid-column: 1 / -1; width: 100%; min-width: 0; max-width: none; margin: 0; }
.orbit-season-labels { grid-column: 1 / -1; display: flex; justify-content: space-between; margin: 0 8px; font-size: 10px; line-height: 1.4; }
.orbit-season-labels span { width: 0; text-align: center; white-space: nowrap; }
.orbit-season-labels span:first-child { text-align: left; }
.orbit-season-labels span:last-child { text-align: right; }
@media (max-width: 480px) {
    .orbit-slider-row { grid-template-columns: minmax(0, 1fr) 6ch; }
    .orbit-slider-row > label { grid-column: 1 / -1; }
}

.earth-study-wrap { width: 120ch; height: 56em; font-size: min(8px, 1.3333cqw); }
#earth-study-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#earth-study-overlay [hidden] { display: none; }
#earth-study-overlay line { stroke: currentColor; stroke-width: 0.8px; vector-effect: non-scaling-stroke; }
#earth-study-overlay text { fill: currentColor; font: 1.6px "Courier New", monospace; }
.earth-study-normal { color: inherit; }
.earth-study-sun-vector { color: #83b9ff; }
html[data-theme="retro"] .earth-study-sun-vector { color: #0000ee; }
#earth-study-overlay .earth-study-sun-vector line { stroke-width: 1.5px; }
#earth-study-point { fill: #e22b32; stroke: #fff; stroke-width: 0.75px; vector-effect: non-scaling-stroke; }

#earth-study-ground, #axis-orbit-ground { fill: currentColor; fill-opacity: 0.1; stroke: currentColor; stroke-opacity: 0.65; stroke-width: 0.8px; vector-effect: non-scaling-stroke; }

/* Explicit heights and containment keep SVG updates out of document layout.
   The viewBox scales the drawing to fit without changing the reserved space. */
.local-study-wrap { position: relative; width: 600px; max-width: 100%; height: 330px; margin: 8px auto 4px; contain: size layout paint; overflow: clip; }
#local-study-scene { display: block; position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
@media (max-width: 600px) {
    .local-study-wrap { height: 190px; }
}
/* Horizon messages and play/pause labels must not reflow the controls. */
#local-study-height { flex: 0 0 16ch; white-space: nowrap; }
#local-study-toggle { min-width: 7ch; }
#local-study-scene line { stroke: currentColor; stroke-width: 0.8px; vector-effect: non-scaling-stroke; }
#local-study-scene text { fill: currentColor; font: 2.4px "Courier New", monospace; }
#local-study-ground { fill: currentColor; fill-opacity: 0.1; stroke: currentColor; stroke-opacity: 0.65; stroke-width: 0.8px; vector-effect: non-scaling-stroke; }
.local-study-sun { color: #83b9ff; }
html[data-theme="retro"] .local-study-sun { color: #0000ee; }
#local-study-scene .local-study-sun line { stroke-width: 1.5px; }
.local-study-origin { fill: currentColor; }
#local-study-angle-arc, #local-study-altitude-arc { fill: none; stroke: currentColor; stroke-width: 0.8px; vector-effect: non-scaling-stroke; }
#local-study-scene #local-study-angle-label, #local-study-scene #local-study-altitude-label { font: italic 3.2px Georgia, serif; text-anchor: middle; dominant-baseline: middle; }
#local-study-horizon-line { stroke-dasharray: 1 1; opacity: 0.55; }
.local-study-altitude { color: #83b9ff; }
html[data-theme="retro"] .local-study-altitude { color: #0000ee; }
