/* =========================================================================
   ForeverAfter.life — Blog (index, category pages, article)
   Local tokens alias the site's --ff-* scale, the same way quotes.css does, so
   these pages inherit the shared palette rather than carrying their own.
   Loaded only on the blog pages (linked from their templates).
   ========================================================================= */

/* Scoped to the blog's own roots rather than :root. Two of the names below --
   --font-sans and --accent -- are the design system's as well, and the admin
   article preview loads this file on a page that already owns them: written
   onto :root there they resolved to nothing (the --ff-* originals only exist
   on the public layout), which invalidated `body { font-family: var(--font-sans) }`
   and dropped the whole admin chrome to Times. Every rule in this file is
   inside the .ba-* namespace, so the tokens only ever need to reach these
   roots and what they contain. */
.ba-wrap,
.ba-article,
.ba-body,
.ba-grid,
.ba-strip-more {
  --surface: var(--ff-surface);
  --surface-2: var(--ff-surface-2);
  --ink: var(--ff-ink);
  --ink-2: var(--ff-ink-2);
  --ink-3: var(--ff-ink-3);
  --line: var(--ff-line);
  --line-soft: var(--ff-line-soft);
  --accent: var(--ff-accent);
  --accent-deep: var(--ff-accent-deep);
  --accent-tint: var(--ff-accent-tint);
  --font-serif: var(--ff-font-serif);
  --font-sans: var(--ff-font-sans);
  --radius-lg: var(--ff-radius-lg);
  --shadow-sm: var(--ff-shadow-sm);
}

/* ---- Shell ---- */
.ba-wrap { max-width: 1040px; margin: 0 auto; padding: 46px 32px 110px; }
.ba-article { max-width: 720px; margin: 0 auto; padding: 20px 32px 72px; }
@media (max-width: 640px) {
  .ba-wrap { padding: 32px 18px 80px; }
  .ba-article { padding: 16px 18px 56px; }
}

/* ---- Breadcrumb ---- */
.ba-crumb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.88rem; color: var(--ink-3); margin-bottom: 18px; }
.ba-crumb a { color: var(--ink-3); text-decoration: none; }
.ba-crumb a:hover { color: var(--accent-deep); text-decoration: underline; }
.ba-crumb .sep { opacity: 0.5; }

/* ---- Listing head ---- */
.ba-head { padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.ba-head h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(2.05rem, 4vw, 2.8rem); line-height: 1.06; letter-spacing: -0.01em; margin: 0; }
.ba-head p { color: var(--ink-2); font-size: 1.01rem; margin: 12px 0 0; max-width: 56ch; }

/* ---- Topic chips ---- */
.ba-chips { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 30px; }
.ba-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  font-size: 0.88rem; text-decoration: none; transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ba-chip:hover { border-color: var(--accent); color: var(--accent-deep); }
.ba-chip.is-on { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
.ba-chip .n { font-size: 0.78rem; color: var(--ink-3); }
.ba-chip.is-on .n { color: var(--accent-deep); opacity: 0.75; }

/* ---- Card grid ---- */
.ba-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 26px; }

.ba-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.ba-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px oklch(0.4 0.03 250 / 0.09); }

.ba-card-cover { display: block; aspect-ratio: 16 / 9; background: var(--surface-2); }
.ba-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ba-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.ba-card-cat {
  align-self: flex-start; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-deep); text-decoration: none; font-weight: 600;
}
.ba-card-cat:hover { text-decoration: underline; }
.ba-card-title { font-family: var(--font-serif); font-weight: 500; font-size: 1.28rem; line-height: 1.22; margin: 0; }
.ba-card-title a { color: var(--ink); text-decoration: none; }
.ba-card-title a:hover { color: var(--accent-deep); }
.ba-card-excerpt { color: var(--ink-2); font-size: 0.94rem; line-height: 1.55; margin: 0; }
.ba-card-meta { margin: auto 0 0; padding-top: 6px; color: var(--ink-3); font-size: 0.82rem; display: flex; flex-direction: column; gap: 2px; }
.ba-card-meta .sep { opacity: 0.55; }

.ba-empty { color: var(--ink-3); font-size: 1rem; padding: 40px 0 60px; text-align: center; }

/* ---- Pagination ---- */
.ba-pager { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 46px; flex-wrap: wrap; }
.ba-pager-link { color: var(--accent-deep); text-decoration: none; font-weight: 600; font-size: 0.94rem; }
.ba-pager-link:hover { text-decoration: underline; }
.ba-pager-at { color: var(--ink-3); font-size: 0.88rem; }

/* ---- Article ---- */
.ba-preview {
  background: var(--accent-tint); border: 1px solid var(--accent); border-radius: 10px;
  padding: 11px 15px; color: var(--accent-deep); font-size: 0.9rem; margin-bottom: 20px;
}

.ba-article-head h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(2rem, 4.4vw, 2.75rem); line-height: 1.08; letter-spacing: -0.01em; margin: 0; }
.ba-standfirst { color: var(--ink-2); font-size: 1.1rem; line-height: 1.6; margin: 16px 0 0; }
.ba-byline { color: var(--ink-3); font-size: 0.86rem; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 7px; }
.ba-byline .sep { opacity: 0.55; }

.ba-cover { margin: 30px 0 0; }
.ba-cover img { width: 100%; height: auto; border-radius: var(--radius-lg); display: block; }

/* ---- Article body: the complete vocabulary ArticleRenderer emits ---- */
.ba-body { margin-top: 34px; color: var(--ink); font-size: 1.06rem; line-height: 1.72; }
/* Flow spacing lives on the children, not on each tag: a `.ba-body p` reset
   would be one point more specific than the sibling rule below and would
   silently win, leaving every paragraph after a list or a heading glued to it.
   Anything wanting its own rhythm (quotes, figures, the rule) sets a margin
   further down, where it is later in the file and takes precedence. */
.ba-body > * { margin-top: 0; margin-bottom: 0; }
.ba-body > * + * { margin-top: 1.15em; }
.ba-body a { color: var(--accent-deep); text-underline-offset: 2px; }
.ba-body h2, .ba-body h3, .ba-body h4 {
  font-family: var(--font-serif); font-weight: 500; line-height: 1.25; letter-spacing: -0.005em;
  margin-top: 1.9em; margin-bottom: 0;
}
.ba-body h2 { font-size: 1.62rem; }
.ba-body h3 { font-size: 1.32rem; }
.ba-body h4 { font-size: 1.12rem; }
.ba-body h2 + *, .ba-body h3 + *, .ba-body h4 + * { margin-top: 0.75em; }

.ba-list { padding-left: 1.35em; }
.ba-list li + li { margin-top: 0.45em; }

.ba-quote { margin: 1.9em 0; padding: 0 0 0 20px; border-left: 3px solid var(--accent); }
.ba-quote blockquote { margin: 0; }
.ba-quote p { font-family: var(--font-serif); font-size: 1.2rem; line-height: 1.55; color: var(--ink); margin: 0; }
.ba-quote figcaption { margin-top: 9px; color: var(--ink-3); font-size: 0.86rem; }

.ba-rule { border: 0; border-top: 1px solid var(--line); margin: 2.4em auto; width: 120px; opacity: 0.9; }

.ba-figure { margin: 1.9em 0; }
.ba-figure img { width: 100%; height: auto; border-radius: 10px; display: block; }
.ba-figure figcaption { margin-top: 9px; color: var(--ink-3); font-size: 0.86rem; text-align: center; }

/* ---- Sources & foot ---- */
.ba-sources { margin-top: 46px; padding-top: 22px; border-top: 1px solid var(--line); }
.ba-sources h2 { font-family: var(--font-serif); font-weight: 500; font-size: 1.18rem; margin: 0 0 12px; }
.ba-sources ul { margin: 0; padding-left: 1.25em; color: var(--ink-2); font-size: 0.92rem; }
.ba-sources li + li { margin-top: 6px; }
.ba-sources a { color: var(--accent-deep); }

.ba-article-foot { margin-top: 40px; }
.ba-back { color: var(--accent-deep); font-weight: 600; text-decoration: none; }
.ba-back:hover { text-decoration: underline; }

/* ---- Related strip ---- */
.ba-related { padding-top: 10px; }
.ba-related h2 { font-family: var(--font-serif); font-weight: 500; font-size: 1.5rem; margin: 0 0 22px; }

/* ---- Homepage strip ----
   The cards are the blog index's own; only the row above them is new. */
.ba-strip-more { color: var(--accent-deep); text-decoration: none; font-weight: 600; font-size: 0.94rem; }
.ba-strip-more:hover { text-decoration: underline; }
