/*
 * The four themes, and the control that picks between them.
 *
 * `jekyll-theme-primer` writes its colours as literals — `#24292e` on `body`,
 * `#f6f8fa` behind a code block, `#0366d6` on a link — so a second theme
 * cannot be a variable swap in the theme's own stylesheet. What it can be is a
 * second stylesheet that names those same places once each and reads their
 * colour from a custom property. That is this file: the block below is the
 * whole palette, four times over, and everything after it is the list of
 * places a palette reaches.
 *
 * Load order matters and is not the only thing holding this up: every rule
 * here is written under `:root[data-theme=…]` or a `@media` guard, so it
 * outranks the theme's own selector rather than merely following it.
 *
 * No attribute on <html> means "whatever the system asks for", which is the
 * state a reader who has never touched the picker is in, and the state the
 * picker returns to when they choose System. A stored choice is written to
 * `data-theme` before the first paint, in the layout.
 */

:root {
  color-scheme: light;

  --nk-bg: #ffffff;
  --nk-fg: #1f2733;
  --nk-fg-muted: #5d6878;
  --nk-link: #1a67a3;
  --nk-accent: #a57c24;
  --nk-border: #e2e6ec;
  --nk-border-strong: #d8dde5;
  --nk-surface: #f5f7fa;
  --nk-code-bg: #f5f7fa;
  --nk-code-inline-bg: rgba(27, 39, 51, 0.06);
  --nk-row: #ffffff;
  --nk-row-alt: #f5f7fa;
  --nk-header-bg: rgba(255, 255, 255, 0.86);
}

/*
 * Dark is the logo's night blue rather than an inversion of the light one. It
 * stays close to GitHub's dark palette because the code blocks below are
 * coloured by `github-dark`, and the page has to agree with them. The accent
 * in every theme is the logo's gold; links are its blue.
 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;

    --nk-bg: #0c1119;
    --nk-fg: #cfd6df;
    --nk-fg-muted: #8b96a5;
    --nk-link: #62b0ea;
    --nk-accent: #d8b264;
    --nk-border: #253041;
    --nk-border-strong: #2c384b;
    --nk-surface: #131a26;
    --nk-code-bg: #131a26;
    --nk-code-inline-bg: rgba(110, 124, 145, 0.3);
    --nk-row: #0c1119;
    --nk-row-alt: #131a26;
    --nk-header-bg: rgba(12, 17, 25, 0.86);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --nk-bg: #0c1119;
  --nk-fg: #cfd6df;
  --nk-fg-muted: #8b96a5;
  --nk-link: #62b0ea;
  --nk-accent: #d8b264;
  --nk-border: #253041;
  --nk-border-strong: #2c384b;
  --nk-surface: #131a26;
  --nk-code-bg: #131a26;
  --nk-code-inline-bg: rgba(110, 124, 145, 0.3);
  --nk-row: #0c1119;
  --nk-row-alt: #131a26;
  --nk-header-bg: rgba(12, 17, 25, 0.86);
}

/* Named so that a system set to dark can still be overridden back. */
:root[data-theme="light"] {
  color-scheme: light;

  --nk-bg: #ffffff;
  --nk-fg: #1f2733;
  --nk-fg-muted: #5d6878;
  --nk-link: #1a67a3;
  --nk-accent: #a57c24;
  --nk-border: #e2e6ec;
  --nk-border-strong: #d8dde5;
  --nk-surface: #f5f7fa;
  --nk-code-bg: #f5f7fa;
  --nk-code-inline-bg: rgba(27, 39, 51, 0.06);
  --nk-row: #ffffff;
  --nk-row-alt: #f5f7fa;
  --nk-header-bg: rgba(255, 255, 255, 0.86);
}

/*
 * Sepia is here because of what this site is: three specification parts and
 * forty decision records, read end to end rather than searched. It is a light
 * theme — the code keeps its light colours — with the white taken out of it.
 */
:root[data-theme="sepia"] {
  color-scheme: light;

  --nk-bg: #f4ecd8;
  --nk-fg: #3b3228;
  --nk-fg-muted: #6f6353;
  --nk-link: #2f5d8c;
  --nk-border: #ded0b4;
  --nk-border-strong: #d5c5a3;
  --nk-surface: #ece1c6;
  --nk-code-bg: #ece1c6;
  --nk-code-inline-bg: rgba(59, 50, 40, 0.09);
  --nk-row: #f4ecd8;
  --nk-row-alt: #ece1c6;
  --nk-accent: #8a6420;
  --nk-header-bg: rgba(244, 236, 216, 0.9);
}

/* ---------------------------------------------------------------- the page */

body {
  background-color: var(--nk-bg);
  color: var(--nk-fg);
}

.markdown-body {
  color: var(--nk-fg);
}

.markdown-body a {
  color: var(--nk-link);
}

.markdown-body h1,
.markdown-body h2 {
  border-bottom-color: var(--nk-border);
}

.markdown-body h6 {
  color: var(--nk-fg-muted);
}

.markdown-body hr {
  background-color: var(--nk-border);
}

.markdown-body blockquote {
  color: var(--nk-fg-muted);
  border-left-color: var(--nk-border-strong);
}

.markdown-body kbd {
  color: var(--nk-fg);
  background-color: var(--nk-surface);
  border-color: var(--nk-border);
  border-bottom-color: var(--nk-border-strong);
  box-shadow: inset 0 -1px 0 var(--nk-border-strong);
}

.markdown-body table th,
.markdown-body table td {
  border-color: var(--nk-border-strong);
}

.markdown-body table tr {
  background-color: var(--nk-row);
  border-top-color: var(--nk-border);
}

.markdown-body table tr:nth-child(2n) {
  background-color: var(--nk-row-alt);
}

/* Inline `code`. The block form is the Shiki `<pre>` further down. */
.markdown-body code,
.markdown-body tt {
  background-color: var(--nk-code-inline-bg);
}

/*
 * The theme paints white behind every image, which is right for a diagram
 * with a transparent background and wrong for the logo on a dark page. Only
 * the ones that need it keep it, and none in this repository do.
 */
.markdown-body img {
  background-color: transparent;
}

/*
 * Primer's utility classes carry `!important`, so the footer needs it back to
 * be reachable at all.
 */
.footer,
.markdown-body .text-gray {
  color: var(--nk-fg-muted) !important;
}

.markdown-body .border-gray-light {
  border-color: var(--nk-border) !important;
}

/* ----------------------------------------------------------------- the code */

/*
 * Every fenced block on this site is re-highlighted after Jekyll has run, by
 * `scripts/site-highlight/highlight.mjs`, from the same TextMate grammar the
 * editors use. Shiki writes both of each token's colours onto the token as
 * custom properties and sets no `color` at all, so switching themes is a
 * matter of saying which of the two to read. That is the only reason this
 * works without `!important`: an inline `color` outranks every selector in
 * this file, and a custom property does not.
 *
 * Light is the base, so Sepia — which has no token colours of its own —
 * inherits it by not matching either dark rule. The background is taken off
 * the block and given back from the palette, which is what lets Sepia have a
 * code background of its own at all.
 */
.markdown-body .shiki {
  background-color: var(--nk-code-bg);
  padding: 16px;
  overflow: auto;
  font-size: 85%;
  line-height: 1.45;
  border-radius: 3px;
}

/*
 * The lines are inline and the newline between them is what breaks them, which
 * is why `white-space: pre` is not a detail here: give `.line` a `display` of
 * its own and every block is double-spaced, because the newline is still there.
 */
.markdown-body .shiki code {
  background-color: transparent;
  padding: 0;
  border: 0;
  font-size: 100%;
  white-space: pre;
}

.markdown-body .shiki,
.markdown-body .shiki span {
  color: var(--shiki-light);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .markdown-body .shiki,
  :root:not([data-theme]) .markdown-body .shiki span {
    color: var(--shiki-dark);
  }
}

:root[data-theme="dark"] .markdown-body .shiki,
:root[data-theme="dark"] .markdown-body .shiki span {
  color: var(--shiki-dark);
}

/* -------------------------------------------------------------- the control */

.theme-picker {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--nk-border);
  border-radius: 6px;
  background-color: var(--nk-surface);
  font-size: 12px;
  line-height: 20px;
}

.theme-picker button {
  padding: 1px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--nk-fg-muted);
  font: inherit;
  cursor: pointer;
}

.theme-picker button:hover {
  color: var(--nk-fg);
}

.theme-picker button[aria-pressed="true"] {
  background-color: var(--nk-bg);
  color: var(--nk-fg);
  font-weight: 600;
}

.theme-picker button:focus-visible {
  outline: 2px solid var(--nk-link);
  outline-offset: -1px;
}

/* ----------------------------------------------------------------- the menu */

/*
 * A sidebar where there is room for one, and a stack of closed sections above
 * the text where there is not. The content column keeps the theme's own width
 * and centring inside whatever is left, so a narrow window reads exactly as it
 * did before the menu existed.
 */

.page {
  display: block;
}

.site-nav {
  flex: none;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  border-bottom: 1px solid var(--nk-border);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

/*
 * The outer disclosure is the menu itself, and it exists for narrow screens
 * only: a section of sixty decision records, open because it is the one being
 * read, would be the whole first screenful before a word of the page. On a
 * wide screen its summary is gone and its body is shown whether the disclosure
 * is open or not, so the sidebar is simply always there.
 */
.site-nav-outer > summary,
.site-nav-section > summary {
  padding: 4px 0;
  color: var(--nk-fg);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

/* The triangle, drawn rather than inherited, so it is the same mark in every
   browser and turns with the section. */
.site-nav-outer > summary::-webkit-details-marker,
.site-nav-section > summary::-webkit-details-marker {
  display: none;
}

.site-nav-outer > summary::before,
.site-nav-section > summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  vertical-align: 1px;
  transition: transform 0.12s ease;
}

.site-nav-outer[open] > summary::before,
.site-nav-section[open] > summary::before {
  transform: rotate(90deg);
}

.site-nav-outer > summary:focus-visible,
.site-nav-section > summary:focus-visible {
  outline: 2px solid var(--nk-link);
  outline-offset: 1px;
}

.site-nav ul {
  margin: 2px 0 10px;
  padding: 0 0 0 13px;
  border-left: 1px solid var(--nk-border);
  list-style: none;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  display: block;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--nk-fg-muted);
  text-decoration: none;
}

.site-nav a:hover {
  background-color: var(--nk-surface);
  color: var(--nk-fg);
}

/* The page being read. It is the one entry a reader needs to find without
   reading, so it is marked twice: for the eye and for a screen reader. */
.site-nav a[aria-current="page"] {
  background-color: var(--nk-surface);
  color: var(--nk-fg);
  font-weight: 600;
}

/* Indented under the one-line menu, on the screens where that line exists. */
.site-nav-body {
  padding-left: 13px;
}

@media (min-width: 900px) {
  .page {
    display: flex;
    align-items: flex-start;
  }

  /* At this width the outer disclosure is not a control. It is left open and
     its summary is taken away, so what remains is the sidebar. */
  .site-nav-outer > summary {
    display: none;
  }

  .site-nav-body {
    padding-left: 0;
  }

  .site-nav {
    position: sticky;
    top: var(--nk-header-height);
    width: 264px;
    max-height: calc(100vh - var(--nk-header-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 8px 24px 16px;
    border-right: 1px solid var(--nk-border);
    border-bottom: 0;
  }

  /* The content column must be able to shrink, or a wide table inside it
     pushes the whole layout instead of scrolling in its own box. */
  .page > .container-lg {
    min-width: 0;
    flex: 1 1 auto;
  }
}

/* --------------------------------------------------------------- the header */

/*
 * One bar across every page, and sticky: the way home and the six places a
 * reader goes are never more than a glance away, however deep into a decision
 * record the reader is. The sidebar sits under it (`top` above).
 */
:root {
  --nk-header-height: 56px;
  --nk-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Helvetica, Arial, sans-serif;
}

body {
  font-family: var(--nk-sans);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--nk-border);
  background-color: var(--nk-header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  font-family: var(--nk-sans);
  font-size: 14px;
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1440px;
  min-height: var(--nk-header-height);
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

.site-brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  color: var(--nk-fg);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.site-brand:hover {
  color: var(--nk-fg);
  text-decoration: none;
}

.site-brand img {
  border-radius: 7px;
}

.site-header-menu {
  flex: 1 1 auto;
  min-width: 0;
}

.site-header-menu > summary {
  display: none;
}

.site-header-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.site-header-links a,
.site-github {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--nk-fg-muted);
  text-decoration: none;
  white-space: nowrap;
}

.site-header-links a:hover,
.site-github:hover {
  background-color: var(--nk-surface);
  color: var(--nk-fg);
  text-decoration: none;
}

.site-header-links a[aria-current="page"] {
  color: var(--nk-fg);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--nk-accent);
  border-radius: 6px 6px 0 0;
}

.site-header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The two badges the README carries, as one pill: the version leads to the
   changelog, the status to the roadmap. */
.site-version {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--nk-border);
  border-radius: 999px;
  font-size: 12px;
  line-height: 22px;
  white-space: nowrap;
}

.site-version a {
  padding: 0 9px;
  color: var(--nk-fg-muted);
  text-decoration: none;
}

.site-version a + a {
  border-left: 1px solid var(--nk-border);
  color: var(--nk-accent);
  font-weight: 600;
}

.site-version a:hover {
  background-color: var(--nk-surface);
  text-decoration: none;
}

.site-header a:focus-visible,
.site-header summary:focus-visible {
  outline: 2px solid var(--nk-link);
  outline-offset: 1px;
}

/*
 * Too narrow for the row: the links become a menu under a button, opened as a
 * panel below the bar. `nav.js` closes the disclosure at this width; without
 * script it stays open and the panel is simply shown.
 */
@media (max-width: 1099px) {
  .site-header-inner {
    justify-content: space-between;
  }

  .site-header-menu {
    flex: none;
  }

  .site-header-menu > summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--nk-border);
    border-radius: 6px;
    color: var(--nk-fg);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
  }

  .site-header-menu > summary::-webkit-details-marker {
    display: none;
  }

  .site-header-burger,
  .site-header-burger::before,
  .site-header-burger::after {
    display: block;
    width: 14px;
    height: 2px;
    border-radius: 1px;
    background-color: currentColor;
  }

  .site-header-burger {
    position: relative;
  }

  .site-header-burger::before,
  .site-header-burger::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .site-header-burger::before { top: -5px; }
  .site-header-burger::after { top: 5px; }

  .site-header-body {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--nk-border);
    background-color: var(--nk-bg);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  }

  .site-header-links {
    flex-direction: column;
  }

  .site-header-links a {
    padding: 8px 10px;
    font-size: 15px;
  }

  .site-header-links a[aria-current="page"] {
    box-shadow: inset 3px 0 0 var(--nk-accent);
    border-radius: 0 6px 6px 0;
  }

  .site-header-tools {
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--nk-border);
  }
}

/* --------------------------------------------------------------- the text */

/*
 * A line of about 75 characters. The theme's column is 1012px, which at 16px
 * is well over a hundred, and a specification is read end to end.
 */
.page > .markdown-body {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  letter-spacing: -0.01em;
}

.page-edit {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--nk-border);
  color: var(--nk-fg-muted);
  font-size: 13px;
}

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

.site-footer {
  border-top: 1px solid var(--nk-border);
  background-color: var(--nk-surface);
  color: var(--nk-fg-muted);
  font-family: var(--nk-sans);
  font-size: 13px;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 16px;
  box-sizing: border-box;
}

.site-footer-brand strong {
  color: var(--nk-fg);
}

.site-footer-sub {
  display: block;
  margin-top: 2px;
  font-style: italic;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.site-footer-links a {
  color: var(--nk-fg-muted);
}

.site-footer-links a:hover {
  color: var(--nk-fg);
}

/* ------------------------------------------------------------ the home page */

/*
 * The first screen is the logo's own night, in every theme: the logo is
 * painted on it, and a white page around a dark picture is what made the old
 * front page look like a README. Everything below it follows the theme.
 */
.home {
  --nk-hero-bg: #0c1119;
  --nk-hero-fg: #e8ecf1;
  --nk-hero-muted: #a9b4c2;
  --nk-gold: #d8b264;
  --nk-gold-deep: #b98f3e;
  --nk-blue: #4aa3e0;
}

.home main {
  display: block;
}

.home h2,
.home h3 {
  border: 0;
  letter-spacing: -0.01em;
}

.home code {
  padding: 0.15em 0.35em;
  border-radius: 4px;
  background-color: var(--nk-code-inline-bg);
  font-size: 0.88em;
}

.home-inner,
.hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  box-sizing: border-box;
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 72% 45%, rgba(74, 163, 224, 0.16), transparent 55%),
    radial-gradient(ellipse at 20% 110%, rgba(216, 178, 100, 0.12), transparent 50%),
    var(--nk-hero-bg);
  color: var(--nk-hero-fg);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  align-items: center;
  gap: 40px;
  padding-top: 72px;
  padding-bottom: 72px;
}

.hero-eyebrow {
  margin: 0 0 16px;
  color: var(--nk-gold);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 20px;
  border: 0;
  color: var(--nk-hero-fg);
  font-size: clamp(32px, 3.7vw, 52px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--nk-gold) 0%, #e9d4a0 40%, var(--nk-blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  max-width: 560px;
  margin: 0 0 32px;
  color: var(--nk-hero-muted);
  font-size: 18px;
  line-height: 1.6;
}

.hero-lead:has(+ .hero-lead) {
  margin-bottom: 14px;
}

.hero-lead code {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--nk-hero-fg);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-motto {
  margin: 28px 0 0;
  color: var(--nk-hero-muted);
  font-style: italic;
  letter-spacing: 0.04em;
}

/* The picture's background is the hero's night, so `lighten` lets only the
   emblem show; the two fades take what is left of its edge away without
   reaching the lettering. */
.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: lighten;
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
    linear-gradient(to bottom, transparent, #000 12%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
    linear-gradient(to bottom, transparent, #000 12%, #000 90%, transparent);
  mask-composite: intersect;
  animation: nk-rise 1.2s ease-out both;
}

@keyframes nk-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

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

.button {
  display: inline-block;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.button:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 2px solid var(--nk-blue, var(--nk-link));
  outline-offset: 2px;
}

.button-primary {
  background: linear-gradient(180deg, var(--nk-gold), var(--nk-gold-deep));
  color: #1a1408;
}

.button-primary:hover {
  color: #1a1408;
}

.hero .button-secondary {
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--nk-hero-fg);
}

.hero .button-secondary:hover {
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--nk-hero-fg);
}

.hero .button-ghost {
  color: var(--nk-hero-muted);
}

.hero .button-ghost:hover {
  color: var(--nk-hero-fg);
}

.button-secondary {
  border-color: var(--nk-border-strong);
  color: var(--nk-fg);
}

.button-secondary:hover {
  border-color: var(--nk-accent);
  color: var(--nk-fg);
}

.button-ghost {
  color: var(--nk-link);
}

.home-section {
  padding: 72px 0;
}

.home-section-alt {
  border-top: 1px solid var(--nk-border);
  border-bottom: 1px solid var(--nk-border);
  background-color: var(--nk-surface);
}

.home-heading {
  margin: 0 0 32px;
  font-size: 30px;
  font-weight: 750;
  text-align: center;
}

.home-split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 48px;
}

.home-split-text h2 {
  margin: 0 0 16px;
  font-size: 30px;
  font-weight: 750;
  line-height: 1.2;
}

.home-split-text p {
  color: var(--nk-fg-muted);
  font-size: 16px;
  line-height: 1.65;
}

.home-split-text a {
  color: var(--nk-link);
  font-weight: 600;
}

/* The "In depth" link is the split's last child: in one column it follows the
   side (a figure, a code panel) instead of standing above it; in two it sits
   right under the text, the side beside both. */
.home-split-more {
  margin: -24px 0 0;
  font-size: 16px;
}

.home-split-more a {
  color: var(--nk-link);
}

@media (min-width: 900px) {
  .home-split:has(> .home-split-more) {
    row-gap: 0;
  }

  .home-split:has(> .home-split-more) > .home-split-text {
    grid-column: 1;
    grid-row: 1;
    align-self: end;
  }

  .home-split:has(> .home-split-more) > .home-code-side {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .home-split > .home-split-more {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    margin: 0;
  }
}

/* The code panel is dark in every theme, like the hero it follows. */
.home-code.markdown-body {
  max-width: none;
}

.home-code.markdown-body .shiki,
.home-code.markdown-body pre {
  margin: 0;
  padding: 24px;
  border: 1px solid #253041;
  border-radius: 12px;
  background-color: #0c1119;
  box-shadow: 0 24px 48px rgba(12, 17, 25, 0.25);
  font-size: 14px;
  line-height: 1.6;
}

.home-code.markdown-body .shiki,
.home-code.markdown-body .shiki span {
  color: var(--shiki-dark);
}

/*
 * A compiler message as the terminal shows it, on the same dark panel: the
 * code and the place in red, a place that explains it in blue, the way out in
 * green. Written by hand in `index.html`, not highlighted.
 */
.home-code.markdown-body pre.diagnostic {
  color: #d6dde8;
  white-space: pre;
  overflow-x: auto;
}

.home-code.markdown-body pre.diagnostic code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: 12px;
}

@media (max-width: 600px) {
  .home-code.markdown-body pre.diagnostic code { font-size: 11px; }
}

.home-code.markdown-body pre.diagnostic b { color: #f2f5f9; }
.home-code.markdown-body pre.diagnostic .d-error { color: #ff7b72; font-weight: 700; }
.home-code.markdown-body pre.diagnostic .d-note { color: #79c0ff; font-weight: 700; }
.home-code.markdown-body pre.diagnostic .d-help { color: #7ee787; font-weight: 700; }
.home-code.markdown-body pre.diagnostic .d-gutter { color: #6e7b8f; }

.compare {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.compare-card {
  padding: 24px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
  background-color: var(--nk-bg);
}

.compare-card h3 {
  margin: 0;
  font-size: 19px;
}

.compare-card p {
  margin: 0;
  color: var(--nk-fg-muted);
  line-height: 1.6;
}

.compare-card .compare-examples {
  margin: 2px 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.compare-card-nikaia {
  border-color: var(--nk-accent);
  box-shadow: 0 0 0 1px var(--nk-accent), 0 12px 32px rgba(165, 124, 36, 0.12);
}

.compare-card-nikaia .compare-examples {
  color: var(--nk-accent);
}

.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.features-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature p a {
  white-space: nowrap;
}

.feature {
  padding: 24px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
  background-color: var(--nk-bg);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.feature:hover {
  transform: translateY(-2px);
  border-color: var(--nk-accent);
}

.feature svg {
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  fill: none;
  stroke: var(--nk-accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.feature p {
  margin: 0;
  color: var(--nk-fg-muted);
  font-size: 15px;
  line-height: 1.6;
}

.limits-lead {
  max-width: 760px;
  margin: 0 0 32px;
  color: var(--nk-fg-muted);
}

.limits-grid {
  display: grid;
  gap: 20px;
}

.safe-lead {
  max-width: 760px;
  margin: 0 0 32px;
  color: var(--nk-fg-muted);
}

.safe-tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
}

.safe-tile {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--nk-border);
  border-radius: 14px;
  background-color: var(--nk-bg);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 0;
}

.safe-tile-b {
  grid-column: span 3;
}

.safe-tile:hover {
  transform: translateY(-2px);
  border-color: var(--nk-accent);
  box-shadow: 0 12px 28px rgba(12, 17, 25, 0.12);
}

.safe-tile h3 {
  margin: 0;
  color: var(--nk-fg);
  font-size: 18px;
}

.safe-tile p {
  margin: 0;
  color: var(--nk-fg-muted);
  font-size: 15px;
  line-height: 1.55;
}

.safe-tile .home-code.markdown-body pre {
  margin: 0;
  padding: 12px 14px;
  box-shadow: none;
  font-size: 12.5px;
  overflow-x: auto;
}

.safe-tile .home-code.markdown-body pre.diagnostic {
  margin-top: -6px;
  padding: 10px 14px;
  border-radius: 0 0 12px 12px;
  box-shadow: none;
  white-space: pre-wrap;
  font-size: 12px;
}

.safe-tile pre.diagnostic code {
  white-space: pre-wrap;
}

.safe-note {
  padding: 12px 14px;
  border-left: 3px solid var(--nk-border);
  border-radius: 4px;
  background-color: var(--nk-surface);
}

.safe-chip {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--nk-border);
  font-size: 12px;
  font-weight: 600;
  color: var(--nk-fg-muted);
}

.safe-chip-build {
  border-color: var(--nk-accent);
  color: var(--nk-accent);
}

.safe-more {
  margin-top: auto;
  padding-top: 4px;
  font-size: 14px;
  color: var(--nk-accent);
}

.safe-stat {
  padding: 18px 20px;
  border-radius: 12px;
  background-color: var(--nk-surface);
  border: 1px solid var(--nk-border);
}

.safe-stat .stat-value {
  margin: 0 0 4px;
  font-size: 34px;
  font-weight: 750;
  color: var(--nk-accent);
}

.safe-stat .stat-label {
  margin: 0;
  color: var(--nk-fg-muted);
  font-size: 14px;
}

.home-code-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.home-code-side .home-code.markdown-body pre.diagnostic {
  white-space: pre-wrap;
}

.lead-in {
  font-weight: 700;
}

.safe-in-depth {
  font-weight: 600;
}

.safe-reading {
  margin: 32px 0 0;
  padding: 20px 24px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
  background-color: var(--nk-surface);
}

.safe-reading h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.safe-reading ul {
  margin: 0;
  padding-left: 20px;
}

.safe-below {
  margin: 24px 0 0;
  color: var(--nk-fg-muted);
}

@media (max-width: 1000px) {
  .safe-tile,
  .safe-tile-b { grid-column: span 3; }
}

@media (max-width: 700px) {
  .safe-tile,
  .safe-tile-b { grid-column: 1 / -1; }
}

.safe-others {
  margin: 24px 0 0;
  color: var(--nk-fg-muted);
  font-size: 15px;
}

.safe-others a {
  margin-right: 14px;
}

.limit-class {
  padding: 24px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
  background-color: var(--nk-bg);
}

.limit-class h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.limit-n {
  display: inline-block;
  min-width: 1.4em;
  color: var(--nk-accent);
}

.limit-steps {
  display: grid;
  grid-template-columns: 11em minmax(0, 1fr);
  gap: 10px 20px;
  margin: 0;
}

.limit-steps dt {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--nk-accent);
  padding-top: 3px;
}

.limit-steps dd {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.limit-steps dd strong {
  font-size: 16px;
}

.limit-details {
  margin-top: 16px;
  border-top: 1px solid var(--nk-border);
  padding-top: 12px;
}

.limit-details summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--nk-accent);
}

.limit-details pre {
  overflow-x: auto;
}

@media (max-width: 760px) {
  .limit-steps { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .limit-steps dd { margin-bottom: 10px; }
}

.home-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
  padding: 32px;
  border: 1px solid var(--nk-border);
  border-left: 4px solid var(--nk-accent);
  border-radius: 12px;
}

.home-status h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.home-status p {
  margin: 0;
  color: var(--nk-fg-muted);
  line-height: 1.65;
}

.home-status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.next {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.next-card {
  display: block;
  padding: 20px 22px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
  background-color: var(--nk-bg);
  color: var(--nk-fg);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.next-card:hover {
  transform: translateY(-2px);
  border-color: var(--nk-accent);
  color: var(--nk-fg);
  text-decoration: none;
}

.next-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.next-card h3::after {
  content: " →";
  color: var(--nk-accent);
}

.next-card p {
  margin: 0;
  color: var(--nk-fg-muted);
  font-size: 14px;
  line-height: 1.55;
}

@media (prefers-reduced-motion: reduce) {
  .button, .feature, .next-card { transition: none; }
  .button:hover, .feature:hover, .next-card:hover { transform: none; }
}

@media (max-width: 899px) {
  .hero-inner,
  .home-split,
  .home-status {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-inner {
    padding-top: 40px;
    padding-bottom: 48px;
    gap: 8px;
  }

  .hero-art {
    order: -1;
    max-width: 340px;
    margin: 0 auto;
  }

  .compare,
  .features,
  .features-four,
  .next {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-section {
    padding: 48px 0;
  }

  .home-inner,
  .hero-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (min-width: 900px) and (max-width: 1099px) {
  .features,
  .features-four,
  .next {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/*
 * The proofs, the numbers and the progress sections. Stat tiles carry a
 * headline number each; the self-hosting chart is one series, so it needs no
 * legend: its caption names it, and every bar carries its value as text.
 */
.home-eyebrow {
  margin: 0 0 10px;
  color: var(--nk-accent);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home-split-text .home-eyebrow {
  color: var(--nk-accent);
  font-size: 13px;
  line-height: 1.4;
}

.home-eyebrow-center {
  text-align: center;
}

.home-eyebrow-center + .home-heading {
  margin-bottom: 16px;
}

.home-intro {
  max-width: 760px;
  margin: 0 auto 32px;
  color: var(--nk-fg-muted);
  font-size: 16px;
  line-height: 1.65;
  text-align: center;
}

.home-footnote {
  margin: 24px 0 0;
  color: var(--nk-fg-muted);
  font-size: 14px;
  line-height: 1.6;
}

#performance .home-footnote {
  text-align: center;
}

.home-footnote a {
  color: var(--nk-link);
  font-weight: 600;
}

.home-code-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}


.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.stat {
  padding: 24px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
  background-color: var(--nk-bg);
}

.stat p {
  margin: 0;
}

.stat-value {
  color: var(--nk-fg);
  font-size: 44px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin-top: 8px !important;
  color: var(--nk-fg);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.stat-detail {
  margin-top: 6px !important;
  color: var(--nk-fg-muted);
  font-size: 14px;
  line-height: 1.5;
}

.stats-compact {
  gap: 12px;
  margin: 16px 0 0;
}

.stats-compact .stat {
  padding: 16px;
}

.stats-compact .stat-value {
  font-size: 28px;
}

.stats-compact .stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--nk-fg-muted);
}

.progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 48px;
}

.progress-text p {
  color: var(--nk-fg-muted);
  font-size: 16px;
  line-height: 1.65;
}

.progress-text p:first-child {
  margin-top: 0;
}

.progress-text b {
  color: var(--nk-fg);
}

.progress-text .stat-value {
  color: var(--nk-fg);
  font-size: 28px;
  line-height: 1.05;
}

.progress-text .stat-label {
  font-size: 13px;
  line-height: 1.4;
}

.progress-text .home-footnote {
  font-size: 14px;
}

.bars {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
  background-color: var(--nk-bg);
}

.bars figcaption {
  margin-bottom: 16px;
}

.bars figcaption b {
  display: block;
  color: var(--nk-fg);
  font-size: 16px;
}

.bars figcaption span {
  color: var(--nk-fg-muted);
  font-size: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-radius: 4px;
}

.bar-row:hover {
  background-color: var(--nk-surface);
}

.bar-day,
.bar-value {
  color: var(--nk-fg-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.bar-value {
  text-align: right;
  color: var(--nk-fg);
}

.bar-track {
  display: block;
  height: 14px;
}

/* Scaled to 25 %, not 100 %: the chart is about the climb, and the axis is
   stated by every bar's own value. */
.bar {
  display: block;
  width: calc(var(--v) / 40 * 100%);
  min-width: 2px;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background-color: var(--nk-accent);
}

@media (max-width: 899px) {
  .stats,
  .progress {
    grid-template-columns: minmax(0, 1fr);
  }

  .progress {
    gap: 24px;
  }

  .stat-value {
    font-size: 36px;
  }
}

/* A link to a heading (the guides' Specification links, a shared #anchor)
   lands below the sticky header instead of behind it. */
.markdown-body [id] {
  scroll-margin-top: calc(var(--nk-header-height) + 16px);
}

.home-split-text h2 code { font-size: 0.8em; }

/* The 1BRC study. Running text stands on the page, not in a box, so that a
   phone gives it the whole width; a box is kept for small things with little
   or no text: the "Used by" line of a technique, the program's source. */
.study-card {
  margin: 36px 0 0;
}
.study-card > h2 {
  margin: 0 0 12px;
  font-size: 20px;
}
.study-card > p:last-child,
.study-card > ul:last-child { margin-bottom: 0; }
.study-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 32px;
}
.study-tile {
  display: flex;
  flex-direction: column;
  padding: 16px 0 0;
  border-top: 1px solid var(--nk-border);
}
.study-tile h3 {
  margin: 0;
  font-size: 17px;
}
.study-tile p {
  margin: 8px 0 0;
  color: var(--nk-fg-muted);
  font-size: 15px;
  line-height: 1.55;
}
.study-tile p:last-of-type { margin-bottom: 12px; }
.study-used {
  margin-top: auto;
  align-self: flex-start;
  padding: 4px 10px;
  border: 1px solid var(--nk-border);
  border-radius: 8px;
  background-color: var(--nk-surface);
  font-size: 13px;
  color: var(--nk-fg-muted);
}
.study-used strong {
  margin-right: 6px;
  color: var(--nk-fg);
}
.study-used code { font-size: 12px; }
.study-wide { grid-column: 1 / -1; }
.study-card pre { max-width: 100%; overflow-x: auto; }
.study-card table { font-size: 14px; }
/* The program's source is a box: a disclosure with code and no prose. */
details.study-card {
  padding: 14px 16px;
  border: 1px solid var(--nk-border);
  border-radius: 12px;
}
@media (max-width: 760px) {
  .study-tiles { grid-template-columns: minmax(0, 1fr); }
}
