@font-face {
  font-family: "Literata";
  src: url("/fonts/literata-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/fonts/literata-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: light-dark(#f6f1e6, #1c1915);
  --text: light-dark(#2b2620, #e8e0cf);
  --muted: light-dark(#675e52, #9a9081);
  --accent: light-dark(#a8431f, #e98d5f);
  --line: light-dark(#cfc4ab, #453e33);
  --code-bg: light-dark(#ece4d2, #27231d);
  --serif: "Literata", Charter, Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 38rem;
  color-scheme: light dark;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 1.125rem/1.7 var(--serif);
  margin: 0;
  padding: clamp(1.25rem, 5vw, 3.5rem) clamp(1.25rem, 5vw, 1.5rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 48rem) { body { font-size: 1.2rem; } }

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

#page { width: 100%; max-width: var(--measure); margin: 0 auto; flex: 1; display: flex; flex-direction: column; }
main { flex: 1; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem 2rem;
  margin-bottom: clamp(2.5rem, 7vw, 4rem);
}
header .site {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
header nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; font-size: 1rem; }
header nav a { color: var(--text); text-decoration: none; padding: 0.1rem 0; border-bottom: 2px solid transparent; }
header nav a:hover { color: var(--accent); }
header nav a[aria-current="page"] { border-bottom-color: var(--accent); }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg);
  border: 2px solid var(--accent);
  border-radius: 4px;
  z-index: 10;
}
.skip:focus { top: 1rem; }

main > :first-child { margin-top: 0; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; scroll-margin-top: 1.5rem; }
h1 { font-size: clamp(2rem, 6vw, 2.6rem); margin: 0 0 0.8rem; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.4rem, 4.5vw, 1.65rem); margin: 2.6rem 0 0.7rem; letter-spacing: -0.01em; }
h3 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
h4 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }

.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 2.6rem 0 0.7rem; }
.section-head h2 { margin: 0; }
.section-head a { font-size: 0.9rem; white-space: nowrap; color: var(--muted); }
.section-head a:hover { color: var(--accent); }
.crumb { margin: -0.3rem 0 1.1rem; font-family: var(--mono); font-size: 0.85rem; }
.crumb a { display: inline-block; padding: 0.3rem 0; color: var(--muted); }
.crumb a:hover { color: var(--accent); }

.anchor { margin-left: 0.3em; color: var(--muted); text-decoration: none; font-weight: 400; opacity: 0; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); }
@media (hover: none) { .anchor { display: none; } }
p, ul, ol { margin: 0 0 1.2rem; }
ul, ol { padding-left: 1.4rem; }
li + li { margin-top: 0.3rem; }
li::marker { color: var(--accent); }
hr { border: 0; border-top: 1px dashed var(--line); margin: 2.5rem 0; }

.meta { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; margin: 0 0 1.8rem; }
.meta a { color: inherit; white-space: nowrap; }
.meta a:hover { color: var(--accent); }
.lede { font-size: 1.15em; line-height: 1.6; margin-bottom: 1rem; }
.home > h1 + p { font-size: 1.15em; line-height: 1.6; }
@media (max-width: 30rem) {
  .lede, .home > h1 + p { font-size: 1.05em; }
}

code, pre { font: 0.85em var(--mono); }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; }
pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1.2rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
}

main img, main video { display: block; width: 100%; height: auto; border-radius: 10px; }

table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; }
th, td { padding: 0.4rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; }

ul.posts { list-style: none; padding: 0; margin: 0 0 1.4rem; }
ul.posts li { margin: 0; }
ul.posts li::marker { content: none; }
ul.posts a {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 1rem;
  row-gap: 0.1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--line);
  color: var(--text);
  text-decoration: none;
}
ul.posts a span { line-height: 1.35; color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
ul.posts a:hover span { text-decoration-thickness: 2px; }
ul.posts small { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
ul.posts time { color: var(--muted); font-family: var(--mono); font-size: 0.8rem; }

@media (max-width: 30rem) {
  ul.posts a { grid-template-columns: 1fr; }
}

time { white-space: nowrap; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 3rem 0 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
  font-size: 0.95rem;
  line-height: 1.4;
}
.pager a { display: flex; flex-direction: column; gap: 0.2rem; max-width: 48%; text-decoration: none; }
.pager .next { margin-left: auto; text-align: right; }
.pager small { color: var(--muted); font-family: var(--mono); font-size: 0.75rem; }
.pager span { color: var(--muted); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.pager a:hover span { color: var(--accent); text-decoration-thickness: 2px; }

figure { margin: 1.5rem 0; }
figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.4rem; }

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

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
footer .links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.9rem; }
footer .links a { display: inline-flex; padding: 0.25rem; margin: -0.25rem; }
footer svg { display: block; }
footer a, footer button { color: var(--muted); }
footer a:hover, footer button:hover { color: var(--accent); }
footer button {
  display: inline-flex;
  font: inherit;
  background: none;
  border: 0;
  padding: 0.25rem;
  margin: -0.25rem;
  cursor: pointer;
}
footer button[data-to="light"] .moon, footer button[data-to="dark"] .sun { display: none; }
footer button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
footer button[hidden] { display: none; }

@media (max-width: 30rem) {
  header { flex-direction: column; align-items: center; gap: 0.7rem; }
  header nav { align-self: stretch; justify-content: space-evenly; gap: 0.2rem 0.5rem; }
  header nav a { padding: 0.35rem 0; }
  footer { flex-direction: column; align-items: center; text-align: center; }
  footer .links { justify-content: center; }
}

main { overflow-wrap: break-word; }

@media print {
  :root { --bg: #fff; --text: #000; --muted: #444; --accent: #000; --line: #999; --code-bg: #f2f2f2; color-scheme: light; }
  body { font-size: 11pt; padding: 0; }
  header nav, footer .links, .skip, .anchor, .pager { display: none; }
  a { text-decoration: none; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
}