/* ============================================================================
   CHANDRASEKHAR LIMIT  ·  stylesheet
   ----------------------------------------------------------------------------
   An editorial page: one column of serif text, figures with thin lines and
   captions under them, generous space. Fonts come from ../../lib/sci.css
   (STIX Two Text for text and maths, Inter for captions and controls).

   PALETTE: greys, one blue (--blue, the model and the dwarf) and one warm
   colour (--warm, the limit). The canvases use the same values
   (figures.js COL). No glows, no gradients, no animation.

   No overflow-x on body. html clips.
     grep -n 'COLUMN'    text column and headings
     grep -n 'FIGURES'   canvases, controls, captions
     grep -n 'IMAGES'    the real images and their credits
     grep -n 'TABLES'    the fact tables
     grep -n 'SAVER'     the screensaver canvas (html.saving)
     grep -n 'PHONE'     narrow screens and touch targets
   ========================================================================== */
:root{
  --bg:#0e0f11; --ink:#e7e5e0; --ink2:#b9b8b3; --dim:#86878b; --rule:#2a2c30;
  --blue:#9ec1ff; --warm:#d9a45b;
  --serif:var(--sci-serif,'STIX Two Text',Georgia,serif);
  --sans:var(--sci-sans,Inter,system-ui,-apple-system,sans-serif);
  --col:680px; --wide:940px;
  --sl:env(safe-area-inset-left,0px); --sr:env(safe-area-inset-right,0px);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{background:var(--bg);overflow-x:hidden;-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{background:var(--bg);color:var(--ink);font:400 19px/1.62 var(--serif);-webkit-font-smoothing:antialiased}
a{color:var(--ink);text-decoration:underline;text-decoration-color:var(--dim);text-underline-offset:2px}
a:hover{text-decoration-color:var(--ink)}
sub,sup{font-size:0.72em;line-height:0}
b{font-weight:600}

/* ---------------------------------------------------------------- COLUMN */
#doc{padding:56px calc(24px + var(--sr)) 96px calc(24px + var(--sl))}
#doc > *, section{max-width:var(--col);margin-left:auto;margin-right:auto}
/* A wide figure leaves the text column on both sides by the same amount. */
figure.wide{width:min(var(--wide), calc(100vw - 48px));max-width:none!important;margin-left:calc(50% - min(var(--wide) / 2, 50vw - 24px))!important}
p{margin-bottom:1.05em}
.head{padding-bottom:28px}
.kicker{font:500 0.78rem/1.4 var(--sans);color:var(--dim);margin-bottom:14px}
h1{font:400 2.7rem/1.1 var(--serif);letter-spacing:-0.01em;margin-bottom:14px}
.dek{font-size:1.25rem;line-height:1.5;color:var(--ink2)}
h2{font:400 1.75rem/1.25 var(--serif);margin:72px auto 20px;padding-top:22px;border-top:1px solid var(--rule)}
h2 .n{display:inline-block;min-width:1.5em;color:var(--dim)}
h3{font:600 1.08rem/1.4 var(--serif);margin:40px auto 12px}
.small{font:400 0.84rem/1.55 var(--sans);color:var(--dim)}
.toc{margin:36px auto 0;padding:18px 0;border-top:1px solid var(--rule);border-bottom:1px solid var(--rule)}
.toc ol{list-style:none;counter-reset:t;columns:2;column-gap:32px;font:400 0.9rem/1.5 var(--sans)}
.toc li{counter-increment:t;break-inside:avoid;padding:3px 0}
.toc li::before{content:counter(t);display:inline-block;width:1.4em;color:var(--dim)}
.toc a{text-decoration:none;color:var(--ink2)}
.toc a:hover{color:var(--ink)}
.eq{margin:22px auto 26px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;line-height:0;color:var(--ink)}
.eq::-webkit-scrollbar{display:none}
.eq mjx-container,.eq > svg{margin:0!important}
.eq svg{max-width:none;overflow:visible}
.eq.raw{line-height:1.5;font:0.85rem/1.5 ui-monospace,Menlo,monospace;color:var(--dim);white-space:pre-wrap}
blockquote{margin:26px auto 28px;padding-left:22px;border-left:1px solid var(--dim);font-style:italic;font-size:1.15rem;color:var(--ink)}

/* ---------------------------------------------------------------- FIGURES */
figure{margin:40px auto 44px;position:relative}
.cv{display:block;width:100%;touch-action:pan-y;user-select:none;-webkit-user-select:none}
.cv.hero{height:440px;cursor:ew-resize}
.cv.chart{height:340px}
.cv.chart.short{height:280px}
.cv.chart.tall{height:380px}
.cv.sq{aspect-ratio:1/1;height:auto}
.cv.hole{aspect-ratio:16/9;height:auto;background:#000;cursor:grab}
.pair{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.ctl{display:flex;flex-wrap:wrap;align-items:center;gap:10px 18px;margin-top:12px;font:400 0.82rem/1.3 var(--sans);color:var(--ink2)}
.ctl label{display:flex;align-items:center;gap:10px}
.ctl label span{color:var(--dim)}
.ctl output{font-variant-numeric:tabular-nums;color:var(--ink);min-width:8ch}
.ctl button{font:400 0.8rem/1 var(--sans);color:var(--ink2);background:transparent;border:1px solid var(--rule);border-radius:3px;padding:8px 12px;cursor:pointer;touch-action:manipulation}
.ctl button:hover{color:var(--ink);border-color:var(--dim)}
.ctl button[aria-pressed="true"]{color:var(--ink);border-color:var(--ink2)}
.seg{display:inline-flex;gap:0}
.seg button{border-radius:0}
.seg button:first-child{border-radius:3px 0 0 3px}
.seg button:last-child{border-radius:0 3px 3px 0;border-left:0}
input[type=range]{-webkit-appearance:none;appearance:none;background:transparent;width:220px;max-width:100%;height:28px}
input[type=range]::-webkit-slider-runnable-track{height:1px;background:var(--dim)}
input[type=range]::-moz-range-track{height:1px;background:var(--dim)}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:13px;height:13px;border-radius:50%;background:var(--bg);border:1.5px solid var(--ink);margin-top:-6px}
input[type=range]::-moz-range-thumb{width:11px;height:11px;border-radius:50%;background:var(--bg);border:1.5px solid var(--ink)}
figcaption{margin-top:12px;font:400 0.84rem/1.55 var(--sans);color:var(--dim)}
figcaption b{color:var(--ink2);font-weight:500}
.nogl{display:none;position:absolute;left:0;right:0;top:0;aspect-ratio:16/9;align-items:center;justify-content:center;padding:20px;text-align:center;font:400 0.85rem var(--sans);color:var(--dim)}
.nogl.on{display:flex}

/* ---------------------------------------------------------------- IMAGES */
figure.img img{display:block;width:100%;height:auto;background:#000}
figure.img.side{float:right;width:240px;margin:6px 0 18px 28px}
figure.img.side figcaption{font-size:0.76rem}
figure.img.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}
figure.img.two img{aspect-ratio:1/1;object-fit:cover}
figure.img.two figcaption{grid-column:1 / -1}
.credit{display:block;margin-top:4px;font-size:0.74rem;color:var(--dim)}
.credit a{color:var(--dim)}
section::after{content:'';display:block;clear:both}

/* ---------------------------------------------------------------- TABLES */
table.facts{width:100%;border-collapse:collapse;margin:8px auto 10px;font:400 0.88rem/1.45 var(--sans)}
table.facts td{padding:8px 0;border-bottom:1px solid var(--rule);vertical-align:top;color:var(--ink2)}
table.facts td:first-child{color:var(--dim);width:42%;padding-right:16px}
.refs{font:400 0.8rem/1.55 var(--sans);color:var(--dim);padding-left:1.2em;display:grid;gap:6px}

/* ---------------------------------------------------------------- SAVER */
#saverCv{display:none}
html.saving,html.saving body{background:#000;overflow:hidden}
html.saving body > *:not(#saverCv){display:none!important}
html.saving #saverCv{display:block;position:fixed;inset:0;width:100vw;height:100vh;z-index:100}

/* ---------------------------------------------------------------- PHONE */
@media (pointer:coarse){
  .ctl button{min-height:44px;padding:12px 14px}
  input[type=range]{height:44px}
  input[type=range]::-webkit-slider-thumb{width:22px;height:22px;margin-top:-11px}
  input[type=range]::-moz-range-thumb{width:20px;height:20px}
  .toc li{padding:0}
  .toc a{display:inline-block;min-height:44px;line-height:44px}
}
@media (max-width:700px){
  body{font-size:17.5px}
  #doc{padding:36px calc(18px + var(--sr)) 72px calc(18px + var(--sl))}
  h1{font-size:2.1rem}
  .dek{font-size:1.1rem}
  h2{font-size:1.45rem;margin-top:56px}
  .toc ol{columns:1}
  .cv.hero{height:620px}
  .cv.chart{height:320px}
  .cv.chart.tall{height:560px}
  .cv.chart.short{height:260px}
  figure.img.side{float:none;width:70%;margin:24px auto}
  .ctl label{width:100%}
  .ctl label input{flex:1}
  .pair{gap:10px}
  figure.wide{width:calc(100vw - 36px);margin-left:calc(50% - 50vw + 18px)!important}
}
