@font-face {
  font-family: "Instrument";
  src: url("/fonts/instrument.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument";
  src: url("/fonts/instrument-italic.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: italic;
  font-display: swap;
}

:root {
  --void: #060818;   /* page */
  --star: #e9ecff;   /* headings */
  --text: #cfd4ee;   /* body */
  --haze: #8d93b8;   /* secondary */
  --rim: #b9c2ff;    /* horizon line, links */
  --glow: #6d7dff;   /* atmosphere */
  --panel: #10152e;  /* code */
  --line: rgb(255 255 255 / 0.11);
  --measure: 40rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--void); color: var(--text); }
body { margin: 0; font: 400 1.125rem / 1.65 "Instrument", system-ui, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: clip; }

a { color: var(--rim); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--star); }
:focus-visible { outline: 2px solid var(--rim); outline-offset: 4px; border-radius: 2px; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 2; }
.skip:focus { top: 1rem; }

h1, h2, h3 { color: var(--star); font-stretch: 75%; font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; }

/* ---------- header (over the stars) ---------- */

.head { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 1rem; padding: 2.5rem clamp(1.5rem, 4.5vw, 4rem) 0; font-size: 1rem; }
.head a { color: var(--haze); text-decoration: none; }
.head a:hover { color: var(--star); }
.head nav { display: flex; gap: 1.5rem; }

/* a few fixed stars behind the whole top of every page */
body::before {
  content: "";
  position: absolute; inset: 0 0 auto; height: 46rem; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 62%, #fff9 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 33%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 73% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 86% 41%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 22%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 48%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 30%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 55%, #fff6 50%, transparent 51%),
    radial-gradient(1px 1px at 19% 40%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 79% 63%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 3% 8%, #fffc 50%, transparent 51%),
    radial-gradient(1px 1px at 48% 4%, #fff9 50%, transparent 51%);
}

/* ---------- home: the horizon ---------- */

.sky { position: relative; display: flex; flex-direction: column; text-align: center; padding: clamp(5rem, 12vw, 9rem) 1.5rem 0; }
.sky h1 { position: relative; margin: 0; font-size: clamp(3.5rem, 1rem + 9vw, 8.75rem); line-height: 0.9; }
.tag { position: relative; margin: 1.5rem auto 0; max-width: 40rem; color: var(--haze); text-wrap: balance; font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3rem); }

/* a planet so large only its upper edge shows: one circle drawn as a gradient, so it fades into the page with no seam */
.planet {
  --r: max(75rem, 90vw);
  --lift: 8rem; /* room above the horizon for the glow to fade out */
  position: relative;
  height: calc(24rem + var(--lift));
  margin: calc(clamp(2.5rem, 6vw, 4.5rem) - var(--lift)) -1.5rem 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% calc(var(--r) + var(--lift)),
    var(--void) calc(var(--r) - 18rem),
    #10153a calc(var(--r) - 1.5rem),
    #1b2254 calc(var(--r) - 2px),
    var(--rim) calc(var(--r) - 1px),
    var(--rim) var(--r),
    rgb(109 125 255 / 0.5) calc(var(--r) + 1px),
    rgb(109 125 255 / 0.12) calc(var(--r) + 4rem),
    transparent calc(var(--r) + 9rem));
  /* the far sides of the glow would otherwise stop at the box's bottom edge */
  mask-image: linear-gradient(transparent, #000 var(--lift), #000 60%, transparent);
  animation: rise 1.8s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes rise { from { opacity: 0; translate: 0 3rem; } }

.below {
  position: relative;
  width: min(62rem, 100% - 3rem);
  margin: -15rem auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem 4rem;
}
.below h2 { font-size: 1.125rem; font-weight: 600; color: var(--haze); letter-spacing: 0; margin: 0 0 0.5rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.item { display: block; padding: 1rem 0; text-decoration: none; }
.item strong { display: block; color: var(--star); font-size: 1.375rem; font-weight: 600; line-height: 1.3; }
.item span { color: var(--haze); }
a.item:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.item-empty strong { color: var(--haze); }

.post-item { padding: 1rem 0; }
.post-item time { display: block; color: var(--haze); font-size: 0.95rem; }
.post-item > a { font-size: 1.375rem; line-height: 1.3; }
.post-item p { margin: 0.35rem 0 0; color: var(--haze); }

@media (max-width: 48rem) {
  .below { grid-template-columns: 1fr; margin-top: -17rem; }
}

/* ---------- a post ---------- */

.post { width: min(var(--measure), 100% - 3rem); margin: clamp(4rem, 10vw, 7rem) auto 0; position: relative; }
.post h1 { font-size: clamp(2.5rem, 1.5rem + 4vw, 4.25rem); margin: 0; text-wrap: balance; }
.meta { color: var(--haze); margin: 1.25rem 0 3rem; }

.prose > * { margin-block: 0 1.25em; }
.prose :is(h2, h3) { letter-spacing: -0.01em; }
.prose h2 { font-size: 2rem; margin-top: 2em; }
.prose h3 { font-size: 1.5rem; margin-top: 1.75em; }
.prose strong { color: var(--star); }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
.prose blockquote { margin-inline: 0; padding-left: 1.25rem; border-left: 2px solid var(--glow); color: var(--haze); }
.prose hr { border: 0; height: 1px; background: var(--line); margin-block: 3rem; }

code, pre { font-family: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, monospace; font-size: 0.875em; }
:not(pre) > code { background: var(--panel); padding: 0.1em 0.35em; border-radius: 4px; color: var(--star); }
pre { background: var(--panel); padding: 1rem 1.25rem; border-radius: 6px; overflow-x: auto; line-height: 1.5; border: 1px solid var(--line); }

.back { margin-top: 4rem; }

/* ---------- footer ---------- */

.foot { width: min(62rem, 100% - 3rem); margin: 7rem auto 0; padding-block: 1.5rem 3rem; border-top: 1px solid var(--line); color: var(--haze); font-size: 0.95rem; }
.foot p { margin: 0; }
.post ~ .foot { width: min(var(--measure), 100% - 3rem); }

@media (prefers-reduced-motion: reduce) {
  .planet { animation: none; }
}
