/* ----------------------------------------------------
   Deep-space theme for blog posts, matching the homepage.
   Loaded after styles.css and post.css, so it only
   re-points tokens and patches the places that assumed
   a light page.
   ---------------------------------------------------- */

:root {
  --bg: #020308;
  --ink: #e9eef8;
  --ink-soft: #a2adc2;
  --ink-faint: #67728a;
  --rule: rgba(176, 202, 255, .14);
  --rule-faint: rgba(176, 202, 255, .07);
  --paper: #070b16;
  --accent: #9cc8ff;
  --accent-soft: rgba(156, 200, 255, .12);
  --ice-bright: #d8ebff;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  color-scheme: dark;
}

::selection { background: var(--accent); color: var(--bg); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* top bar */
.topbar {
  background: rgba(2, 3, 8, .72);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom-color: var(--rule);
}
.topbar-inner { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.topbar .brand { font-weight: 500; }
.topbar a:hover { color: var(--ice-bright); }

/* hero: a strip of deep space, with a black hole rising over the horizon */
.post-hero {
  position: relative;
  overflow: hidden;
  max-width: none;
  padding-left: 0; padding-right: 0;
  padding-bottom: clamp(70px, 9vw, 110px);
  background:
    radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 64%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 30%, #f1c48a 50%, transparent 51%),
    radial-gradient(1px 1px at 57% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 52%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 26%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 60%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 94% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 70%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(1px 1px at 50% 78%, #fff 50%, transparent 51%),
    radial-gradient(90% 120% at 82% 120%, #0c1730 0%, #050812 50%, var(--bg) 100%);
  border-bottom: 1px solid var(--rule);
}
.post-hero::before {
  content: ""; position: absolute; pointer-events: none;
  right: -6vw; bottom: -34vw;
  width: 46vw; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, #000 92%, rgba(216, 235, 255, .7) 95.5%, rgba(156, 200, 255, .14) 97.5%, transparent 100%);
  opacity: .9;
}
.post-hero > * {
  position: relative;
  max-width: 820px;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.post-hero .eyebrow {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
.post-hero .eyebrow .pill { border-radius: 999px; padding: 3px 10px; border-color: var(--rule); background: var(--accent-soft); color: var(--ice-bright); }
.post-hero h1 {
  font-family: var(--display); font-weight: 400; letter-spacing: -.015em; line-height: 1.04;
  text-shadow: 0 0 50px rgba(156, 200, 255, .18);
}
.post-hero h1 em {
  font-style: italic;
  background: linear-gradient(100deg, #fff 10%, var(--accent) 70%, #6f9fe6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.byline { border-top-color: var(--rule); }
.byline .field-label { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }

/* article */
.post-cover img, figure.figure, .article > figure.photo, .photo-grid img { border-radius: 4px; }
.post-cover img { border-color: var(--rule); }
figure.figure, .article > figure.photo { overflow: hidden; }
/* paper figures were drawn on white; keep them on white so they stay legible */
figure.figure img { background: #fff; }

.article p .dropcap:first-letter { font-family: var(--display); font-weight: 400; color: var(--ice-bright); }
.article h2 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(28px, 3.4vw, 36px); letter-spacing: -.005em; text-transform: none;
  border-bottom: 1px solid var(--rule);
}
.article h2 .num { font-family: var(--mono); font-size: .38em; letter-spacing: .1em; vertical-align: .5em; color: var(--accent); }
.article h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0; font-size: 1.45em; }
.article a { text-decoration-color: var(--rule); }
.article a:hover { color: var(--ice-bright); }

.tldr, .widget, .algo, .cite-block { border-radius: 4px; border-color: var(--rule); background: var(--paper); }
.tldr .label, .algo .algo-title, .widget header .tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 500;
  color: var(--accent);
}
.widget header .tag { border-radius: 999px; padding: 2px 9px; }
.note { background: var(--accent-soft); border-left-color: var(--accent); border-radius: 0 4px 4px 0; }
.pull { font-family: var(--display); font-style: italic; border-color: var(--rule); color: var(--ink); }
figure.figure figcaption .num { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; color: var(--accent); }
.widget input[type="range"] { background: var(--rule); }
.algo .kw { color: var(--accent); }

.article .katex { color: var(--ink); }

.post-footer { border-top: 1px solid var(--rule); font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
.post-footer a { border-bottom-color: var(--rule); }
.post-footer a:hover { color: var(--ice-bright); }

/* byline rule should line up with the text, not the padding */
.post-hero > .byline {
  padding-left: 0; padding-right: 0;
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(820px - 2 * var(--gutter));
}

@media (max-width: 720px) {
  .post-hero::before { width: 80vw; right: -30vw; bottom: -62vw; opacity: .7; }
}
