/* Self-hosted, latin subset. File names carry a content hash so they can be cached for a year;
   if a font file changes, rename it and update the preloads in layouts/base.njk. */
@font-face { font-family: "Archivo Narrow"; font-style: normal; font-weight: 500 700; font-display: swap; src: url("/fonts/archivo-narrow.728b32e9.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Red Hat Mono"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/fonts/red-hat-mono.9914ffa6.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/fonts/source-serif-4.2a24bad4.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/source-serif-4-italic.1ad786b3.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ground: #d9d8d3;
  --carbon: #16161a;
  --red: #b01e14;
  --paper: #f4f3ee;
  --dim: #4a4a4e;
  --soft: #55555a;
  --prompt: #b3b2ad;
  --green: #6fbf8a;

  --display: "Archivo Narrow", "Arial Narrow", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "Red Hat Mono", ui-monospace, monospace;

  --legend: 14.5rem;
  --foot: 4rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  color-scheme: light;
  scrollbar-color: var(--carbon) var(--ground);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--carbon);
  font: 500 1.0625rem/1.4 var(--display);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red); color: var(--paper); }
a { color: inherit; text-decoration-color: var(--red); text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--carbon); color: var(--paper); padding: 0.5rem 0.75rem; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: var(--legend) minmax(0, 1fr); min-height: 100vh; }

.legend {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--carbon);
}

.brand { font: 600 1rem var(--mono); text-decoration: none; margin-bottom: 2.25rem; }
.brand:hover { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }

.legend ul { list-style: none; margin: 0; padding: 0; }
.legend .note { margin: auto 0 0; font: 400 0.75rem/1.4 var(--mono); color: var(--soft); }

.legend nav a {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 0.65rem 0;
  color: var(--dim);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
}

.legend nav a:hover { color: var(--carbon); }
.legend .n { font: 600 0.85rem var(--mono); letter-spacing: 0; }

.legend nav a[aria-current] { color: var(--carbon); }

/* the underline draws under the current item and retracts from the one you leave */
.legend .t { position: relative; }
.legend .t::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.2em;
  border-bottom: 2px solid var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease);
}
.legend nav a[aria-current] .t::after { transform: scaleX(1); }

.col { display: flex; flex-direction: column; min-width: 0; padding: 0 var(--gutter) 0 3.5rem; }
main { flex: 1; }

/* ---------- page, rail, plate ---------- */

.page { min-height: calc(100svh - var(--foot)); padding: clamp(2rem, 9vh, 5rem) 0 2rem; }

.rail { position: relative; width: min(100%, 52rem); border-top: 1px solid var(--carbon); padding-top: 0.85rem; }

/* a red head on the rail's hairline, drawn in when the page or panel arrives */
.rail::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  width: 2.5rem;
  border-top: 2px solid var(--red);
  transform-origin: left;
  animation: tie 0.7s var(--ease) var(--d, 0s) both;
}

@keyframes tie { from { transform: scaleX(0); } }

.plate.rail { width: 100%; border-top: 0; }
.plate { background: var(--carbon); color: var(--paper); padding: 1.1rem clamp(1.25rem, 3vw, 2.25rem) 1.75rem; }
.plate::before { top: 0; }

.prompt { margin: 0 0 0.4rem; font: 400 0.875rem var(--mono); color: var(--prompt); overflow-wrap: anywhere; }
.prompt b { color: var(--paper); font-weight: 400; }
.prompt .ps { color: var(--green); }

.plate h1 {
  margin: 0;
  font: 700 clamp(4rem, 17vw, 11rem) / 0.86 var(--display);
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.tag {
  margin: 0.9rem 0 0;
  max-width: 52ch;
  font: 400 1.0625rem/1.55 var(--mono);
  color: #dcdbd6;
  text-wrap: pretty;
}

/* ---------- writing list ---------- */

.post-list { list-style: none; margin: 0; padding: 0; }

.post-list a {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.2rem 1rem;
  align-items: baseline;
  padding: 0 0 1rem;
  text-decoration: none;
}

.post-list time { grid-row: span 2; font: 400 0.875rem var(--mono); font-variant-numeric: tabular-nums; }
.post-list :is(.title, .desc) { grid-column: 2; }
.post-list .title { font: 600 1.5rem/1.25 var(--serif); }
.post-list .desc { font: 400 0.95rem/1.45 var(--serif); color: var(--dim); }

.post-list a:is(:hover, :focus-visible) .title { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.post-list .empty { font: 400 0.875rem var(--mono); color: var(--soft); }

.all { margin: 0.25rem 0 0; }
.all a { display: inline-flex; gap: 0.5rem; align-items: center; padding: 0.55rem 0; font: 400 0.8125rem var(--mono); text-decoration: none; }
.all a:hover { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; }

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

.post-header { width: min(100%, 52rem); margin-bottom: 2.5rem; }

.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 0; margin: 1.5rem 0 0; padding: 0.8rem 0 0; border-top: 1px dashed var(--carbon); font: 400 0.875rem var(--mono); color: var(--soft); }
.meta > :not(:last-child)::after { content: "/"; margin: 0 0.75em; }

.meta .tags { display: inline-flex; flex-wrap: wrap; gap: 0 0.75em; }
.meta .tags > span::before { content: "#"; }

.post-header h1 {
  margin: 0 0 1rem;
  font: 700 clamp(2.5rem, 6vw, 4.5rem) / 1.02 var(--display);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.lede { margin: 0; max-width: 40rem; font: italic 400 1.3rem/1.5 var(--serif); color: var(--dim); text-wrap: pretty; }

.prose { max-width: 66ch; font: 400 1.25rem/1.7 var(--serif); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.25rem; text-wrap: pretty; }
.prose a { text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }

.prose h2 { margin: 3rem 0 0.75rem; font: 700 1.9rem/1.15 var(--display); letter-spacing: -0.005em; text-wrap: balance; }
.prose h3 { margin: 2.25rem 0 0.5rem; font: 600 1rem/1.4 var(--mono); }
.prose ul, .prose ol { margin: 0 0 1.25rem; padding-left: 1.4em; }
.prose li { margin-bottom: 0.4rem; }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 1px dashed var(--carbon); margin: 3rem 0; }

.prose blockquote {
  margin: 2.5rem 0;
  padding: 0.1rem 0 0.1rem 1.5rem;
  border-left: 2px solid var(--red);
  font: italic 400 1.6rem/1.35 var(--serif);
}

.prose blockquote p { margin: 0; }

.prose :not(pre) > code {
  font: 0.85em var(--mono);
  background: rgb(22 22 26 / 0.08);
  padding: 0.1em 0.35em;
}

.prose pre {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  background: var(--carbon);
  color: var(--paper);
  scrollbar-color: var(--prompt) var(--carbon);
  font: 0.875rem/1.65 var(--mono);
}

.prose pre code { font: inherit; }

.prose h4 { margin: 1.75rem 0 0.4rem; font: 600 0.875rem/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.prose strong { font-weight: 600; }
.prose kbd { padding: 0.05em 0.4em; font: 0.8em var(--mono); border: 1px solid var(--carbon); }
.prose figure { margin: 2rem 0; }
.prose figcaption { margin-top: 0.5rem; font: 400 0.8125rem/1.4 var(--mono); color: var(--soft); }

.prose table {
  display: block;
  max-width: 100%;
  margin: 2rem 0;
  overflow-x: auto;
  border-collapse: collapse;
  font: 400 0.875rem/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
}

.prose th, .prose td { padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--carbon); text-align: left; vertical-align: top; }
.prose th { font-weight: 600; border-bottom-width: 2px; }

.token.comment, .token.prolog { color: #9a9993; font-style: italic; }
.token.keyword, .token.boolean, .token.important, .token.string, .token.char, .token.regex { color: var(--green); }
.token.number { color: #dcdbd6; }
.token.function, .token.class-name { color: #fff; font-weight: 600; }
.token.punctuation, .token.operator { color: var(--prompt); }

.post-nav {
  width: min(100%, 52rem);
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 4.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--carbon);
}

.post-nav a { display: flex; flex-direction: column; max-width: 22rem; text-decoration: none; }
.post-nav .lbl { margin-bottom: 0.25rem; font: 400 0.8125rem var(--mono); color: var(--soft); }
.post-nav .ttl { font: 600 1.2rem/1.3 var(--serif); }
.post-nav a:hover .ttl { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.post-nav .next { margin-left: auto; text-align: right; }

/* ---------- 404 ---------- */

.lost { margin-bottom: 3rem; }

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

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0 1.5rem;
  min-height: var(--foot);
  padding: 0.25rem 0;
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: var(--ground);
  border-top: 1px solid var(--carbon);
  font: 400 0.8125rem var(--mono);
  color: var(--soft);
}

.foot .links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.5rem; font: 400 0.875rem var(--mono); color: var(--carbon); }
.foot .links a { display: inline-block; padding: 0.85rem 0; text-decoration: none; }
.foot .links a:hover { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; }

@media (min-width: 36.01rem) {
  .foot { display: grid; grid-template-columns: 1fr auto 1fr; }
  .foot > :last-child { justify-self: end; }
}

/* ---------- print ---------- */

@media print {
  .legend, .skip { display: none; }
  .shell { display: block; }
  .col { padding: 0; }
  .page { min-height: 0; padding: 0; }
  .foot { position: static; }
  .rail::before { animation: none; }
  .prose pre { white-space: pre-wrap; background: none; color: var(--carbon); border: 1px solid var(--carbon); }
  body { background: #fff; }
}

/* ---------- narrow ---------- */

@media (min-width: 56rem) {
  .plate h1 { font-size: clamp(4rem, min(17vw, calc((100vw - 25rem) * 0.2)), 11rem); }
}

@media (max-width: 56rem) {
  html { scroll-padding-top: 4.5rem; }
  .shell { display: block; }
  .legend .note { display: none; }

  .legend {
    position: sticky;
    z-index: 5;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 1rem;
    padding: 0.5rem var(--gutter);
    background: var(--ground);
    border-right: 0;
    border-bottom: 1px solid var(--carbon);
  }

  .brand { margin: 0; }
  .legend ul { display: flex; gap: 0.75rem; }
  .legend nav a { padding: 0.8rem 0.25rem; letter-spacing: 0.06em; }

  .col { padding: 0 var(--gutter); }
  .page { min-height: calc(100svh - 4rem - var(--foot)); padding-top: 1.5rem; }
}

@media (max-width: 36rem) {
  :root { --foot: 3.5rem; }
  .foot { flex-wrap: nowrap; }
  .foot > span:first-child { display: none; }
  .foot .links { gap: 0 1rem; }
  .legend .n { display: none; }
  .legend ul { gap: 0.5rem; }
  .legend nav a { letter-spacing: 0.03em; font-size: 0.85rem; padding-inline: 0.15rem; }
  .post-list a { grid-template-columns: minmax(0, 1fr); }
  .post-list :is(.title, .desc) { grid-column: 1; }
  .post-list time { grid-row: auto; }
  .prose { font-size: 1.125rem; }
  .prose blockquote { font-size: 1.35rem; }
  .post-nav { flex-direction: column; gap: 1.25rem; }
  .post-nav .next { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .rail::before { animation: none !important; }
}
