/* ============================================================
   ChubbyFI — site layout + prose
   Built on top of brand/tokens.css (color/type tokens + the
   .ledger / .ledger-table / .eyebrow / .voice-note / .btn / .cta
   component classes). This file adds: page chrome (header/footer/
   nav), page containers, the home post-list, and prose styling
   for post bodies.
   ============================================================ */

.wrap {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  border-bottom: var(--hairline);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  flex-wrap: wrap;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.site-header__brand svg { display: block; height: 28px; width: auto; }

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.site-header__nav a {
  font-family: var(--font-mono);
  font-size: var(--size-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
}

.site-header__nav a:hover,
.site-header__nav a[aria-current="page"] {
  color: var(--evergreen);
}

.theme-toggle {
  font-family: var(--font-mono);
  font-size: var(--size-caption);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: none;
  border: var(--hairline);
  border-radius: var(--radius);
  color: var(--ink-soft);
  padding: 0.4em 0.75em;
  cursor: pointer;
}

.theme-toggle:hover { color: var(--ink); border-color: var(--ink-soft); }

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  border-top: var(--hairline);
  margin-top: var(--space-6);
  padding: var(--space-4) 0 var(--space-6);
}

.site-footer__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: var(--size-caption);
  color: var(--ink-soft);
}

.site-footer a { color: var(--ink-soft); text-decoration-color: var(--rule); }
.site-footer a:hover { color: var(--evergreen); text-decoration-color: var(--brass); }

/* ============================================================
   Main sections
   ============================================================ */

main { padding: var(--space-5) 0 var(--space-6); }

.section { margin-bottom: var(--space-6); }
.section:last-child { margin-bottom: 0; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

/* ============================================================
   Home hero — sits inside .ledger from tokens.css
   ============================================================ */

.home-hero { margin-bottom: var(--space-6); }

.home-hero .ledger__row + .ledger__row { margin-top: var(--space-1); }

/* ============================================================
   Post list (home + tag archives)
   ============================================================ */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-card {
  display: block;
  padding: var(--space-4) 0;
  border-bottom: var(--hairline);
  text-decoration: none;
  color: inherit;
}

.post-list > li:first-child .post-card { padding-top: 0; }
.post-list > li:last-child .post-card { border-bottom: none; }

.post-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.post-card__title {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: var(--size-h2);
  line-height: var(--leading-tight);
  color: var(--ink);
  margin: 0 0 var(--space-1);
}

.post-card:hover .post-card__title { color: var(--evergreen); }

.post-card__excerpt {
  color: var(--ink-soft);
  font-size: var(--size-small);
  margin: 0;
  max-width: var(--measure);
}

/* ============================================================
   Article / post page
   ============================================================ */

.post-header { margin-bottom: var(--space-5); }

.post-header__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-2);
}

.post-header__title {
  font-size: var(--size-display);
  margin-bottom: var(--space-3);
}

.post-feature {
  margin: 0 0 var(--space-5);
}

.post-feature img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: var(--hairline);
}

.post-feature figcaption {
  font-family: var(--font-mono);
  font-size: var(--size-caption);
  color: var(--ink-soft);
  margin-top: var(--space-1);
}

/* ---- Prose: styling for post-body html ---- */

.prose {
  max-width: var(--measure);
}

.prose > *:first-child { margin-top: 0; }

.prose h2 {
  font-size: var(--size-h2);
  margin-top: var(--space-6);
}

.prose h3 {
  font-size: var(--size-h3);
  margin-top: var(--space-5);
}

.prose ul,
.prose ol {
  margin: 0 0 var(--space-3);
  padding-left: 1.3em;
}

.prose li { margin-bottom: 0.4em; }

.prose hr {
  border: none;
  border-top: var(--hairline);
  margin: var(--space-5) 0;
}

.prose img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: var(--hairline);
  margin: var(--space-2) 0;
}

/* a <p> whose only content is an <img> + <em> caption, as Ghost exports
   inline figures — the trailing italic line reads as a caption */
.prose p:has(> img) {
  margin: var(--space-4) 0;
}

.prose p:has(> img) em {
  display: block;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: var(--size-caption);
  color: var(--ink-soft);
  margin-top: var(--space-1);
}

/* post tables use .ledger-table (hairlines, mono numerals) and get a
   horizontal-scroll wrapper on narrow viewports only */
.table-scroll { width: 100%; overflow-x: auto; margin: var(--space-4) 0; }
@media (min-width: 480px) {
  .table-scroll .ledger-table { min-width: 480px; }
}

/* tables are label + numeric columns — right-align and set every
   column but the first in mono tabular numerals, ledger-style */
.prose .ledger-table th:not(:first-child),
.prose .ledger-table td:not(:first-child) {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* the "Quick TL;DR:" block, detected and wrapped by the generator */
.tldr {
  background: var(--paper-raised);
  border: var(--hairline);
  border-left: 3px solid var(--brass);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
}

.tldr__label {
  font-family: var(--font-mono);
  font-size: var(--size-eyebrow);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 var(--space-2);
}

.tldr ul { margin-bottom: 0; }

/* ---- post footer: prev/next ---- */

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: var(--hairline);
}

.post-nav__link {
  max-width: 45%;
  text-decoration: none;
}

.post-nav__link--next { text-align: right; margin-left: auto; }

.post-nav__link .eyebrow { display: block; margin-bottom: 0.2em; }

.post-nav__link strong {
  font-family: var(--font-display);
  font-weight: 560;
  color: var(--ink);
}

.post-nav__link:hover strong { color: var(--evergreen); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 640px) {
  .post-header__title { font-size: clamp(2rem, 8vw, 2.6rem); }
  .post-nav__link { max-width: 100%; }
  .post-nav { flex-direction: column; }
  .post-nav__link--next { text-align: left; margin-left: 0; }
}
