/* Paragraph walkthrough. Applied only after the guide mounts. */
.wg-on .article-header + .hero { display:none }
.wg-on { --wg-top:max(18px,env(safe-area-inset-top,0px)) }
.wg-on .reading-layout { display:grid; grid-template-columns:minmax(0,1.42fr) minmax(320px,1fr); gap:24px 30px; align-items:start; padding:20px clamp(22px,4vw,54px) 28px }
.wg-on .reading-layout > .article-body {grid-area:1 / 1}
.wg-rail { grid-area:1 / 2; align-self:start; position:sticky; top:var(--wg-top); z-index:3; min-width:0; display:flex; flex-direction:column; gap:16px; max-height:calc(100dvh - var(--wg-top) - 12px) }
.wg-slot { min-width:0; flex:none }
.wg-rail > .sidebar { min-height:0; overflow:auto; overscroll-behavior:contain }
.wg.wg-docked { position:fixed; left:var(--wg-left); top:var(--wg-top); width:var(--wg-width); max-height:var(--wg-height); z-index:10; overscroll-behavior:contain }
.wg { box-sizing:border-box; background:#122d34; color:#f4f3e8; border:2px solid #264b4e; border-radius:12px; box-shadow:0 6px 18px #0b253033; max-height:calc(100vh - 32px); font:500 16px/1.35 system-ui,sans-serif; }
.wg *, .wg *::before, .wg *::after {box-sizing:border-box}
.wg [hidden] {display:none!important}
.wg-head { padding:9px 13px; display:flex; justify-content:space-between; align-items:center; gap:8px; background:#22434a; }
.wg-head strong {font-size:14px;letter-spacing:.01em}
.wg button,.wg select {min-height:36px; border:1px solid #8ca9a6; border-radius:6px; font:600 14px/1.1 system-ui,sans-serif; color:#f3f3e8; background:#1d3e44; padding:6px 10px; cursor:pointer; text-transform:none; letter-spacing:normal;box-shadow:none}
.wg button:disabled {opacity:.45;cursor:default}
.wg button:focus-visible,.wg select:focus-visible {outline:3px solid #ffd18a;outline-offset:2px}
.wg header button {min-height:32px}
.wg-title {padding:14px 15px 0;display:flex;align-items:baseline;gap:9px}
.wg-title output {white-space:nowrap;color:#aeded0;font:600 13px/1.3 Consolas,monospace}
.wg-title b {font-size:clamp(16px,1.5vw,22px); line-height:1.1}
.wg-graphic {display:block; width:100%; height:auto;max-height:210px;font:500 16px/1.2 system-ui,sans-serif}
.wg .wg-caption {margin:0;padding:4px 15px 8px;color:#eef2ea;font:500 15px/1.4 system-ui,sans-serif; min-height:51px}
.wg-nav,.wg-experiment {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 13px 12px}
.wg-experiment {justify-content:flex-start;flex-wrap:wrap;padding:3px 13px 6px}
.wg-experiment label {font-size:14px}
.wg .wg-next,.wg-experiment button {background:#a8eacb;color:#163631;border-color:#a8eacb}
.wg p,.wg h2 {color:inherit}
.wg-on .wg-current {position:relative}
.wg-current::before {content:'';position:absolute;top:0;bottom:0;left:-8px;border-left:3px solid #36746a}


@media(max-width:820px) {
 .wg-on {--wg-top:max(12px,env(safe-area-inset-top,0px))}
 .wg-on .reading-layout {display:flex;flex-direction:column;gap:16px;padding:12px clamp(12px,4vw,28px) 24px}
 .wg-rail {display:contents}
 .wg-slot {position:sticky;top:var(--wg-top);align-self:stretch;order:-1;z-index:3}
 .wg-slot > .wg {max-height:49svh}
 .wg-slot > .wg-docked {top:var(--wg-top);max-height:min(49svh,var(--wg-height))}
 .wg-on .reading-layout > .article-body {order:0;align-self:stretch}
 .wg-rail > .sidebar {order:1;align-self:stretch;overflow:visible}
 .wg-head {padding:6px 12px}.wg-title {padding:7px 12px 0}
 .wg-graphic {height:clamp(84px,17svh,150px)}
 .wg .wg-caption {font-size:14px;line-height:1.25;padding:1px 12px 5px;min-height:0}
 .wg-nav {padding:3px 10px 7px}.wg-experiment {padding:2px 10px}
 .wg button,.wg select {min-height:36px}.wg header button {min-height:32px}
}
@media (max-height:510px) and (max-width:820px) {
 .wg-slot > .wg-docked {max-height:min(52svh,var(--wg-height))}
 .wg-graphic {height:78px}
}

@media print {.wg{display:none!important}.wg-on .reading-layout{display:block}.wg-on .wg-current{padding:0;box-shadow:none}.wg-on .article-header + .hero{display:block}}








/* Keep a usable picture and transport on short phones. */
@media(max-width:650px) {
 .wg-listening #floating-listener {bottom:max(8px,env(safe-area-inset-bottom));right:10px;max-width:calc(100vw - 20px)}
 .wg-listening #floating-listener.on-left {left:10px;right:auto}
 .wg-listening #article-reader:not([hidden]) {width:min(320px,calc(100vw - 20px));max-width:none;display:grid;grid-template-columns:76px 1fr;align-items:end;gap:4px}
 .wg-listening #reader-character {width:72px;height:62px;grid-area:1/1;margin:0}
 .wg-listening #reader-character img {width:46px;height:46px;margin:auto}
 .wg-listening #article-reader > .reader-launchers {grid-area:1/2;width:auto;justify-content:flex-end;margin:0}
 .wg-listening #reader-controls {grid-area:2/1/span 1/span 2;max-height:26dvh;overflow:auto}
}
@media(min-width:550px) and (orientation:landscape) and (max-height:550px) {
 .wg-listening #floating-listener {left:12px;right:auto}
}

@media(min-width:550px) and (max-width:820px) and (orientation:landscape) and (max-height:550px) {
 .wg-slot > .wg-docked {left:auto;right:8px;width:min(48vw,370px);max-height:calc(100dvh - var(--wg-top) - 8px)}
 .wg-listening #article-reader:not([hidden]) {max-width:42vw}
}

.wg-graphic { aspect-ratio:344 / 154; object-fit:contain; min-height:0 }
.wg.wg-docked {display:flex;flex-direction:column}
.wg-docked #wg-body {display:flex;flex-direction:column;min-height:0}
.wg-docked .wg-graphic {flex:0 1 auto;min-height:0}
.wg-docked .wg-head,.wg-docked .wg-title,.wg-docked .wg-caption,.wg-docked .wg-nav,.wg-docked .wg-experiment {flex:none}
.wg-tight .wg-title {padding:7px 12px 0}
.wg-tight .wg-caption {min-height:0;font-size:14px;padding:2px 12px 5px}
.wg-tight .wg-head,.wg-tight .wg-nav,.wg-tight .wg-experiment {padding:4px 10px}



/* Expanded captions share the available height with the drawing. */
@media(min-width:651px) and (min-height:551px) {
 .wg-listening:has(#reader-caption:not([hidden])) #reader-character {width:96px;height:96px}
 .wg-listening:has(#reader-caption:not([hidden])) #reader-character img {width:72px;height:72px;margin:auto}
}
