@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600 750;
  font-display: swap;
  src: url("manrope-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --background: #f7f4ec;
  --surface: #fffdf7;
  --surface-raised: #eee8db;
  --text: #29251f;
  --heading: #171510;
  --muted: #5f5a50;
  --faint: #756f63;
  --border: #d3cabb;
  --gold: #825600;
  --gold-soft: #a87319;
  --cyan: #096b78;
  --cyan-hover: #004c57;
  --code: #26363b;
  --danger: #a52a2a;
  --measure: 52rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

::selection {
  background: #ead7ac;
  color: var(--heading);
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 1rem;
  line-height: 1.58;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--cyan);
  text-decoration-color: color-mix(in srgb, var(--cyan) 45%, transparent);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--cyan-hover);
  text-decoration-color: currentColor;
}

a:focus-visible {
  border-radius: 0.2rem;
  outline: 0.18rem solid var(--gold);
  outline-offset: 0.18rem;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 20;
  padding: 0.55rem 0.8rem;
  transform: translateY(-200%);
  border: 1px solid var(--gold);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--text);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.5rem;
  padding: 0.5rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 92%, transparent);
  backdrop-filter: blur(12px);
}

.site-mark {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.site-mark__prompt {
  color: var(--gold);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: flex-end;
  font-size: 0.9rem;
}

.site-nav a {
  padding: 0.3rem 0.1rem;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(10rem, 12.5rem) minmax(0, var(--measure));
  gap: clamp(1.5rem, 3vw, 2.75rem);
  justify-content: center;
  width: min(100% - 2rem, 68rem);
  margin: 0 auto;
  padding: clamp(1.75rem, 3vw, 3rem) 0 4.5rem;
}

.contents {
  position: sticky;
  top: 4.75rem;
  align-self: start;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-right: 1px solid var(--border);
  font-size: 0.78rem;
}

.contents__label {
  margin: 0 0 0.75rem;
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#TOC ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#TOC > ul > li > a {
  display: none;
}

#TOC > ul > li > ul {
  display: block;
  margin: 0;
}

#TOC ul ul ul {
  display: none;
}

#TOC li + li {
  margin-top: 0.28rem;
}

#TOC a {
  display: block;
  color: var(--muted);
  line-height: 1.25;
  text-decoration: none;
}

#TOC a:hover {
  color: var(--text);
}

main {
  min-width: 0;
}

main > h1:first-child {
  max-width: 24ch;
  margin: 0 0 0.9rem;
  color: var(--heading);
  font-family: "Manrope", ui-sans-serif, sans-serif;
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

main > h1:first-child + p {
  margin-top: 0;
  color: var(--gold);
  font-family: "Manrope", ui-sans-serif, sans-serif;
  font-size: clamp(1.05rem, 1.75vw, 1.2rem);
  font-weight: 600;
  line-height: 1.42;
}

h2,
h3 {
  color: var(--heading);
  font-family: "Manrope", ui-sans-serif, sans-serif;
  font-weight: 700;
  line-height: 1.18;
  text-wrap: balance;
}

h2 {
  margin: 3.25rem 0 0.9rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  font-size: clamp(1.45rem, 2.5vw, 1.75rem);
  letter-spacing: -0.025em;
}

h3 {
  margin: 2rem 0 0.65rem;
  font-size: 1.2rem;
}

p,
ul,
ol,
table,
pre {
  margin-top: 0;
  margin-bottom: 1rem;
}

li + li {
  margin-top: 0.25rem;
}

strong {
  color: inherit;
}

code {
  padding: 0.1em 0.32em;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--surface-raised);
  color: var(--code);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
}

pre {
  overflow-x: auto;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-left: 0.22rem solid var(--gold-soft);
  border-radius: 0.35rem;
  background: var(--surface);
}

pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-spacing: 0;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  min-width: 9rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-raised);
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

tr:nth-child(even) td {
  background: color-mix(in srgb, var(--surface) 75%, transparent);
}

hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.site-footer {
  padding: 1.5rem max(1rem, calc((100vw - 68rem) / 2));
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.82rem;
}

.site-footer p {
  margin: 0.25rem 0;
}

@media (max-width: 58rem) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .page-shell {
    display: block;
    width: min(100% - 2rem, var(--measure));
    padding-top: 2rem;
  }

  .contents {
    position: static;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    margin-bottom: 2rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    background: var(--surface);
  }

  .contents__label {
    margin-bottom: 0.55rem;
  }

  #TOC > ul > li > ul {
    display: flex;
    gap: 0.4rem;
    width: max-content;
  }

  #TOC li + li {
    margin-top: 0;
  }

  #TOC a {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    background: var(--background);
    white-space: nowrap;
  }
}

@media (max-width: 35rem) {
  html {
    scroll-padding-top: 7.5rem;
  }

  .site-nav {
    gap: 0.3rem 0.8rem;
  }

  main > h1:first-child {
    font-size: 2rem;
  }

  h2 {
    margin-top: 2.75rem;
  }

  th,
  td {
    min-width: 12rem;
  }
}

@media print {
  :root {
    --background: #fff;
    --text: #111;
    --muted: #444;
    --border: #bbb;
  }

  .site-header,
  .contents,
  .site-footer {
    display: none;
  }

  .page-shell {
    display: block;
    width: auto;
    padding: 0;
  }

  main > h1:first-child,
  main > h1:first-child + p,
  h2,
  h3,
  strong,
  a {
    color: #111;
  }
}
