/* Site adapter: the reusable stylesheet does not depend on Material. */
.md-content .jj-widget {
 --jj-fg: var(--md-default-fg-color);
 --jj-bg: var(--md-default-bg-color);
 --jj-muted: var(--md-default-fg-color--light);
 --jj-font: var(--md-text-font-family);
}
[data-md-color-scheme="slate"] .jj-widget {
 --jj-c1: #6bbbd5; --jj-c2: #ed93ac; --jj-c3: #e5b65e; --jj-c4: #b9a5e5;
}

/* The Interactive page uses the full width; other pages never load this file. */
.md-grid { max-width: 84rem; }
.md-content { min-width: 0; }
.md-content__inner { margin: 0 1rem; }
.jj-demo { margin: 1.5rem 0 3rem; scroll-margin-top: 6rem; }
.jj-demo-heading { position: relative; }
.md-typeset .jj-demo-heading h2 { margin: 0 9rem .35rem 0; font-size: 1.25rem; }
.md-typeset .jj-demo-heading p { margin: .35rem 0; font-size: .72rem; line-height: 1.45; }
.md-typeset .jj-demo-heading p:last-child { position: absolute; right: 0; top: 0; margin: 0; }
.md-content .jj-widget {
 --jj-plot-height: clamp(240px, 40vh, 380px);
 display: grid; grid-template-columns: 190px minmax(0, 1fr);
 gap: .8rem; align-items: start; padding: .8rem; margin-top: .6rem;
 font-size: .72rem;
}
.jj-toolbar { position: sticky; top: 6rem; z-index: 3; min-width: 0; background: var(--jj-bg); }
.jj-toolbar .host-controls { gap: .35rem; margin: 0 0 .7rem; }
.jj-toolbar button { font-size: .7rem; }
.jj-toolbar .jj-controls, .jj-toolbar .jj-controls.row { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.jj-toolbar .jj-slider { min-width: 0; line-height: 1.25; }
.jj-toolbar input[type=range] { margin: .2rem 0 0; }
.jj-widget .jj-plots { min-width: 0; gap: .5rem; }
.jj-widget .jj-plots.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.jj-widget .jj-plots.three { grid-template-columns: .55fr 1fr 1fr; }
.jj-widget .jj-plot-frame { display: flex; align-items: center; justify-content: center; height: var(--jj-plot-height); overflow: clip; }
.jj-widget .jj-plot-frame > svg { width: 100%; height: 100%; max-width: none; min-width: 0; }
.jj-widget[data-widget=transmission] > .jj-plot-panel { grid-column: 2; }
.jj-widget[data-widget=twosums] { grid-template-columns: 190px minmax(0,.8fr) minmax(0,1.2fr); }
.jj-widget .twosums-left, .jj-widget .twosums-right { min-width: 0; }
.jj-widget .explorer-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); min-width: 0; }
.jj-widget .explorer-grid > .sketch { grid-column: 1/-1; }
.jj-widget .explorer-grid > .sketch > svg { width: 100%; height: 75px; }
.jj-widget .explorer-grid > .alpha-cell { grid-column: 1/-1; }
.jj-widget[data-widget=explorer] { --jj-plot-height: clamp(200px, 30vh, 300px); }
.jj-widget .square-body { min-width: 0; }
.jj-widget svg.square-sketch { width: 100%; height: var(--jj-plot-height); max-width: none; }

@media (max-width: 760px) {
 .md-content__inner { margin: 0 .8rem; }
 .jj-demo { scroll-margin-top: 3.2rem; margin: 1.5rem 0 2rem; }
 .md-typeset .jj-demo-heading h2 { margin-right: 0; font-size: 1.1rem; }
 .md-typeset .jj-demo-heading p { font-size: .7rem; }
 .md-typeset .jj-demo-heading p:last-child { position: static; margin-top: .3rem; }
 .md-content .jj-widget, .jj-widget[data-widget=twosums] {
  display: flex; flex-direction: column; gap: .4rem; padding: .5rem;
  --jj-plot-height: 245px;
 }
 .jj-widget > *, .jj-widget .twosums-left, .jj-widget .twosums-right { width: 100%; }
 .jj-toolbar { top: 2.4rem; padding: .4rem 0; border-bottom: 1px solid var(--jj-muted); }
 .jj-toolbar .host-controls { gap: .3rem; margin-bottom: .4rem; }
 .jj-toolbar .host-controls button { padding: .25em .45em; font-size: .65rem; }
 .jj-toolbar .jj-controls, .jj-toolbar .jj-controls.row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .35rem .6rem; }
 .jj-toolbar .jj-slider { font-size: .65rem; }
 .jj-widget[data-widget=twosums] .jj-slider:last-child { grid-column: 1/-1; }
 .jj-widget[data-widget=speed] .jj-controls,
 .jj-widget[data-widget=length] .jj-controls { grid-template-columns: minmax(0,1fr); }
 .jj-toolbar .jj-button { font-size: .65rem; }
 .jj-widget .jj-plots.two, .jj-widget .jj-plots.three, .jj-widget .explorer-grid { grid-template-columns: minmax(0,1fr); }
 .jj-widget .jj-plot-frame { height: auto; aspect-ratio: var(--jj-plot-aspect); max-height: 220px; }
 .jj-widget .explorer-grid > .sketch { grid-column: auto; }
 .jj-widget .explorer-grid > .sketch > svg { height: 45px; }
 .jj-widget .explorer-grid > .sketch .tex-fo { display: none; }
 .jj-widget svg.square-sketch { height: 115px; }
}

/* Keep the site's review launcher available without covering plot labels. */
body .source-comments-controls { position: static; justify-content: flex-end; margin: .5rem 1rem; }
.jj-widget[data-widget=speed] > .alpha-readout { grid-column: 2; }

@media (max-width: 760px) {
 .jj-widget[data-widget=transmission] .axis-label-y { display: none; }
 .jj-widget .jj-mobile-ylabel { display: block; font-size: 14px; padding-left: 1rem; }
}
