/* ═══════════════════════════════════════════════════════════════════════════
   Blog theme — the static half of the site.
   ═══════════════════════════════════════════════════════════════════════════

   The 322 posts under blog-content/ are plain HTML served by Caddy; they never
   touch the React bundle, so client/src/styles/theme.css cannot reach them.
   They were written by a content agent against a generic slate-and-indigo
   palette: white page, #4338ca links, #f8fafc callouts, a #111827 CTA slab
   with an #f59e0b button. The blog INDEX had the opposite problem — hardcoded
   dark, with the violet #7c3aed we retired everywhere else.

   So: someone on light mode leaves a cream site and lands on a white page with
   indigo links; someone on dark mode gets flashbanged.

   This file is the blog's copy of the theme. The token VALUES are lifted
   verbatim from client/src/styles/theme.css — if that file's palette changes,
   this one has to change with it. It is duplicated rather than imported
   because the React CSS is bundled with a content hash and has no stable URL.

   The token names here are roles, not values (--blog-ink, --blog-card), unlike
   theme.css's generated --t-xxxxxx names. Nothing generated this file, so
   there is no dark-value invariant to preserve; these were chosen by hand to
   match what the site already looks like.
   ════════════════════════════════════════════════════════════════════════════ */

:root,
:root[data-theme="dark"] {
  --blog-ground: #1a1412;
  --blog-ground-deep: #0f0d0b;
  --blog-card: #2a2220;
  --blog-card-alt: #221b18;
  --blog-border: #3d3530;
  --blog-border-soft: rgba(201, 146, 30, .18);

  --blog-ink: #f5f0e8;
  --blog-ink-2: #b8a99a;
  --blog-ink-muted: #a89677;

  --blog-accent: #d4a574;
  --blog-gold: #c89132;
  --blog-gold-alt: #d4a656;
  --blog-on-gold: #090805;

  --blog-note-bg: rgba(201, 146, 30, .10);
  --blog-th-bg: #221b18;
  --blog-shadow: 0 8px 28px rgba(0, 0, 0, .45);
  --blog-nav-bg: rgba(9, 8, 5, .95);
}

:root[data-theme="light"] {
  --blog-ground: #faf6ee;
  --blog-ground-deep: #f1e9da;
  --blog-card: #fffdf8;
  --blog-card-alt: #f7f1e4;
  --blog-border: #e3d8c6;
  --blog-border-soft: rgba(138, 101, 16, .18);

  --blog-ink: #1f1a14;
  --blog-ink-2: #4a4038;
  --blog-ink-muted: #5f5443;

  --blog-accent: #9a6a2f;
  --blog-gold: #8a6410;
  --blog-gold-alt: #8f6a1c;
  /* Light mode's gold is a dark olive (#8a6410); a dark label on it measures
     3.2:1. Cream measures 5.4:1. Dark-on-gold only works in dark mode. */
  --blog-on-gold: #fffdf8;

  --blog-note-bg: rgba(138, 101, 16, .09);
  --blog-th-bg: #f1e9da;
  --blog-shadow: 0 8px 28px rgba(74, 58, 32, .14);
  --blog-nav-bg: rgba(250, 246, 238, .94);
}

/* ── Page ───────────────────────────────────────────────────────────────── */
body {
  background: var(--blog-ground);
  color: var(--blog-ink-2);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.72;
  margin: 0;
}
.container {
  max-width: 840px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}
h1, h2, h3, h4 { color: var(--blog-ink); }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: 2.4rem; line-height: 1.18; margin: 0 0 12px; }
h2 { font-size: 1.5rem; margin: 34px 0 12px; }
h3 { font-size: 1.1rem; margin: 22px 0 10px; }
p, li { font-size: 1.03rem; color: var(--blog-ink-2); }
strong { color: var(--blog-ink); }
ul, ol { padding-left: 22px; }
a { color: var(--blog-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; border-radius: 12px; margin: 22px 0; display: block; }
hr { border: none; border-top: 1px solid var(--blog-border); margin: 32px 0; }
code {
  background: var(--blog-card-alt);
  border: 1px solid var(--blog-border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .92em;
}

.breadcrumb, .meta, .post-count, .date { color: var(--blog-ink-muted); font-size: .92rem; }
.breadcrumb { margin-bottom: 20px; }
.lede, .subtitle { font-size: 1.08rem; color: var(--blog-ink-2); }

/* ── Article furniture ──────────────────────────────────────────────────── */
.callout, .checklist, .related-links, .faq, .blog-card {
  background: var(--blog-card);
  border: 1px solid var(--blog-border);
  border-radius: 14px;
  padding: 20px 22px;
  margin: 24px 0;
}
.note {
  background: var(--blog-note-bg);
  border-left: 4px solid var(--blog-gold);
  border-radius: 0 8px 8px 0;
  padding: 16px 18px;
  margin: 22px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: .97rem;
  display: block;
  overflow-x: auto;
}
th, td {
  border: 1px solid var(--blog-border);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  color: var(--blog-ink-2);
}
th { background: var(--blog-th-bg); color: var(--blog-ink); }

/* The article CTA. It was a #111827 slab with an amber button — close enough
   to the brand by accident that it only needed the tokens. */
.cta {
  background: var(--blog-ground-deep);
  border: 1px solid var(--blog-border-soft);
  border-radius: 16px;
  padding: 28px;
  margin: 40px 0 0;
}
.cta h2 { margin-top: 0; }
.cta p { color: var(--blog-ink-2); }
.cta a {
  display: inline-block;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--blog-gold), var(--blog-gold-alt));
  color: var(--blog-on-gold);
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 700;
}
.cta a:hover { text-decoration: none; opacity: .92; }

/* ── Blog index ─────────────────────────────────────────────────────────── */
.blog-grid { display: flex; flex-direction: column; gap: 18px; }
/* Cards inside .blog-grid are spaced by the grid gap; the standalone promo
   card above the grid needs its own bottom margin. */
.blog-card { padding: 0; overflow: hidden; transition: border-color .2s, transform .2s; margin: 0 0 18px; }
.blog-grid > .blog-card { margin: 0; }
.blog-card:hover { border-color: var(--blog-gold); transform: translateY(-2px); }
.blog-card a { display: block; padding: 22px 24px; color: inherit; }
.blog-card a:hover { text-decoration: none; }
.blog-card h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.22rem; margin: 0 0 8px; }
.blog-card p { color: var(--blog-ink-2); font-size: .95rem; margin: 0 0 10px; }
.back-link { display: inline-block; margin-bottom: 26px; font-size: .95rem; }

/* ── Shared nav ─────────────────────────────────────────────────────────────
   A static copy of SiteNav, cut down to what a static page can honestly show.
   These pages have no auth state, so there is no Dashboard/Logout and no
   "My Books" — the overwhelming majority of blog traffic is logged-out search
   traffic, and showing a signed-in menu to someone who is not signed in is
   worse than showing a signed-out one to someone who is.
   ─────────────────────────────────────────────────────────────────────────── */
.blog-nav {
  /* sticky, not fixed. Fixed needs a spacer sized to the bar, and this bar does
     not have one height: the link list wraps to two lines somewhere around
     1200px, which silently slid every page's first heading under the nav.
     Sticky takes its own space, so wrapping costs nothing. */
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 20px;
  background: var(--blog-nav-bg);
  border-bottom: 1px solid var(--blog-border-soft);
  backdrop-filter: blur(10px);
}
.blog-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--blog-ink);
  white-space: nowrap;
}
.blog-nav-logo:hover { text-decoration: none; }
.blog-nav-logo em { color: var(--blog-gold); font-style: normal; }
.blog-nav-logo img { width: 30px; height: 30px; margin: 0; border-radius: 0; }

.blog-nav-links { display: flex; align-items: center; gap: 14px; flex: 1; flex-wrap: wrap; }
.blog-nav-links a { font-size: 13px; font-weight: 500; color: var(--blog-ink-2); white-space: nowrap; }
.blog-nav-links a:hover { color: var(--blog-gold); text-decoration: none; }
.blog-nav-links a[aria-current="page"] { color: var(--blog-gold); font-weight: 700; }

.blog-nav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.blog-nav-ghost { font-size: 13px; font-weight: 500; color: var(--blog-ink-muted); white-space: nowrap; }
.blog-nav-ghost:hover { color: var(--blog-ink); text-decoration: none; }
.blog-nav-cta {
  background: var(--blog-gold);
  color: var(--blog-on-gold);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 3px 14px rgba(201, 146, 30, .32);
}
.blog-nav-cta:hover { text-decoration: none; opacity: .9; }

.blog-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--blog-border);
  border-radius: 8px;
  background: transparent;
  color: var(--blog-ink-2);
  cursor: pointer;
  flex: none;
}
.blog-theme-toggle:hover { color: var(--blog-gold); border-color: var(--blog-gold); }
.blog-theme-toggle svg { display: block; }

.blog-nav-burger {
  display: none;
  background: none;
  border: none;
  color: var(--blog-ink);
  cursor: pointer;
  padding: 6px;
}
@media (max-width: 900px) {
  .blog-nav-links { display: none; }
  .blog-nav-burger { display: block; }
  .blog-nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 18px 24px 22px;
    background: var(--blog-nav-bg);
    border-bottom: 1px solid var(--blog-border-soft);
    backdrop-filter: blur(10px);
  }
  .blog-nav-links.open a { font-size: 15px; }
}

/* ── Shared footer ──────────────────────────────────────────────────────── */
.blog-footer {
  border-top: 1px solid var(--blog-border);
  background: var(--blog-ground-deep);
  padding: 44px 24px 30px;
  margin-top: 60px;
}
.blog-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 32px;
}
@media (max-width: 760px) {
  .blog-footer-inner { grid-template-columns: 1fr 1fr; gap: 26px; }
}
.blog-footer h4 {
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--blog-ink-muted);
  margin: 0 0 12px;
}
.blog-footer-col { display: flex; flex-direction: column; gap: 9px; }
.blog-footer-col a { font-size: 13.5px; color: var(--blog-ink-2); }
.blog-footer-col a:hover { color: var(--blog-gold); text-decoration: none; }
.blog-footer-brand { font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 700; color: var(--blog-ink); }
.blog-footer-brand em { color: var(--blog-gold); font-style: normal; }
.blog-footer-blurb { font-size: 13.5px; color: var(--blog-ink-muted); margin: 10px 0 0; max-width: 34ch; }
.blog-footer-base {
  max-width: 1080px;
  margin: 32px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--blog-border);
  font-size: 12.5px;
  color: var(--blog-ink-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.blog-footer-base a { color: var(--blog-ink-muted); }

@media (max-width: 600px) {
  h1 { font-size: 1.75rem; }
  .container { padding: 24px 18px 44px; }
}
