/* Keep the theme's course flex item shrinkable around intrinsically wide tables. */
body.single-sfwd-courses main.prism-bg > .container.learndash-wrapper {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Coach styles affect both theme navigation and padded footer containers. */
body.single-sfwd-courses .container,
body.single-sfwd-lessons .container,
body.single-sfwd-topic .container {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

/* Native focus mode already supplies course, progress and account navigation.
   The site's additional fixed header otherwise covers those controls. */
body.ld-in-focus-mode:has(.ld-focus) .tess-modern-header {
    display: none;
}

/* Quotes and example prompts. Block themes style core/quote only when a quote block renders,
   so classic lessons need these rules to show a quote as a quote. */
.learngen-quote,
body.single-sfwd-courses blockquote.wp-block-quote,
body.single-sfwd-lessons blockquote.wp-block-quote,
body.single-sfwd-topic blockquote.wp-block-quote {
    margin: 1.25rem 0;
    padding: 0.75rem 1rem 0.75rem 1.25rem;
    border-left: 4px solid #2563eb;
    border-radius: 0 0.5rem 0.5rem 0;
    background-color: #f8fafc;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

.learngen-quote > :first-child { margin-top: 0; }
.learngen-quote > :last-child { margin-bottom: 0; }

.learngen-quote ul {
    list-style: disc;
    padding-left: 1.5rem;
}

.learngen-quote ol {
    list-style: decimal;
    padding-left: 1.5rem;
}

/* Refresher and go-deeper layers carry their own inline look; keep keyboard focus visible. */
details.learngen-layer > summary:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Interactive explainers (assets/explainer.js): controls the runtime adds under the chart or diagram. */
.learngen-explainer-panel {
    margin: 0.75rem 0 0;
    padding: 0.75rem;
    border: 1px solid #dbe3ec;
    border-radius: 0.75rem;
    background-color: #f8fafc;
    box-sizing: border-box;
}
.learngen-explainer-input {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-weight: 600;
}
.learngen-explainer-input-value,
.learngen-explainer-output dd {
    font-variant-numeric: tabular-nums;
}
.learngen-explainer-input-value { font-weight: 400; }
.learngen-explainer-inputs input[type="range"] {
    width: 100%;
    min-height: 44px;
    accent-color: #2563eb;
}
.learngen-explainer-outputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.learngen-explainer-output {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dbe3ec;
    border-radius: 0.5rem;
    background-color: #ffffff;
}
.learngen-explainer-output dt { font-size: 0.875rem; color: #334155; }
.learngen-explainer-output dd { margin: 0; font-size: 1.25rem; font-weight: 700; }
.learngen-explainer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.learngen-explainer-panel button {
    min-height: 44px;
    padding: 0.5rem 1rem;
    border: 1px solid #2563eb;
    border-radius: 0.5rem;
    background-color: #ffffff;
    color: #1d4ed8;
    font-weight: 600;
    cursor: pointer;
}
.learngen-explainer-panel button[aria-pressed="true"] { background-color: #2563eb; color: #ffffff; }
.learngen-explainer-panel button:disabled { opacity: 0.45; cursor: default; }
.learngen-explainer-panel button:focus-visible,
.learngen-explainer-coach:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
/* A step-through or tap-to-explain diagram can be taller than a phone screen: its panel stays in view. */
[data-learngen-explainer="step-through"] .learngen-explainer-panel,
[data-learngen-explainer="tap-to-explain"] .learngen-explainer-panel {
    position: sticky;
    bottom: 0.5rem;
    z-index: 1;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.12);
}
.learngen-explainer-indicator { margin: 0; font-weight: 600; }
.learngen-explainer-text { margin: 0.5rem 0; }
.learngen-explainer-coach { display: table; margin-top: 0.75rem; font-weight: 600; }
.learngen-explainer-stepping .diagram-node { opacity: 0.4; transition: opacity 0.2s; }
.learngen-explainer-stepping .diagram-node.learngen-explainer-current { opacity: 1; }
.learngen-explainer-current rect { stroke: #1d4ed8; stroke-width: 4; }
/* Focus scrolling keeps a part above the pinned panel. */
.learngen-explainer-target { cursor: pointer; scroll-margin-bottom: 45vh; }
.learngen-explainer-target:focus { outline: none; }
.learngen-explainer-target:hover rect,
.learngen-explainer-target:focus-visible rect { stroke: #1d4ed8; stroke-width: 3; }
@media (prefers-reduced-motion: reduce) {
    .learngen-explainer-stepping .diagram-node { transition: none; }
}

/* Divi wraps focus-mode content in #et-boc, a flex item of .ld-focus that would not shrink below the
   focus header's previous and next buttons: on a phone every lesson was laid out 960px wide and cut off
   at the right edge (beyond-machine.com, 2026-10-30). The wrapper, the header and its buttons shrink. */
.ld-focus > #et-boc,
.ld-focus .ld-focus-main,
.ld-focus .ld-focus-header .ld-content-actions,
.ld-focus .ld-focus-header .ld-content-action,
.ld-focus .ld-focus-header .ld-content-action .ld-button {
    min-width: 0;
    max-width: 100%;
}

.ld-focus .ld-focus-header .ld-content-action .ld-button {
    white-space: normal;
}

/* A formula wider than the lesson column scrolls in its own box instead of widening the page:
   displayed formulas, and inline ones, which cannot wrap. */
.learngen-math,
span.katex {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

span.katex {
    display: inline-block;
    vertical-align: middle;
}

/* A side-by-side diagram's columns wrap rather than shrink below their drawing's width, so labels keep
   their size: three 280px columns in beyond-machine.com's 754px column were scaled to 243px, a 16px
   label to 13.9px (2026-10-30). The renderer's inline flex-basis is 220px; columns are drawn at 280px
   (300px in earlier renderers), and max-width keeps each at its own width. */
.learngen-visual-diagram-container[data-learngen-layout="side-by-side"] > .learngen-diagram-column {
    flex-basis: 300px !important;
}

/* A long identifier in prose, such as a module path in a link or inline code, breaks rather than
   widening the page on a phone (beyond-machine.com, 2026-10-30: "statsmodels.stats.weightstats.CompareMeans"). */
body.single-sfwd-courses :is(p, li, dd, figcaption) :is(code, a),
body.single-sfwd-lessons :is(p, li, dd, figcaption) :is(code, a),
body.single-sfwd-topic :is(p, li, dd, figcaption) :is(code, a) {
    overflow-wrap: anywhere;
}


/* Divi resets every list to no markers and every heading to no margin, and puts them back only inside
   its own modules, which LearnDash content is not in: on beyond-machine.com a lesson's bullets and a
   module page's numbered lesson list showed as plain lines, and headings sat on the paragraph above
   (2026-11-01). Lesson lists and headings get theirs back; LearnDash's own lists carry classes. */
body.et_divi_theme .ld-tab-content :is(ul, ol):is(:not([class]), .wp-block-list) {
    margin: 0 0 1em;
    padding-left: 1.5em;
}
body.et_divi_theme .ld-tab-content ul:is(:not([class]), .wp-block-list) { list-style-type: disc; }
body.et_divi_theme .ld-tab-content ol:is(:not([class]), .wp-block-list) { list-style-type: decimal; }
body.et_divi_theme .ld-tab-content :is(ul, ol) ul:not([class]) { list-style-type: circle; }
body.et_divi_theme .ld-tab-content :is(ul, ol):is(:not([class]), .wp-block-list) > li { margin: 0.35em 0; }
body.et_divi_theme .ld-tab-content :is(ul, ol) :is(ul, ol):not([class]) { margin: 0.35em 0 0; }
body.et_divi_theme .ld-tab-content :is(h2, h3, h4):not(:first-child) { margin-top: 1.4em; }

/* Term tooltips (src/utils/termTips.ts): a dotted term opens its definition. With assets/term-tips.js
   the definition opens on hover, focus or tap and is placed inside the screen; without it, on hover and
   focus below the term; without this stylesheet it reads in brackets after the term. */
.learngen-term {
    position: relative;
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    cursor: help;
}
.learngen-term:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 2px;
}
.learngen-term-paren { display: none; }
.learngen-term-tip {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 0.4rem);
    z-index: 1000;
    width: max-content;
    max-width: min(18rem, calc(100vw - 1.5rem));
    padding: 0.55rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background-color: #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    font-size: 0.9rem;
    font-weight: 400;
    font-style: normal;
    line-height: 1.45;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    white-space: normal;
    cursor: auto;
}
html:not(.learngen-terms-js) .learngen-term:hover > .learngen-term-tip,
html:not(.learngen-terms-js) .learngen-term:focus > .learngen-term-tip { display: block; }
html.learngen-terms-js .learngen-term > .learngen-term-tip { position: fixed; top: 0; left: 0; }
html.learngen-terms-js .learngen-term.is-open > .learngen-term-tip { display: block; }

/* Data plots (packages/renderer/src/dataPlots.ts) are drawn wide and narrow: an SVG scales its text with
   it, so on a phone the narrow drawing shows and tick labels keep their size. Without this stylesheet the
   wide drawing shows. Stepped plots get their buttons from assets/plot-steps.js. */
@media (max-width: 600px) {
    .learngen-plot-svg-wide { display: none !important; }
    .learngen-plot-svg-narrow { display: block !important; }
}
.learngen-plot-steps-panel { margin-top: 0.75rem; }
