/* Interactive figures in explainer articles (src/figures.ts): a figure from apps/web/figures/<id>
   built with the body-anatomy skill. The figure's own styles are figures/<id>/src/figure.css
   (generated); its colours are figures/<id>/site.css. This file sets the kit's colours to the
   design-system tokens and lays out the scroll steps, the figure and its cards on the page. */

.fig-article {
  --a-ink: #1d1d1f;
  --a-soft: #424245;
  --a-faint: #6e6e73;
  --a-line: #e8e8ed;
  --a-panel: #f5f5f7;
  --a-primary: #0071e3;
  --a-amber: #b8740a;

  /* the figure kit, light theme */
  --bh-page: #ffffff;
  --bh-card: #ffffff;
  --bh-text: #424245;
  --bh-strong: #1d1d1f;
  --bh-muted: #6e6e73;
  --bh-hi: #1d1d1f;
  --bh-mid: #86868b;
  --bh-lo: #d2d2d7;
  --bh-faint: #e8e8ed;
  --bh-lit: #000000;
  --bh-sans: "Geist", -apple-system, system-ui, sans-serif;
  --bh-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --bh-ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}
.fig-article .fig-block { margin: 0 0 40px; }

/* scroll steps beside a sticky figure */
.fig-article .a-scrolly { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.3fr); gap: 56px; max-width: 1200px; margin: 64px auto 24px; padding: 0 24px; }
.fig-article .a-sticky { grid-column: 2; grid-row: 1; position: sticky; top: 4vh; height: 92vh; align-self: start; }
.fig-article .a-steps { grid-column: 1; grid-row: 1; padding: 34vh 0 30vh; }
/* every card stays fully readable; the active one is white, with a blue edge */
.fig-article .a-step { margin: 0 0 62vh; padding: 24px 26px; background: var(--a-panel); border-radius: 18px; transition: background-color 0.35s var(--bh-ease), box-shadow 0.35s var(--bh-ease); }
.fig-article .a-step:last-child { margin-bottom: 0; }
.fig-article .a-step.is-active { background: #ffffff; box-shadow: inset 3px 0 0 var(--a-primary), inset 0 0 0 1px var(--a-line), 0 18px 40px -24px rgb(0 0 0 / 0.25); }
.fig-article .a-step h3 { margin: 0 0 8px; font-size: 21px; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
.fig-article .a-step p { margin: 0; font-size: 17px; line-height: 1.55; color: var(--a-soft); }

/* the figure */
.fig-article .fig-main.bh-plate { margin: 0; height: 100%; display: flex; flex-direction: column; padding: 0; background: transparent; box-shadow: none; }
.fig-article .fig-main .bh-stage { flex: 1; aspect-ratio: auto; min-height: 0; border-radius: 18px; background: radial-gradient(70% 62% at 50% 46%, #ffffff 0%, #fafafc 62%, #f5f5f7 100%); box-shadow: inset 0 0 0 1px var(--a-line); }
.fig-article .fig-main .bh-label-text { font-size: 12.5px; stroke: #ffffff; }
.fig-article .a-figbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 12px; }
.fig-article .a-figname { font-size: 13px; color: var(--a-faint); }
.fig-article .a-figctl { display: flex; flex-wrap: wrap; gap: 8px; }
.fig-article .a-readout { min-height: 1.4em; margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: var(--a-soft); }
.fig-article .fig-main .bh-key-list { font-size: 13px; color: var(--a-soft); }

/* controls: a segmented control, as on the supplement pages */
.fig-article .bh-seg { gap: 2px; padding: 3px; border-radius: 999px; background: var(--a-panel); box-shadow: none; }
.fig-article .bh-seg button { padding: 8px 14px; border-radius: 999px; font: 500 13px/1 var(--bh-sans); letter-spacing: 0; text-transform: none; white-space: nowrap; color: var(--a-soft); }
.fig-article .bh-seg button[aria-pressed="true"] { background: #ffffff; color: var(--a-ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.14); }
.fig-article .bh-seg button:focus-visible { outline: 2px solid var(--a-primary); outline-offset: 2px; }

/* cards in the text column, a little wider than it */
.fig-article .a-wide { box-sizing: border-box; width: calc(100% - 48px); max-width: 860px; margin: 28px auto 0; }
.fig-article .a-card { padding: 24px; border: 1px solid var(--a-line); border-radius: 18px; background: #ffffff; }
.fig-article figure.a-card figcaption, .fig-article .a-chart-note { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--a-faint); }
.fig-article .a-try { display: grid; gap: 12px; }
.fig-article .a-try-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.fig-article .a-try-label { min-width: 120px; font-size: 13px; font-weight: 600; color: var(--a-soft); }
.fig-article .a-try .bh-stat { margin: 4px 0 0; font: 14px/1.55 var(--bh-sans); color: var(--a-soft); }
.fig-article .bh-trace { height: 190px; margin-top: 6px; overflow: visible; }
.fig-article .a-card .bh-trace { width: calc(100% - 28px); margin-left: 28px; }
.fig-article .a-trace-b { height: 150px; }
.fig-article .bh-hband { fill: var(--a-panel); opacity: 1; }
.fig-article .bh-chart-title { font: 600 12px var(--bh-sans); fill: var(--a-soft); }
.fig-article .bh-axis { font: 10.5px var(--bh-sans); fill: var(--a-faint); }
.fig-article .bh-band-label { font: 600 9.5px var(--bh-sans); fill: var(--a-faint); }
.fig-article .a-key { display: inline-block; width: 18px; height: 0; margin: 0 6px 3px 0; border-top: 2px solid; vertical-align: middle; }

/* phones and narrow windows: a smaller figure, with its readout, sticks to the top;
   the step cards come up in the space under it and pass behind it */
@media (max-width: 959px) {
  .fig-article .a-scrolly { grid-template-columns: 1fr; gap: 0; margin-top: 24px; padding: 0 16px; }
  /* one grid cell for both: a sticky element sticks only inside its own cell */
  .fig-article .a-sticky { grid-column: 1; grid-row: 1; top: 0; z-index: 5; height: auto; padding: 8px 0 6px; background: #ffffff; box-shadow: 0 1px 0 var(--a-line); }
  .fig-article .fig-main.bh-plate { height: auto; }
  .fig-article .fig-main .bh-stage { flex: none; height: 34vh; min-height: 200px; }
  .fig-article .a-readout { min-height: 2.8em; }
  .fig-article .a-steps { grid-column: 1; grid-row: 1; position: relative; z-index: 4; padding: 78vh 0 34vh; }
  .fig-article .a-step { margin-bottom: 56vh; padding: 20px; }
  .fig-article .a-step p { font-size: 16.5px; }
  .fig-article .a-figname { display: none; }
  /* no labels on a phone: the overlay, its key and its button are hidden */
  .fig-article .fig-main .bh-key-list, .fig-article .fig-main .bh-overlay, .fig-article .a-figctl .bh-seg:has(#labels) { display: none !important; }
  .fig-article .a-wide { width: calc(100% - 32px); }
  .fig-article .a-card { padding: 18px 16px; }
}
