/* One stylesheet for every docs page — the markdown build applies the same
   shell to all of them, so all styling lives here (unlike apps/blog, where each
   post carries its own <style>). Palette and faces match the blog so the two
   static sites read as one brand. */

:root {
  --paper: #f6f3ec;
  --card: #fffdf9;
  --ink: #2e1a0e;
  --ink-soft: #6b5a4c;
  --berry: #6e1e3a;
  --line: #e4dbcb;
  --line-soft: #efe7d8;
  --maxw: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--berry); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:focus-visible { outline: 3px solid var(--berry); outline-offset: 3px; border-radius: 4px; }

/* ---------------------------------------------------------------- topbar */

.topbar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 28px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar .brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.topbar .links { display: flex; gap: 18px; align-items: center; }
.topbar .links a { color: var(--ink-soft); text-decoration: none; font-weight: 600; }
.topbar .links a:hover { color: var(--berry); }
.topbar .links .cta {
  color: #fff;
  background: var(--berry);
  padding: 7px 14px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}
.topbar .links .cta:hover { color: #fff; opacity: 0.9; }

/* ---------------------------------------------------------------- layout */

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px 40px;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* ---------------------------------------------------------------- sidebar */

.toc {
  position: sticky;
  top: 32px;
  padding-top: 72px;
}
.toc-label {
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--berry);
  font-weight: 700;
  margin: 0 0 14px;
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 8px 0 8px 16px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 16px;
  line-height: 1.35;
}
.toc a:hover { color: var(--ink); }
.toc a.here { color: var(--berry); font-weight: 600; border-left-color: var(--berry); }

/* ---------------------------------------------------------------- article */

/* Cap the reading measure on the column, not just the article, so the
   prev/next pager lines up with the text above it. */
main { min-width: 0; max-width: 46rem; padding-top: 56px; }

.eyebrow {
  font-family: "Space Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--berry);
  font-weight: 700;
  margin: 0 0 18px;
}
h1 {
  font-family: "Fraunces", serif;
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.4rem, 5.6vw, 3.6rem);
  line-height: 1.03;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}
.dek {
  font-size: 1.18rem;
  color: var(--ink-soft);
  max-width: 34em;
  margin: 0 0 12px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

article h2 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 48px 0 14px;
  scroll-margin-top: 24px;
}
article h3 {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.24rem;
  line-height: 1.25;
  margin: 32px 0 10px;
  scroll-margin-top: 24px;
}
article p { margin: 0 0 20px; }
article strong { font-weight: 700; }

article ul, article ol { margin: 0 0 22px; padding-left: 1.25em; }
article li { margin: 0 0 9px; }
article li::marker { color: var(--berry); }

article blockquote {
  margin: 26px 0;
  padding: 18px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--berry);
  border-radius: 0 14px 14px 0;
  color: var(--ink-soft);
}
article blockquote p:last-child { margin-bottom: 0; }

article hr { border: 0; border-top: 1px solid var(--line); margin: 44px 0; }

article code {
  font-family: "Space Mono", monospace;
  font-size: 0.85em;
  background: var(--line-soft);
  border-radius: 6px;
  padding: 2px 6px;
}
article pre {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 22px;
}
article pre code { background: none; padding: 0; font-size: 0.82em; }

article table { width: 100%; border-collapse: collapse; font-size: 16px; margin: 0 0 24px; }
article th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--line);
}
article td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }

/* ---------------------------------------------------------------- pager */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 56px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 48%;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pager a:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -22px rgba(46, 26, 14, 0.6); }
.pager a.next { text-align: right; margin-left: auto; }
.pager a span {
  font-family: "Space Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--berry);
}

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

.foot {
  border-top: 1px solid var(--line);
  margin-top: 24px;
}
.foot p {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 28px 44px;
  font-size: 15px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- narrow */

@media (max-width: 860px) {
  body { font-size: 17px; }
  .shell { grid-template-columns: 1fr; gap: 0; }
  .toc {
    position: static;
    padding: 40px 0 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
  }
  .toc ul { display: flex; flex-wrap: wrap; gap: 6px; border-left: 0; }
  .toc a {
    padding: 6px 13px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 15px;
    background: var(--card);
  }
  .toc a.here { border-color: var(--berry); }
  main { padding-top: 30px; }
  .pager a { max-width: 100%; }
}

@media (max-width: 520px) {
  .topbar, .shell, .foot p { padding-left: 20px; padding-right: 20px; }
  .pager { flex-direction: column; }
  .pager a.next { text-align: left; margin-left: 0; }
}
