/* Editorial theme. No framework, no JS. Blocks bring their own CSS, inlined
   per page, so a page only pays for what it renders. */

:root {
  --bg: #fdfdfc;
  --fg: #1a1a1a;
  --muted: #767a82;
  --muted-strong: #4b5058;
  --rule: #e4e3df;
  --tint: #f4f3f0;
  --accent: #2563eb;
  /* Reading measure for a single column of prose. */
  --measure: 34rem;
  /* Outer container. Rail and card layouts need real width; the single-column
     editorial layout deliberately stays narrow. */
  --container: calc(var(--measure) + var(--gutter) * 2);
  --gutter: 1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151a;
    --fg: #e9e8e4;
    --muted: #8b8f98;
    --muted-strong: #b3b7bf;
    --rule: #2a2c33;
    --tint: #1c1e24;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

img { max-width: 100%; height: auto; }

.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

/* Wide shells: the rail and card layouts were designed edge-to-edge. */
.layout-digest, .layout-grid, .layout-stream { --container: 78rem; --gutter: 2rem; }
.layout-stream { --container: 62rem; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: .5rem; background: var(--fg); color: var(--bg); padding: .5rem .8rem; border-radius: 4px; z-index: 10; }

/* -- masthead ------------------------------------------------------------ */

.masthead { border-bottom: 1px solid var(--rule); }
.masthead__inner { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; padding-block: 1.15rem; flex-wrap: wrap; }
.masthead__brand { display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-heading); font-size: 1.14rem; font-weight: 600;
  letter-spacing: -.015em; text-decoration: none; }
.brand__icon { flex-shrink: 0; color: var(--accent); }
.masthead__brand img { display: block; }
.masthead__nav { display: flex; gap: 1.15rem; flex-wrap: wrap; font-size: .81rem; letter-spacing: .05em; text-transform: uppercase; }
.masthead__nav a { color: var(--muted-strong); text-decoration: none; }
.masthead__nav a:hover { color: var(--accent); }

/* -- shared bits --------------------------------------------------------- */

.article__kickers { display: flex; gap: .9rem; margin: 0 0 .3rem; }
.kicker { display: inline-block; font-size: .71rem; font-weight: 650; letter-spacing: .11em; text-transform: uppercase; color: var(--accent); text-decoration: none; margin-bottom: .5rem; }

.meta { display: flex; gap: .9rem; flex-wrap: wrap; margin: 0; font-size: .8rem; color: var(--muted); }
.meta__updated { font-style: italic; }

.empty { color: var(--muted); font-style: italic; list-style: none; padding: 2rem 0; }

/* -- home ---------------------------------------------------------------- */

.hero { padding-block: 3.5rem 2.25rem; }
.hero__title { font-family: var(--font-heading); font-weight: var(--heading-weight, 700); font-size: clamp(2rem, 6vw, 2.9rem); line-height: 1.08; letter-spacing: -.028em; margin: 0; }
.hero__tagline { margin: .75rem 0 0; font-size: 1.06rem; color: var(--muted-strong); max-width: var(--measure); }

.lead { padding-block: 2rem; border-top: 2px solid var(--fg); border-bottom: 1px solid var(--rule); }
.lead__link { text-decoration: none; display: block; }
.lead__title { font-family: var(--font-heading); font-size: clamp(1.5rem, 4.5vw, 2rem); line-height: 1.18; letter-spacing: -.02em; margin: 0; }
.lead__link:hover .lead__title { color: var(--accent); }
.lead__excerpt { margin: .7rem 0 .9rem; color: var(--muted-strong); }

.lead__media { margin-bottom: 1.1rem; }
.lead__media img { display: block; width: 100%; height: auto; border-radius: 6px; }

.cards { list-style: none; margin: 0; padding: 0; }
.card { padding-block: 1.6rem; border-bottom: 1px solid var(--rule); }
.cards .card:last-child { border-bottom: none; }
.card--media { display: grid; grid-template-columns: 140px 1fr; gap: 1.1rem; align-items: start; }
.card__media img, .row__media img { display: block; width: 100%; height: auto;
  aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; }
.card a { text-decoration: none; }
.card__title { font-family: var(--font-heading); font-size: 1.24rem; line-height: 1.28; letter-spacing: -.012em; margin: 0; }
.card a:hover .card__title { color: var(--accent); }
.card__excerpt { margin: .5rem 0 .7rem; font-size: .95rem; color: var(--muted-strong); }

/* -- listings ------------------------------------------------------------ */

.listing__header { padding-block: 3rem 1.5rem; border-bottom: 2px solid var(--fg); }
.listing__title { font-family: var(--font-heading); font-size: clamp(1.8rem, 5vw, 2.4rem); line-height: 1.1; letter-spacing: -.025em; margin: 0; }
.listing__description { margin: .7rem 0 0; font-size: 1.02rem; color: var(--muted-strong); max-width: 32rem; }
.listing__count { margin: .5rem 0 0; font-size: .82rem; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0; }
.row { padding-block: 1.5rem; border-bottom: 1px solid var(--rule); }
/* Separators sit BETWEEN items -- a trailing rule leaves a stray line above
   the footer. */
.rows .row:last-child { border-bottom: none; }
.row--media { display: grid; grid-template-columns: 120px 1fr; gap: 1.1rem; align-items: start; }
.row--media .row__media img { aspect-ratio: 4 / 3; }
.row--compact.row--media { grid-template-columns: 72px 1fr; gap: .9rem; align-items: center; }
.row a { text-decoration: none; }
.row__title { font-family: var(--font-heading); font-size: 1.2rem; line-height: 1.3; margin: 0 0 .4rem; }
.row a:hover .row__title { color: var(--accent); }
.row__excerpt { margin: 0 0 .55rem; font-size: .93rem; color: var(--muted-strong); }
.row--compact { padding-block: .95rem; }
.row--compact .row__title { font-size: 1.05rem; margin-bottom: .25rem; }

/* -- article ------------------------------------------------------------- */

.article { padding-bottom: 3.5rem; }
.article__header { padding-block: 3rem 1.75rem; }
.article__title { font-family: var(--font-heading); font-weight: var(--heading-weight, 700); font-size: clamp(1.9rem, 5.5vw, 2.65rem); line-height: 1.11; letter-spacing: -.028em; margin: 0; }
.article__standfirst { margin: .9rem 0 0; font-size: 1.13rem; line-height: 1.5; color: var(--muted-strong); }
.article__meta { margin-top: 1.15rem; padding-top: 1.15rem; border-top: 1px solid var(--rule); }
.article__body { --bleed: 0px; }
.article__body > :first-child { margin-top: 0; }

.article--page .article__header { padding-block: 3rem 1.25rem; }

.toc { margin: 0 0 2.25rem; padding: 1.1rem 1.3rem; background: var(--tint); border-radius: 8px; }
.toc__label { margin: 0 0 .55rem; font-size: .71rem; font-weight: 650; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.15rem; font-size: .91rem; }
.toc li { margin-bottom: .28rem; }
.toc li.toc__l3 { padding-left: .85rem; }
.toc li.toc__l4 { padding-left: 1.7rem; }
.toc a { color: var(--muted-strong); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.related { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.related__title { margin: 0 0 .8rem; font-size: .78rem; font-weight: 650;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.related ul { list-style: none; margin: 0; padding: 0; }
.related li { padding-block: .6rem; border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.related li:last-child { border-bottom: none; }
.related a { font-family: var(--font-heading); font-weight: 600; text-decoration: none; }
.related a:hover { color: var(--accent); }
.related__topic { flex-shrink: 0; font-size: .78rem; color: var(--muted); }

.byline { display: flex; gap: 1rem; align-items: flex-start; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.byline img { border-radius: 50%; flex-shrink: 0; }
.byline__name { margin: 0 0 .2rem; font-weight: 650; font-size: .93rem; }
.byline__role { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.byline__bio { margin: 0; font-size: .88rem; color: var(--muted); }

/* -- footer -------------------------------------------------------------- */

.footer { border-top: 1px solid var(--rule); margin-top: 2rem; padding-block: 2.25rem 1.5rem; }
.footer__inner { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.footer__name { margin: 0; font-family: var(--font-heading); font-weight: 600; }
.footer__tagline { margin: .25rem 0 0; font-size: .87rem; color: var(--muted); max-width: 22rem; }
.footer__nav { display: flex; flex-direction: column; gap: .35rem; font-size: .87rem; }
.footer__nav a { color: var(--muted-strong); text-decoration: none; }
.footer__nav a:hover { color: var(--accent); }
.footer__legal { margin-top: 1.75rem; font-size: .78rem; color: var(--muted); }
.footer__legal p { margin: 0; }
.footer__disclaimer { margin: 0 0 .7rem !important; max-width: 46rem; line-height: 1.55; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .masthead__inner { padding-block: .9rem; }
  .card--media, .row--media { grid-template-columns: 96px 1fr; gap: .8rem; }
  .row--compact.row--media { grid-template-columns: 64px 1fr; }
}

/* -- two-tier header ------------------------------------------------------ */

.masthead__nav .count, .topicbar__count, .topicbar__inner .count {
  font-size: .78em; color: var(--muted); margin-left: .3em;
}
.topicbar { border-top: 1px solid var(--rule); background: var(--tint); }
.topicbar__inner { display: flex; gap: 1.15rem; flex-wrap: wrap; padding-block: .6rem;
  font-size: .81rem; letter-spacing: .04em; text-transform: uppercase; }
.topicbar__inner a { color: var(--muted-strong); text-decoration: none; }
.topicbar__inner a:hover { color: var(--accent); }

/* -- rail shell ----------------------------------------------------------- */

.shell { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 3.5rem;
  align-items: start; }
/* Article bodies keep their reading measure even inside a wide shell. */
.shell__body .article__body, .shell__body .blk-prose { max-width: var(--measure); }
.shell__rail { position: sticky; top: 1.5rem; padding-top: 2.5rem; }
.rail__widget { margin-bottom: 2rem; }
.rail__title { margin: 0 0 .7rem; font-size: .78rem; font-weight: 650;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.rail__list { list-style: none; margin: 0; padding: 0; font-size: .92rem; line-height: 1.4; }
.rail__list li { padding-block: .6rem; border-bottom: 1px solid var(--rule); }
.rail__list li:last-child { border-bottom: none; }
.rail__list li:first-child { border-top: 1px solid var(--rule); }
.rail__list a { color: inherit; text-decoration: none; }
.rail__list a:hover { color: var(--accent); }
.rail__chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .25rem .65rem; border: 1px solid var(--rule); border-radius: 999px;
  font-size: .82rem; text-decoration: none; color: var(--muted-strong); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.rail__search input { width: 100%; padding: .5rem .7rem; font: inherit; font-size: .9rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--bg); color: var(--fg); }
.rail__cta { font-size: .9rem; color: var(--muted-strong); margin: 0;
  padding: .9rem 1rem; background: var(--tint); border-radius: 8px; }

/* -- text list with right-aligned date ------------------------------------ */

.row__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.row__date { flex-shrink: 0; font-size: .8rem; color: var(--muted); white-space: nowrap; }

/* -- card grid ------------------------------------------------------------ */

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); padding-block: 2rem; }
.tile a { text-decoration: none; }
.tile__media { margin-bottom: .8rem; }
.tile__media img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2;
  object-fit: cover; border-radius: 6px; }
.tile__title { font-family: var(--font-heading); font-weight: var(--heading-weight, 700);
  font-size: 1.14rem; line-height: 1.3; margin: 0; }
.tile a:hover .tile__title { color: var(--accent); }
.tile__excerpt { margin: .5rem 0 .6rem; font-size: .93rem; color: var(--muted-strong); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; gap: 0; }
  .shell__rail { position: static; padding-top: 1.5rem; order: 2; border-top: 1px solid var(--rule); }
  .row__head { display: block; }
  .row__date { display: block; margin-top: .2rem; }
}

/* -- accent rule under page titles (from the original digest theme) -------- */

.hero__title::after, .listing__title::after {
  content: ""; display: block; width: 3.4rem; height: 3px; margin-top: .85rem;
  background: var(--accent); border-radius: 2px;
}

/* -- search page ---------------------------------------------------------- */

.searchpage__form { margin: 1.5rem 0 .5rem; }
.searchpage__form input { width: 100%; padding: .7rem .9rem; font: inherit; font-size: 1rem;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); color: var(--fg); }
.searchpage__form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.searchpage__status { font-size: .84rem; color: var(--muted); margin: .6rem 0 0; }
.masthead__search input { padding: .35rem .7rem; font: inherit; font-size: .84rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--bg); color: var(--fg); width: 11rem; }
