/* Blog pages only. Reuses main.css tokens/classes (.card-3d, .tag, .label, h2, .desc);
   this file adds only what doesn't exist yet: article prose, the index grid, and a
   light-theme toggle.

   main.css's body default is the Shikamaru display font (--fb) — a stylized display
   face, fine for a one-line logo/hero but unreadable at paragraph or heading-of-many
   length. Everything text-heavy here (prose AND headings) uses Space Grotesk instead
   (already loaded site-wide via the Google Fonts link in <head>) — only short chips
   (.tag, .label, nav) stay on the brand font. */
/* Article titles now read on Space Grotesk too, same as post h1 — Shikamaru stays only
   on short chips (.tag/.label/nav), everything longer than a couple words reads better
   on the normal body font. */
.post-body,
.post h1,
.post-hero-content h1,
.empty-state,
.blog-intro,
.featured-desc, .featured-meta,
.row-cat, .row-date,
.post-meta,
.featured-title,
.row-title,
.post-body h2,
.post-body h3 {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ─── LIGHT THEME (opt-in via .theme-toggle, default is the site's dark look) ─── */
body.theme-light {
  --bg: #f7f4ee;
  --bg2: #ece7dc;
  --ink: #c23f2d;
  --ink2: color-mix(in srgb, #241f18 68%, transparent);
  --ink3: color-mix(in srgb, #241f18 42%, transparent);
  --pink: #c23f2d;
  --pink2: color-mix(in srgb, #c23f2d 80%, black);
  --card: #ffffff;
}
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink2);
  font-size: 0.85rem;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s;
}
.theme-toggle:hover { color: var(--pink); border-color: var(--pink); }
body.theme-light .theme-toggle { border-color: rgba(0,0,0,0.15); }
.f-links .theme-toggle { margin-left: 12px; vertical-align: middle; }

/* Coral footer is heavy at its default (main.css) padding — blog pages want the
   article to stay the strongest element on the page, so this trims it ~38%. */
footer.footer--blog { padding: 15px var(--pad); }

/* Sticky footer, scoped to blog pages only (homepage's scroll-driven hero doesn't
   want its body turned into a flex column) — keeps the footer from riding up into
   empty space on a tall viewport with little content (e.g. the zero-post state). */
body.blog-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.blog-page .blog-shell { flex: 1 0 auto; }
body.blog-page footer { flex-shrink: 0; }

.blog-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 64px) var(--pad) 120px;
}

/* main.css's generic `section { padding: clamp(80px,12vw,140px) ... }` is sized for the
   homepage's full-bleed sections. .blog-hero/.featured-wrap/.older-posts are also <section>
   tags, so without this they silently inherit that ~80-140px top+bottom padding on top of
   the margins below — the actual cause of the oversized gaps between hero/featured/list. */
.blog-hero, .featured-wrap, .older-posts { padding: 0; }

.empty-state { color: var(--ink2); }

/* ─── HERO ─── */
.blog-hero h1 {
  font-size: clamp(3rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 20px;
}
.blog-intro {
  font-size: clamp(1rem, 1.1vw, 1.125rem);
  line-height: 1.7;
  color: var(--ink2);
  max-width: 600px;
}

/* ─── LAYOUT — featured card left, other posts right (matches the reference: two
   columns on desktop, stacked back to one below ~900px) ─── */
.blog-columns {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 64px;
  align-items: start;
  margin-top: 64px;
}
@media (max-width: 900px) {
  .blog-columns { grid-template-columns: 1fr; gap: 56px; }
}

/* ─── FEATURED (latest) ARTICLE ─── */
.featured-post {
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: transform 300ms ease, background-color 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
}
.featured-link {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: inherit;
  overflow: hidden; /* clips the image to the card's own rounded corners */
}
.featured-post-image {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.featured-link-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 28px 22px;
}
.featured-post:hover,
.featured-post:focus-within {
  transform: translateY(-4px);
  border-color: var(--pink);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}
.featured-post:hover .featured-link,
.featured-post:focus-within .featured-link {
  background: color-mix(in srgb, var(--card) 90%, white 10%);
}
/* Stretched-link: the title is the only real anchor, but its ::after covers the whole
   card so the entire card stays clickable (per the original design brief) — while the
   tag links below stay independently clickable by sitting above the overlay (z-index). */
.featured-title-link {
  color: inherit;
  text-decoration: none;
}
.featured-title-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}
.featured-title-link:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 4px;
}
.featured-tags {
  position: relative;
  z-index: 2;
  font-family: var(--ff);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink3);
}
.featured-tags a { color: inherit; text-decoration: none; }
.featured-tags a:hover { color: var(--pink); }
.featured-title {
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.featured-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.featured-meta {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink3);
}
.featured-cta {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pink);
  white-space: nowrap;
}
.featured-cta .arrow {
  display: inline-block;
  transition: transform 300ms ease;
}
.featured-post:hover .arrow,
.featured-post:focus-within .arrow {
  transform: translateX(4px);
}

/* ─── OLDER ARTICLES — editorial list, no cards ─── */
.older-posts { margin-top: 0; }
.post-list { list-style: none; }
.post-row { border-top: 1px solid rgba(127,127,127,0.18); }
.post-row:last-child { border-bottom: 1px solid rgba(127,127,127,0.18); }
.post-row-link {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 24px 4px;
  text-decoration: none;
  color: inherit;
}
/* Each <a class="post-row-link"> is its own independent grid container, so rows with
   a thumbnail and rows without (e.g. a future post with no custom image) don't need
   to share one column layout — this variant just adds a column, nothing else moves. */
.post-row-link--has-thumb { grid-template-columns: 64px 1fr auto; }
.row-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-xs);
}
.post-row-link:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 4px;
  border-radius: var(--radius-xs);
}
.row-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  transition: color 250ms ease;
}
.row-meta {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink3);
}
/* Sits below .post-row-link (not inside it — an <a> can't contain another <a>, and
   each tag links to its own /blog/tag/ page) but still reads as part of the same row. */
.row-tags {
  padding: 0 4px 20px 4px;
  margin-top: -12px;
  font-family: var(--ff);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink3);
}
.post-row:has(.post-row-link--has-thumb) .row-tags { padding-left: calc(4px + 64px + 20px); }
.row-tags a { color: inherit; text-decoration: none; }
.row-tags a:hover { color: var(--pink); }
.row-arrow {
  font-size: 1.1rem;
  color: var(--ink3);
  transition: transform 250ms ease, color 250ms ease;
}
.post-row-link:hover .row-title,
.post-row-link:focus-visible .row-title { color: var(--pink); }
.post-row-link:hover .row-arrow,
.post-row-link:focus-visible .row-arrow {
  color: var(--pink);
  transform: translateX(4px);
}

@media (max-width: 640px) {
  .featured-post-image { height: 160px; }
  .post-row-link {
    grid-template-columns: 1fr 20px;
    gap: 12px;
    align-items: start;
  }
  .post-row-link--has-thumb { grid-template-columns: 44px 1fr 20px; }
  .row-thumb { width: 44px; height: 44px; }
  .row-meta { display: flex; flex-direction: column; gap: 2px; }
  .row-tags { padding-left: 4px; }
  .post-row:has(.post-row-link--has-thumb) .row-tags { padding-left: calc(4px + 44px + 12px); }
}

/* The index page (.blog-hero etc.) stays left-aligned within .blog-shell by design —
   but an individual article reads better centered, at a narrower column than the
   shell's 880px, so this re-centers just the article regardless of .blog-shell's own
   alignment. */
.post {
  max-width: 720px;
  margin: 0 auto;
}
.post h1,
.post-hero-content h1 {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 20px;
}
.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.post-tags .tag { text-decoration: none; }
.post-meta {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink3);
  margin-bottom: 40px;
}
.post-meta .post-author {
  color: var(--ink2);
  text-decoration: none;
}
.post-meta .post-author:hover { color: var(--pink); }

/* ─── HERO BANNER — full-bleed image, header text overlaid on top of it ───
   Inserted before <main> (see pre_main_html in page_shell) specifically so it can
   escape .blog-shell's centered 880px column and run edge-to-edge. Text colors here
   are hard-coded rather than themed (--ink/--ink2 etc.) because the scrim behind the
   text is always dark regardless of the light/dark toggle — themed colors would go
   dark-on-dark in light mode. */
.post-hero-banner {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 85vh;
  overflow: hidden;
  background: #000; /* shows through instantly, before the image decodes */
}
.post-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Two layers: a soft frosted-glass blur right behind the text (kills legibility
   problems from busy image detail, e.g. the light sky the title used to sit on)
   plus a strong bottom-weighted gradient so contrast holds no matter what's under
   it — a flat gradient alone wasn't dark enough by the time it reached the title. */
.post-hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(6,5,4,0.32) 0%, rgba(6,5,4,0.5) 30%, rgba(6,5,4,0.82) 62%, rgba(6,5,4,0.97) 100%);
}
.post-hero-blur {
  position: absolute;
  inset: 30% 0 0 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 40%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 40%);
}
/* Coral edge — echoes the same bottom accent bar the auto-generated OG cards use,
   so a hero banner and a typographic fallback card still read as one family. */
.post-hero-banner::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--pink);
  z-index: 2;
}
.post-hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 40px) var(--pad) 60px;
}
.post-hero-content .post-back a { color: rgba(255,255,255,0.7); }
.post-hero-content .post-back a:hover { color: var(--pink); }
.post-hero-content .tag {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.post-hero-content .tag:hover { background: var(--pink); border-color: var(--pink); }
.post-hero-content h1 {
  color: #f7f1e4;
  text-shadow: 0 6px 32px rgba(0,0,0,0.6);
}
.post-hero-content .post-meta { color: rgba(255,255,255,0.85); margin-bottom: 0; }
.post-hero-content .post-meta .post-author { color: #fff; }
.post-hero-content .post-meta .post-author:hover { color: var(--pink); }

/* Post pages with a hero banner don't need .blog-shell's own top padding — the
   banner already clears the fixed nav on its own. */
.blog-shell--has-hero { padding-top: 56px; }

@media (max-width: 640px) {
  .post-hero-banner { min-height: 65vh; }
  .post-hero-content { padding-top: calc(var(--nav-h) + 24px); }
}

.post-body {
  color: var(--ink2);
  line-height: 1.8;
  font-size: 1.05rem;
}
.post-body h2 {
  color: var(--ink);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.2;
  margin: 48px 0 16px;
}
.post-body h3 {
  color: var(--ink);
  font-size: 1.2rem;
  margin: 32px 0 12px;
}
.post-body p { margin-bottom: 20px; }
.post-body ul, .post-body ol { margin: 0 0 20px 1.4em; }
.post-body li { margin-bottom: 8px; }
.post-body a { color: var(--pink); }
.post-body strong { color: var(--ink); }
.post-body code {
  background: var(--card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.post-body pre {
  background: var(--card);
  border: 1px solid rgba(127,127,127,0.18);
  padding: 20px;
  border-radius: var(--radius-xs);
  overflow-x: auto;
  margin-bottom: 20px;
}
/* Highlight/callout box — write one in a post with:
     !!! note "Title"
         indented body text
   (the "admonition" markdown extension ships with the `markdown` package already
   installed, so this needed no new dependency). One visual treatment covers every
   note/tip/warning type — this is a generic "highlight this" box, not a severity system. */
.post-body .admonition {
  background: var(--card);
  border: 1px solid rgba(227,83,66,0.28);
  border-radius: var(--radius-xs);
  padding: 20px 24px;
  margin: 0 0 24px;
}
.post-body .admonition-title {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.post-body .admonition > :last-child { margin-bottom: 0; }
.post-body code, .post-body pre {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}
.post-body pre code { background: none; padding: 0; }
.post-body blockquote {
  border-left: 2px solid var(--pink);
  padding-left: 20px;
  color: var(--ink3);
  margin: 0 0 20px;
}
.post-body table { border-collapse: collapse; margin-bottom: 20px; width: 100%; }
.post-body th, .post-body td {
  border: 1px solid rgba(127,127,127,0.25);
  padding: 8px 12px;
  text-align: left;
}

.post-related { margin-top: 56px; padding-top: 32px; border-top: 1px solid rgba(127,127,127,0.18); }
.post-related-list { list-style: none; }
.post-related-list li { margin-bottom: 10px; }
.post-related-list a {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  color: var(--ink2);
  text-decoration: none;
}
.post-related-list a:hover { color: var(--pink); }

.post-back { margin-top: 56px; }
.post-back--top { margin-top: 0; margin-bottom: 32px; }
.post-back a {
  color: var(--ink2);
  text-decoration: none;
  font-family: var(--ff);
  font-size: 0.85rem;
}
.post-back a:hover { color: var(--pink); }
