/* Article-style homepage (index-b.html): long-form research narrative with figures. */

.article { --col: 720px; --wide: 1100px; --panel: #f2f5f7; }
.col, .wide { width: 100%; margin-inline: auto; padding-inline: var(--gutter); }
.col { max-width: calc(var(--col) + 2 * var(--gutter)); }
.wide { max-width: calc(var(--wide) + 2 * var(--gutter)); }

/* ---------- Title block ---------- */
.a-head { padding-top: clamp(48px, 7vw, 104px); }
.a-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 15px; color: var(--muted); }
.a-meta .tag { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #e6f1f7; color: #0f5b88; font-weight: 600; font-size: 14px; }
.a-head h1 { margin-top: 22px; font: 600 clamp(38px, 5.2vw, 70px)/1.04 var(--sans); letter-spacing: -.035em; color: var(--ink); max-width: 17ch; }
.a-head .standfirst { margin-top: 26px; font: clamp(19px, 1.6vw, 23px)/1.5 var(--sans); color: var(--ink-soft); max-width: 46ch; }
.a-head .byline { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 15px; color: var(--muted); }
.a-head .byline b { color: var(--ink); font-weight: 600; }

.a-hero { margin-top: clamp(36px, 5vw, 64px); }
.a-hero img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; object-position: 50% 55%; border-radius: 22px; }
.a-hero figcaption, .fig-cap { margin-top: 14px; font-size: 15px; line-height: 1.5; color: var(--muted); }

/* ---------- Stats strip ---------- */
.a-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-block: clamp(48px, 6vw, 80px); border-block: 1px solid var(--line); }
.a-stats div { padding: 26px clamp(12px, 2vw, 28px); }
.a-stats div + div { border-left: 1px solid var(--line); }
.a-stats b { display: block; font: 600 clamp(30px, 3.6vw, 52px)/1 var(--sans); letter-spacing: -.035em; color: #0d4268; font-variant-numeric: tabular-nums; }
.a-stats span { display: block; margin-top: 10px; font-size: 15px; line-height: 1.4; color: var(--ink-soft); }

/* ---------- Body text ---------- */
.prose { font-size: 19px; line-height: 1.7; color: #243a4c; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: clamp(56px, 7vw, 96px); font: 600 clamp(28px, 2.8vw, 38px)/1.15 var(--sans); letter-spacing: -.025em; color: var(--ink); }
.prose h2 + p { margin-top: 18px; }
.prose ul { padding-left: 1.2em; }
.prose li + li { margin-top: .5em; }
.prose strong { color: var(--ink); }
.prose a { font-weight: 600; }

/* ---------- Figures ---------- */
.fig { margin-block: clamp(36px, 4.5vw, 60px); }
.fig-panel { background: var(--panel); border-radius: 22px; padding: clamp(20px, 3.6vw, 48px); }
.fig-title { font: 600 clamp(19px, 1.5vw, 22px)/1.3 var(--sans); color: var(--ink); margin-bottom: 6px; }
.fig-sub { font-size: 15.5px; color: var(--muted); margin-bottom: 24px; max-width: 70ch; }
.fig-cap b { color: var(--ink); font-weight: 600; }
.fig-cap { max-width: var(--col); }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2vw, 28px); }
.fig-pair .fig-panel { display: flex; flex-direction: column; }
.big-stat { font: 600 clamp(44px, 5vw, 68px)/1 var(--sans); letter-spacing: -.04em; color: #0d4268; margin: 4px 0 6px; }
.big-stat + p { color: var(--ink-soft); font-size: 15.5px; margin-bottom: 22px; }
.fig-pair .chart-data { margin-top: auto; }

/* System diagram */
.lanes { display: grid; gap: 30px; }
.lane-title { font: 600 14px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.flow { list-style: none; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 26px; }
.flow li { position: relative; background: #fff; border: 1px solid #cfdbe4; border-radius: 14px; padding: 16px 16px 14px; }
.flow li + li::before { content: ""; position: absolute; left: -22px; top: 50%; width: 18px; height: 2px; background: #9fb6c6; }
.flow li + li::after { content: ""; position: absolute; left: -9px; top: calc(50% - 4px); border: 5px solid transparent; border-left: 6px solid #9fb6c6; }
.flow .kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.flow .kind::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--k, #257de0); }
.flow .agent { --k: #257de0; }
.flow .software { --k: #00a383; }
.flow .store { --k: #e8631f; }
.flow li.is-software { border-style: dashed; border-color: #00a383; }
.flow li.is-store { background: #fff8f3; border-color: #f0c4a8; }
.flow h4 { margin: 8px 0 4px; font: 600 16.5px/1.25 var(--sans); color: var(--ink); }
.flow p { font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.flow .num { display: block; margin-top: 8px; font: 600 15px/1.2 var(--sans); color: #0d4268; font-variant-numeric: tabular-nums; }
.lane-link { display: flex; justify-content: center; }
.lane-link span { font-size: 13.5px; color: var(--muted); padding: 4px 12px; border: 1px dashed #9fb6c6; border-radius: 999px; background: #fff; }
.diagram-key { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 24px; font-size: 14px; color: var(--ink-soft); }
.diagram-key span { display: inline-flex; align-items: center; gap: 8px; }
.diagram-key i { width: 18px; height: 12px; border-radius: 3px; border: 1.5px solid #cfdbe4; background: #fff; }
.diagram-key i.sw { border: 1.5px dashed #00a383; }
.diagram-key i.st { background: #fff8f3; border-color: #f0c4a8; }

/* Charts */
.chart-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 14px; font-size: 14.5px; color: var(--ink-soft); }
.chart-legend li::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: var(--c); margin-right: 8px; vertical-align: -1px; }
.chart-legend.compact { margin: 10px 0 0; font-size: 14px; }
.hbar { list-style: none; padding: 0; }
.hbar li { display: grid; grid-template-columns: minmax(150px, 17rem) minmax(0, 1fr) 6.5rem; gap: 16px; align-items: center; padding: 9px 8px; border-radius: 8px; outline: none; }
.hbar li:hover, .hbar li:focus-visible { background: #fff; box-shadow: 0 0 0 1px #d5e0e8; }
.hbar-label { font-size: 15.5px; line-height: 1.3; color: var(--ink); }
.hbar-track { height: 14px; background: #e1e8ee; border-radius: 0 4px 4px 0; }
.hbar-fill { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font: 600 16px/1.2 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.hbar-value small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }

.stack { display: flex; gap: 2px; height: 44px; border-radius: 6px; overflow: hidden; }
.stack-seg { position: relative; min-width: 3px; display: flex; align-items: center; justify-content: center; outline: none; transition: filter .15s; }
.stack-seg:hover, .stack-seg:focus-visible { filter: brightness(1.08) saturate(1.1); box-shadow: inset 0 0 0 2px #fff; }
.stack-in { font: 600 14px/1 var(--sans); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); pointer-events: none; }
.stack-seg.is-light .stack-in { color: #17324a; text-shadow: none; }
.stack-key { list-style: none; padding: 0; margin-top: 18px; display: grid; gap: 2px; }
.stack-key li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto 4.2rem; gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid #dfe7ed; font-size: 15.5px; }
.stack-key li:last-child { border-bottom: 0; }
.stack-key li::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.stack-key .k-label { color: var(--ink); }
.stack-key .k-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.stack-key .k-share { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.stack-rows { display: grid; gap: 30px; }
.stack-row-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.stack-row-title { font-weight: 600; color: var(--ink); }
.stack-row-n { color: var(--muted); font-size: 14.5px; }
.stack-rows .stack { height: 34px; }

.chart-data { margin-top: 22px; font-size: 14.5px; }
.chart-data summary { cursor: pointer; color: var(--link); font-weight: 600; width: fit-content; }
.chart-data table { margin-top: 12px; width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
.chart-data th, .chart-data td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #e3eaef; }
.chart-data td { text-align: right; font-variant-numeric: tabular-nums; }
.chart-data tr:first-child th { background: #e9f0f4; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.chart-data tr:first-child th:not(:first-child) { text-align: right; }

.chart-tip { position: fixed; z-index: 60; max-width: 280px; padding: 10px 12px; background: #0f2b42; color: #e8f1f7; border-radius: 8px; font-size: 14px; line-height: 1.45; box-shadow: 0 8px 24px rgba(15, 43, 66, .25); pointer-events: none; }
.chart-tip b { display: block; color: #fff; }

/* ---------- Pull quote ---------- */
.pull { margin-block: clamp(44px, 6vw, 80px); padding-left: clamp(20px, 3vw, 36px); border-left: 4px solid var(--accent); }
.pull p { font: italic 500 clamp(24px, 2.6vw, 34px)/1.35 var(--serif); color: var(--ink); letter-spacing: -.01em; }
.pull cite { display: block; margin-top: 16px; font: 600 15px/1.4 var(--sans); font-style: normal; color: var(--muted); }

/* ---------- Case modules ---------- */
.cases { display: grid; gap: clamp(16px, 2vw, 24px); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: clamp(32px, 4vw, 48px); }
.case { background: var(--panel); border-radius: 22px; padding: clamp(24px, 3vw, 38px); display: flex; flex-direction: column; }
.case.lead-case { grid-column: 1 / -1; background: #0f2b42; color: #e3eef5; }
.case .theme { font-size: 14px; font-weight: 600; color: #0f6a99; }
.case.lead-case .theme { color: #8fd3e2; }
.case h3 { margin: 10px 0 12px; font: 600 clamp(21px, 1.9vw, 27px)/1.28 var(--sans); letter-spacing: -.015em; color: var(--ink); }
.case.lead-case h3 { color: #fff; font-size: clamp(23px, 2.3vw, 32px); max-width: 32ch; }
.case p { color: var(--ink-soft); font-size: 16px; }
.case.lead-case p { color: #c3d6e4; max-width: 70ch; }
.case .status { margin-top: auto; padding-top: 18px; font-size: 14px; color: var(--muted); }
.case.lead-case .status { color: #a9c3d4; }

/* ---------- CTA row ---------- */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.pill { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 12px 24px; border-radius: 999px; font-weight: 600; text-decoration: none; border: 1px solid var(--brand-deep); }
.pill.solid { background: var(--brand-deep); color: #fff; }
.pill.solid:hover { background: #0a3a5d; }
.pill.ghost { color: var(--brand-deep); background: #fff; }
.pill.ghost:hover { background: #eef5f9; }

/* ---------- Related ---------- */
.related { margin-top: clamp(64px, 8vw, 112px); padding-block: clamp(48px, 6vw, 80px); background: var(--panel); }
.related h2 { font: 600 clamp(26px, 2.6vw, 34px)/1.2 var(--sans); letter-spacing: -.02em; margin-bottom: 28px; }
.rel-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); list-style: none; padding: 0; }
.rel-grid li { background: #fff; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid #dfe7ed; }
.rel-art { height: 120px; display: grid; place-content: center; }
.rel-art svg { width: 100%; height: 120px; }
.rel-body { padding: 22px 24px 26px; }
.rel-meta { display: flex; gap: 12px; font-size: 14px; color: var(--muted); }
.rel-meta span { color: #0f6a99; font-weight: 600; }
.rel-body h3 { margin: 10px 0 8px; font: 600 20px/1.3 var(--sans); color: var(--ink); }
.rel-body p { color: var(--ink-soft); font-size: 15.5px; }

.a-notice { margin-top: clamp(48px, 6vw, 80px); margin-bottom: clamp(56px, 7vw, 96px); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .flow { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .flow li + li::before, .flow li + li::after { display: none; }
  .rel-grid { grid-template-columns: 1fr 1fr; }
  .rel-grid li:last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .a-stats { grid-template-columns: 1fr 1fr; }
  .a-stats div:nth-child(3) { border-left: 0; }
  .a-stats div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .a-hero img { aspect-ratio: 4 / 3; border-radius: 16px; }
  .fig-panel, .case { border-radius: 16px; }
  .fig-pair, .cases, .rel-grid { grid-template-columns: 1fr; }
  .rel-grid li:last-child { grid-column: auto; }
  .prose { font-size: 18px; }
  .hbar li { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "t t"; gap: 8px 12px; padding: 10px 4px; }
  .hbar-label { grid-area: l; }
  .hbar-value { grid-area: v; }
  .hbar-track { grid-area: t; }
  .hbar-value small { display: inline; margin-left: 6px; }
  .stack { height: 38px; }
  .stack-in { font-size: 12.5px; }
}
@media (max-width: 560px) {
  .flow { grid-template-columns: 1fr; gap: 22px; }
  .flow li + li::before { display: block; left: 50%; top: -18px; width: 2px; height: 14px; }
  .flow li + li::after { display: block; left: calc(50% - 4px); top: -8px; border: 5px solid transparent; border-top: 6px solid #9fb6c6; }
  .stack-key li { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .stack-key .k-share { grid-column: 3; }
  .stack-key .k-value { display: none; }
}

/* =========================================================
   Homepage layer (index.html): article design, homepage structure
   ========================================================= */
.home-hero { padding-block: clamp(44px, 6vw, 88px) clamp(40px, 5vw, 72px); }
.home-hero .hero-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 40px clamp(32px, 5vw, 72px); align-items: center; }
.home-hero h1 { margin-top: 20px; font: 600 clamp(40px, 5vw, 72px)/1.02 var(--sans); letter-spacing: -.04em; color: var(--ink); }
.home-hero .standfirst { margin-top: 24px; font: clamp(18px, 1.5vw, 22px)/1.55 var(--sans); color: var(--ink-soft); max-width: 44ch; }
.home-hero .cta-row { margin-top: 32px; }
.home-hero figure img { width: 100%; aspect-ratio: 5 / 4; object-fit: cover; object-position: 50% 55%; border-radius: 24px; }
.home-hero figcaption { margin-top: 12px; font-size: 14.5px; color: var(--muted); }

.hsec { padding-block: clamp(64px, 8vw, 112px); }
.hsec.panel-bg { background: var(--panel); }
.hsec .section-head { margin-bottom: clamp(28px, 3.5vw, 44px); }
.hsec .section-head .display { font-family: var(--sans); letter-spacing: -.03em; }
.hsec .section-head .text-link { margin-top: 18px; }
.hsec .fig { margin-block: 0; }
.hsec .fig + .fig, .hsec .fig-pair + .fig { margin-top: clamp(20px, 2.4vw, 32px); }
.hsec.panel-bg .fig-panel, .hsec.panel-bg .case:not(.lead-case) { background: #fff; }
.hsec .fig-pair { margin: 0; }
.hsec .fig-pair .fig-cap { margin-top: auto; padding-top: 16px; }

.questions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); list-style: none; padding: 0; }
.questions li { background: var(--panel); border-radius: 22px; padding: clamp(24px, 2.6vw, 36px); display: flex; flex-direction: column; }
.questions .q-num { width: 40px; height: 40px; border-radius: 50%; display: grid; place-content: center; background: #fff; color: #0f6a99; font-weight: 700; border: 1px solid #cfdbe4; }
.questions h3 { margin: 20px 0 10px; font: 600 clamp(21px, 1.8vw, 26px)/1.25 var(--sans); letter-spacing: -.015em; }
.questions p { color: var(--ink-soft); font-size: 16.5px; }

.pill.light { background: #fff; color: var(--brand-deep); border-color: #fff; }
.pill.light:hover { background: #e7f3f6; }

.commit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); list-style: none; padding: 0; }
.commit li { border-top: 3px solid var(--brand); padding-top: 18px; }
.commit h3 { font: 600 19px/1.3 var(--sans); margin-bottom: 8px; color: var(--ink); }
.commit p { color: var(--ink-soft); font-size: 16px; }

.hsec .pull { margin: clamp(40px, 5vw, 64px) 0 0; }
.hsec .cases { margin-block: clamp(20px, 2.4vw, 32px) 0; }
.hsec .related-inner .rel-grid { margin-top: 0; }

@media (max-width: 980px) {
  .home-hero .hero-grid { grid-template-columns: 1fr; }
  .home-hero figure { order: -1; }
  .home-hero figure img { aspect-ratio: 16 / 9; }
  .questions, .commit { grid-template-columns: 1fr 1fr; }
  .questions li:last-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .questions, .commit { grid-template-columns: 1fr; }
  .questions li:last-child { grid-column: auto; }
  .home-hero figure img { border-radius: 16px; aspect-ratio: 4 / 3; }
}

/* Bar charts inside half-width panels: label and value above the bar. */
.fig-pair .hbar li { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "t t"; gap: 8px 12px; padding: 10px 4px; }
.fig-pair .hbar-label { grid-area: l; }
.fig-pair .hbar-value { grid-area: v; }
.fig-pair .hbar-track { grid-area: t; }
