/* ─── Article pages — same system, editorial layout ─────────
   Width: articles now use the page the way the home page does. The body was
   a 760px column centred in a 2000px viewport, which read as an A4 sheet
   floating in space.

   The fix is NOT "set prose to full width" — a 1900px line of body copy runs
   past 200 characters and becomes genuinely unreadable. What uses the width
   properly is an editorial grid:
     · the shell matches the home page (--shell, 1500px)
     · type steps up (19px body, not 16.8px), so a wider measure still reads
     · prose fills a generous column capped at ~76 characters
     · a sticky rail on the right takes the remaining width with the section
       nav and a compact CTA — so the space is used, not padded
   Below 1100px the rail drops and prose centres on its own measure.
   ──────────────────────────────────────────────────────────── */

/* ─── Nav on article pages ────────────────────────────────
   Two real bugs were visible here:

   1. The bar was transparent until `.is-stuck`, which main.js sets — but
      article pages load js/article.js, so it never fired and the links sat
      directly on top of the h1. Article nav is opaque from the start.
   2. `.nav-links` had no `white-space: nowrap` guard of its own (the home
      page rule covers `.nav-links a`, but these labels are longer relative
      to the space left by the wordmark), so links wrapped into the headline.
      Both are prevented below. */
.nav--article::before { opacity: 1; }
.nav--article .nav-links { flex-wrap: nowrap; }
.nav--article .nav-links a { white-space: nowrap; }

/* ─── Hero ────────────────────────────────────────────────── */
.article-hero {
  position: relative;
  min-height: 58vh;
  display: flex;
  align-items: flex-end;
  padding-block: clamp(7rem, 15vh, 10rem) clamp(2.5rem, 5vw, 4rem);
  padding-inline: 0;
  overflow: hidden;
}
.article-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.75) brightness(0.55);
  z-index: 0;
}
.article-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 11, 22, 0.55) 0%, rgba(7, 11, 22, 0.35) 45%, var(--ink) 100%);
  z-index: 1;
}
/* Was 860px centred; now the same rail as every other page section. */
.article-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.article-hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.7rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  min-height: 0;
  margin: 1rem 0 1.2rem;
  /* Uses the width without becoming one very long line */
  max-width: 24ch;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.article-meta .story-chip { margin-bottom: 0; }

/* ─── Editorial grid ──────────────────────────────────────── */
.article-shell {
  position: relative;
  z-index: 10;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(2.5rem, 4.5vw, 5rem);
  align-items: start;   /* required for the sticky rail to track */
}

/* ─── Body ────────────────────────────────────────────────── */
/* Measured, not guessed: at 928px the 18.9px body copy ran ~94 characters per
   line. 46rem lands it at ~72 — inside the 65–80 band where long-form prose
   stays readable. The width freed up goes to the rail, not to the paragraph. */
.article-body {
  max-width: 46rem;
  padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(3rem, 6vw, 5rem);
}
.article-body > p:first-of-type {
  font-size: clamp(1.25rem, 1.6vw, 1.45rem);
  line-height: 1.62;
  color: var(--paper);
  margin-bottom: 1.8rem;
}
.article-body p {
  color: var(--muted);
  font-size: 1.18rem;
  line-height: 1.8;
  margin-bottom: 1.6rem;
}
.article-body h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 1.14;
  margin: 3.4rem 0 1.3rem;
  /* Clears the fixed nav when reached from a TOC link */
  scroll-margin-top: 6.5rem;
}
.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.4rem 0 0.9rem;
  scroll-margin-top: 6.5rem;
}
.article-body ul, .article-body ol {
  margin: 0 0 1.6rem 1.4rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.8;
}
.article-body li { margin-bottom: 0.6rem; }
.article-body li::marker { color: var(--blue); }
.article-body strong { color: var(--paper); }

/* Pull quote */
.pull-quote {
  border-left: 3px solid transparent;
  border-image: var(--grad) 1;
  padding: 0.5rem 0 0.5rem 1.9rem;
  margin: 3rem 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.015em;
  color: var(--paper);
}

/* Key-takeaways box */
.takeaways {
  border: 1px solid rgba(147, 160, 189, 0.2);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(20, 28, 52, 0.65), rgba(12, 18, 36, 0.65));
  padding: 1.8rem 2rem;
  margin: 3rem 0;
}
.takeaways h3 { margin-top: 0; }
.takeaways .eyebrow { margin-bottom: 0.8rem; padding-bottom: 0.45rem; }
.takeaways ul { margin-bottom: 0; font-size: 1.08rem; }

/* Article footer CTA */
.article-cta {
  margin: 3.8rem 0 0;
  padding: 2.4rem;
  border-radius: 18px;
  border: 1px solid rgba(77, 124, 255, 0.35);
  background: linear-gradient(160deg, rgba(77, 124, 255, 0.14), rgba(155, 107, 255, 0.1));
  text-align: center;
}
.article-cta h3 { margin: 0 0 0.6rem; }
.article-cta p { margin-bottom: 1.4rem; }

/* ─── Sticky rail ─────────────────────────────────────────
   Takes the width the prose deliberately doesn't. Sticky needs a scroll
   container that isn't clipped — body uses `overflow-x: clip` rather than
   `hidden` for exactly this reason (hidden creates a scroll container and
   silently kills position:sticky in descendants). */
.article-rail {
  position: sticky;
  top: 6.5rem;
  padding-top: clamp(2.5rem, 5vw, 4rem);
  display: grid;
  gap: 1.4rem;
}

/* The ambient logo particles are drawn on a fixed canvas behind everything and
   sit right about here at this width, which made the TOC hard to read. A panel
   ground rather than bare text keeps the rail legible without hiding the mark. */
.article-toc {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 16, 51, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.2rem 1.3rem;
}
.toc-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 0.9rem;
}
.article-toc ul { list-style: none; display: grid; gap: 0.15rem; margin: 0; }
.article-toc a {
  display: block;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--muted-2);
  text-decoration: none;
  padding: 0.35rem 0;
  border-left: 2px solid transparent;
  margin-left: -1.2rem;
  padding-left: 1.2rem;
  transition: color 0.25s, border-color 0.25s;
}
.article-toc a:hover { color: var(--paper); }
.article-toc a.is-current {
  color: var(--paper);
  border-left-color: var(--cyan);
}
.article-toc a {
  margin-left: -1.3rem;
  padding-left: 1.3rem;
}

.rail-cta {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(77, 124, 255, 0.12), rgba(155, 107, 255, 0.08));
  padding: 1.3rem 1.4rem;
}
.rail-cta p {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 1rem;
}
.rail-cta .btn { padding: 0.6rem 1.2rem; font-size: 0.88rem; }

/* ─── Next reads ──────────────────────────────────────────── */
/* Matches the home page insights grid width rather than 1100px. */
.next-reads {
  max-width: var(--shell-wide);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(4rem, 8vw, 6rem);
  position: relative;
  z-index: 10;
}
.next-reads h2 { margin-bottom: 1.8rem; }
.next-reads .insight-grid { margin-top: 0; }
/* Three equal cards here — the home page's 4-col + lead-story rule doesn't
   apply, and inheriting it made the first card span two columns. */
.next-reads .insight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.next-reads .insight-card:first-child { grid-column: auto; grid-row: auto; }
.next-reads .insight-card:first-child figure { aspect-ratio: 3 / 2; }
.next-reads .insight-card:first-child h3 { font-size: 1.12rem; }
@media (max-width: 900px) {
  .next-reads .insight-grid { grid-template-columns: 1fr; }
}

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  text-decoration: none;
  margin-bottom: 1.4rem;
}
.back-link:hover { color: var(--paper); }

/* ─── Narrow ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-rail { display: none; }
  .article-body { max-width: 62rem; margin-inline: auto; }
}
@media (max-width: 700px) {
  .article-body p { font-size: 1.1rem; }
  .article-body ul, .article-body ol { font-size: 1.06rem; }
}
