:root {
  --paper: #f3efe6;
  --ink: #1c1916;
  --muted: #5c564c;
  --line: #ddd6c8;
  --accent: #c4512c;
  --teal: #1d6a60;
  --sidebar: #172421;
  --sidebar-text: #ece7dc;
  --sidebar-muted: #a3aea6;
  --sidebar-line: #31423e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Segoe UI", "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
}

::selection { background: #efd0c2; }

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-150%);
  background: white;
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  z-index: 5;
}

.skip:focus { transform: none; }

.app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 1.25rem 0.9rem 2rem;
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.sidebar ::selection {
  background: #3e6a62;
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0.35rem 1rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 8px;
  background: #243833;
  color: #f6f1e7;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.topics { margin: 0 0.35rem 0.9rem; }

.topic-link {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--sidebar-line);
  border-radius: 999px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
}

.topic-link.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff8f4;
}

.search { display: block; margin: 0 0.35rem 0.4rem; }

.search input {
  width: 100%;
  padding: 0.48rem 0.7rem;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: #101916;
  color: var(--sidebar-text);
  font: inherit;
  font-size: 0.95rem;
}

.search input::placeholder { color: #7f8c86; }

.search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cat-label {
  margin: 1rem 0 0.25rem;
  padding: 0 0.45rem;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  gap: 0.45rem;
  margin: 0.08rem 0;
  padding: 0.28rem 0.45rem;
  border-radius: 7px;
  color: inherit;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.05); }

.nav-link.is-active {
  background: #243833;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-num {
  flex: 0 0 auto;
  padding-top: 0.12rem;
  color: var(--sidebar-muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.nav-q { min-width: 0; }

.empty {
  margin: 0.8rem 0.45rem;
  color: var(--sidebar-muted);
  font-size: 0.92rem;
}

.main {
  padding: 2.4rem 2.6rem 4.5rem;
  max-width: 920px;
}

.topic-head { margin-bottom: 2rem; }

.eyebrow,
.kicker,
.section-label,
.example-title,
.lang,
.dir {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topic-head h1,
.entry h1,
.entry h3 {
  margin: 0.25rem 0 0.6rem;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  overflow-wrap: break-word;
}

.topic-head h1 { font-size: 3.2rem; }

.entry h1 { font-size: 2.35rem; }

.lede,
.count { max-width: 62ch; }

.lede { margin: 0; font-size: 1.12rem; }

.count { margin: 0.7rem 0 0; color: var(--muted); }

.group-title {
  margin: 0 0 1.1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.group-block + .group-block { margin-top: 2.8rem; }

.entry-wrap + .entry-wrap {
  margin-top: 2.4rem;
  padding-top: 2.2rem;
  border-top: 1px solid var(--line);
}

.entry h3 { font-size: 1.55rem; }

.q-link { color: inherit; text-decoration: none; }

.q-link:hover { color: var(--teal); }

.num {
  margin-right: 0.35rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7em;
  font-weight: 500;
}

.kicker { margin-bottom: 0.35rem; }

.back { margin: 0 0 0.8rem; }

.back a,
.seealso a,
.pager a,
.prose a {
  color: var(--teal);
}

.answer {
  margin-top: 1rem;
  padding-left: 0.95rem;
  border-left: 3px solid var(--accent);
}

.details { margin-top: 1.15rem; }

.section-label { margin-bottom: 0.35rem; }

.prose { max-width: 68ch; }

.prose p { margin: 0.55rem 0; }

.prose ul,
.prose ol { margin: 0.4rem 0 0.7rem; padding-left: 1.2rem; }

.prose li + li { margin-top: 0.25rem; }

.prose code {
  padding: 0.08em 0.32em;
  border-radius: 0.25rem;
  background: #e7e0d2;
  font-family: var(--mono);
  font-size: 0.9em;
}

.example {
  margin-top: 1.25rem;
  overflow: hidden;
  border: 1px solid #243330;
  border-radius: 12px;
  background: #141c1a;
}

.example-bar {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.55rem 0.85rem;
  background: #1c2b28;
}

.example-title { color: #f0d7c8; }

.lang {
  color: #8fbfb4;
  font-family: var(--mono);
}

.caption {
  margin: 0;
  color: #c9c2b6;
  font-size: 0.88rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

.example-bar button {
  margin-left: auto;
  border: 1px solid #46605a;
  border-radius: 999px;
  background: transparent;
  color: #f3efe6;
  font: inherit;
  font-size: 0.82rem;
  padding: 0.18rem 0.6rem;
  cursor: pointer;
}

.example-bar button:hover { background: #2a403c; }

.example-bar button:focus-visible,
.nav-link:focus-visible,
.q-link:focus-visible,
.topic-link:focus-visible,
.brand:focus-visible,
.pager a:focus-visible,
.seealso a:focus-visible,
.back a:focus-visible,
.prose a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

pre.chroma {
  margin: 0;
  padding: 0.95rem 1rem 1.1rem;
  overflow-x: auto;
  background: #141c1a !important;
  color: #e7e1d6;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.55;
}

.seealso { margin-top: 1.2rem; }

.seealso ul {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
}

.seealso li + li { margin-top: 0.2rem; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.pager a {
  max-width: 46%;
  color: var(--ink);
  text-decoration: none;
}

.pager a:hover { color: var(--teal); }

.pager .next { margin-left: auto; text-align: right; }

.dir { display: block; margin-bottom: 0.15rem; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    max-height: 46vh;
  }
  .main { padding: 1.4rem 1rem 3rem; }
  .topic-head h1 { font-size: 2.4rem; }
  .entry h1 { font-size: 1.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
