:root{color-scheme:dark;color:#fff0d4;background:#142f36;font-family:system-ui,sans-serif}*{box-sizing:border-box}body{margin:0}a{color:#ffe1a2}button,input,select{font:inherit}button,select{background:#25464e;color:#fff0d4;border:1px solid #a1bbba66;padding:10px 14px;border-radius:6px}button{cursor:pointer}button:hover{background:#365c63}a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #f4c46a;outline-offset:4px}[hidden]{display:none!important}header{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:26px 5vw;border-bottom:1px solid #c4d1b622}.brand{font-family:Georgia,serif;font-size:21px;letter-spacing:.18em;text-decoration:none;color:#fff0d4}.brand span{font:11px system-ui;letter-spacing:.04em;display:block;margin-top:8px}.small,.eyebrow,.number{font-size:10px;letter-spacing:.18em;color:#e4c894}.gallery{background:radial-gradient(ellipse at 85% 5%,#54665144,transparent 60%),#142f36}.gallery main{max-width:1120px;margin:auto;padding:65px 5vw 45px}h1,h2{font-family:Georgia,serif;font-weight:normal}h1{font-size:clamp(43px,6vw,74px);letter-spacing:-.04em;line-height:1.04;margin:18px 0}p{line-height:1.7;color:#cbd9d0}.intro{font-size:17px;margin-bottom:40px}.cards{display:grid;grid-template-columns:1fr 1fr;gap:22px}.card{display:flex;flex-direction:column;min-height:290px;border:1px solid #c7ceb344;padding:30px;border-radius:12px;text-decoration:none;color:#fff0d4;background:linear-gradient(145deg,#51674f55,#213d3d)}.card:hover{border-color:#efd49a}.card h2{font-size:34px;margin-bottom:0}.card p{font-size:14px}.card strong{margin-top:auto;padding-top:20px;font-size:13px;color:#f7d99d}.paws{background:linear-gradient(145deg,#89633655,#2b4243)}.scope{max-width:770px;padding-top:34px}.scope h2{font-size:27px}.scope p,.scope a{font-size:13px}footer{padding:24px 5vw;font-size:9px;letter-spacing:.16em;color:#a6bbb7;border-top:1px solid #c4d1b622}.motion header{padding:16px 24px}.motion main{padding:20px 24px;max-width:1500px;margin:auto}.motion h1{font-size:36px;margin:6px 0}.motion .intro{font-size:13px;margin:10px 0 18px}.controls{display:flex;align-items:center;flex-wrap:wrap;gap:12px 22px;padding:14px 0}.controls label{font-size:12px;display:flex;align-items:center;gap:9px}.controls input[type=range]{width:130px}.views{position:relative;border:1px solid #adbfaa55;border-radius:10px;overflow:hidden;background:#9aaba4}#motion-scene{width:100%;height:470px;display:block}.labels{position:absolute;top:14px;left:0;width:100%;display:grid;grid-template-columns:1fr 1fr;pointer-events:none}.labels div{margin:0 16px;background:#16343ce6;padding:10px 14px;border-radius:6px;font-size:13px;width:fit-content}.labels small{display:block;font-size:10px;color:#bccac0;margin-top:5px}.divider{position:absolute;top:0;bottom:0;left:50%;width:1px;background:#e9dfc477;pointer-events:none}.motion details{margin:20px 0;font-size:12px}.motion summary{cursor:pointer}.motion output{display:block;font:11px/1.7 ui-monospace,monospace;white-space:pre-line;color:#cbd9d0}.note{font-size:12px;margin-bottom:0}.error{padding:20px;background:#442f24}#speed-value{min-width:20px}@media(max-width:650px){header{padding:20px}.small{display:none}.gallery main{padding:35px 20px}.cards{grid-template-columns:1fr}.card{min-height:260px}.motion main{padding:18px 12px}.motion h1{font-size:31px}.motion header{padding:16px}.controls{gap:12px}.controls label{font-size:11px}.controls input[type=range]{width:85px}#motion-scene{height:620px}.labels{height:100%;display:block;top:0}.labels div{position:absolute;top:12px;left:0}.labels div+div{top:calc(50% + 12px)}.divider{left:0;right:0;top:50%;bottom:auto;width:auto;height:1px}}
:root .sea{background:linear-gradient(145deg,#3b8b9166,#203d4d)}.gallery .cards{grid-template-columns:repeat(auto-fit,minmax(250px,1fr))}#ocean-scene{width:100%;height:560px;display:block}.ocean-caption{position:absolute;top:20px;left:20px;color:#fff6dd;pointer-events:none;text-shadow:0 2px 7px #122e3c}.ocean-caption span{font-size:10px;letter-spacing:.19em}.ocean-caption small{display:block;font-family:Georgia,serif;font-size:20px;margin-top:7px}@media(max-width:650px){#ocean-scene{height:490px}.ocean-caption{top:14px;left:14px}.ocean-caption small{font-size:17px}}

/* Gallery layout stays scoped so the live motion and ocean studies retain their styles. */
.gallery:not(.family-entry) a,.gallery:not(.family-entry) summary{scroll-margin-block:8px}
.gallery main{max-width:1160px;padding-top:38px}.gallery h1{font-size:clamp(40px,5vw,58px)}.gallery .intro{margin-bottom:28px;font-size:16px}
.study-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:22px;align-items:start}
.study-card{min-width:0;padding:27px;border:1px solid #c7ceb344;border-radius:12px;background:linear-gradient(145deg,#51674f55,#213d3d)}
.study-card h2{font-size:31px;margin:12px 0}.study-card>p{font-size:14px;margin:12px 0 20px}.study-links{display:grid;gap:8px}
.study-open,.study-compare{display:block;width:fit-content;border:1px solid #d4c49966;border-radius:6px;padding:12px 16px;font-size:13px;line-height:1.4;text-decoration:none}
.study-open{width:100%;background:#e9d6ab;color:#193339;font-weight:650}.study-open:hover{background:#fff0d4}.study-open span{float:right}.study-compare:hover{background:#e9d6ab15;border-color:#efd49a}
.study-card .choice-note{font-size:12px;color:#b9cec6;line-height:1.6;margin:16px 0 22px;min-height:39px}
.gallery details{border-top:1px solid #c7ceb32b}.gallery summary{cursor:pointer;min-height:44px;padding:13px 0;font-size:13px;color:#eed7ac}.gallery summary:focus-visible{outline:3px solid #f4c46a;outline-offset:4px}
.gallery details p{font-size:12px;line-height:1.6;margin:3px 0 12px}.comparison-list{list-style:none;padding:0;margin:0 0 14px}.comparison-list li{display:grid;grid-template-columns:1fr 1fr;gap:2px 15px;margin:8px 0 12px}.comparison-list span{grid-column:1/-1;font-size:11px;color:#b9cec6}.comparison-list a,.pursuit-links a{font-size:12px;line-height:1.5;padding:10px 0;display:block}.pursuit-links{list-style:none;padding:0;margin:0 0 12px}
.motion-entry{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:24px 27px;margin-top:22px;background:#8963361c;border:1px solid #c7ceb333;border-radius:12px}.motion-entry h2{font-size:26px;margin:8px 0}.motion-entry p{font-size:13px;margin:0}.motion-entry>a{flex-shrink:0}
.gallery-note{padding:24px 0 0;max-width:800px}.gallery-note h2{font-size:23px;margin:8px 0}.gallery-note p,.gallery-note a{font-size:12px}.gallery-note details{margin-top:16px}
@media(max-width:700px){.study-grid{grid-template-columns:1fr}.gallery main{padding:30px 20px}.study-card{padding:22px}.study-card .choice-note{min-height:0}.motion-entry{align-items:flex-start;flex-direction:column;padding:22px;gap:18px}.gallery h1{font-size:42px}}

/* Ocean controls reveal comparisons without changing any scene dimensions. */
.raft-walk-controls[hidden]{display:none}
.ocean.walking #ocean-scene{height:clamp(160px,60dvh,560px)}
.ocean.mouth-sample #ocean-scene{height:clamp(160px,60dvh,560px)}
@media(max-height:360px){.ocean.mouth-sample #ocean-scene{height:160px}.ocean.mouth-sample .ocean-caption{top:6px;left:8px}.ocean.mouth-sample .ocean-caption small{display:none}}
.raft-directions{display:flex;gap:6px;max-width:360px;margin:10px 0 20px}
.raft-directions button{flex:1;min-height:48px;min-width:0;padding:10px 6px;font-size:14px;touch-action:none;user-select:none}
.raft-directions button.pressed{background:#62795a;border-color:#ffe1a2}
#ocean-scene:focus-visible{outline:3px solid #f4c46a;outline-offset:-4px}
@media(max-height:360px){.ocean.walking #ocean-scene{height:120px}.ocean.walking .ocean-caption{top:6px;left:8px}.ocean.walking .ocean-caption small{display:none}}
.ocean .ocean-controls{gap:10px 16px;padding:6px 0 14px}
.ocean #ocean-comparisons{margin:0}
.ocean #ocean-comparisons[open]{flex-basis:100%}
.ocean #ocean-comparisons>summary{min-height:44px;padding:13px 12px;border:1px solid #a1bbba66;border-radius:6px;color:#ffe1a2;width:fit-content}
.ocean summary:focus-visible{outline:3px solid #f4c46a;outline-offset:4px}
.ocean .ocean-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:14px 12px;padding:16px 0 2px}
.ocean .ocean-options label{min-width:0;flex-direction:column;align-items:stretch;gap:5px}
.ocean .ocean-options select{width:100%;min-width:0;min-height:44px}

/* Failed studies keep recovery visible while scene controls are unavailable. */
.motion .error{position:fixed;z-index:10;top:50%;left:50%;transform:translate(-50%,-50%);width:min(460px,calc(100% - 32px));max-height:calc(100dvh - 32px);overflow:auto;padding:24px;border:1px solid #e4c894;border-radius:10px;box-shadow:0 12px 60px #081d26aa}
.motion .error p{margin:0 0 18px;color:#fff0d4;font-size:15px;line-height:1.5}
.motion .error button{min-height:44px}
.motion .controls :disabled{opacity:.5;cursor:default}

/* Keep motion-study entry compact while retaining every comparison control. */
.motion-study .motion-controls{gap:10px 16px;padding:6px 0 14px}
.motion-study .motion-controls>button{min-height:44px}
.motion-study #motion-comparisons{margin:0}
.motion-study #motion-comparisons[open]{flex-basis:100%}
.motion-study #motion-comparisons>summary{min-height:44px;padding:13px 12px;border:1px solid #a1bbba66;border-radius:6px;color:#ffe1a2;width:fit-content}
.motion-study #motion-comparisons>summary:focus-visible{outline:3px solid #f4c46a;outline-offset:4px}
.motion-study .motion-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:14px 12px;padding:16px 0 2px}
.motion-study .motion-options label{min-width:0;flex-wrap:wrap;gap:5px 9px}
.motion-study .motion-options select{width:100%;min-width:0;min-height:44px}
.motion-study .motion-options input[type=range]{flex:1;min-width:50px}

/* Captions sit below the cats; their arrangement follows the rendered view width. */
.motion-study .views{container-type:inline-size}
.motion-study .labels{inset:auto 0 12px;height:auto;display:grid;grid-template-columns:1fr 1fr}
.motion-study .labels>div{position:static;display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 8px;margin:0 12px;padding:6px 10px;max-width:calc(100% - 24px);font-size:12px}
.motion-study .labels small{margin:0;font-size:10px}
.motion-study .divider{top:0;bottom:0;left:50%;right:auto;width:1px;height:auto}
@container (width < 650px){
 .motion-study .labels{inset:0;height:100%;display:block}
 .motion-study .labels>div{position:absolute;top:auto;bottom:calc(50% + 10px);left:0}
 .motion-study .labels>div+div{top:auto;bottom:10px}
 .motion-study .divider{left:0;right:0;top:50%;bottom:auto;width:auto;height:1px}
}

/* Give the gallery description its own row before three actions become cramped. */
@media(min-width:701px) and (max-width:900px){
 .gallery .motion-entry{flex-wrap:wrap;justify-content:flex-start;gap:18px 24px}
 .gallery .motion-entry>div{flex:0 0 100%}
}

/* Keep direct family and chase links together in the two study headers. */
.motion header .study-pages{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px 16px}
.motion header .study-pages a{display:grid;align-items:center;min-height:44px;font-size:13px;line-height:1.4}

/* Manual chapter-two sample continuation; for reachable keyboard and touch controls. */
#raft-route-controls button{min-height:44px}
#raft-route-controls a{display:inline-flex;align-items:center;min-height:44px;padding:10px 14px;border:1px solid #a1bbba66;border-radius:6px}
#raft-route-controls:has(>[hidden]:first-child):has(>[hidden]:last-child){display:none}

/* Raft pounce remains reachable as a keyboard and touch action. */
.ocean #raft-pounce{min-height:48px;touch-action:manipulation}
.ocean #raft-pounce:disabled{opacity:.5;cursor:default}

/* Keep the raft visible when a direction button receives focus or scrolls into view. */
.ocean.walking [data-raft-direction]{scroll-margin-block-start:calc(clamp(160px,60dvh,560px) + 12px);scroll-margin-block-end:8px}
@media(max-height:360px){.ocean.walking [data-raft-direction]{scroll-margin-block-start:132px}}

/* Keep the scene, directions and existing raft actions together during play. */
.ocean.walking:not(.shark-dodge) .raft-directions{margin-bottom:6px}
.ocean.walking .raft-actions{display:flex;gap:6px;max-width:360px}
.ocean.walking .raft-actions button{flex:1;min-width:0;min-height:48px;padding:10px 6px;font-size:14px}
.ocean.walking .raft-actions button{scroll-margin-block-start:calc(clamp(160px,60dvh,560px) + 66px);scroll-margin-block-end:6px}
.ocean.walking:not(.shark-dodge) [data-raft-direction]{scroll-margin-block-end:60px}
@media(max-height:360px){.ocean.walking .raft-actions button{scroll-margin-block-start:186px}}
