/* BioGraphs Statistics 101: the guide's layout and its text blocks (V1's guide, in the UI kit's tokens). */
body.s1 { margin: 0; background: var(--bg); color: var(--ink); }
.s1 [hidden] { display: none !important; } /* (the figures hide parts that have a display of their own: notes, code, editor) */
.s1 .brand { text-decoration: none; color: var(--ink); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--panel); padding: 8px 12px; }

/* topics on the left, the page on the right */
.s1-shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 0; max-width: 1240px; margin: 0 auto; }
/* (under the sticky top bar: --s1-top = its height, set by guide.js; the list scrolls on its own and its first and last
   topics can always be reached) */
.s1-nav { position: sticky; top: var(--s1-top, 49px); align-self: start; max-height: calc(100vh - var(--s1-top, 49px)); overscroll-behavior: contain; overflow-y: auto; padding: 20px 10px 32px 16px; box-sizing: border-box; scrollbar-width: thin; }
.s1-sec { margin-bottom: 14px; }
.s1-sec-t { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 0 8px 4px; }
.s1-nav a { display: flex; gap: 8px; align-items: baseline; margin: 2px 0; padding: 5px 8px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: 13.5px; line-height: 1.35; }
.s1-nav a:hover { background: var(--hover); color: var(--ink); }
.s1-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.s1-n { flex: none; width: 20px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--faint); }
.s1-nav a.on .s1-n { color: inherit; }
.s1-main { min-width: 0; padding: 26px 28px 48px; outline: none; }
.s1-main:focus, .s1-main:focus-visible { outline: none; box-shadow: none; } /* (focused after a topic is opened, for screen readers: no ring) */
.s1-mobile-nav { display: none; }
.s1-body { max-width: 820px; font-size: 15px; line-height: 1.62; }

@media (max-width: 900px) {
  .s1-shell { grid-template-columns: minmax(0, 1fr); }
  .s1-nav { display: none; }
  .s1-main { padding: 16px 16px 40px; }
  .s1-mobile-nav { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
  .s1-mobile-nav label { font-size: 13px; color: var(--muted); }
  .s1-mobile-nav select { flex: 1; min-width: 0; }
}

/* text */
.s1-body h1 { font-size: 26px; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; margin: 0 0 14px; }
.s1-body h2 { font-size: 18px; font-weight: 640; margin: 30px 0 8px; letter-spacing: -.005em; }
.s1-body h3 { font-size: 15.5px; margin: 20px 0 6px; }
.s1-body p { margin: 0 0 12px; }
.s1-body ul, .s1-body ol { margin: 0 0 14px; padding-left: 22px; }
.s1-body li { margin: 3px 0; }
.s1-body li > ul { margin: 4px 0 6px; }
.s1-body code { font: 12.5px/1.4 var(--mono); background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
.s1-body .small, .s1-body small { font-size: 13px; }
.s1-body .muted { color: var(--muted); }
.s1-body dl { margin: 0 0 14px; }
.s1-body dt { font-weight: 640; margin-top: 12px; }
.s1-body dd { margin: 2px 0 0; color: var(--ink); }
.s1-body a { color: var(--accent); }
.s1-body a.see { text-decoration: underline dotted; text-underline-offset: 3px; }
.s1-body a.see:hover { text-decoration-style: solid; }
.s1-body .sig { color: var(--warn); font-weight: 640; }
.s1-body .ns { color: var(--muted); }

/* "Try it": an example opened in the app; the power calculator's examples the same */
.s1-body a.try { display: inline-flex; align-items: center; gap: 4px; padding: 1px 10px; margin: 1px 2px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 999px;
  font-size: 13px; line-height: 1.6; color: var(--accent); background: var(--panel); text-decoration: none; white-space: nowrap; vertical-align: baseline; }
.s1-body a.try:hover { background: var(--accent-soft); }
.s1-body a.try.off { color: var(--faint); border-color: var(--line); cursor: default; background: none; }

/* boxes */
.s1-body .tip, .s1-body .caution, .s1-body .inapp, .s1-body .example, .s1-body .inshort { margin: 16px 0; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); }
.s1-body .tip { border-left: 3px solid var(--accent); background: var(--info-soft); border-color: transparent; border-left-color: var(--accent); }
.s1-body .caution { border-left: 3px solid var(--warn); background: var(--warn-soft); border-color: transparent; border-left-color: var(--warn); }
.s1-body .inapp { border-left: 3px solid var(--ok); background: var(--ok-soft); border-color: transparent; border-left-color: var(--ok); }
.s1-body .example { background: var(--panel-2); }
/* a place in the app named inside a sentence: a small label, not a box */
.s1-body span.inapp { display: inline; margin: 0; padding: 1px 7px; border: 0; border-radius: var(--radius-xs); font-size: 13.5px; font-weight: 560; white-space: normal; }
.s1-body .inshort { background: var(--panel); box-shadow: var(--shadow-sm); }
.s1-body .inshort > b:first-child { display: block; font-size: 13px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.s1-body .inshort ul { margin-bottom: 0; }
.s1-body :is(.tip, .caution, .inapp, .example) > :last-child { margin-bottom: 0; }
.s1-body .checklist { list-style: none; padding-left: 0; }
.s1-body .checklist li::before { content: "☐ "; color: var(--muted); }

/* tables */
.s1-body .table-wrap { overflow-x: auto; margin: 12px 0 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.s1-body table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.45; }
.s1-body th, .s1-body td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: normal; overflow-wrap: break-word; }
.s1-body td .try { white-space: nowrap; }
.s1-body td.num, .s1-body th.num { overflow-wrap: normal; white-space: nowrap; }
.s1-body thead th { background: var(--panel-2); font-weight: 620; font-size: 12.5px; color: var(--muted); }
.s1-body tbody tr:last-child td { border-bottom: 0; }

/* "Which test?": the decision tree */
.s1-body .tree { margin: 14px 0 20px; }
.s1-body .tree-root { display: table; margin: 0 auto 10px; padding: 7px 18px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-weight: 620; font-size: 14px; }
.s1-body .tree-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.s1-body .tree-head { padding: 7px 10px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); text-align: center; font-weight: 620; font-size: 13.5px; margin-bottom: 8px; }
.s1-body .tree-branch { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); margin-bottom: 8px; font-size: 13.5px; line-height: 1.45; }
.s1-body .tree-branch-title { font-weight: 640; margin-bottom: 4px; }
.s1-body .tree-leaf { color: var(--muted); margin: 3px 0; }
.s1-body .tree-leaf b { color: var(--ink); }
@media (max-width: 700px) { .s1-body .tree-cols { grid-template-columns: minmax(0, 1fr); } }

/* figures: Python draws them (see guide.js) */
/* (display: block: app.css's .fig is the app's chart area, a centred flex box) */
.s1-body figure.fig { display: block; flex: none; min-height: 0; margin: 18px 0 22px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.s1-body .fig-title { font-weight: 640; font-size: 14.5px; margin-bottom: 8px; }
.s1-body figure.fig figcaption { font-size: 13.5px; line-height: 1.5; color: var(--muted); margin-top: 8px; }
.s1-body figure.fig figcaption b, .s1-body figure.fig figcaption [data-r] { color: var(--ink); }
/* settings changed: a note beside "Back to the guide's values"; its room is always kept (visibility), so nothing moves */
.fx-moved { font-size: 12.5px; font-style: italic; color: var(--faint); visibility: hidden; }
.s1-body figure.fig.moved .fx-moved { visibility: visible; }
/* the sliders: each with a ▶ that moves it by itself; the speed of that last */
.fx-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 18px; margin: 0 0 10px; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.fx-controls .ui-field { margin: 0; }
.fx-controls .ui-label { display: flex; align-items: center; gap: 4px; }
/* New sample / Back to the guide's values: a row of their own at the end of the box */
.fx-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding-top: 2px; }
.fx-actions .btn-sm { margin: 0; }
.fx-actions .ui-icon { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; }
.fx-anim { margin-left: auto; flex: none; width: 24px; height: 20px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line);
  border-radius: var(--radius-xs); background: var(--panel); color: var(--accent); font-size: 9px; line-height: 1; cursor: pointer; box-shadow: none; }
.fx-anim:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.fx-anim.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* Chart / Code: the app's tabs (app.css .view-tabs), joined to their frame (.figwrap) */
/* the tab row: Chart / Code on the left, the run status on the right (the app's .fig-bar and .run) */
.fx-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; }
.fx-head .run { flex: 0 1 auto; margin-bottom: 4px; box-sizing: border-box; overflow: hidden; }
.fx-head .run.bad { cursor: pointer; }
.fx .fx-tabs button { padding: 6px 14px; font-size: 13px; }
.fx .fx-tabs .ui-icon { width: 14px; height: 14px; }
.fx .figwrap { flex: none; }
.fx.show-code .view-tabs button.on { --tab-bg: var(--code-bar); color: var(--code-ink); }
.fx.show-code .figwrap { background: var(--code-bg); }
.fx.not-first .figwrap { border-top-left-radius: var(--radius); z-index: 1; }
.fx-chart { position: relative; height: 100%; }
.fx-chart.drawn { background: var(--paper); color-scheme: light; }
.fx .codeview { height: 100%; }
.fx .code-tools { flex-wrap: wrap; }
.fx .code-tools .btn-sm { margin: 0; }
.fx .code-tools .ui-icon, .fx-bar .ui-icon { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; }
.fx-plot { width: 100%; }
/* before the first drawing: the app's note (what is loading); an error of the script the same way */
.fx-note { position: absolute; inset: 0; margin: auto; max-width: none; padding: 16px 24px; overflow: auto; }
.fx-chart.drawn .fx-note { background: var(--paper); --ink: #1d2433; --muted: #5f6b7d; --faint: #788193; color: #5f6b7d; }
.fx-note.bad .pi { color: var(--bad); }
.fx-note .fx-err { font: 12px/1.5 var(--mono); color: var(--bad); white-space: pre-wrap; max-width: 640px; }
.fx-chart.drawn .fx-note .fx-err { color: #b42318; }
/* a later run that takes a while: a small sign in the corner */
.fx-busy { position: absolute; top: 8px; right: 8px; display: flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; color: #8f5400; background: #fdf3e2; box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.fx-spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; flex: none; }
.fx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.fx-bar .btn-sm { margin: 0; }
@media (prefers-reduced-motion: reduce) { .fx-spin { animation: none; } }

/* previous / next: one line each, as the kit's buttons */
.s1-pager { max-width: 820px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }
.s1-pg { display: inline-flex; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); text-decoration: none;
  color: var(--accent); font-weight: 600; font-size: 13.5px; line-height: 1.35; max-width: 48%; }
.s1-pg:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.s1-pg.next { margin-left: auto; text-align: right; }

/* validation */
.s1-body details { margin: 6px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.s1-body details > summary { cursor: pointer; padding: 8px 12px; font-weight: 600; font-size: 14px; }
.s1-body details > :not(summary) { margin: 0 12px 12px; }
.s1-body .chip { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 1.7; background: var(--sunken); color: var(--muted); }
.s1-body .chip.ok { background: var(--ok-soft); color: var(--ok); }
.s1-body .chip.bad { background: var(--bad-soft); color: var(--bad); }
.s1-body .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
