/* =============================================
   A Star Orbiting Our Black Hole — page styles (derived from cosmic-horizons.css)
   Loaded after /css/main.css; reuses its variables, .section-label,
   .section-title, .section-divider, .btn, .guide-cards and .footer.
   ============================================= */
:root {
  --space: #000000;
  --ink: var(--text-primary);
  --ink-dim: var(--text-muted);
  --ink-soft: #d8d2c6;
  --panel: rgba(12, 12, 16, 0.82);
  --rule: rgba(232, 228, 217, 0.14);
  --teal: #6fd3b4;
  --blue: #a9c4ff;
  --display: 'Cinzel', serif;
  --math: "Cambria Math", "STIX Two Math", Cambria, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --nav-h: 64px;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Hero / simulator ---------- */
#hero { position: relative; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; background: var(--space); font-size: 15px; line-height: 1.45; }
#sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; z-index: 1; }
#sky.dragging { cursor: grabbing; }

.title { position: absolute; left: max(24px, env(safe-area-inset-left)); top: calc(var(--nav-h) + 18px); max-width: 430px; z-index: 3; pointer-events: none; }
.title a { pointer-events: auto; }
.title .section-label { margin-bottom: 6px; }
.title h1 { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 2.6vw, 36px); line-height: 1.1; letter-spacing: 0.02em; margin: 0 0 10px; color: var(--ink); text-shadow: 0 0 12px #000; }
.title .lede { max-width: 44ch; margin: 0 0 8px; font-size: 15px; line-height: 1.5; color: var(--ink-soft); text-shadow: 0 0 8px #000, 0 0 16px #000; }
.title .hint { margin: 0; color: var(--ink-dim); font-size: 13px; text-shadow: 0 0 8px #000; }
.title .hint a { color: var(--gold); }
#readout { font-variant-numeric: tabular-nums; }
.coarse { display: none; }
@media (pointer: coarse) { .coarse { display: inline; } .fine { display: none; } }

#caption { position: absolute; top: calc(var(--nav-h) + 18px); z-index: 3; max-width: min(440px, 44vw); padding: 6px 14px; text-align: center;
  background: rgba(8, 9, 14, 0.72); border: 1px solid rgba(232, 228, 217, 0.12); border-radius: 10px; pointer-events: none; }
#caption[hidden] { display: none; }
#capMain { margin: 0 0 2px; font-family: var(--display); font-size: 14px; line-height: 1.3; color: var(--gold-light); }
#capSub { margin: 0; font-size: 13px; line-height: 1.45; color: var(--ink-soft); }

/* Settings panel */
#panel {
  position: absolute; top: calc(var(--nav-h) + 16px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 4;
  width: 318px; max-height: calc(100% - var(--nav-h) - 32px);
  overflow-y: auto; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle); border-radius: 10px; padding: 6px 16px 14px;
  scrollbar-width: thin; scrollbar-color: rgba(232,228,217,.25) transparent;
}
#panel.collapsed > :not(.panel-head) { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0 4px; }
.panel-head h2 { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin: 0; }
details { border-top: 1px solid var(--rule); padding: 4px 0; }
summary { cursor: pointer; list-style: none; padding: 8px 0; font-family: var(--display); font-size: 14px; letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--ink-dim); font-family: 'Lato', sans-serif; }
details[open] summary::after { content: "−"; }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; margin: 6px 0 12px; }
.row label { font-size: 13.5px; }
.row output { font-size: 12.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.row input[type=range], .row select { grid-column: 1 / -1; width: 100%; }
.hint-s { grid-column: 1 / -1; font-size: 12px; color: var(--ink-dim); margin: 0; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--rule); border-radius: 1px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--rule); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); margin-top: -6px; border: 0; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: 0; }
select { background: rgba(255,255,255,0.05); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 13.5px; }
select option { background: #1a1b26; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--gold); width: 15px; height: 15px; flex: none; }
.check input:disabled + span { opacity: 0.45; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 10px; }
.presets button:last-child:nth-child(odd) { grid-column: 1 / -1; }
#hero button, .credit-box button { font: inherit; font-size: 13px; color: var(--ink); background: rgba(255,255,255,0.05); border: 1px solid var(--rule); border-radius: 6px; padding: 7px 9px; cursor: pointer; text-align: left; }
#hero button:hover, .credit-box button:hover { background: rgba(255,255,255,0.1); }
#hero button[aria-pressed=true] { border-color: var(--gold); color: var(--gold-light); }
#hero .presets button.featured { border-color: rgba(111, 211, 180, 0.45); background: rgba(111, 211, 180, 0.09); }
#hero .presets button.featured:hover { background: rgba(111, 211, 180, 0.17); }
#hero .presets button.featured[aria-pressed=true] { border-color: var(--gold); color: var(--gold-light); }
#hero .icon-btn { padding: 5px 10px; text-align: center; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.view-note { border-left: 2px solid var(--teal); padding: 4px 0 4px 10px; margin: 0 0 8px; color: var(--ink-soft); font-size: 13px; }
.view-note[hidden] { display: none; }
.now { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 4px 0 10px; font-size: 13px; }
.now dt { color: var(--ink-dim); }
.now dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
#customBox[hidden] { display: none; }

#error { display: none; position: absolute; inset: 0; place-items: center; padding: 24px; text-align: center; font-size: 17px; z-index: 5; }
#error p { max-width: 46ch; }

/* Bare mode (?ui=0) for embedding and for making figures; keep=labels,card,rv,tag */
body.bare #navbar, body.bare .title, body.bare #panel, body.bare main, body.bare footer,
body.bare #caption, body.bare #card, body.bare #rvCard { display: none; }
body.bare.show-labels #caption:not([hidden]) { display: block; }
body.bare.show-card #card { display: block; }
body.bare.show-rv #rvCard:not([hidden]) { display: block; }
body.bare #hero { height: 100vh; }

/* ---------- Science write-up ---------- */
.so-science { max-width: var(--max-width); margin: 0 auto; padding: 80px 24px 24px; }
.so-science section { padding: 0; margin: 0 0 88px; }
.so-science .section-title { margin-bottom: 1rem; }
.so-science h3 { font-family: var(--display); font-weight: 600; font-size: 1.05rem; letter-spacing: 0.03em; margin: 0 0 6px; color: var(--ink); }
.prose { max-width: 68ch; font-size: 17px; line-height: 1.7; color: var(--ink-soft); }
.prose p { margin: 0 0 14px; }
.prose strong { color: var(--ink); font-weight: 700; }
.muted { color: var(--ink-dim); }
.real-note { max-width: 68ch; margin: 0 0 22px; padding: 10px 16px; border-left: 2px solid var(--gold); font-size: 16.5px; line-height: 1.6; color: var(--ink); background: rgba(201, 168, 76, 0.05); }
.guess { border: 1px solid var(--border-subtle); border-radius: 10px; padding: 18px 22px; max-width: 68ch; margin: 0 0 26px; background: rgba(201, 168, 76, 0.04); }
.guess p { margin: 0 0 8px; } .guess p:last-child { margin: 0; }

.numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 28px 24px; margin: 8px 0 22px; }
.numbers > div { border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.numbers .n { font-family: var(--display); font-size: 34px; line-height: 1; color: var(--gold-light); font-variant-numeric: lining-nums; }
.numbers .n small { font-size: 17px; color: var(--ink-dim); }
.numbers .l { font-size: 14px; line-height: 1.5; color: var(--ink-dim); margin-top: 10px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 30px 40px; margin-top: 26px; }
.features p { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink-soft); }

.so-science figure { margin: 30px 0 0; }
.so-science figure img { width: 100%; height: auto; display: block; border-radius: 4px; background: #050505; }
figcaption { font-size: 14px; color: var(--ink-dim); margin-top: 10px; max-width: 80ch; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pair span, .strip span { display: block; font-size: 13px; color: var(--ink); margin-top: 6px; }
.experiment { margin-top: 44px; }
.experiment .prose { margin-bottom: 4px; }
.wide-fig img { max-width: 1100px; }
.chart { width: 100%; max-width: 900px; height: auto; display: block; background: #08090d; border-radius: 6px; }

.eq { font-family: var(--math); font-size: 18px; margin: 16px 0 18px; padding: 10px 0 10px 18px; border-left: 2px solid var(--gold); overflow-x: auto; color: var(--ink); line-height: 1.7; }
.prose i, .eq i { font-family: var(--math); font-style: italic; }
ol.steps { padding-left: 1.4em; margin: 0; }
ol.steps li { margin: 0 0 18px; padding-left: 4px; }
ol.steps li::marker { color: var(--gold); font-family: var(--display); }

.so-science table { border-collapse: collapse; width: 100%; max-width: 820px; font-size: 14.5px; margin: 18px 0 8px; font-variant-numeric: tabular-nums; }
.so-science th, .so-science td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.so-science th { font-weight: 700; color: var(--ink-dim); font-size: 13px; }
.table-wrap { overflow-x: auto; }
.limits { list-style: none; padding: 0; margin: 0; max-width: 68ch; font-size: 16.5px; line-height: 1.65; color: var(--ink-soft); }
.limits li { padding: 12px 0; border-top: 1px solid var(--rule); }
.limits strong { color: var(--ink); font-weight: 700; }
ol.refs { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); max-width: 80ch; padding-left: 1.6em; margin: 0; }
ol.refs li { margin: 0 0 10px; }
ol.refs i { color: var(--ink); }
.credit-box { border: 1px solid var(--border-subtle); border-radius: 8px; padding: 18px 20px; max-width: 68ch; margin-top: 18px; }
.credit-box code { font-family: var(--math); font-size: 17px; color: var(--ink); }
.credit-box button { margin-top: 12px; }
.so-more { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 48px; }

@media (max-width: 700px) {
  #hero { height: auto; min-height: 0; }
  #sky { position: absolute; top: 0; height: 64svh; }
  #hero { padding-top: 64svh; }
  .title { top: calc(var(--nav-h) + 10px); right: 16px; max-width: none; }
  .title .lede { display: none; }
  .title h1 { font-size: 22px; }
  #caption { top: auto; bottom: calc(100% - 64svh + 10px); left: 10px !important; width: calc(100% - 20px); max-width: none; }
  #card { position: relative; left: auto; bottom: auto; width: auto; margin: 10px; }
  #panel { position: relative; top: auto; right: auto; width: auto; max-height: none; margin: 0 10px 12px; }
  .pair, .strip { grid-template-columns: 1fr; }
}


/* ---------- Star orbit additions ---------- */
#card { position: absolute; left: 16px; bottom: 16px; z-index: 3; width: 360px; max-width: calc(100% - 32px);
  background: rgba(8, 9, 14, 0.82); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 10px 14px 8px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-size: 13px; line-height: 1.45; color: var(--ink-soft); }
#card p { margin: 0 0 6px; }
#card .c-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--ink); }
#card .c-head b { font-family: var(--display); font-weight: 600; letter-spacing: 0.03em; color: var(--gold-light); }
#card .c-head span { color: var(--ink-dim); font-size: 12.5px; margin-left: 4px; }
#card .c-note { font-size: 12px; color: var(--ink-dim); }
#card.collapsed > :not(.c-head) { display: none; }
#card.collapsed { width: auto; padding-bottom: 10px; }
#hero .card-toggle { margin-left: auto; padding: 3px 10px; font-size: 12px; }

/* The speed graph, along the bottom between the card and the panel */
#rvCard { position: absolute; z-index: 2; left: 16px; right: 350px; bottom: 16px; height: 210px; background: rgba(8, 9, 14, 0.85); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 4px 6px 6px; }
#rvCard[hidden] { display: none; }
#panel.collapsed ~ #rvCard { right: 16px; }
#rv { display: block; width: 100%; height: calc(100% - 26px); border-radius: 6px; }
.rv-head { display: flex; justify-content: space-between; align-items: center; height: 24px; padding: 0 2px 0 6px; font-family: var(--display); font-size: 13px; letter-spacing: 0.04em; color: var(--ink-soft); }
#hero .rv-head .icon-btn { padding: 1px 8px; font-size: 11.5px; }
body.view-peri #rvCard { height: 300px; }
/* the card sits above the graph */
#card { bottom: 238px; }
body.view-peri #card { bottom: 328px; }
#rvCard[hidden] ~ #card, body.rv-off #card { bottom: 16px; }
body.bare.show-rv #rvCard { left: 0; right: 0; bottom: 0; border-radius: 0; border: 0; }

.seg { display: flex; gap: 4px; margin: 6px 0 4px; }
#hero .seg button { flex: 1; text-align: center; padding: 6px 4px; font-size: 12.5px; }
#rpBox[hidden], #measureBox[hidden], #fitNote[hidden] { display: none; }

@media (max-width: 1100px) { #rvCard { right: 16px; } }
/* Phones: the picture on top, then the caption, card, graph and panel (must follow the rules above) */
@media (max-width: 700px) {
  #sky { height: 70svh; }
  #hero { padding-top: 70svh; }
  #caption { bottom: calc(100% - 70svh + 10px); }
  .title .hint .fine, .title .hint .coarse, .title .hint br, #readout { display: none; }
  #card { position: relative; left: auto; bottom: auto !important; width: auto; max-width: none; margin: 10px; }
  #rvCard, body.view-peri #rvCard { position: relative; inset: auto; height: 230px; margin: 0 10px 10px; }
  body.view-peri #rvCard { height: 300px; }
  #panel { position: relative; top: auto; right: auto; width: auto; max-height: none; margin: 0 10px 12px; }
}
@media (min-width: 701px) { #caption { max-width: min(520px, 46vw); } }

/* Live readouts: a fixed-width value column, so values changing width never move the labels, and values never wrap.
   Rows then keep their height while the numbers update (no jitter). Checked by tools/readout_jitter.py. */
.now { grid-template-columns: minmax(0, 1fr) var(--now-values, 10.5em); }
.now dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .wide { grid-column: 1 / -1; }            /* a value that can be long gets its own full-width line under its label */
.now dd.wide { margin-top: -3px; }
.now { --now-values: 12.5em; }
#liveNow[hidden] { display: none; }
