/* Data figures, from the "Data figures" board on the Choice OMG Design
   canvas (approved 2026-11-22). Loaded only on pages that carry a figure.
   Light by default; dark inside .zone-dark.
   Font: Poppins (site --font-body), already loaded at 400/500/600/700.
   One breakpoint: viewport max-width 511.98px (phones). */
.data-figure { margin: 0; width: 100%; box-sizing: border-box; padding: 24px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; display: flex; flex-direction: column; gap: 16px; color: #1e293b; font-family: 'Poppins', system-ui, sans-serif; line-height: 1.6; }
.data-figure__title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.4; color: #1e293b; }
/* Share bar */
.share-bars { display: flex; flex-direction: column; gap: 12px; }
.share-bar { display: grid; grid-template-columns: 200px minmax(0, 1fr) 48px; grid-template-areas: "label track value"; gap: 16px; align-items: center; }
.share-bar__label { grid-area: label; font-size: 14px; line-height: 1.4; color: #1e293b; }
.share-bar__track { grid-area: track; display: block; height: 16px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.share-bar__fill { /* width set inline, e.g. style="width: 56%" */ display: block; height: 16px; background: #2563eb; border-radius: 0 6px 6px 0; }
.share-bar__value { grid-area: value; font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; color: #1e293b; }
/* Trend */
.trend { display: flex; flex-direction: column; gap: 8px; }
.trend-key { display: flex; align-items: center; gap: 8px; }
.trend-key__swatch { stroke: #2563eb; stroke-width: 2; }
.trend-key__label { font-size: 13px; color: #475569; }
.trend__plot { position: relative; height: 300px; } /* 64px card strip + 8px gap + 200px plot + 28px axis band */
.trend__svg { display: block; width: 100%; height: 100%; overflow: visible; font-family: 'Poppins', system-ui, sans-serif; }
.trend__baseline { stroke: #e2e8f0; stroke-width: 1; }
.trend__ref { stroke: #475569; stroke-width: 1; stroke-dasharray: 4 4; }
.trend__label { font-size: 12px; fill: #475569; }
.trend__line { fill: none; stroke: #2563eb; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend__dots { /* zero-length segments with round caps = 8px dots */ fill: none; stroke: #2563eb; stroke-width: 8; stroke-linecap: round; }
.trend__cross { stroke: #475569; stroke-width: 1; }
.trend__focus { /* r = 6 */ fill: #2563eb; stroke: #ffffff; stroke-width: 2; }
.trend__hit { fill: transparent; }
.trend__tip { position: absolute; top: 0; width: 200px; white-space: nowrap; box-sizing: border-box; padding: 8px 12px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 6px; pointer-events: none; }
.trend__tip[hidden] { display: none; }
.trend__tip-week { font-size: 12px; color: #475569; }
.trend__tip-value { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: #1e293b; }
/* Caption and note */
.data-figure__caption { display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.6; color: #475569; }
/* Disclosure: closed by default (no open attribute) */
.data-figure__numbers { border-top: 1px solid #e2e8f0; }
.data-figure__numbers > summary { padding: 11px 0; /* 44px tap target */ cursor: pointer; font-size: 14px; font-weight: 600; color: #1d4ed8; }
.data-figure__numbers table { width: 100%; border-collapse: collapse; font-size: 14px; color: #1e293b; }
.data-figure__numbers th, .data-figure__numbers td { padding: 8px 0; border-bottom: 1px solid #e2e8f0; }
.data-figure__numbers th:first-child { text-align: left; padding-right: 12px; }
.data-figure__numbers thead th { font-weight: 600; }
.data-figure__numbers tbody th { font-weight: 400; }
.data-figure__numbers thead th:last-child, .data-figure__numbers td { text-align: right; font-variant-numeric: tabular-nums; }
/* Dark: inside a zone-dark section */
.zone-dark .data-figure { background: #1e293b; border-color: #334155; color: #f8fafc; }
.zone-dark .data-figure__title, .zone-dark .share-bar__label, .zone-dark .share-bar__value, .zone-dark .trend__tip-value, .zone-dark .data-figure__numbers table { color: #f8fafc; }
.zone-dark .share-bar__track { background: #334155; }
.zone-dark .share-bar__fill { background: #60a5fa; }
.zone-dark .trend-key__swatch, .zone-dark .trend__line, .zone-dark .trend__dots { stroke: #60a5fa; }
.zone-dark .trend-key__label, .zone-dark .trend__tip-week, .zone-dark .data-figure__caption { color: #94a3b8; }
.zone-dark .trend__label { fill: #94a3b8; }
.zone-dark .trend__ref, .zone-dark .trend__cross { stroke: #94a3b8; }
.zone-dark .trend__baseline { stroke: #334155; }
.zone-dark .trend__focus { fill: #60a5fa; stroke: #1e293b; }
.zone-dark .trend__tip { background: #1e293b; border-color: #334155; }
.zone-dark .data-figure__numbers { border-top-color: #334155; }
.zone-dark .data-figure__numbers > summary { color: #60a5fa; }
.zone-dark .data-figure__numbers th, .zone-dark .data-figure__numbers td { border-bottom-color: #334155; }
/* Phones: figure is full column width (412px viewport -> 380px figure) */
@media (max-width: 511.98px) {
  .data-figure { padding: 16px; }
  .share-bar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "track track"; column-gap: 12px; row-gap: 6px; align-items: end; }
}
/* Contrast, measured: bar on track 4.19:1 light, 4.07:1 dark; muted text 7.58:1 light, 5.71:1 dark; summary link 6.70:1 light, 5.75:1 dark. */

/* Site overrides. style.css styles every p, table, th and row hover inside
   .page-content, and those rules outrank or tie the single-class rules above.
   Each selector here carries .page-content so it wins inside a figure.
   - .page-content p adds a 1rem bottom margin and line-height 1.7 to the title.
   - .page-content table sets min-width 480px, which would push the numbers
     table wider than a 412px phone, and a 1.5rem bottom margin.
   - .page-content th paints a grey background and fixes the text colour,
     which would put dark text on the dark figure inside .zone-dark.
   - .page-content tbody tr:hover paints a near-white row.
   The figure's own margin is 0 in the canvas CSS; inside page copy it gets
   1.5rem above and below so it does not touch the paragraphs around it. */
.page-content .data-figure { margin: 1.5rem 0; }
.page-content .data-figure__title { margin: 0; line-height: 1.4; }
.page-content .data-figure__numbers table { min-width: 0; margin-bottom: 0; font-size: 14px; }
.page-content .data-figure__numbers th { background: none; color: inherit; }
.page-content .data-figure__numbers tbody tr:hover { background: none; }

/* ===== v3 (figures-v3 spec section 1) ===== */
/* ---------- Tooltip: pinned strip above the plot at every width ---------- */
/* The card (200px, one line, 61px tall) sits in a 64px strip at the top of the
   plot; JS sets left. The longest English week, "Week of September 28, 2026",
   is 170px at 12px Poppins. Phones keep a shorter plot. */
@media (max-width: 511.98px) {
  .trend__plot {
    height: 260px;            /* 64px card strip + 8px gap + 160px plot + 28px axis band */
  }
}

/* ---------- Chinese pages (/zh/): figure has lang="zh-Hans" ---------- */
.data-figure:lang(zh) {
  font-family: 'Poppins', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC', system-ui, sans-serif;
}
.data-figure:lang(zh) .data-figure__title { line-height: 1.5; }
.data-figure:lang(zh) .share-bar__label,
.data-figure:lang(zh) .paired__label { line-height: 1.5; }
.data-figure:lang(zh) .data-figure__caption,
.data-figure:lang(zh) .data-figure__numbers table { line-height: 1.7; }
.data-figure:lang(zh) .trend__svg {
  font-family: 'Poppins', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans CJK SC', system-ui, sans-serif;
}

/* ---------- Paired bars ---------- */
/* Series 1 (visits): solid bar colour. Series 2 (conversions): outline bar,
   card colour inside, 2px border in the bar colour, always second.
   No second series colour: the outline fill is the card colour
   (--color-surface #ffffff light, --color-dark-surface #1e293b dark). */
.paired {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.paired__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}
.paired__key {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #475569;
}
.paired__swatch {
  width: 16px;
  height: 12px;
  box-sizing: border-box;
  background: #2563eb;
}
.paired__swatch--outline {
  background: #ffffff;
  border: 2px solid #2563eb;
}
.paired__row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 48px;
  grid-template-areas: "label bars values";
  column-gap: 16px;
  align-items: center;
}
.paired__label {
  grid-area: label;
  font-size: 14px;
  line-height: 1.4;
  color: #1e293b;
}
.paired__bars {
  grid-area: bars;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.paired__values {
  grid-area: values;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.paired__track {
  display: block;
  height: 16px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
}
.paired__fill {               /* width set inline, e.g. style="width: 58%" */
  display: block;
  height: 16px;
  min-width: 4px;
  box-sizing: border-box;
  background: #2563eb;
  border-radius: 0 6px 6px 0;
}
.paired__fill--outline {
  background: #ffffff;
  border: 2px solid #2563eb;
}
.paired__value {
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;          /* matches the 16px bar it sits beside */
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #1e293b;
}

/* ---------- Stat tile ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat__number {
  margin: 0;
  font-family: 'Funnel Display', system-ui, sans-serif;
  font-weight: 800;
  font-size: 64px;
  line-height: 1;
  color: #1e293b;
}
.stat__label {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  color: #475569;
}

/* Row of up to three tiles, inside one figure frame */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.stat-row__tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: #f8fafc;
  border-radius: 12px;
}
.stat-row__number {
  margin: 0;
  font-family: 'Funnel Display', system-ui, sans-serif;
  font-weight: 800;
  font-size: 48px;
  line-height: 1;
  color: #1e293b;
}
.stat-row__label {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: #475569;
}

/* ---------- Dark (inside .zone-dark) ---------- */
.zone-dark .paired__key,
.zone-dark .stat__label,
.zone-dark .stat-row__label { color: #94a3b8; }
.zone-dark .paired__label,
.zone-dark .paired__value,
.zone-dark .stat__number,
.zone-dark .stat-row__number { color: #f8fafc; }
.zone-dark .paired__swatch,
.zone-dark .paired__fill { background: #60a5fa; }
.zone-dark .paired__swatch--outline,
.zone-dark .paired__fill--outline { background: #1e293b; border-color: #60a5fa; }
.zone-dark .paired__track { background: #334155; }
.zone-dark .stat-row__tile { background: #0f172a; }

/* ---------- Phones ---------- */
@media (max-width: 511.98px) {
  .paired__row {
    grid-template-columns: minmax(0, 1fr) 48px;
    grid-template-areas:
      "label label"
      "bars values";
    column-gap: 12px;
    row-gap: 6px;
  }
  .stat__number { font-size: 56px; }
  .stat-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .stat-row__tile { padding: 16px; }
  .stat-row__number { font-size: 40px; }
}

/* Contrast, measured:
   paired: solid #2563eb on track #e2e8f0 4.19:1; outline border #2563eb on track 4.19:1;
   outline inside #ffffff against its border 5.17:1. Dark: #60a5fa on #334155 4.07:1;
   inside #1e293b against border 5.75:1. The two bars of a pair never touch (4px gap).
   stat: number #1e293b on #ffffff 14.63:1; label #475569 on #f8fafc 7.24:1;
   dark label #94a3b8 on #0f172a 6.96:1.
   Below about 3% both paired bars are 4px slivers; position (conversions always second),
   the legend and the value labels carry the difference. */

/* Three-column tables (paired-bar): every column after the first is right-aligned. */
.data-figure__numbers th + th, .data-figure__numbers td { text-align: right; padding-left: 12px; }

/* Site overrides for the v3 blocks: .page-content p adds a bottom margin and
   line-height 1.7, which would loosen the stat numbers and labels. */
.page-content .stat__number, .page-content .stat__label,
.page-content .stat-row__number, .page-content .stat-row__label { margin: 0; }
.page-content .stat__number, .page-content .stat-row__number { line-height: 1; }
.page-content .stat__label, .page-content .stat-row__label { line-height: 1.4; }
