/* Brainova — ground #EDF1E0 · accent #2447E0 · Instrument Serif + Figtree */

:root {
  --ground: #EDF1E0;
  --card: #F7FAEC;
  --paper: #FCFDF6;
  --ink: #212819;
  --ink-soft: #4C5442;
  --ink-faint: #6E7663;
  --accent: #2447E0;
  --accent-deep: #1A34AD;
  --line: #D9E0C8;
  --line-strong: #B4BF9E;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Figtree', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.04rem;
  line-height: 1.65;
}

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

a { color: var(--accent); }
a:hover { color: var(--accent-deep); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: .6rem 1rem;
  z-index: 50; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip:focus { left: 0; color: #fff; }

.shell {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 1.75rem);
}

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

.masthead { border-bottom: 1px solid var(--line-strong); background: var(--ground); }
.masthead__in {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .6rem 1.5rem; padding-block: .9rem;
}

.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  text-decoration: none; color: var(--ink);
}
.brand__name {
  font-family: var(--serif);
  font-size: 1.65rem;
  line-height: 1;
  letter-spacing: .01em;
}
.brand__tag {
  font-size: .78rem; color: var(--ink-faint); font-weight: 500;
  border-left: 1px solid var(--line-strong);
  padding-left: .8rem; margin-left: .2rem;
}
.brand:hover { color: var(--accent-deep); }

.nav { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
.nav a {
  color: var(--ink-soft); text-decoration: none;
  font-weight: 600; font-size: .92rem; padding-block: .2rem;
}
.nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- hero ---------- */

.hero { padding-block: 3.4rem 1.6rem; max-width: 60rem; }
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.7rem, 7vw, 4.4rem);
  line-height: 1.02; margin: 0 0 1.1rem;
  letter-spacing: -.01em;
}
.hero__lede {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: var(--ink-soft); max-width: 44rem; margin: 0 0 1.4rem;
}
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.chip {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--paper); color: var(--ink-soft);
  font-size: .8rem; font-weight: 600; text-decoration: none;
  padding: .3rem .8rem;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- sections & cards ---------- */

.section { margin-block: 2.6rem; }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; border-bottom: 1px solid var(--line-strong);
  padding-bottom: .55rem; margin-bottom: 1.3rem;
}
.section__head h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin: 0;
}
.more {
  font-size: .88rem; font-weight: 700; text-decoration: none;
  color: var(--accent); white-space: nowrap;
}
.more:hover { text-decoration: underline; text-underline-offset: 4px; }
.section__blurb { color: var(--ink-faint); font-size: .92rem; margin: -0.6rem 0 1.2rem; }

.cards {
  display: grid; gap: 1.15rem;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
}

.card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(33, 40, 25, .08);
}
.card__media { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--line); }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__body { padding: .95rem 1.05rem 1.1rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }

.kicker {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); margin: 0;
}
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { text-decoration: underline; text-underline-offset: 3px; }

.card__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.42rem; line-height: 1.16; }
.card__title a { color: var(--ink); text-decoration: none; }
.card__title a:hover { color: var(--accent-deep); }
.card__dek {
  margin: 0; font-size: .9rem; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__meta { margin: auto 0 0; padding-top: .4rem; font-size: .78rem; color: var(--ink-faint); }

/* ---------- feature ---------- */

.feature {
  display: grid; gap: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; margin-bottom: 1.15rem;
}
.feature__media { display: block; min-height: 100%; background: var(--line); }
.feature__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feature__body { padding: 1.6rem 1.7rem 1.8rem; display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.feature__title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.08; }
.feature__title a { color: var(--ink); text-decoration: none; }
.feature__title a:hover { color: var(--accent-deep); }
.feature__dek { margin: 0; color: var(--ink-soft); font-size: 1rem; max-width: 40rem; }
@media (min-width: 760px) {
  .feature { grid-template-columns: 1.05fr 1fr; }
}

.btn {
  display: inline-block; background: var(--accent); color: #fff;
  font-weight: 700; font-size: .9rem; text-decoration: none;
  padding: .55rem 1.15rem; border-radius: 999px; margin-top: .4rem;
}
.btn:hover { background: var(--accent-deep); color: #fff; }

/* ---------- page head (archive / topic / about) ---------- */

.page-head { padding-block: 2.8rem .4rem; max-width: 60rem; }
.page-head h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 5.4vw, 3.4rem);
  line-height: 1.05; margin: .2rem 0 .7rem;
}
.page-head__lede { color: var(--ink-soft); font-size: 1.08rem; max-width: 44rem; margin: 0; }

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

.article { min-width: 0; }

.article-grid {
  display: grid; gap: 2.4rem;
  align-items: start;
  padding-bottom: 2rem;
}
@media (min-width: 1000px) {
  .article-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}

.article__head { padding-block: 1.8rem .6rem; max-width: 46rem; }
.article__title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 5.6vw, 3.5rem);
  line-height: 1.05; margin: .3rem 0 .8rem; letter-spacing: -.005em;
}
.article__dek {
  font-size: clamp(1.08rem, 2.2vw, 1.25rem);
  color: var(--ink-soft); margin: 0 0 1.1rem;
}
.article__by {
  margin: 0 0 1rem; font-size: .9rem; font-weight: 700;
  color: var(--ink-soft);
}
.article__by::before {
  content: ""; display: inline-block; width: 26px; height: 2px;
  background: var(--accent); vertical-align: middle; margin-right: .6rem;
}
.article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem .5rem; }
.article__read { font-size: .82rem; color: var(--ink-faint); font-weight: 600; }

.fig { margin: 1.8rem 0; }
.fig img {
  border-radius: 12px; border: 1px solid var(--line);
  width: 100%; display: block; background: #fff;
}
.fig figcaption { font-size: .84rem; color: var(--ink-faint); margin-top: .5rem; max-width: 46rem; }
.fig .credit { color: var(--ink-faint); font-style: italic; }

.prose { max-width: 44rem; }
.prose .unit { margin-block: 1.4rem; }
.prose h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.55rem, 3.2vw, 2rem); line-height: 1.15;
  margin: 2.2rem 0 .7rem;
}
.prose p { margin: .95rem 0; }
.prose em { font-style: italic; }
.prose ul { padding-left: 1.4rem; }
.prose li { margin-block: .4rem; }

.related { margin-top: 2.6rem; }
.related h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 1.8rem; margin: 0 0 1.1rem;
  border-bottom: 1px solid var(--line-strong); padding-bottom: .5rem;
}

/* ---------- listing + ad rail layout (archive / topics / tags) ----------
   Main content plus one ad-only rail. Marked data-ad-layout: when the rail's
   placements are all removed, the rail wrapper disappears and the flex row
   collapses to a single full-width column. */

.listing-grid { display: flex; gap: 2.4rem; align-items: stretch; }
.listing-main { flex: 1 1 auto; min-width: 0; }
.listing-rail {
  flex: 0 0 300px; min-width: 0;
  display: flex; flex-direction: column;
}
.listing-rail[data-ad-rail]:empty { display: none; }
@media (max-width: 999px) { .listing-rail { display: none; } }

/* article rail: editorial explore box plus an ad-only sub-column */
.rail-wrap { min-width: 0; display: flex; flex-direction: column; }
@media (max-width: 999px) { .rail-wrap { display: none; } }
.rail-ads[data-ad-rail] { flex: 1 1 auto; min-width: 0; }
.rail-ads[data-ad-rail]:empty { display: none; }
.railbox {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.1rem 1.2rem; margin-bottom: 1.4rem;
}
.railbox__head {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint);
  margin: 0 0 .6rem;
}
.railbox__link {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem 0; border-top: 1px solid var(--line);
  color: var(--ink-soft); font-weight: 600; font-size: .92rem; text-decoration: none;
}
.railbox__link:first-of-type { border-top: 0; }
.railbox__link:hover { color: var(--accent); }
.railbox__link span {
  font-size: .75rem; color: var(--ink-faint);
  background: var(--ground); border: 1px solid var(--line);
  border-radius: 999px; padding: .05rem .55rem;
}

/* ---------- ads ----------
   Every placement is an ad-only element marked data-ad-placement; it holds
   the label, spacing and the responsive creative alternatives, and never any
   editorial text. Each creative box (.ad__frame) is the exact declared size
   and carries data-slot / data-ad-slot / data-slot-id. Each unit is shown
   only when its actual container fits it whole, including padding: media
   queries pick the unit for the viewport, container queries guarantee it
   fits the real containing block. Unfilled placements and empty rails are
   removed before serving; :empty guards collapse anything left behind. */

.ad-placement {
  container-type: inline-size;
  margin: 1.8rem auto;
  text-align: center;
}
.ad-placement:empty { display: none; margin: 0; }
.ad-placement--feed { grid-column: 1 / -1; margin-block: .2rem; }
.feed-ad { grid-column: 1 / -1; }
.feed-ad:empty { display: none; }
.ad-placement--bottom { margin-block: 1.5rem 0; }
.ad-placement--rail { position: sticky; top: 1.5rem; margin-block: 0 1.4rem; }

.ad__label {
  display: block;
  font-size: .66rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: .4rem;
}
.ad__frame {
  display: inline-flex; align-items: center; justify-content: center;
  outline: 1px dashed var(--line-strong); outline-offset: -1px;
  background: rgba(255, 255, 255, .55); border-radius: 6px;
  color: var(--ink-faint); font-size: .78rem; font-weight: 500;
}
.ad__size { padding: .3rem; }

/* exact approved sizes — nothing is stretched, cropped or shrunk */
.ad--728x90, .ad--468x60, .ad--320x50, .ad--300x600 { display: none; }
.ad--300x250 { display: block; }

/* banner placements run one leaderboard/rect unit per viewport band;
   the 300x250 is their small-screen fallback only */
.ad-placement--banner .ad--300x250 { display: none; }
@media (max-width: 559px) { .ad-placement--banner .ad--300x250 { display: block; } }
@media (max-width: 335px) { .ad--300x250 { display: none; } }

.ad--728x90 { display: block; }
@media (max-width: 859px) { .ad--728x90 { display: none; } }

.ad--468x60 { display: block; }
@media (max-width: 559px), (min-width: 860px) { .ad--468x60 { display: none; } }

.ad--320x50 { display: block; }
@media (min-width: 560px) { .ad--320x50 { display: none; } }

.ad--300x600 { display: block; }
@media (max-width: 999px) { .ad--300x600 { display: none; } }

/* container fit guards — a unit never renders wider than its containing block */
@container (max-width: 299px) { .ad--300x250 { display: none; } .ad--300x600 { display: none; } }
@container (max-width: 319px) { .ad--320x50 { display: none; } }
@container (max-width: 467px) { .ad--468x60 { display: none; } }
@container (max-width: 727px) { .ad--728x90 { display: none; } }

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

.footer {
  border-top: 1px solid var(--line-strong);
  margin-top: 3.5rem; padding-block: 2.6rem 3rem;
}
.footer__in {
  display: grid; gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .footer__in { grid-template-columns: 1.2fr 1fr; } }
.footer__tagline { font-family: var(--serif); font-size: 1.15rem; margin: .7rem 0 .4rem; }
.footer__fine { font-size: .82rem; color: var(--ink-faint); max-width: 30rem; margin: 0; }
.footer__nav { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.footer__head {
  font-size: .72rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .55rem;
}
.footer__nav a {
  display: block; color: var(--ink-soft); text-decoration: none;
  font-size: .92rem; padding-block: .22rem;
}
.footer__nav a:hover { color: var(--accent); }

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  .hero { padding-block: 2.2rem 1rem; }
  .brand__tag { display: none; }
  .feature__body { padding: 1.2rem 1.15rem 1.4rem; }
}
