/* =============================================
   Pulsar, Ray Traced — page styles (derived from black-hole.css)
   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 #plots, body.bare main, body.bare footer { display: none !important; }

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

.ps-science figure { margin: 30px 0 0; }
.ps-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); }

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

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

/* ---------- Pulsar additions ---------- */
:root { --teal: #6fd3b4; }
.title { top: calc(var(--nav-h) + 18px + env(safe-area-inset-top, 0px)); bottom: auto; max-width: 520px; }
#hero::after { background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.15) 22%, transparent 34%, transparent 70%, rgba(0,0,0,0.55) 100%); }
.callout { left: 0; top: 0; }

#loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; color: var(--ink-dim); font-size: 14px; pointer-events: none; transition: opacity 0.4s; }
#loading.done { opacity: 0; }

#plots {
  position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 3;
  width: min(430px, calc(100% - 32px)); background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle); border-radius: 10px; padding: 10px 14px 8px;
}
#plots[hidden] { display: none; }
#hero #plots .plot-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; padding: 2px 0; margin: 0; cursor: pointer; text-align: left; color: inherit; }
#hero #plots .plot-head:hover h2 { color: var(--gold-light); }
.plot-head .caret { width: 8px; height: 8px; border-right: 1.5px solid var(--ink-dim); border-bottom: 1.5px solid var(--ink-dim);
  transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform 0.2s; flex: none; }
#plots.collapsed .plot-head .caret { transform: rotate(-135deg); margin-top: 4px; }
#plots.collapsed { width: auto; padding-bottom: 10px; }
#plots.collapsed #plot-body, #plots.collapsed #plot-tip { display: none; }
.plot-pf { font-size: 11.5px; color: var(--ink-dim); margin: 2px 0 0; }
.plot-head h2 { font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin: 0; }
.plot-head span { font-size: 11.5px; color: var(--ink-dim); }
.plot-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); margin: 6px 0 0; }
.plot-label .key { display: inline-flex; gap: 10px; color: var(--ink-dim); font-size: 11px; white-space: nowrap; }
.key i { display: inline-block; width: 14px; height: 0; border-top: 2px solid; vertical-align: 3px; margin-right: 4px; }
.key i.dash { border-top-style: dashed; }
.key i.dot { width: 5px; height: 5px; border: 0; border-radius: 50%; vertical-align: 1px; }
#plots canvas { display: block; width: 100%; height: 62px; }
#plots canvas#plot-pa { height: 74px; }
.plot-x { font-size: 11px; color: var(--ink-dim); text-align: center; margin-top: 1px; }
#plot-tip { position: absolute; right: 12px; top: -8px; transform: translateY(-100%); background: rgba(12,12,16,0.94); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 9px; font-size: 12px; line-height: 1.4; color: var(--ink); pointer-events: none; font-variant-numeric: tabular-nums; }
#plot-tip[hidden] { display: none; }

#live { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 4px 0 10px; font-size: 12.5px; }
#live dt { color: var(--ink-dim); }
#live dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }
.subhead { font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); margin: 14px 0 2px; }

.chart-fig svg { width: 100%; height: auto; display: block; }
.chart-fig .legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; }
.legend i { display: inline-block; width: 18px; border-top: 2px solid; vertical-align: 4px; margin-right: 6px; }
.legend i.dash { border-top-style: dashed; }
.chart-fig svg text { fill: var(--ink-dim); font: 12px 'Lato', sans-serif; }
.chart-fig svg text.pt { fill: var(--ink); font-size: 13px; }
.chart-fig svg text.pf { font-size: 11.5px; }
.chart-fig svg .grid { stroke: rgba(232, 228, 217, 0.12); stroke-width: 1; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trio span { display: block; font-size: 13px; color: var(--ink); margin-top: 6px; }
.ps-science figure img { background: #000; }
.note { border-left: 2px solid var(--teal); padding: 4px 0 4px 16px; margin: 18px 0; color: var(--ink-soft); }
.note strong { color: var(--ink); }

@media (max-width: 700px) {
  #plots { display: none; }
  .trio { grid-template-columns: 1fr; }
}
body.bare #hero { height: 100vh !important; height: 100svh !important; }
.ps-method { padding-top: calc(var(--nav-h) + 48px); }
.ps-method h1.section-title { font-size: clamp(1.8rem, 3.2vw, 2.4rem); }
.toc { margin-top: 18px; }
.toc ol { padding-left: 1.4em; margin: 0; }
.toc li { margin: 4px 0; }
.toc li::marker { color: var(--gold); }
.ps-science code { font-size: 0.92em; color: var(--ink); }
/* Let drags over the title reach the canvas; only its link stays clickable. */
.title { pointer-events: none; }
.title a { pointer-events: auto; }
.title .explain-link {
  display: inline-block; margin: 0 0 12px; padding: 7px 16px; border: 1px solid var(--gold); border-radius: 999px;
  font-family: var(--display); font-size: 14px; letter-spacing: 0.06em; color: var(--gold-light);
  background: rgba(10, 10, 14, 0.55); text-decoration: none; transition: background 0.2s, color 0.2s;
}
.title .explain-link:hover, .title .explain-link:focus-visible { background: var(--gold); color: #12131a; }
/* The two featured views: teal, so gold keeps meaning "selected". */
#hero .presets button.featured { border-color: rgba(111, 211, 180, 0.55); background: rgba(111, 211, 180, 0.09); color: #b8f0de; }
#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); }
/* An odd last view button spans the full row. */
.presets button:last-child:nth-child(odd) { grid-column: 1 / -1; }

.view-note { border-left: 2px solid var(--teal); padding: 4px 0 4px 10px; margin: 0 0 8px; color: var(--ink-soft); }
.view-note[hidden] { display: none; }
.numbers.numbers-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .numbers.numbers-3 { grid-template-columns: 1fr 1fr; } }
