/* BitSize Statistics & Probability — builds on python_patterns/patterns.css + python_data/data.css
   (same components) with a violet accent, the animated charts (statchart.js), live sliders and the
   When card. */
.px.st, .px-panel.st { --px-accent: #6D28D9; --px-accent-2: #8B5CF6; --px-soft-bg: #F3EEFF;
  --sc-a: #7C3AED; --sc-b: #0EA5E9; --sc-hit: #16A34A; --sc-out: #E11D48; --sc-warn: #F59E0B; --sc-soft: #94A3B8; --sc-ink: #1F2937; }
.px.st code { background: #EFE9FC; }
.st .px-callout--teal { background: #F3EEFF; border-color: #DDD0FB; color: #3B1D78; }

/* ── charts ── */
.sc-wrap { display: grid; gap: 10px; margin: 2px 0 4px; }
.sc-wrap--multi { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.sc-fig { margin: 0; padding: 10px 10px 4px; border-radius: 14px; background: #fff; border: 1px solid #E9E3F7;
  box-shadow: 0 12px 26px -22px rgba(76, 29, 149, .55); }
.sc-fig .vz-label { margin: 0 0 2px 6px; }
.sc { display: block; width: 100%; height: auto; font-family: var(--px-mono); }
.sc-grid { stroke: #EEF0F4; stroke-width: 1; }
.sc-axis { stroke: #9CA3AF; stroke-width: 1.2; }
.sc-tk { stroke: #C7CCD4; }
.sc-tick { font-size: 11px; fill: #6B7280; }
.sc-alabel { font-size: 12px; font-weight: 700; fill: #4B5563; font-family: var(--px-font, inherit); }
.sc-a { --c: var(--sc-a); } .sc-b { --c: var(--sc-b); } .sc-hit { --c: var(--sc-hit); } .sc-out { --c: var(--sc-out); }
.sc-warn { --c: var(--sc-warn); } .sc-soft { --c: var(--sc-soft); } .sc-ink { --c: var(--sc-ink); }
.sc-bar { fill: var(--c); fill-opacity: .82; }
.sc-bar.is-hit { fill: var(--sc-hit); fill-opacity: .95; }
.sc-bar.is-out { fill: var(--sc-out); fill-opacity: .9; }
.sc-area { fill: var(--c); fill-opacity: .26; stroke: var(--c); stroke-width: 1; stroke-opacity: .5; }
.sc-line { fill: none; stroke: var(--c); stroke-linejoin: round; stroke-linecap: round; }
.sc-line.is-dash, .sc-vline.is-dash { stroke-dasharray: 5 4; }
.sc-pt { fill: var(--c); fill-opacity: .7; stroke: #fff; stroke-width: 1; }
.sc-pt.is-hit { fill: var(--sc-hit); fill-opacity: .95; }
.sc-pt.is-out { fill: var(--sc-out); fill-opacity: .95; }
.sc-vline { stroke: var(--c); stroke-width: 2.2; }
.sc-band { fill: var(--c); fill-opacity: .14; }
.sc-ref { stroke: var(--sc-ink); stroke-width: 1.4; stroke-dasharray: 3 3; opacity: .6; }
.sc-whisk { stroke: var(--c); stroke-width: 1.8; }
.sc-boxr { fill: var(--c); fill-opacity: .22; stroke: var(--c); stroke-width: 1.8; }
.sc-med { stroke: var(--c); stroke-width: 3.2; }
.sc-ci { stroke: var(--c); stroke-width: 2.2; stroke-linecap: round; opacity: .75; }
.sc-ci.is-out { stroke: var(--sc-out); opacity: 1; }
.sc-cidot { fill: var(--c); } .sc-cidot.is-out { fill: var(--sc-out); }
.sc-vlabel, .sc-blabel, .sc-llabel, .sc-note { font-size: 11.5px; font-weight: 700; fill: var(--c); paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.sc-legend text { font-size: 11.5px; fill: #374151; font-weight: 600; }
.sc-key { fill: var(--c); fill-opacity: .85; }
.st .vz-stage.is-done .sc-fig { border-color: #BBF7D0; }
@media (max-width: 560px) { .sc-wrap--multi { grid-template-columns: 1fr; } .sc-tick { font-size: 13px; } }

/* ── live sliders (explorables) ── */
.st-inputs { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(180deg, #FAF7FF, #F3EEFF); border: 1px solid #E4DAFB; }
.st-slider { display: grid; gap: 4px; min-width: 180px; flex: 1 1 180px; font-size: 12.5px; color: #4B5563; }
.st-slider > span { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.st-slider code { font-weight: 700; color: #4C1D95; background: none !important; padding: 0; }
.st-slider output { font: 800 13px var(--px-mono); color: #6D28D9; min-width: 3ch; text-align: right; }
.st-slider small { color: #8B8FA3; font-size: 11.5px; }
.st-slider input[type=range] { width: 100%; accent-color: #7C3AED; height: 22px; cursor: pointer; }
.st-inputs .px-ghost { flex: none; }

/* ── the When card ── */
.st-when { display: grid; gap: 12px; }
.st-when__q { margin: 0; padding: 14px 16px; border-radius: 14px; background: linear-gradient(120deg, #4C1D95, #6D28D9 65%, #8B5CF6); color: #fff;
  box-shadow: 0 16px 34px -24px rgba(76, 29, 149, .9); }
.st-when__q span { display: block; margin-bottom: 4px; font: 700 11px var(--px-mono); letter-spacing: .12em; text-transform: uppercase; color: #DDD6FE; }
.st-when__q b { font-size: 18px; line-height: 1.4; }
.st-when__q code { background: rgba(255, 255, 255, .16) !important; color: #fff; }
.st-when__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.st-when__box { padding: 12px 16px; border-radius: 14px; background: #fff; border: 1px solid #E5E7EB; }
.st-when__box h3 { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.st-when__box ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; line-height: 1.5; }
.st-when__box--use { border-color: #BBF7D0; background: #F6FEF9; } .st-when__box--use h3 { color: #15803D; }
.st-when__box--check { border-color: #FDE68A; background: #FFFCF0; } .st-when__box--check h3 { color: #B45309; }
.st-when__box--alt { border-color: #E4DAFB; background: #FBF9FF; } .st-when__box--alt h3 { color: #6D28D9; }
.st-alt { list-style: none; padding: 0 !important; }
.st-alt li { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px dashed #E9E3F7; }
.st-alt li:first-child { border-top: 0; }
.st-alt b { color: #8B5CF6; }
.st-alt li span:last-child { font-weight: 700; color: #3B1D78; }
.st-when__rel { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: #6B7280; }
@media (max-width: 680px) { .st-when__grid { grid-template-columns: 1fr; } .st-alt li { grid-template-columns: 1fr; gap: 2px; } .st-alt b { display: none; } }

/* ── the map: hero demo + datasets ── */
.st-demo { margin: 0; padding: 12px 14px 8px; border-radius: 18px; background: linear-gradient(160deg, #FFFFFF 0%, #F3EEFF 100%);
  border: 1px solid #E4DAFB; box-shadow: 0 24px 50px -30px rgba(76, 29, 149, .55); }
.st-demo__cap { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font: 700 12.5px var(--px-mono); color: #4C1D95; }
.st-demo__cap span { padding: 3px 9px; border-radius: 8px; background: #EDE7FD; }
.st-demo__cap b { color: #7C3AED; }
.st-demo__svg { display: block; width: 100%; height: auto; }
.st-demo__svg rect { fill: #8B5CF6; fill-opacity: .75; transition: y .12s, height .12s; }
.st-demo__svg rect.is-tail { fill: #E11D48; fill-opacity: .85; }
.st-demo__axis { stroke: #A78BFA; stroke-width: 1.5; }
.st-demo__curve { fill: none; stroke: #4C1D95; stroke-width: 2.6; stroke-dasharray: 900; stroke-dashoffset: 0; animation: stDraw 1.2s ease-out; }
.st-demo__tail { fill: #E11D48; fill-opacity: .28; }
.st-demo__p { font: 800 15px var(--px-mono); fill: #BE123C; }
@keyframes stDraw { from { stroke-dashoffset: 900; } to { stroke-dashoffset: 0; } }
.st-datasets { max-width: 1100px; margin: 0 auto 26px; padding: 18px 20px; border-radius: 18px; background: #fff; border: 1px solid #E9E3F7; }
.st-datasets h2 { margin: 0 0 4px; font-size: 18px; }
.st-datasets > p { margin: 0 0 12px; color: var(--px-soft); }
.st-datasets ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.st-datasets li { display: grid; gap: 2px; padding: 9px 12px; border-radius: 12px; background: #FAF7FF; border: 1px solid #EFE9FC; font-size: 13px; color: #4B5563; }
.st-datasets li code { justify-self: start; font-weight: 700; color: #4C1D95; }
@media (prefers-reduced-motion: reduce) { .st-demo__curve { animation: none; } .st-demo__svg rect { transition: none; } }

/* ── Which test? chooser ── */
.st-ch-trail { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.st-ch-trail li { display: flex; align-items: center; gap: 8px; }
.st-ch-trail li + li::before { content: '→'; color: #A78BFA; font-weight: 700; }
.st-ch-trail button { display: grid; text-align: left; gap: 1px; padding: 6px 12px; border-radius: 10px; border: 1px solid #E4DAFB; background: #FBF9FF;
  font: 600 13.5px/1.3 inherit; color: #4C1D95; cursor: pointer; }
.st-ch-trail button:hover { border-color: #7C3AED; }
.st-ch-trail small { font-size: 11px; font-weight: 500; color: #8B8FA3; }
.st-ch-q h2, .st-ch-res h2 { margin: 2px 0 6px; font-size: 22px; line-height: 1.3; }
.st-ch-help { margin: 0 0 12px; color: #6B7280; }
.st-ch-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin: 12px 0; }
.st-ch-opt { display: flex; gap: 10px; align-items: flex-start; animation: st-ch-in .28s ease both; }
.st-ch-opt:nth-child(2) { animation-delay: .03s; } .st-ch-opt:nth-child(3) { animation-delay: .06s; }
.st-ch-opt:nth-child(4) { animation-delay: .09s; } .st-ch-opt:nth-child(n+5) { animation-delay: .12s; }
.st-ch-opt b { display: block; font-size: 15px; }
.st-ch-opt small { display: block; margin-top: 2px; font-size: 12.5px; color: #6B7280; }
.st-ch-opt:hover:not(:disabled) { background: #FBF9FF; }
.st-ch-res { border-color: #C4B5FD; box-shadow: 0 10px 30px -18px rgba(109, 40, 217, .55); animation: st-ch-in .32s ease both; }
.st-ch-res h2 { font-size: 26px; color: #4C1D95; }
.st-ch-code { position: relative; margin: 12px 0 14px; }
.st-ch-code pre { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--px-code, #1E1B2E); color: #EDE9FE; overflow-x: auto;
  font: 500 13px/1.55 var(--px-mono); }
.st-ch-copy { position: absolute; top: 8px; right: 8px; padding: 4px 10px !important; font-size: 12px !important; }
.st-ch-res .st-when__box p { margin: 0; line-height: 1.5; }
.st-ch-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.st-ch-acts .px-cta { margin: 0; }
.st-ch-soon { font-size: 14px; color: #6B7280; }
.st-ch-all { margin-top: 26px; padding: 12px 16px; border-radius: 14px; border: 1px solid #E5E7EB; background: #fff; }
.st-ch-all summary { cursor: pointer; font-weight: 700; color: #4C1D95; }
.st-ch-all ul { list-style: none; margin: 12px 0 0; padding: 0; columns: 2 260px; column-gap: 24px; }
.st-ch-all li { display: flex; gap: 10px; padding: 4px 0; break-inside: avoid; font-size: 14px; }
.st-ch-n { font: 700 12px var(--px-mono); color: #A78BFA; min-width: 2ch; padding-top: 2px; }
@keyframes st-ch-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .st-ch-res .st-when__grid { grid-template-columns: 1fr; } }
.st-ch-code pre code { display: block; background: none !important; color: inherit !important; padding: 0 !important; font: inherit; white-space: pre; }
