@font-face {
  font-family: "Charis SIL";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/charis-sil-400.woff2) format("woff2");
}
@font-face {
  font-family: "Charis SIL";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/charis-sil-700.woff2) format("woff2");
}
@font-face {
  font-family: "Charis SIL";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/charis-sil-400-italic.woff2) format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-400.woff2) format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-700.woff2) format("woff2");
}

/* The palette is the OKLab midpoint of Catppuccin and Gruvbox. The accents are
   darkened in the light themes to stay legible on --surface. */
:root {
  color-scheme: light dark;
  --bg: #f4f3e6;
  --surface: #dbd6c7;
  --border: #c9c2b7;
  --text: #393b47;
  --muted: #5e5c64;
  --link: #0769b6;
  --link-visited: #8a43b0;
  --a-purple: #823ba8;
  --a-blue: #005da9;
  --a-green: #436500;
  --a-peach: #af2700;
  --a-rose: #9c3e22;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #303038;
    --surface: #43424b;
    --border: #57555d;
    --text: #e2e2e0;
    --muted: #bdb9b8;
    --link: #86aac7;
    --link-visited: #cd94c9;
    --a-purple: #d89ed4;
    --a-blue: #91b6d3;
    --a-green: #b0cb68;
    --a-peach: #fd985a;
    --a-rose: #fcb087;
  }
}
/* Auto mode also honors an OS "increase contrast" request. Manual data-theme
   selections have higher specificity and still win. */
@media (prefers-contrast: more) {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --surface: #eaeaea;
    --border: #000000;
    --text: #000000;
    --muted: #1a1a1a;
    --link: #0000ee;
    --link-visited: #551a8b;
    --a-purple: var(--text);
    --a-blue: var(--text);
    --a-green: var(--text);
    --a-peach: var(--text);
    --a-rose: var(--text);
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1a1a1a;
    --border: #ffffff;
    --text: #ffffff;
    --muted: #f0f0f0;
    --link: #55aaff;
    --link-visited: #cc99ff;
    --a-purple: var(--text);
    --a-blue: var(--text);
    --a-green: var(--text);
    --a-peach: var(--text);
    --a-rose: var(--text);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3e6;
  --surface: #dbd6c7;
  --border: #c9c2b7;
  --text: #393b47;
  --muted: #5e5c64;
  --link: #0769b6;
  --link-visited: #8a43b0;
  --a-purple: #823ba8;
  --a-blue: #005da9;
  --a-green: #436500;
  --a-peach: #af2700;
  --a-rose: #9c3e22;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #303038;
  --surface: #43424b;
  --border: #57555d;
  --text: #e2e2e0;
  --muted: #bdb9b8;
  --link: #86aac7;
  --link-visited: #cd94c9;
  --a-purple: #d89ed4;
  --a-blue: #91b6d3;
  --a-green: #b0cb68;
  --a-peach: #fd985a;
  --a-rose: #fcb087;
}
:root[data-theme="hc-light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #eaeaea;
  --border: #000000;
  --text: #000000;
  --muted: #1a1a1a;
  --link: #0000ee;
  --link-visited: #551a8b;
  --a-purple: var(--text);
  --a-blue: var(--text);
  --a-green: var(--text);
  --a-peach: var(--text);
  --a-rose: var(--text);
}
:root[data-theme="hc-dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1a1a1a;
  --border: #ffffff;
  --text: #ffffff;
  --muted: #f0f0f0;
  --link: #55aaff;
  --link-visited: #cc99ff;
  --a-purple: var(--text);
  --a-blue: var(--text);
  --a-green: var(--text);
  --a-peach: var(--text);
  --a-rose: var(--text);
}

/* --- the two-column shell: header is a sidebar rail; main + footer stack in
   the prose column. All serif; browser defaults do the lifting. --- */
body {
  max-width: 58rem;
  min-height: 100vh;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 1.75rem 1rem;
  background: var(--bg);
  color: var(--text);
  font-family: "Charis SIL", Georgia, "Times New Roman", serif;
  font-size: 16.5px;
  line-height: 1.62;
  display: grid;
  grid-template-columns: 10rem 1fr;
  grid-template-rows: 1fr auto;
  column-gap: 1.9rem;
  font-variant-numeric: oldstyle-nums;
}
header {
  grid-row: 1 / 3;
  padding-right: 1.25rem;
  display: flex;
  flex-direction: column;
}
header#top {
  border-right: 1px solid var(--border);
}
main {
  min-width: 0;
}

header .site {
  margin: 0 0 0.9rem;
  font-size: 1.125rem;
  font-weight: 700;
}
header .site a {
  color: var(--text);
  text-decoration: none;
}
header .site .menu-link {
  display: none;
}
header nav {
  display: flex;
  flex-direction: column;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
/* Standalone nav links are touch targets: block-level for full width, min-height
   for a 44px tap area. Negative margin bleeds the padding so text stays aligned
   with the rail edge. */
header nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.4rem;
  margin: 0 -0.4rem;
  color: var(--link);
  text-decoration: none;
}
header nav a:visited {
  color: var(--link);
}
header nav.meta {
  margin-top: 0.9rem;
  font-size: 0.875rem;
}
header nav.meta a {
  color: var(--muted);
}
header nav.meta a:visited {
  color: var(--muted);
}
header nav a[aria-current="page"],
footer .bottom-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}
/* A marker glyph points at the current page in the sidebar rail. */
header nav a[aria-current="page"]::before {
  content: "→";
  margin-right: 0.4em;
  color: var(--muted);
  font-weight: 400;
}
header button {
  margin-top: 0.9rem;
  align-self: flex-start;
  min-height: 44px;
  padding: 0.6rem 0;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  z-index: 1;
}
.skip-link:focus {
  top: 0.5rem;
}
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
main:focus {
  outline: none;
}

h1 {
  font-size: 1.625rem;
  line-height: 1.3;
  margin: 0 0 1rem;
  text-wrap: balance;
}
p {
  text-wrap: pretty;
  max-width: 42rem;
}
a {
  color: var(--link);
}
a:visited {
  color: var(--link-visited);
}
::selection {
  background: color-mix(in srgb, var(--link) 22%, var(--bg));
}

footer {
  grid-column: 2;
  border-top: 1px solid var(--border);
  margin-top: 1.9rem;
  padding-top: 0.5rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}
footer a,
footer a:visited {
  color: var(--muted);
}
footer p {
  margin: 0;
}
footer .bottom-nav {
  display: none;
}
footer .top-link {
  display: none;
}
@media (max-width: 40rem) {
  body {
    display: block;
  }
  header {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 0 0.6rem;
    margin-bottom: 1.5rem;
  }
  header .site {
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  header .site .menu-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 0.5rem;
    margin: 0 -0.5rem;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--link);
    white-space: nowrap;
  }
  header nav,
  header nav.meta,
  header button {
    display: none;
  }
  footer .bottom-nav {
    display: block;
  }
  footer .bottom-nav p {
    margin: 0 0 0.35rem;
  }
  footer .bottom-nav p:first-child {
    font-size: 0.9375rem;
  }
  footer .bottom-nav a,
  footer .bottom-nav a:visited {
    color: var(--link);
    text-decoration: none;
  }
  footer .top-link {
    display: inline;
    text-decoration: none;
    white-space: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
