/* =============================================
   Black Hole, Ray Traced — page styles
   Loaded after /css/main.css; reuses its variables, .section-label,
   .section-title, .section-divider, .btn 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);
  --accent: var(--gold);
  --ember: #ffb46b;        /* colour of a ~4000 K blackbody (physics swatches only) */
  --blue: #a9c4ff;         /* colour of a ~15000 K blackbody */
  --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: 480px; overflow: hidden; background: var(--space); font-size: 15px; line-height: 1.45; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#view.dragging { cursor: grabbing; }
#hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.35) 22%, transparent 40%); }

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

/* Callouts drawn over the render */
#callouts { position: absolute; inset: 0; pointer-events: none; z-index: 2; transition: opacity 0.25s; }
#callouts.hidden { opacity: 0; }
#callouts svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#callouts line { stroke: rgba(232, 228, 217, 0.7); stroke-width: 1; }
#callouts circle { fill: var(--ink); }
.callout {
  position: absolute; max-width: 23ch; font-size: 12.5px; line-height: 1.3; color: #e6dfd2;
  text-shadow: 0 0 4px #000, 0 0 8px #000, 0 0 16px #000;
}
.callout b { display: block; font-family: var(--display); font-weight: 600; font-size: 13.5px; letter-spacing: 0.04em; color: var(--gold-light); }
.callout.center { text-align: center; }

#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; }
input[type=range]:disabled { opacity: 0.4; }
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; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 10px; }
#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 .icon-btn { padding: 5px 10px; text-align: center; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

#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 */
body.bare #navbar, body.bare .title, body.bare #panel, body.bare #callouts, body.bare main, body.bare footer { display: none; }

/* ---------- Science write-up ---------- */
.bh-science { max-width: var(--max-width); margin: 0 auto; padding: 80px 24px 24px; }
.bh-science section { padding: 0; margin: 0 0 88px; }
.bh-science .section-title { margin-bottom: 1rem; }
.bh-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); }

.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); }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 2px; }

.bh-science figure { margin: 30px 0 0; }
.bh-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; }
.strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.strip span, .pair span { display: block; font-size: 13px; color: var(--ink); margin-top: 6px; }
.experiment { margin-top: 44px; }
.experiment .prose { margin-bottom: 4px; }

.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); }

.bh-science table { border-collapse: collapse; width: 100%; max-width: 760px; font-size: 14.5px; margin: 18px 0 8px; font-variant-numeric: tabular-nums; }
.bh-science th, .bh-science td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--rule); }
.bh-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; }

.bh-more { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 48px; }

@media (max-width: 700px) {
  #hero { height: 82vh; height: 82svh; }
  #panel { top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; max-height: 60%; }
  .title { top: calc(var(--nav-h) + 14px + env(safe-area-inset-top, 0px)); bottom: auto; right: 20px; }
  .title .lede { display: none; }
  .title h1 { font-size: 24px; }
  #hero::after { background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 34%); }
  .strip { grid-template-columns: 1fr 1fr; }
  .pair { grid-template-columns: 1fr; }
  .callout { font-size: 11.5px; max-width: 18ch; }
  .callout b { font-size: 12.5px; }
}
