/*
Theme Name: Optimize AEO
Theme URI: https://optimizeaeo.io
Author: Charles Morris
Author URI: https://optimizeaeo.io
Description: Custom editorial theme for Optimize AEO — field-tested notes on Answer Engine Optimization. Built from a hand-coded design system, no page builders. Ports the design tokens from the Optimize AEO design system (Instrument Serif + Inter + JetBrains Mono, off-white editorial palette).
Version: 0.3.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: optimize-aeo
*/

/* ─────────────────────────────────────────────────────────────
   1. DESIGN TOKENS (the source of truth)
   These mirror the variables in the Article.html design.
   Every page on the site reads from these.
   ───────────────────────────────────────────────────────────── */

:root {
  /* Surface */
  --bg:    #F7F5F0;
  --bg-2:  #F1EEE7;
  --bg-3:  #EBE6D9;

  /* Ink */
  --ink:   #171614;
  --ink-2: #3A3733;
  --ink-3: #6E6A63;
  --ink-4: #94908A;

  /* Rules / dividers */
  --rule:   #DCD7CC;
  --rule-2: #E6E1D5;

  /* Accent */
  --accent:    oklch(0.62 0.13 45);
  --accent-ink: oklch(0.42 0.13 45);
  --accent-bg:  oklch(0.95 0.025 60);

  /* Semantic callouts */
  --note:      oklch(0.95 0.04 220);
  --note-ink:  oklch(0.38 0.10 220);
  --warn:      oklch(0.94 0.06 70);
  --warn-ink:  oklch(0.42 0.12 60);

  /* Typography */
  --serif: 'Instrument Serif', 'Source Serif Pro', Georgia, serif;
  --sans:  'Inter', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Reading density (overridden on body via [data-density]) */
  --body-size:    18px;
  --body-leading: 1.7;
  --para-gap:     1.15em;
  --section-gap:  3.2rem;
}

[data-density="compact"]     { --body-size: 16px; --body-leading: 1.55; --para-gap: 0.85em; --section-gap: 2.4rem; }
[data-density="comfortable"] { --body-size: 18px; --body-leading: 1.70; --para-gap: 1.15em; --section-gap: 3.2rem; }
[data-density="loose"]       { --body-size: 19px; --body-leading: 1.85; --para-gap: 1.45em; --section-gap: 4rem; }

/* ─────────────────────────────────────────────────────────────
   2. RESET / BASE
   ───────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

img, svg, video {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font: inherit;
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────
   3. LAYOUT WRAPPER
   ───────────────────────────────────────────────────────────── */

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 880px) {
  .wrap { padding: 0 22px; }
}

/* ─────────────────────────────────────────────────────────────
   4. SITE HEADER
   ───────────────────────────────────────────────────────────── */

header.site {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.site-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}

.wordmark {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: var(--ink);
}

.wordmark .dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  display: inline-block;
  margin-left: 4px;
  transform: translateY(-2px);
}

nav.primary {
  display: flex;
  gap: 28px;
  align-items: center;
}

nav.primary a {
  font-size: 14px;
  color: var(--ink-2);
  transition: color .15s;
}

nav.primary a:hover { color: var(--ink); }

nav.primary a.active,
nav.primary a.current-menu-item,
nav.primary li.current-menu-item > a,
nav.primary li.current_page_item > a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

nav.primary a.cta {
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  color: var(--ink);
  transition: background .15s, color .15s;
}

nav.primary a.cta:hover {
  background: var(--ink);
  color: var(--bg);
}

/* WordPress-injected nav menu list reset */
nav.primary ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 28px;
  align-items: center;
}

@media (max-width: 880px) {
  nav.primary { gap: 16px; }
  nav.primary ul { gap: 16px; }
  nav.primary a:not(.cta) { display: none; }
  nav.primary li:not(.menu-item-cta) { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   5. SITE FOOTER
   ───────────────────────────────────────────────────────────── */

footer.site {
  background: var(--ink);
  color: var(--bg);
  padding: 56px 0 28px;
  margin-top: 80px;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid oklch(0.28 0.01 60);
  margin-bottom: 24px;
}

.footer-row .wordmark {
  color: var(--bg);
  font-size: 28px;
}

.footer-row nav {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.footer-row nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.footer-row nav a {
  font-size: 13px;
  color: oklch(0.85 0.005 60);
  transition: color .15s;
}

.footer-row nav a:hover { color: var(--bg); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: oklch(0.65 0.01 60);
  letter-spacing: 0.04em;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom a {
  color: oklch(0.65 0.01 60);
  transition: color .15s;
}

.footer-bottom a:hover { color: var(--bg); }

/* ─────────────────────────────────────────────────────────────
   6. PROVISIONAL HOMEPAGE / FALLBACK PAGE STYLES
   These exist so the placeholder index page looks intentional
   while we build out the real templates in later batches.
   ───────────────────────────────────────────────────────────── */

.holding {
  padding: 96px 0 120px;
}

.holding .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.holding .eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.holding h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 4.8vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.018em;
  margin: 0 0 24px;
  text-wrap: balance;
  max-width: 22ch;
}

.holding h1 em {
  font-style: italic;
  color: var(--accent-ink);
}

.holding .deck {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink-2);
  margin: 0 0 40px;
  font-style: italic;
  max-width: 56ch;
}

.holding .meta-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
  font-family: var(--mono);
  font-size: 12px;
  margin-top: 56px;
}

.holding .meta-block > div {
  padding: 8px 24px 8px 0;
  border-right: 1px solid var(--rule-2);
}

.holding .meta-block > div:last-child { border-right: none; }

.holding .meta-block dt {
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  margin-bottom: 6px;
}

.holding .meta-block dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}

@media (max-width: 880px) {
  .holding { padding: 56px 0 80px; }
  .holding h1 { font-size: 36px; }
  .holding .deck { font-size: 18px; }
  .holding .meta-block > div {
    padding: 12px 0;
    border-right: none !important;
    border-bottom: 1px solid var(--rule-2);
  }
  .holding .meta-block > div:last-child { border-bottom: none; }
}

/* ─────────────────────────────────────────────────────────────
   7. SCREEN-READER UTILITY (WordPress requires this)
   ───────────────────────────────────────────────────────────── */

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--bg);
  clip: auto !important;
  clip-path: none;
  color: var(--ink);
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  height: auto;
  left: 5px;
  line-height: normal;
  padding: 15px 23px 14px;
  text-decoration: none;
  top: 5px;
  width: auto;
  z-index: 100000;
}

/* ─────────────────────────────────────────────────────────────
   8. BREADCRUMB
   ───────────────────────────────────────────────────────────── */

.breadcrumb {
  border-bottom: 1px solid var(--rule-2);
  padding: 18px 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.breadcrumb a { transition: color .15s; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb .sep { margin: 0 10px; color: var(--ink-4); }
.breadcrumb .here { color: var(--ink); }

/* ─────────────────────────────────────────────────────────────
   9. ARTICLE LAYOUT (Guide + Journal)
   ───────────────────────────────────────────────────────────── */

.article-layout {
  display: grid;
  grid-template-columns: 1fr minmax(0, 720px) 240px;
  gap: 64px;
  padding: 56px 32px 80px;
  max-width: 1240px;
  margin: 0 auto;
  align-items: start;
}

.article-layout.journal-layout,
.prose.no-rail ~ .toc + nothing,
.article-layout:has(> .prose.no-rail:first-child) {
  grid-template-columns: minmax(0, 720px) 240px;
}

/* Older browsers without :has() — Journal layout has no left rail */
.article-layout.journal-layout {
  grid-template-columns: minmax(0, 720px) 240px;
  justify-content: center;
}

/* Left rail (series context — Guide only) */
.left-rail {
  position: sticky;
  top: 96px;
}
.left-rail .pillar-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 16px;
}
.left-rail h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
  font-weight: 500;
}
.left-rail .meta-block {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  margin-top: 24px;
  line-height: 1.9;
}
.left-rail .meta-block dt { color: var(--ink); margin-top: 8px; }
.left-rail .meta-block dt:first-child { margin-top: 0; }
.left-rail .meta-block dd { margin: 0; }

/* ─────────────────────────────────────────────────────────────
   10. HEADLINE
   ───────────────────────────────────────────────────────────── */

.headline { margin-bottom: 36px; }

.pillar-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pillar-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}

h1.article-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 4.8vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.018em;
  margin: 0 0 28px;
  text-wrap: balance;
}
h1.article-title em { font-style: italic; color: var(--accent-ink); }

.article-deck {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink-2);
  margin: 0;
  text-wrap: pretty;
  font-style: italic;
}

/* ─────────────────────────────────────────────────────────────
   11. META BAR (technical trust signal)
   ───────────────────────────────────────────────────────────── */

.meta-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, auto));
  gap: 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 18px 0;
  margin: 36px 0 48px;
  font-family: var(--mono);
  font-size: 11px;
  overflow-x: auto;
}
.meta-bar > div {
  padding-right: 36px;
  border-right: 1px solid var(--rule-2);
}
.meta-bar > div:last-child { border-right: none; padding-right: 0; }
.meta-bar > div + div { padding-left: 36px; }

.meta-bar dt {
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  margin-bottom: 6px;
}
.meta-bar dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
}
.meta-bar dd .author-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}
.meta-bar dd .author-line:hover { color: var(--accent-ink); }
.meta-bar dd .avatar {
  width: 18px;
  height: 18px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-family: var(--sans);
  font-weight: 500;
}

/* ─────────────────────────────────────────────────────────────
   12. RIGHT-RAIL TOC
   ───────────────────────────────────────────────────────────── */

.toc {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
.toc h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 14px;
  font-weight: 500;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule-2);
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}
.toc li {
  counter-increment: toc;
  margin: 0;
}
.toc a {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-3);
  padding: 8px 0 8px 24px;
  position: relative;
  border-left: 1px solid transparent;
  transition: color .15s, border-color .15s;
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  position: absolute;
  left: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  top: 9px;
}
.toc a:hover { color: var(--ink); }
.toc a.active {
  color: var(--ink);
  border-left-color: var(--accent);
  padding-left: 20px;
}
.toc a.active::before { color: var(--accent-ink); }

.toc-foot {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--rule-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.7;
}
.toc-foot a {
  display: block;
  color: var(--ink-2);
  padding: 4px 0;
}
.toc-foot a:hover { color: var(--accent-ink); }

/* ─────────────────────────────────────────────────────────────
   13. PROSE — typography for post content
   ───────────────────────────────────────────────────────────── */

.prose {
  font-size: var(--body-size);
  line-height: var(--body-leading);
  color: var(--ink);
}
.prose .post-content > * + * { margin-top: var(--para-gap); }
.prose .post-content p { margin: 0; text-wrap: pretty; }
.prose .post-content p + p { margin-top: var(--para-gap); }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose .post-content a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: background .15s;
}
.prose .post-content a:hover { background: var(--accent-bg); }

.prose .post-content h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-top: var(--section-gap);
  margin-bottom: 18px;
  scroll-margin-top: 96px;
}

.prose .post-content h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.005em;
  margin-top: 2.4rem;
  margin-bottom: 10px;
  scroll-margin-top: 96px;
}

.prose .post-content ul,
.prose .post-content ol {
  padding-left: 1.4em;
  margin: 0;
}
.prose .post-content ul li,
.prose .post-content ol li {
  margin-top: 0.5em;
  padding-left: 0.3em;
}
.prose .post-content ul li::marker { color: var(--accent); }
.prose .post-content ol li::marker {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--ink-3);
}

.prose .post-content blockquote {
  border-left: 2px solid var(--accent);
  padding: 12px 0 12px 22px;
  margin: 1.6em 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1em;
  color: var(--ink-2);
}
.prose .post-content blockquote p { margin: 0; }

.prose .post-content code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-3);
  padding: 1px 5px;
  border-radius: 2px;
}

.prose .post-content pre {
  background: #1a1815;
  color: #e8e3d6;
  padding: 16px;
  margin: 1.4em 0;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid #2a2622;
}
.prose .post-content pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

.prose .post-content img {
  max-width: 100%;
  height: auto;
  margin: 1.6em 0;
  border: 1px solid var(--rule);
}

.prose .post-content figure { margin: 1.8em 0; }
.prose .post-content figcaption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.6;
  letter-spacing: 0.02em;
}

/* Tables */
.prose .post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 1.6em 0;
  border-top: 1px solid var(--ink);
}
.prose .post-content th,
.prose .post-content td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule-2);
  text-align: left;
  vertical-align: top;
}
.prose .post-content thead th {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  background: var(--bg-2);
  border-bottom: 1px solid var(--rule);
}

/* ─────────────────────────────────────────────────────────────
   14. CALLOUTS (note / warn / tldr)
   ───────────────────────────────────────────────────────────── */

.callout {
  background: var(--bg-2);
  border-left: 2px solid var(--ink);
  padding: 20px 24px;
  margin: 1.6em 0;
  font-size: 0.95em;
  line-height: 1.6;
}
.callout.note { background: var(--note); border-left-color: var(--note-ink); }
.callout.note .label { color: var(--note-ink); }
.callout.warn { background: var(--warn); border-left-color: var(--warn-ink); }
.callout.warn .label { color: var(--warn-ink); }

.callout .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
}
.callout .label::before {
  content: "■";
  font-size: 8px;
  transform: translateY(-1px);
}
.callout p { margin: 0; }
.callout p + p { margin-top: 0.6em; }

/* ─────────────────────────────────────────────────────────────
   15. UPDATE BANNER
   ───────────────────────────────────────────────────────────── */

.update-banner {
  margin-top: 4.2rem;
  background: var(--bg-2);
  border-left: 2px solid var(--accent);
  padding: 22px 26px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: center;
}
.update-banner .label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.update-banner .body {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.4;
  color: var(--ink);
}
.update-banner .body b { font-weight: 400; font-style: italic; }

/* ─────────────────────────────────────────────────────────────
   16. NEWSLETTER
   ───────────────────────────────────────────────────────────── */

.newsletter {
  margin-top: 4rem;
  background: var(--ink);
  color: var(--bg);
  padding: 48px 40px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: center;
}
.newsletter h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.1;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.newsletter h3 em {
  color: oklch(0.78 0.1 45);
  font-style: italic;
}
.newsletter p {
  font-size: 14px;
  color: oklch(0.78 0.01 60);
  line-height: 1.55;
  margin: 0;
  max-width: 42ch;
}
.newsletter form {
  display: flex;
  gap: 0;
  border: 1px solid oklch(0.32 0.01 60);
}
.newsletter input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
  padding: 14px 16px;
  outline: none;
}
.newsletter input::placeholder { color: oklch(0.55 0.01 60); }
.newsletter button {
  background: var(--bg);
  color: var(--ink);
  border: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  padding: 0 22px;
  cursor: pointer;
}
.newsletter button:hover { background: oklch(0.78 0.1 45); }
.newsletter .meta {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: oklch(0.6 0.01 60);
  letter-spacing: 0.06em;
}

/* ─────────────────────────────────────────────────────────────
   17. RECIRCULATION (related grid)
   ───────────────────────────────────────────────────────────── */

.recirc {
  border-top: 1px solid var(--rule);
  margin-top: 5rem;
  padding-top: 56px;
}
.recirc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.recirc-head h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.01em;
}
.recirc-head h3 em { font-style: italic; color: var(--accent-ink); }
.recirc-head a {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--ink-3);
  padding-bottom: 1px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.related-card {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  transition: background .15s;
}
.related-card:hover { background: var(--bg-2); }

.related-cat {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.related-card h4 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
}
.related-foot {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  border-top: 1px solid var(--rule-2);
  padding-top: 10px;
}

/* ─────────────────────────────────────────────────────────────
   18. RESPONSIVE — article layout
   ───────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .article-layout {
    grid-template-columns: minmax(0, 720px) 220px;
    gap: 40px;
    justify-content: center;
  }
  .left-rail { display: none; }
}

@media (max-width: 880px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 22px 60px;
    justify-content: stretch;
  }
  .toc { display: none; }

  h1.article-title { font-size: 36px; }
  .article-deck { font-size: 18px; }

  .meta-bar {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .meta-bar > div {
    padding: 0 0 12px 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--rule-2) !important;
  }

  .update-banner,
  .newsletter {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .newsletter { padding: 32px 24px; }
  .related-grid { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────────────────
   19. HOMEPAGE — HERO
   ───────────────────────────────────────────────────────────── */

.hero {
  padding: 96px 0 88px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 80px;
  align-items: end;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}
.hero .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.hero .eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}
h1.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 6.4vw, 88px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 36px;
  text-wrap: balance;
}
h1.hero-title em {
  font-style: italic;
  color: var(--accent-ink);
}
.hero-sub {
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 56ch;
  margin: 0 0 36px;
  text-wrap: pretty;
}
.cta-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 13px 22px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent-ink); color: var(--bg); }
.btn-ghost {
  border-color: var(--rule);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--ink); }
.btn .arrow {
  font-family: var(--mono);
  font-size: 13px;
}

.hero-meta {
  border-left: 1px solid var(--rule);
  padding-left: 32px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.9;
  margin: 0;
}
.hero-meta dt {
  color: var(--ink);
  margin-top: 14px;
}
.hero-meta dt:first-child { margin-top: 0; }
.hero-meta dd { margin: 0; }

/* ─────────────────────────────────────────────────────────────
   20. HOMEPAGE — SECTION SCAFFOLD
   ───────────────────────────────────────────────────────────── */

section.block {
  padding: 88px 0;
  border-bottom: 1px solid var(--rule);
}
.section-head {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 32px;
  align-items: end;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule-2);
}
.section-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
}
.section-title em {
  font-style: italic;
  color: var(--accent-ink);
}
.section-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--ink-3);
  padding-bottom: 2px;
  transition: color .15s, border-color .15s;
}
.section-link:hover {
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────
   21. HOMEPAGE — TOOLS GRID
   ───────────────────────────────────────────────────────────── */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.tool-card {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 28px 26px 24px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 240px;
  transition: background .2s;
  text-decoration: none;
  color: inherit;
}
.tool-card:hover { background: var(--bg-2); }
.tool-mark {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tool-mark .glyph {
  color: var(--ink);
  font-size: 18px;
  letter-spacing: -0.04em;
}
.tool-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.05;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.tool-desc {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0 0 22px;
  flex: 1;
}
.tool-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tool-link::after {
  content: "→";
  transition: transform .2s;
}
.tool-card:hover .tool-link::after { transform: translateX(3px); }

/* ─────────────────────────────────────────────────────────────
   22. HOMEPAGE — GUIDES GRID
   ───────────────────────────────────────────────────────────── */

.guides {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.guide {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 32px 28px 36px;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  transition: background .2s;
  text-decoration: none;
  color: inherit;
}
.guide:hover { background: var(--bg-2); }
.guide-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
}
.guide-meta .pillar {
  color: var(--accent-ink);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.guide-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 16px;
  flex: 1;
}
.guide-excerpt {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0 0 24px;
}
.guide-foot {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule-2);
  padding-top: 14px;
}
.guide-foot .read {
  color: var(--ink);
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

/* ─────────────────────────────────────────────────────────────
   23. HOMEPAGE — WHY THIS EXISTS
   ───────────────────────────────────────────────────────────── */

.why { background: var(--bg-2); }
.why-inner {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 80px;
  align-items: start;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}
.why-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-top: 1px solid var(--ink);
  padding-top: 16px;
  width: fit-content;
}
.why-body {
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: pretty;
}
.why-body em {
  font-style: italic;
  color: var(--accent-ink);
}

/* ─────────────────────────────────────────────────────────────
   24. HOMEPAGE — JOURNAL FEATURE GRID
   ───────────────────────────────────────────────────────────── */

.blog-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.post {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: background .2s;
  text-decoration: none;
  color: inherit;
}
.post:hover { background: var(--bg-2); }
.post.feature {
  grid-row: 1 / 3;
  min-height: 480px;
  background: var(--ink);
  color: var(--bg);
}
.post.feature:hover { background: #221F1B; }
.post-cat {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.post.feature .post-cat { color: oklch(0.72 0.1 45); }
.post-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  flex: 1;
}
.post.feature .post-title {
  font-size: 44px;
  line-height: 1.05;
}
.post-excerpt {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
  margin: 0 0 18px;
}
.post.feature .post-excerpt {
  color: oklch(0.78 0.01 60);
  font-size: 16px;
  max-width: 38ch;
}
.post-foot {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  display: flex;
  gap: 16px;
}
.post.feature .post-foot { color: oklch(0.72 0.01 60); }

/* ─────────────────────────────────────────────────────────────
   25. HOMEPAGE — GLOSSARY PREVIEW
   ───────────────────────────────────────────────────────────── */

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.glossary-item {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 24px 28px;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: background .2s;
}
.glossary-item:hover { background: var(--bg-2); }
.glossary-item dt {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.glossary-item dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}

/* ─────────────────────────────────────────────────────────────
   26. HOMEPAGE — NEWSLETTER BLOCK WRAPPER
   The newsletter visual itself uses .newsletter (already defined
   in section 16). The .newsletter-block wrapper centers it.
   ───────────────────────────────────────────────────────────── */

.newsletter-block {
  padding: 88px 0;
  border-bottom: none;
}
.newsletter-block .newsletter {
  margin-top: 0;
}

/* ─────────────────────────────────────────────────────────────
   27. ARCHIVE PAGES (Guides, Journal listings)
   ───────────────────────────────────────────────────────────── */

.archive-hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--rule);
}
.archive-hero .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.archive-hero .eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.archive-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  text-wrap: balance;
}
.archive-title em {
  font-style: italic;
  color: var(--accent-ink);
}
.archive-deck {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.4;
  color: var(--ink-2);
  margin: 0;
  font-style: italic;
  max-width: 60ch;
  text-wrap: pretty;
}

.archive-body {
  padding: 64px 0 96px;
}

.filter-bar {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.filter-bar a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 14px 20px;
  border-right: 1px solid var(--rule-2);
  transition: color .15s, background .15s;
}
.filter-bar a:hover { color: var(--ink); background: var(--bg-2); }
.filter-bar a.active {
  color: var(--accent-ink);
  background: var(--accent-bg);
}

/* Journal feed (single column rows) */
.journal-feed {
  border-top: 1px solid var(--rule);
}
.journal-row {
  display: block;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule-2);
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.journal-row:hover {
  background: var(--bg-2);
  margin: 0 -16px;
  padding: 28px 16px;
}
.row-meta {
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.row-cat {
  color: var(--accent-ink);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.row-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
.row-excerpt {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
  max-width: 70ch;
}

/* Pagination */
.pager {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule-2);
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
}
.pager .page-numbers {
  padding: 8px 12px;
  color: var(--ink-3);
  border: 1px solid transparent;
  transition: all .15s;
}
.pager .page-numbers:hover {
  color: var(--ink);
  border-color: var(--rule);
}
.pager .page-numbers.current {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-bg);
}

.empty-state {
  padding: 80px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink-3);
}

/* ─────────────────────────────────────────────────────────────
   28. READING DENSITY TOGGLE
   ───────────────────────────────────────────────────────────── */

.density-trigger {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  transition: background .15s, color .15s;
  user-select: none;
}
.density-trigger:hover {
  background: var(--ink);
  color: var(--bg);
}
.density-trigger-icon {
  font-size: 13px;
  line-height: 1;
}

.density-panel {
  position: fixed;
  right: 24px;
  bottom: 70px;
  z-index: 61;
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 16px 18px;
  min-width: 240px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  display: none;
}
.density-panel.open { display: block; }

.density-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.density-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.density-close {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.density-close:hover { color: var(--ink); }

.density-seg {
  display: flex;
  border: 1px solid var(--rule);
}
.density-seg button {
  flex: 1;
  background: transparent;
  border: none;
  font-family: var(--mono);
  font-size: 11px;
  padding: 10px 6px;
  cursor: pointer;
  color: var(--ink-2);
  border-right: 1px solid var(--rule);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.density-seg button:last-child { border-right: none; }
.density-seg button.active {
  background: var(--ink);
  color: var(--bg);
}
.density-seg button:hover:not(.active) {
  background: var(--bg-2);
}

/* ─────────────────────────────────────────────────────────────
   29. RESPONSIVE — homepage + listings
   ───────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .hero { padding: 64px 0 56px; }
  .hero-grid { grid-template-columns: 1fr; gap: 48px; padding: 0 22px; }
  .hero-meta {
    border-left: none;
    border-top: 1px solid var(--rule);
    padding: 24px 0 0;
  }

  section.block { padding: 56px 0; }
  .section-head { grid-template-columns: 1fr; gap: 12px; }
  .section-title { font-size: 30px; }

  .tools-grid { grid-template-columns: 1fr; }
  .guides { grid-template-columns: 1fr; }

  .why-inner { grid-template-columns: 1fr; gap: 32px; padding: 0 22px; }
  .why-body { font-size: 24px; }

  .blog-grid { grid-template-columns: 1fr; }
  .post.feature {
    grid-row: auto;
    min-height: 320px;
  }
  .post.feature .post-title { font-size: 30px; }

  .glossary-grid { grid-template-columns: 1fr; }

  .archive-title { font-size: 36px; }
  .archive-deck { font-size: 18px; }
  .row-title { font-size: 22px; }

  .density-trigger,
  .density-panel { right: 16px; }
  .density-trigger { bottom: 16px; }
  .density-panel { bottom: 62px; }
}
