/* =====================================================================
 * article.css — Polyphase article-page styles
 *
 * Reference: site-spec v0.4 §14.4–§14.7, mock-article-jp.html, Step 0
 * sign-off M-3/M-4 (paragraph IDs + scene boundaries).
 *
 * Scope rule: every selector is namespaced under `.page--article` so it
 * cannot collide with top-page selectors (.brand, .hero, .stack-bar in
 * base.css mean different things on the top page). tokens.css + base.css
 * load FIRST; this file is loaded only on article routes.
 *
 * What lives here:
 *   - Scene scaffolding (mode-L / mode-D)
 *   - Scene-aware masthead `is-hidden` transition (M-9 contract)
 *   - Key Claims bilingual grid (v0.4 #6 — JA dt / EN dd visible)
 *   - Article body prose (h2/h3/p/blockquote/ul/sup superscript refs)
 *   - Chart figure (build-charts.js output) wrapper
 *   - Methodology + Sources endnote sections (DOM-direct, v0.4 #20)
 *   - Citation block + Related grid
 *   - Mobile breakpoint at 900px
 *   - prefers-reduced-motion safety net
 *
 * What lives elsewhere:
 *   - Inline chart SVG token literals → scripts/build-charts.js TOKEN_MAP
 *   - Reveal/scene-change behaviour → src/snippets/anim.js + scene-mast.js
 * ===================================================================== */

/* ---------------------------------------------------------------------
 * Scene-aware masthead
 * ------------------------------------------------------------------- */
.masthead {
  transition: opacity 200ms var(--ease), visibility 200ms var(--ease);
}
.masthead.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------------------------------------------------------------------
 * Article shell
 * ------------------------------------------------------------------- */
.page--article {
  background: var(--bg);
  color: var(--text);
}
.page--article .article-body {
  /* The body is a stack of <section data-scene data-mode> blocks. */
  display: block;
}

/* ---------------------------------------------------------------------
 * Scene scaffolding
 * ------------------------------------------------------------------- */
.page--article .scene {
  width: 100%;
  padding: 96px 7vw;
  position: relative;
  background: var(--bg);
  color: var(--text);
}
.page--article .scene.mode-D {
  background: var(--bg-D);
  color: var(--text-D);
}
.page--article .scene.mode-D em {
  color: var(--signal-D);
  font-style: normal;
  font-weight: 600;
}
.page--article .scene.mode-L em {
  color: var(--signal);
  font-style: normal;
  font-weight: 600;
}
.page--article .scene a {
  color: inherit;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.page--article .scene a:hover {
  color: var(--signal);
  border-bottom-color: var(--signal);
}
.page--article .scene.mode-D a {
  border-bottom-color: var(--rule-D);
}
.page--article .scene.mode-D a:hover {
  color: var(--signal-D);
  border-bottom-color: var(--signal-D);
}

/* ---------------------------------------------------------------------
 * Hero / Scene 1
 * ------------------------------------------------------------------- */
.page--article .hero-block {
  text-align: center;
  padding: 12vh 7vw 96px;
  background: var(--bg-D);
  color: var(--text-D);
}
.page--article .hero-block .eyebrow-issue {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--signal-D);
  margin-bottom: 36px;
}
.page--article .hero-block h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.5vw, 88px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 600;
  max-width: 22ch;
  margin: 0 auto;
  color: var(--text-D);
}
.page--article .hero-block .subtitle {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.4;
  color: var(--text-mute-D);
  margin: 32px auto 0;
  max-width: 40ch;
}
.page--article .hero-block .credit {
  margin-top: 72px;
  display: flex;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft-D);
}

/* ---------------------------------------------------------------------
 * Key Claims (v0.4 #6 bilingual mandatory — JA dt / EN dd)
 * ------------------------------------------------------------------- */
.page--article .key-claims-section {
  padding: 80px 7vw 120px;
  background: var(--bg-D);
  color: var(--text-D);
  border-top: 1px solid var(--rule-D);
}
.page--article .key-claims-section .claims-head {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 64px;
  align-items: baseline;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--rule-D);
  max-width: 1280px;
  margin: 0 auto;
}
.page--article .key-claims-section .claims-head h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 600;
  color: var(--text-D);
  margin: 0;
}
.page--article .key-claims-section .claims-head .dek {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-mute-D);
  max-width: 56ch;
  margin: 0;
}
.page--article dl.key-claims {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 48px auto 0;
  max-width: 1280px;
}
.page--article dl.key-claims .claim {
  padding: 32px 32px 28px;
  border-right: 1px solid var(--rule-D);
  display: flex;
  flex-direction: column;
  min-height: 280px;
  position: relative;
}
.page--article dl.key-claims .claim:first-child { padding-left: 0; }
.page--article dl.key-claims .claim:last-child {
  border-right: none;
  padding-right: 0;
}
.page--article dl.key-claims .claim::before {
  content: counter(claim-counter, decimal-leading-zero);
  counter-increment: claim-counter;
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--signal-D);
  margin-bottom: 24px;
}
.page--article dl.key-claims {
  counter-reset: claim-counter;
}
.page--article dl.key-claims dt[lang="ja"] {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.45;
  color: var(--text-D);
  margin-bottom: 14px;
}
.page--article dl.key-claims dt[lang="ja"] em {
  color: var(--signal-D);
  font-style: normal;
  font-weight: 600;
}
.page--article dl.key-claims dd[lang="en"] {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-mute-D);
  font-style: italic;
}

/* ---------------------------------------------------------------------
 * Article body prose (rendered from Markdown by article-parser.js)
 * Each section uses .mode-L (light) or .mode-D (dark) — token tokens
 * already resolve the right colour for each.
 * ------------------------------------------------------------------- */
.page--article .scene > h2,
.page--article .scene > h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  max-width: 28ch;
}
.page--article .scene > h2 {
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 24px;
}
.page--article .scene > h3 {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 600;
  line-height: 1.25;
  margin: 32px 0 14px;
}
.page--article .scene > p {
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.75;
  max-width: 64ch;
  margin: 0 0 18px;
  color: inherit;
}
.page--article .scene.mode-L > p { color: var(--text); }
.page--article .scene.mode-D > p { color: var(--text-mute-D); }
.page--article .scene > blockquote {
  margin: 24px 0;
  padding: 16px 22px;
  border-left: 2px solid var(--signal);
  background: var(--bg-elev);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.6;
  max-width: 64ch;
}
.page--article .scene.mode-D > blockquote {
  background: var(--bg-elev-D);
  border-left-color: var(--signal-D);
}
.page--article .scene > ul,
.page--article .scene > ol {
  font-size: 15px;
  line-height: 1.7;
  max-width: 64ch;
  margin: 0 0 18px;
  padding-left: 1.4em;
}
.page--article .scene > ul li,
.page--article .scene > ol li {
  margin-bottom: 6px;
}
.page--article .scene > p sup a,
.page--article .scene sup a {
  font-size: 11px;
  color: var(--signal);
  border-bottom: none;
  padding: 0 2px;
}
.page--article .scene.mode-D sup a { color: var(--signal-D); }

/* ---------------------------------------------------------------------
 * Chart figure (output of scripts/build-charts.js)
 * ------------------------------------------------------------------- */
.page--article .chart-figure {
  margin: 32px 0;
  max-width: 100%;
}
.page--article .chart-figure svg {
  width: 100%;
  height: auto;
  display: block;
}
.page--article .chart-figure .figcap {
  margin-top: 12px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-mute);
  max-width: 60ch;
}
.page--article .scene.mode-D .chart-figure .figcap {
  color: var(--text-mute-D);
}

/* ---------------------------------------------------------------------
 * Methodology + Sources (visible per v0.4 #20 / §13.7 — never modal)
 * ------------------------------------------------------------------- */
.page--article .endnote {
  background: var(--bg-elev);
  border-top: 1px solid var(--rule);
  padding: 80px 7vw;
}
.page--article .endnote__inner {
  max-width: 980px;
  margin: 0 auto;
}
.page--article .endnote h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}
.page--article .endnote h2 .num {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--text-soft);
  margin-right: 14px;
  vertical-align: middle;
}
.page--article .endnote .body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  max-width: 64ch;
}
.page--article .endnote .body p { margin: 0 0 16px; }
.page--article .endnote .body dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px 24px;
  margin-top: 12px;
  font-size: 14px;
}
.page--article .endnote .body dt {
  color: var(--text-soft);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
  padding-top: 4px;
}
.page--article .endnote .body dd { color: var(--text); margin: 0; }
.page--article .endnote ol.sources-list {
  list-style: none;
  counter-reset: src;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.7;
}
.page--article .endnote ol.sources-list li {
  counter-increment: src;
  padding: 14px 0 14px 56px;
  position: relative;
  border-bottom: 1px solid var(--rule-soft);
}
.page--article .endnote ol.sources-list li::before {
  content: "[" counter(src) "]";
  position: absolute;
  left: 0;
  top: 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--signal);
}
.page--article .endnote ol.sources-list a {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.page--article .endnote ol.sources-list a:hover {
  color: var(--signal);
  border-bottom-color: var(--signal);
}
.page--article .endnote .src-meta {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* ---------------------------------------------------------------------
 * Citation block
 * ------------------------------------------------------------------- */
.page--article .cite-block {
  background: var(--bg);
  padding: 64px 7vw;
  border-top: 1px solid var(--rule);
}
.page--article .cite-block__inner {
  max-width: 980px;
  margin: 0 auto;
}
.page--article .cite-block h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 18px;
}
.page--article .cite-block .quote {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  padding: 18px 22px;
  border-left: 2px solid var(--signal);
  background: var(--bg-elev);
  margin-bottom: 14px;
  max-width: 64ch;
}
.page--article .cite-block .note {
  font-size: 13px;
  color: var(--text-mute);
  max-width: 64ch;
  line-height: 1.6;
}
.page--article .cite-block .note a {
  color: var(--signal);
  border-bottom: 1px solid var(--signal);
  padding-bottom: 1px;
}

/* ---------------------------------------------------------------------
 * Related essays
 * ------------------------------------------------------------------- */
.page--article .related {
  background: var(--bg);
  padding: 80px 7vw;
  border-top: 1px solid var(--rule);
}
.page--article .related__inner {
  max-width: 1280px;
  margin: 0 auto;
}
.page--article .related h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 32px;
}
.page--article .related__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}
.page--article .related-card {
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.page--article .related-card .label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 14px;
}
.page--article .related-card .title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  line-height: 1.32;
  color: var(--text);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}
.page--article .related-card .dek {
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.6;
  margin: 0;
}
.page--article .related a {
  display: block;
  border-bottom: none;
}
.page--article .related a:hover .title { color: var(--signal); }

/* ---------------------------------------------------------------------
 * Mobile
 * ------------------------------------------------------------------- */
@media (max-width: 900px) {
  .page--article .scene { padding: 80px 6vw; }
  .page--article .key-claims-section .claims-head {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-bottom: 32px;
  }
  .page--article dl.key-claims { grid-template-columns: 1fr; }
  .page--article dl.key-claims .claim {
    padding: 28px 0;
    border-right: none;
    border-bottom: 1px solid var(--rule-D);
    min-height: auto;
  }
  .page--article dl.key-claims .claim:last-child { border-bottom: none; }
  .page--article .related__grid { grid-template-columns: 1fr; gap: 28px; }
  .page--article .endnote .body dl { grid-template-columns: 1fr; gap: 4px 0; }
}

/* ---------------------------------------------------------------------
 * prefers-reduced-motion safety net (CSS layer; JS layer in scene-mast.js)
 * ------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .page--article * {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
  .masthead { transition: none !important; }
}
