/* ============================================================
   theme/journal.css — Journal Editorial × Keynote Minimal (v2)
   白背景 + モノクロ基調。アクセント青はデータと小ラベルのみ。
   NEJM / Lancet の図版規範 × Duarte / Zen の大胆な余白と
   タイポコントラスト。docs/design-council.md の設計原則に従う。
   ============================================================ */

:root {
  /* ── 地と文字（無彩色） ── */
  --color-chrome: #e9edf1; /* デッキ外側のガター */
  --color-bg: #ffffff;
  --color-fg: #101418; /* インク（ほぼ黒） */
  --color-fg-secondary: #333c47;
  --color-muted: #5f6875;
  --color-border: #c3cad3; /* 静かな罫線 */
  --color-border-strong: #7d8794;
  --color-num: #5f6875;
  --color-card-bg: #f7f8fa; /* ごく淡いニュートラル */

  /* ── 差し色（データ・キー数値・小ラベル・フォーカスのみ） ── */
  --color-accent: #1a5fb4;
  --color-accent-soft: rgba(26, 95, 180, 0.08);
  --color-accent-line: rgba(26, 95, 180, 0.25);

  /* ── 臨床セマンティック色（慣習色・据え置き） ── */
  --c-good: #047857; /* 低リスク / 強み / for */
  --c-warn: #b45309; /* some concerns */
  --c-bad: #b91c1c; /* 高リスク / 限界 / 異常値 */

  /* ── 書体 ── */
  --font-sans:
    "Avenir Next", "Helvetica Neue", "Arial", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Noto Sans JP", sans-serif;
  --font-mono: "SF Mono", "Consolas", "Menlo", monospace;

  --text-xs: 0.875rem;
  --text-sm: 1.125rem;
  --text-base: 1.125rem;
  --text-lg: 1.5rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.5rem;
  --text-3xl: 3.5rem;
  --text-4xl: 5rem;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-bold: 700;

  --sp-xs: 0.5rem;
  --sp-sm: 1rem;
  --sp-md: 1.5rem;
  --sp-lg: 2.5rem;
  --sp-xl: 4rem;

  --radius: 3px;
  --radius-lg: 4px;
  --border: 1px solid var(--color-border);

  /* ── エンジンUI（ナビ・カウンタ）：白テーマ用 ── */
  --ui-fg: #4c5562;
  --ui-fg-hover: #101418;
  --ui-bg: #f7f8fa;
  --ui-bg-hover: #e4e9ef;
  --ui-border: #778391;
}

/* Data-driven medical charts（チャートの青はデータなので維持） */
.chart-host {
  width: 100%;
  min-height: 240px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-host > svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
}
.chart-axis-label {
  font-size: 18px;
  font-weight: 600;
  fill: var(--color-muted);
}
.medical-chart text,
.chart-host text {
  font-family: var(--font-sans);
  fill: var(--color-fg);
}
.chart-axis,
.chart-null {
  stroke: #4c5562;
  stroke-width: 2;
}
.chart-null {
  stroke-dasharray: 6 5;
}
.chart-reference {
  stroke: #687383;
  stroke-width: 2;
  stroke-dasharray: 7 5;
}
.chart-ci {
  stroke: #101418;
  stroke-width: 3;
}
.chart-point,
.chart-bar {
  fill: var(--color-accent);
}
.chart-bar-negative {
  fill: #8a4b55;
}
.chart-series {
  stroke: var(--color-accent);
  stroke-width: 4;
}
.chart-censor {
  stroke-width: 2;
}
.chart-label {
  font-size: 20px;
  font-weight: 600;
}
.chart-value {
  font-size: 18px;
  text-anchor: start;
}
.chart-tick {
  font-size: 18px;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
/* Safety banner: full-width top strip — never a floating corner sticker */
.synthetic-marker {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  max-width: none;
  margin: 0;
  padding: 5px 20px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card-bg);
  color: var(--color-muted);
  font: 600 12px/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-align: center;
}
.slide:has(> .synthetic-marker),
.slide:has(.synthetic-marker) {
  padding-top: calc(var(--sp-xl) + 18px);
}
.source-note {
  margin-top: auto;
  font-size: 14px !important;
  color: var(--color-muted);
}
/* Title / landing: do not pin source to the floor — it was collapsing the composition upward */
.slide-title .source-note,
.slide-landing .source-note,
.slide-end .source-note {
  margin-top: var(--sp-md);
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:lang(ja) {
  text-wrap: pretty;
  word-break: auto-phrase;
}
:lang(en) {
  overflow-wrap: break-word;
  hyphens: manual;
}

.slide {
  font-feature-settings: "palt" 1;
}

/* ── 見出し（大胆な大小コントラスト。主張が遠くから読める） ── */
.slide h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--color-fg);
}
.slide h2 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--color-fg);
}
.slide h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  line-height: 1.3;
  color: var(--color-fg);
}
.slide p {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--color-muted);
}

/* Projection floor: 24px narrative text; 18px is reserved for dense data,
   flow labels, citations, and compact metadata. Never shrink to solve overflow. */
.slide p:not(.source-note),
.slide li {
  font-size: max(18px, 1em) !important;
}
.slide table th,
.slide table td,
.slide h4,
.slide .participant-flow-box,
.slide .flow-phase,
.slide .review-flow-box,
.slide .bib-journal,
.slide .bib-meta-item,
.slide .bib-meta-label,
.slide .review-state {
  font-size: max(18px, 1em) !important;
}

/* Catch legacy inline sizes across semantic leaf text. The exclusions are
   metadata or CSS-drawn connectors with hidden glyph fallbacks. */
.slide
  :where(div, span, p, li, td, th, h3, h4, strong, small):not(
    .synthetic-marker
  ):not(.slide-footer):not(.footer-left):not(.footer-right):not(
    .template-label
  ):not(.source-note):not(.slide-page-num):not(.sr-only):not(.flow-arrow):not(
    .flow-v-arrow
  ):not(.arrow):not(.flow-side-connector):not(.flow-down-connector):not(
    .review-flow-connector
  ) {
  font-size: max(18px, 1em) !important;
}
.slide svg text {
  font-size: max(18px, 1em) !important;
}

/* 数値は等幅桁で揃える（臨床データの可読性） */
.stat .number,
.kpi-value,
.vital-value,
.forest-hr,
.review-flow-box .num,
table td,
.data-table td {
  font-variant-numeric: tabular-nums;
}

/* ── タイトルスライド（Keynote 流：短いインクバー + 巨大タイトル + 呼吸する下部余白） ── */
.slide-title {
  justify-content: center;
  gap: var(--sp-md);
  padding-bottom: calc(var(--sp-xl) + 16px);
}
.slide-title::before {
  content: "";
  width: 64px;
  height: 4px;
  background: var(--color-fg);
  margin-bottom: var(--sp-sm);
  flex-shrink: 0;
}
.slide-title .label {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  color: var(--color-accent);
  text-transform: uppercase;
}
.slide-title h1 {
  max-width: 1024px;
}
.slide-title .sub {
  font-size: var(--text-lg);
  color: var(--color-muted);
  max-width: 680px;
  line-height: 1.6;
}

/* ── コンテンツスライド（見出し固定・本文は残高を使って垂直バランス） ── */
.slide-content {
  gap: var(--sp-md);
}
.slide-content .body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  flex: 1;
  min-height: 0;
  justify-content: flex-start;
}
.slide-content .body > h2 {
  flex-shrink: 0;
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--color-border);
}
/* Primary content fills remaining height and centers within it */
.slide-content .body > .matrix-2x2,
.slide-content .body > .cols-2,
.slide-content .body > .cols-3,
.slide-content .body > .effect-panel,
.slide-content .body > .choice-list,
.slide-content .body > .chart-host,
.slide-content .body > .flow,
.slide-content .body > .flow-vertical,
.slide-content .body > .vital-grid,
.slide-content .body > .pico-grid {
  flex: 1 1 auto;
  min-height: 0;
  align-self: stretch;
}
.slide-content .body > table {
  flex: 0 1 auto;
  margin-block: auto;
  width: 100%;
}
.slide-content .body > .cols-2,
.slide-content .body > .cols-3,
.slide-content .body > .effect-panel {
  align-items: center;
}

/* ── ランディング（大命題。インクの太線で宣言する） ── */
.slide-landing {
  justify-content: center;
  align-items: flex-start;
}
.slide-landing::before {
  content: "";
  width: 64px;
  height: 4px;
  background: var(--color-fg);
  margin-bottom: var(--sp-md);
  flex-shrink: 0;
}
.slide-landing h2 {
  font-size: var(--text-3xl);
  max-width: 980px;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

/* ── 終了スライド ── */
.slide-end {
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: var(--sp-md);
}
.slide-end .mark {
  width: 48px;
  height: 3px;
  background: var(--color-fg);
  margin: 0 auto;
}

/* ── セクション区切り（インクの太線 + 巨大タイポのみ） ── */
.slide-section {
  justify-content: center;
  gap: var(--sp-sm);
  background: var(--color-bg);
}
.slide-section::before {
  content: "";
  width: 64px;
  height: 4px;
  background: var(--color-fg);
  margin-bottom: var(--sp-md);
  flex-shrink: 0;
}
.slide-section h2 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-fg);
  letter-spacing: -0.02em;
}
.slide-section p {
  font-size: var(--text-lg);
  color: var(--color-muted);
  max-width: 680px;
}

/* ── ユーティリティ ── */
.accent {
  color: var(--color-accent);
}
.muted {
  color: var(--color-muted);
}
.mono {
  font-family: var(--font-mono);
}
.bold {
  font-weight: var(--weight-bold);
}
.divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
}
.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
}
.cols-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-lg);
  margin-block: auto;
}

.list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  list-style: none;
}
.list li {
  display: flex;
  align-items: baseline;
  gap: var(--sp-sm);
  font-size: var(--text-lg);
  color: var(--color-fg-secondary);
  line-height: 1.6;
}
.list li::before {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-fg);
  margin-top: 0.55em;
}

.card {
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--sp-lg) var(--sp-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-sm);
  min-height: 140px;
}
.card h3 {
  font-size: var(--text-lg);
  color: var(--color-fg);
}
.cols-3 > .card h3 {
  color: var(--color-accent);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: var(--text-sm);
}
.card p {
  font-size: var(--text-lg);
  color: var(--color-fg);
  line-height: 1.45;
}

/* ── フロー（横型・SVG調コネクタ） ── */
.flow {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.flow-step {
  flex: 1;
  min-height: 120px;
  text-align: center;
  padding: var(--sp-md);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.flow-step h3 {
  font-size: var(--text-lg);
}
.flow-step p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.flow-arrow {
  flex-shrink: 0;
  width: 44px;
  align-self: center;
  height: 1.5px;
  background: var(--color-border-strong);
  position: relative;
  font-size: 0;
}
.flow-arrow::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid var(--color-border-strong);
  border-right: 1.5px solid var(--color-border-strong);
  transform: translateY(-50%) rotate(45deg);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  min-height: 160px;
}
.stat .number {
  font-size: clamp(4.5rem, 8vw, 6.5rem);
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.stat .label {
  font-size: var(--text-base);
  color: var(--color-muted);
  letter-spacing: 0.04em;
}

/* Effect estimate panel: big NNT + structured RR/CI card */
.effect-panel {
  display: grid;
  grid-template-columns: 0.9fr 1.2fr;
  gap: var(--sp-lg);
  width: 100%;
  max-width: 980px;
  margin-inline: auto;
  padding: var(--sp-md) 0;
}
.effect-panel .card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-sm);
  padding: var(--sp-lg);
  border: 1px solid var(--color-border);
  background: var(--color-card-bg);
  min-height: 200px;
}
.effect-panel .card h3 {
  font-size: var(--text-2xl);
  color: var(--color-fg);
}
.effect-panel .card p {
  font-size: var(--text-lg) !important;
  color: var(--color-fg-secondary);
}
.effect-panel .card .callout {
  margin-top: var(--sp-xs);
  font-weight: var(--weight-bold);
  color: var(--c-warn);
}

/* Numeric table columns (baseline / outcomes) */
.slide table.numeric td:not(:first-child),
.slide table.numeric th:not(:first-child),
.slide table[data-numeric] td:not(:first-child),
.slide table[data-numeric] th:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.slide table caption {
  caption-side: top;
  text-align: left;
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--sp-sm);
}

.slide-logo {
  position: absolute;
  bottom: var(--sp-xl);
  left: var(--sp-xl);
  height: 20px;
  opacity: 0.4;
  pointer-events: none;
}
.slide-title .slide-logo {
  top: var(--sp-xl);
  right: var(--sp-xl);
  bottom: auto;
  left: auto;
  height: 24px;
  opacity: 0.5;
}

.img-box {
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  border: var(--border);
}
.img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.text-img {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
  flex: 1;
  align-items: center;
}
.text-img .text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-fg-secondary);
  border: 1px solid var(--color-border-strong);
  border-radius: 2px;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.05em;
}

/* ── 背景クラスは no-op（白地厳守。装飾を載せない） ── */
.bg-mesh,
.bg-dots,
.bg-gradient,
.bg-noise,
.bg-corner {
  background: var(--color-bg);
}
.bg-noise::after,
.bg-corner::before {
  content: none;
}

/* ============================================================
   リッチメディア
   ============================================================ */
.video-box {
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  background: #000;
}
.video-box video,
.video-box iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: none;
}
.video-box.contain video,
.video-box.contain iframe {
  object-fit: contain;
}
.slide-media {
  padding: 0 !important;
}
.slide-media .video-box,
.slide-media .img-box {
  border-radius: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.img-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-sm);
  flex: 1;
}
.img-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-sm);
  flex: 1;
}
.img-grid-2 .img-box,
.img-grid-3 .img-box {
  aspect-ratio: 16/9;
  flex: none;
}
.text-video {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
  flex: 1;
  align-items: center;
}
.text-video .text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.fig {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  flex: 1;
}
.fig .img-box {
  flex: 1;
}
.fig figcaption {
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-align: center;
}

/* ============================================================
   表（厳密な booktabs：上太線・ヘッダー下・下太線の3本のみ）
   ============================================================ */
.slide table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
  border-top: 2px solid var(--color-fg);
  border-bottom: 2px solid var(--color-fg);
}
.slide table th {
  text-align: left;
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  color: var(--color-fg);
  padding: var(--sp-xs) var(--sp-sm);
  border-bottom: 1px solid var(--color-fg);
  letter-spacing: 0.02em;
}
.slide table td {
  padding: 10px var(--sp-sm);
  border-bottom: none;
  color: var(--color-fg-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* ── タイムライン（縦・●を線の中心に正確に乗せる） ── */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  padding-left: 2.5rem;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.55em;
  bottom: 0.55em;
  width: 2px;
  background: var(--color-border-strong);
  border-radius: 1px;
}
.timeline-item {
  position: relative;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(7px - 2.5rem);
  top: 0.5em;
  width: 11px;
  height: 11px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--color-fg);
  box-shadow: 0 0 0 3px var(--color-bg);
}
.timeline-item h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-xs);
}
.timeline-item p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ── 2x2 マトリクス（PICO等：セル中央寄せ・主張サイズ） ── */
.matrix-2x2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1px;
  flex: 1;
  background: var(--color-border);
  border: 1px solid var(--color-border);
}
.matrix-2x2 > div {
  background: var(--color-bg);
  padding: var(--sp-lg) var(--sp-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-sm);
}
.matrix-2x2 > div h3 {
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: var(--weight-bold);
}
.matrix-2x2 > div p {
  font-size: var(--text-xl) !important;
  font-weight: var(--weight-medium);
  color: var(--color-fg);
  line-height: 1.45;
}
.matrix-label-x,
.matrix-label-y {
  font-size: var(--text-xs);
  color: var(--color-muted);
  text-align: center;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ── サイクル図 ── */
.cycle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.cycle-step {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--color-fg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-sm);
  background: var(--color-card-bg);
}
.cycle-step h3 {
  font-size: var(--text-base);
  margin-bottom: 2px;
}
.cycle-step p {
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.cycle-arrow {
  font-size: var(--text-xl);
  color: var(--color-fg);
  padding: 0 var(--sp-xs);
}

/* ── 引用・コールアウト ── */
.callout {
  padding: var(--sp-md) var(--sp-lg);
  background: var(--color-card-bg);
  border-top: 1px solid var(--color-fg);
}
.callout p {
  font-size: var(--text-xl);
  color: var(--color-fg);
  line-height: 1.6;
}
.callout .attribution {
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-top: var(--sp-sm);
}
.blockquote {
  font-size: var(--text-2xl);
  line-height: 1.4;
  color: var(--color-fg);
  max-width: 900px;
  position: relative;
  padding-left: var(--sp-lg);
}
.blockquote::before {
  content: "\201C";
  position: absolute;
  left: 0;
  top: -0.2em;
  font-size: var(--text-4xl);
  color: var(--color-border-strong);
  line-height: 1;
}

/* ── アイコン付きリスト ── */
.icon-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  list-style: none;
}
.icon-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-md);
  font-size: var(--text-lg);
  color: var(--color-fg-secondary);
  line-height: 1.5;
}
.icon-list .icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  color: var(--color-fg);
}

/* ── ピラミッド（キャンバスを充たすよう大きめに） ── */
.pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  justify-content: center;
}
.pyramid-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-md) var(--sp-lg);
  min-height: 86px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  color: var(--color-fg);
}
.pyramid-level:nth-child(1) {
  width: 46%;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 2px solid var(--color-fg);
}
.pyramid-level:nth-child(2) {
  width: 70%;
}
.pyramid-level:nth-child(3) {
  width: 94%;
  border-radius: 0 0 var(--radius) var(--radius);
}
.pyramid-level h3 {
  font-size: var(--text-lg);
}
.pyramid-level p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ── Before/After ── */
.before-after {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}
.before-after .before,
.before-after .after {
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.before-after .before {
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius) 0 0 var(--radius);
}
.before-after .after {
  background: var(--color-card-bg);
  border: 1.5px solid var(--color-fg);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.before-after .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-fg);
  padding: 0 var(--sp-sm);
  position: relative;
  width: 40px;
  font-size: 0;
}
.before-after .arrow::after {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--color-fg);
  border-right: 2px solid var(--color-fg);
  transform: rotate(45deg);
}

/* ── ステップカード ── */
.step-cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  counter-reset: step-card;
}
.step-card {
  counter-increment: step-card;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius);
}
.step-card::before {
  content: counter(step-card, decimal-zero);
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-fg);
  line-height: 1;
  flex-shrink: 0;
  min-width: 2em;
}
.step-card h3 {
  font-size: var(--text-lg);
}
.step-card p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ============================================================
   図解ユーティリティ
   ============================================================ */
.venn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}
.venn-circle {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 2px solid var(--color-fg);
  background: var(--color-card-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-sm);
}
.venn-circle:nth-of-type(1) {
  transform: translateX(-70px);
}
.venn-circle:nth-of-type(2) {
  transform: translateX(70px);
}
.venn-circle:nth-of-type(3) {
  transform: translateY(-60px);
}
.venn-circle h3 {
  font-size: var(--text-base);
}
.venn-circle p {
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.venn-center {
  position: absolute;
  z-index: 2;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-fg);
}

.radial {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}
.radial-center {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--color-fg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  z-index: 2;
}
.radial-item {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid var(--color-fg);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-xs);
}
.radial-item h4 {
  font-size: var(--text-sm);
}
.radial-line {
  position: absolute;
  height: 2px;
  background: var(--color-border);
  transform-origin: left center;
  z-index: 1;
}

/* ── ツリー図 ── */
.tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  justify-content: center;
}
.tree-root {
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--color-fg);
  color: #fff;
  border-radius: var(--radius-lg);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  text-align: center;
  position: relative;
  z-index: 2;
}
.tree-connector {
  width: 2px;
  height: 28px;
  background: var(--color-border-strong);
  flex-shrink: 0;
}
.tree-level {
  display: flex;
  gap: var(--sp-lg);
  position: relative;
  padding-top: 28px;
}
.tree-level::before {
  content: "";
  position: absolute;
  top: 0;
  height: 2px;
  background: var(--color-border-strong);
  left: var(--tree-line-left, 25%);
  right: var(--tree-line-right, 25%);
}
.tree-node {
  flex: 1;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  min-width: 140px;
}
.tree-node::before {
  content: "";
  position: absolute;
  top: -28px;
  left: 50%;
  width: 2px;
  height: 28px;
  background: var(--color-border-strong);
}
.tree-node h4 {
  font-size: var(--text-base);
  margin-bottom: 4px;
}
.tree-node p {
  font-size: var(--text-xs);
  color: var(--color-muted);
  line-height: 1.4;
}
.tree-node .tree-leaves {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  margin-top: var(--sp-xs);
  justify-content: center;
}
.tree-leaf {
  padding: 3px 10px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: var(--text-xs);
  color: var(--color-fg-secondary);
}

/* ── フロー（縦型・SVG調コネクタ） ── */
.flow-vertical {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.flow-v-step {
  width: 80%;
  max-width: 500px;
  padding: var(--sp-md);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.flow-v-step h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-xs);
}
.flow-v-step p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.flow-v-arrow {
  width: 1.5px;
  height: 28px;
  background: var(--color-border-strong);
  position: relative;
  font-size: 0;
}
.flow-v-arrow::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--color-border-strong);
  border-bottom: 1.5px solid var(--color-border-strong);
  transform: translateX(-50%) rotate(45deg);
}

/* ── ランキング ── */
.ranking {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  counter-reset: rank;
}
.ranking-item {
  counter-increment: rank;
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius);
}
.ranking-item::before {
  content: counter(rank);
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-fg);
  min-width: 2em;
  text-align: center;
  flex-shrink: 0;
}
.ranking-item:first-child {
  background: var(--color-card-bg);
  border: 1px solid var(--color-fg);
}
.ranking-item h3 {
  font-size: var(--text-lg);
}
.ranking-item p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ── 比較図 ── */
.comparison {
  display: grid;
  gap: 1px;
  background: var(--color-border);
  border: 1px solid var(--color-border);
}
.comparison.cols-2 {
  grid-template-columns: 1fr 1fr;
}
.comparison.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.comparison-header {
  background: var(--color-fg);
  color: #fff;
  padding: var(--sp-sm) var(--sp-md);
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  text-align: center;
}
.comparison-cell {
  background: var(--color-bg);
  padding: var(--sp-sm) var(--sp-md);
  font-size: var(--text-sm);
  color: var(--color-fg-secondary);
}

/* ── 階段 ── */
.stairs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding-top: var(--sp-lg);
}
.stair {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  padding: var(--sp-sm) var(--sp-xs);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}
.stair:nth-child(1) {
  min-height: 30%;
}
.stair:nth-child(2) {
  min-height: 45%;
}
.stair:nth-child(3) {
  min-height: 60%;
}
.stair:nth-child(4) {
  min-height: 75%;
}
.stair:nth-child(5) {
  min-height: 90%;
}
.stair h4 {
  font-size: var(--text-sm);
  margin-bottom: var(--sp-xs);
}
.stair p {
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.stair:last-child {
  background: var(--color-fg);
  color: #fff;
  border-color: var(--color-fg);
}
.stair:last-child h4,
.stair:last-child p {
  color: #fff;
}

/* ── ガント ── */
.gantt {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}
.gantt-header {
  display: grid;
  gap: 1px;
  font-size: var(--text-xs);
  color: var(--color-muted);
  text-align: center;
  font-family: var(--font-mono);
  padding-left: 156px;
}
.gantt-row {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 34px;
}
.gantt-label {
  width: 156px;
  flex-shrink: 0;
  font-size: var(--text-sm);
  line-height: 1.2;
  font-weight: var(--weight-bold);
  color: var(--color-fg);
  padding-right: var(--sp-sm);
  text-align: right;
}
.gantt-bar-area {
  flex: 1;
  position: relative;
  height: 100%;
  background: var(--color-card-bg);
  border-radius: var(--radius);
}
.gantt-bar {
  position: absolute;
  height: 24px;
  top: 4px;
  background: var(--color-fg);
  border-radius: var(--radius);
  opacity: 0.85;
}

/* ── 箇条書き（横並び） ── */
.bullets-horizontal {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-md);
}
.bullet-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  padding: var(--sp-md);
  border-top: 2px solid var(--color-fg);
}
.bullet-item h3 {
  font-size: var(--text-lg);
}
.bullet-item p {
  font-size: var(--text-sm);
  color: var(--color-muted);
  line-height: 1.6;
}

.bullets-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  align-content: flex-start;
}
.bullets-tags .tag {
  font-size: var(--text-sm);
  padding: var(--sp-xs) var(--sp-sm);
}

/* ── グループ図 ── */
.group-small {
  display: flex;
  gap: var(--sp-lg);
  align-items: stretch;
}
.group-box {
  flex: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--sp-md);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.group-box h3 {
  font-size: var(--text-lg);
  color: var(--color-fg);
  padding-bottom: var(--sp-xs);
  border-bottom: 1px solid var(--color-border);
}
.group-box .list {
  gap: var(--sp-xs);
}
.group-box .list li {
  font-size: var(--text-sm);
}

/* ── 規模比較（バブル） ── */
.scale-compare {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--sp-lg);
  padding-bottom: var(--sp-md);
}
.scale-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xs);
}
.scale-bubble-circle {
  border-radius: 50%;
  background: var(--color-fg);
  opacity: 0.1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scale-bubble-circle span {
  font-weight: var(--weight-bold);
  color: var(--color-fg);
  opacity: 1;
}
.scale-bubble p {
  font-size: var(--text-sm);
  color: var(--color-muted);
  text-align: center;
}

/* ── レイヤー ── */
.layers {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.layer {
  display: flex;
  align-items: center;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--color-card-bg);
  gap: var(--sp-md);
}
.layer:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--color-fg);
  color: #fff;
}
.layer:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
}
.layer:first-child h3,
.layer:first-child p {
  color: #fff;
}
.layer h3 {
  font-size: var(--text-lg);
  min-width: 120px;
}
.layer p {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* ── アイコンチャート ── */
.icon-chart {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}
.icon-chart-row {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}
.icon-chart-label {
  min-width: 100px;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-fg);
  text-align: right;
}
.icon-chart-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.icon-chart-icons .icon-unit {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background: var(--color-fg);
}
.icon-chart-icons .icon-unit.inactive {
  background: var(--color-border);
}

/* ── ファネル ── */
.funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  justify-content: center;
}
.funnel-level {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--color-card-bg);
  color: var(--color-fg);
}
.funnel-level:nth-child(1) {
  width: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--color-fg);
  color: #fff;
}
.funnel-level:nth-child(2) {
  width: 80%;
}
.funnel-level:nth-child(3) {
  width: 60%;
}
.funnel-level:nth-child(4) {
  width: 40%;
  border-radius: 0 0 var(--radius) var(--radius);
}
.funnel-level h3 {
  font-size: var(--text-base);
}
.funnel-level p {
  font-size: var(--text-xs);
  color: var(--color-muted);
  margin-left: var(--sp-sm);
}
.funnel-level:first-child p {
  color: rgba(255, 255, 255, 0.75);
}

/* ── トライアングル ── */
.triangle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
}
.triangle-top,
.triangle-bottom {
  display: flex;
  justify-content: center;
}
.triangle-bottom {
  gap: var(--sp-xl);
}
.triangle-node {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 2px solid var(--color-fg);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-sm);
}
.triangle-node h4 {
  font-size: var(--text-lg);
}
.triangle-node p {
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.triangle-edges {
  text-align: center;
  color: var(--color-fg);
  font-size: var(--text-sm);
  opacity: 0.5;
}

/* ── 相関図 ── */
.relation {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-lg);
  min-height: 200px;
}
.relation-node {
  padding: var(--sp-md) var(--sp-lg);
  background: var(--color-card-bg);
  border: 2px solid var(--color-fg);
  border-radius: var(--radius);
  text-align: center;
  min-width: 140px;
  z-index: 2;
}
.relation-node h4 {
  font-size: var(--text-lg);
}
.relation-node p {
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.relation-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--color-fg);
  font-size: var(--text-sm);
}
.relation-arrow .arrow {
  font-size: var(--text-xl);
}
.relation-arrow .label {
  font-size: var(--text-xs);
  color: var(--color-muted);
}

/* ── プログレスバー ── */
.progress-bars {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}
.progress-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}
.progress-item .progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-fg);
}
.progress-item .progress-label span {
  color: var(--color-fg);
}
.progress-track {
  height: 12px;
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-fg);
  border-radius: 6px;
}

/* ── チェックリスト ── */
.checklist {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  list-style: none;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  font-size: var(--text-lg);
  color: var(--color-fg-secondary);
  line-height: 1.6;
}
.checklist li::before {
  content: "☐";
  flex-shrink: 0;
  font-size: var(--text-xl);
  color: var(--color-fg);
  line-height: 1.3;
}
.checklist li.checked::before {
  content: "☑";
}
.checklist li.checked {
  color: var(--color-muted);
}

/* ── KPI ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-md);
}
.kpi-card {
  padding: var(--sp-md);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}
.kpi-card .kpi-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  color: var(--color-fg);
  line-height: 1;
  letter-spacing: -0.02em;
}
.kpi-card .kpi-label {
  font-size: var(--text-sm);
  color: var(--color-muted);
}
.kpi-card .kpi-change {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}
.kpi-card .kpi-change.up {
  color: var(--c-good);
}
.kpi-card .kpi-change.down {
  color: var(--c-bad);
}

/* ── データテーブル（booktabs 拡張：帯なし・ストライプなし） ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  border-top: 2px solid var(--color-fg);
  border-bottom: 2px solid var(--color-fg);
}
.data-table th {
  background: none;
  color: var(--color-fg);
  padding: var(--sp-sm) var(--sp-md);
  text-align: left;
  font-weight: var(--weight-bold);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-fg);
}
.data-table td {
  padding: var(--sp-sm) var(--sp-md);
  color: var(--color-fg-secondary);
}
.data-table tr.highlight td {
  background: var(--color-accent-soft);
  font-weight: var(--weight-bold);
}

/* ── 数式 ── */
.formula-box {
  padding: var(--sp-lg);
  background: var(--color-card-bg);
  border: var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-size: var(--text-2xl);
}

/* ── ハニカム ── */
.honeycomb {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
}
.hex {
  width: 120px;
  height: 104px;
  background: var(--color-card-bg);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-sm);
}
.hex h4 {
  font-size: var(--text-sm);
}
.hex p {
  font-size: var(--text-xs);
  color: var(--color-muted);
}
.hex.accent {
  background: var(--color-fg);
  color: #fff;
}
.hex.accent h4,
.hex.accent p {
  color: #fff;
}

/* ── 汎用 縦コネクタ（アルゴリズム・フロー図の罫線矢印） ── */
.algo-arrow {
  position: relative;
  width: 1.5px;
  height: 22px;
  margin: 0 auto;
  flex-shrink: 0;
  font-size: 0;
}
.algo-arrow::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 6px;
  width: 1.5px;
  background: var(--color-border-strong);
}
.algo-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--color-border-strong);
  border-bottom: 1.5px solid var(--color-border-strong);
  transform: translateX(-50%) rotate(45deg);
}
