/* ─────────────────────────────────────────────────────────────
   docs.css — styling for Markdown pages rendered by Jekyll.
   Reuses the palette and type system from index.html, with a
   reading column and full Markdown element styling (headings,
   lists, tables, code blocks, blockquotes, etc.).
   The hand-built HTML pages do not use this file.
   ───────────────────────────────────────────────────────────── */

/* Tokens (palette, fonts, layout) come from the shared editorial sheet,
   /assets/css/meaning-layer.css, which is linked before this file.
   Legacy names below (--amber, --paper-warm, …) are aliased there. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  font-size: 19px;
  line-height: 1.65;
  color: var(--ink-soft);
  background: var(--paper);
  font-feature-settings: "ss01", "cv01";
}

.page { max-width: var(--wide-width); margin: 0 auto; padding: 0 2rem; }

a { color: var(--amber); text-decoration: none; border-bottom: 1px solid rgba(185, 114, 42, 0.3); transition: border-color 0.2s, color 0.2s; }
a:hover { border-color: var(--amber); }

/* ─── Header ─── */

.site-header {
  padding: 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
  gap: 1rem;
}
.brand-mark {
  color: var(--ink);
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.brand-swirl { width: 30px; height: 30px; display: block; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-eyebrow { font-family: var(--font-sans); font-size: 0.6rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.brand-name { font-family: var(--font-serif); font-size: 1.1rem; color: var(--ink); }
.site-header nav { display: flex; gap: 1.75rem; font-size: 0.875rem; flex-wrap: wrap; }
.site-header nav a { color: var(--warm-gray); border-bottom: 2px solid transparent; padding-bottom: 2px; font-weight: 400; }
.site-header nav a:hover { color: var(--ink); }
.site-header nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal); }

/* ─── Sticky page section nav (auto-generated from H2s) ─── */
.page-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -2rem;
  padding: 0 2rem;
}
.page-nav::-webkit-scrollbar { display: none; }
.page-nav a {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--warm-gray);
  border-bottom: 2px solid transparent;
  border-top: none;
  padding: 0.75rem 1.25rem;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.page-nav a:hover,
.page-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--teal);
}
@media (max-width: 768px) {
  .page-nav { margin: 0 -1.25rem; padding: 0 1.25rem; }
}

/* ─── Reading column ─── */

.doc {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 3.5rem 0 4rem;
}

/* ─── Markdown typography ─── */

.doc h1, .doc h2, .doc h3, .doc h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.15;
  color: var(--ink);
}
.doc h1 { font-size: clamp(2.5rem, 5vw, 3.5rem); letter-spacing: -0.015em; margin-bottom: 1.5rem; }
.doc h2 { font-size: 2rem; letter-spacing: -0.01em; margin: 2.75rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line-soft); }
.doc h3 { font-size: 1.5rem; margin: 2rem 0 0.75rem; }
.doc h4 { font-family: var(--font-sans); font-weight: 500; font-size: 1.05rem; letter-spacing: 0.01em; margin: 1.5rem 0 0.5rem; }

.doc p { margin-bottom: 1.25rem; }
.doc strong { color: var(--ink); font-weight: 500; }
.doc em { font-family: var(--font-serif); font-style: italic; }

.doc ul, .doc ol { margin: 0 0 1.25rem 1.5rem; }
.doc li { margin-bottom: 0.4rem; }
.doc li > ul, .doc li > ol { margin-top: 0.4rem; margin-bottom: 0.4rem; }

/* First H1 acts as the page title — give it room, drop the rule */
.doc > h1:first-child { margin-top: 0.5rem; }

/* ─── Inline code & code blocks ─── */

.doc code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--paper-warm);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  border: 1px solid var(--line-soft);
}
.doc pre {
  background: var(--code-bg);
  color: var(--paper);
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  line-height: 1.6;
}
.doc pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* ─── Blockquotes ─── */

.doc blockquote {
  margin: 0 0 1.5rem;
  padding: 0.5rem 0 0.5rem 1.5rem;
  border-left: 2px solid var(--amber);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--ink);
}
.doc blockquote p { margin-bottom: 0.5rem; }
.doc blockquote p:last-child { margin-bottom: 0; }

/* ─── Tables ─── */

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.75rem;
  font-size: 0.9rem;
}
.doc th, .doc td {
  text-align: left;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.doc th {
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1.5px solid var(--line);
}
.doc tbody tr:hover { background: var(--paper-warm); }

/* ─── Misc ─── */

.doc hr { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.doc img { max-width: 100%; height: auto; border-radius: 8px; }
.doc a code { color: var(--amber); }

/* ─── Footer ─── */

footer {
  padding: 2.5rem 0 3rem;
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--warm-gray);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
}
footer .footer-brand { font-family: var(--font-serif); color: var(--ink); }
footer .links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
footer a { color: var(--warm-gray); border-bottom: none; }
footer a:hover { color: var(--ink); }

@media (max-width: 768px) {
  .page { padding: 0 1.25rem; }
  .doc { padding: 2.5rem 0 3rem; }
}
