/* Scoped to the new slide; existing scene layout and scrolling are untouched. */
.microstructure-slide{position:relative;isolation:isolate;display:flex;align-items:center;padding:10svh 9% 10svh 7%;background:#070b0e}
.microstructure-visual{position:absolute;inset:0;z-index:-2;pointer-events:none;overflow:hidden;background:#070b0e url('/assets/tem/hrtem-illustrated-v1.png') center/cover no-repeat}
.microstructure-visual canvas{width:100%;height:100%;display:block;opacity:0}
[data-journey-state=ready][data-journey-motion=full] .microstructure-visual canvas{opacity:1}
.microstructure-slide::after{content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(90deg,#070b0ef5 0%,#070b0ed9 24%,#070b0e70 42%,#070b0e12 68%),linear-gradient(0deg,#070b0ebb,transparent 30%,transparent 80%,#070b0e66)}
.microstructure-copy{max-width:38%;position:relative}
.microstructure-copy .eyebrow{color:var(--gold);font-size:12px;letter-spacing:.17em}
.microstructure-copy h2{font:400 clamp(36px,4.4vw,68px)/1.08 var(--display);letter-spacing:-.035em;margin:22px 0}
.microstructure-copy h2 em{font-family:Georgia,serif;font-weight:400;color:#cbbf9e}
.microstructure-copy p:not(.eyebrow){color:#c7ced2;font-size:clamp(17px,1.4vw,21px);line-height:1.75}
.journey-debug{position:absolute;bottom:24px;left:7%;width:min(560px,80%);z-index:4;padding:12px 16px;background:#060a0fec;border:1px solid #7c909a66;font:12px/1.5 var(--sans);color:#d0d8dc}
.journey-debug strong{font-weight:500;letter-spacing:.03em}.journey-debug output{display:block;white-space:pre-line;font:11px/1.6 monospace;margin:5px 0}
.journey-debug button{border:1px solid #7c909a88;background:transparent;color:#edf0f2;font:inherit;padding:5px 12px;margin:2px 8px 8px 0;cursor:pointer;min-height:32px}
.journey-debug label{display:flex;align-items:center;gap:12px}.journey-debug input{flex:1;min-width:60px;accent-color:#c4b695}.journey-debug button:focus-visible,.journey-debug input:focus-visible{outline:2px solid white;outline-offset:3px}
@media(max-width:700px){.microstructure-slide{padding:75px 55px 200px 6%;align-items:flex-start}.microstructure-copy{max-width:100%}.microstructure-copy h2{font-size:38px;margin:18px 0}.microstructure-copy p:not(.eyebrow){font-size:16px;max-width:30ch}.microstructure-slide::after{background:linear-gradient(180deg,#070b0eef,#070b0e99 44%,#070b0e22 70%,#070b0e99)}.journey-debug{left:6%;bottom:74px;max-width:calc(100% - 85px)}.journey-debug output{font-size:10px}.journey-debug label{display:block}.journey-debug input{width:100%}}
/* Narrative demo: the existing scene and camera remain unchanged. */
.microstructure-slide{background:#000}
.microstructure-slide::after{background:radial-gradient(ellipse at 0% 48%,#000c,transparent 67%)}
.microstructure-copy.narrative-host{max-width:none;width:min(650px,56%);z-index:2;padding:0;max-height:calc(100svh - 180px);overflow:auto;scrollbar-width:thin}
.journey-blackout{position:absolute;inset:0;background:#000;z-index:1;pointer-events:none}
.microstructure-slide[data-narrative-mode=intro] .microstructure-visual{background:#000}
.journey-caption{transform-origin:left center;min-height:180px}
.microstructure-copy .caption-primary{font:400 clamp(30px,3.6vw,54px)/1.14 var(--display)!important;letter-spacing:-.04em;color:#f7f6f2!important;margin:0;max-width:24ch;text-shadow:0 2px 22px #0005}
.caption-primary em{font-family:Georgia,serif;color:var(--gold);font-weight:400}
.microstructure-copy .caption-secondary{font-size:clamp(17px,1.5vw,22px)!important;line-height:1.6!important;max-width:48ch;margin:28px 0 0}
.microstructure-copy .caption-eyebrow{font-size:14px!important;color:#ddd!important;margin:0 0 22px;line-height:1.6!important}
.microstructure-copy .caption-aside{font:italic 19px/1.5 Georgia!important;color:#d3bd90!important;margin-top:22px}
.caption-eyebrow:empty,.caption-secondary:empty,.caption-aside:empty{display:none}
.caption-primary[data-typing=true]:after{content:'';display:inline-block;width:1px;height:.8em;background:#e9d8a9;margin-left:7px;animation:narrative-cursor 1.05s steps(1) infinite}
@keyframes narrative-cursor{0%,50%{opacity:.85}51%,100%{opacity:0}}
[data-narrative-paused=true] .caption-primary:after{animation-play-state:paused}
.journey-summary h2{font-size:clamp(32px,3.4vw,52px);margin-top:0;max-width:23ch}
.microstructure-copy .journey-summary p{font-size:clamp(16px,1.3vw,19px);line-height:1.65;margin:18px 0;max-width:52ch}
.microstructure-copy .journey-summary .journey-relation{color:#e0c78b;font-size:14px;margin-top:26px}
.microstructure-copy .journey-summary .journey-technical{color:#a7b3ba;font-size:12px;line-height:1.8;margin-top:22px}
[data-narrative-mode=summary]::after{background:radial-gradient(ellipse at 5% 45%,#000e,transparent 80%)}
.journey-scale{position:absolute;right:7%;bottom:83px;z-index:2;white-space:pre-line;text-align:right;font:10px/1.8 var(--sans);letter-spacing:.06em;color:#a0b0b9}
.journey-debug{z-index:5;width:min(560px,75%);padding:10px 14px;background:#070a0de8;border-color:#ffffff26}
.journey-debug>summary{cursor:pointer;list-style:none;font-size:11px;color:#aebbc1}
.journey-debug[open]>summary{margin-bottom:8px}.journey-debug[open]{box-shadow:0 4px 30px #0008}
@media(max-width:700px){
 .microstructure-slide{align-items:center;padding:75px 52px 125px 6%}
 .microstructure-copy.narrative-host{width:100%;max-height:calc(100svh - 210px)}
 .microstructure-copy .caption-primary{font-size:clamp(28px,7.5vw,38px)!important;line-height:1.18!important}
 .microstructure-copy .caption-secondary{font-size:17px!important;margin-top:24px;line-height:1.55!important}
 .journey-summary h2{font-size:32px;margin-top:0}
 .microstructure-copy .journey-summary p{font-size:15px;line-height:1.6;max-width:none}
 .microstructure-copy .journey-summary .journey-relation{font-size:13px}
 .journey-scale{right:52px;bottom:120px;font-size:9px}
 .journey-debug{bottom:60px;left:6%}
 .microstructure-slide::after{background:radial-gradient(ellipse at 15% 42%,#000d,transparent 100%)}
}
@media(prefers-reduced-motion:reduce){.caption-primary:after{animation:none}}
.journey-debug select{max-width:100%;display:block;margin:4px 0 12px;background:#101820;color:#dce4e8;border:1px solid #ffffff35;padding:6px 10px;font:12px var(--sans)}
.journey-debug select:focus-visible{outline:2px solid white;outline-offset:3px}

/* Local molten/solid study: imagery fills the entire existing slide. */
[data-thermal-stage]:not([data-thermal-stage=off]) .journey-scale{display:none}
[data-thermal-stage]:not([data-thermal-stage=off])::after{background:radial-gradient(ellipse at 0% 48%,#000b,transparent 66%)}
[data-captions-hidden=true] .narrative-host{visibility:hidden}
[data-captions-hidden=true]::after{opacity:0}
[data-thermal-stage] .microstructure-copy .caption-primary{text-shadow:0 2px 24px #0008}

.microstructure-slide[data-journey-motion=reduced] .microstructure-visual{background-image:url(/assets/optical/extended/br-10x-4.png)}
[data-optical-stage]:not([data-optical-stage=off])::after{background:radial-gradient(ellipse at 0% 48%,#000e 0%,#0009 35%,transparent 76%)}
[data-optical-stage]:not([data-optical-stage=off]) .journey-scale{display:block;color:#fff;text-shadow:0 1px 5px #000,0 1px 12px #000;font-size:11px}
[data-optical-stage] .journey-scale[hidden]{display:none}
[data-optical-stage]:not([data-optical-stage=off])[data-captions-hidden=true]::after{opacity:0}

/* A full microscope field stays legible without cropping away its edges. */
.microstructure-slide[data-journey-motion=reduced] .microstructure-visual{background-size:cover;background-position:center;background-color:#080c10}
@media(max-aspect-ratio:4/5){
 [data-optical-stage]:not([data-optical-stage=off]) .narrative-host{align-self:flex-start;margin-top:2svh}
 [data-optical-stage]:not([data-optical-stage=off]) .caption-primary{font-size:clamp(26px,6.9vw,34px)!important;line-height:1.14!important}
 [data-optical-stage]:not([data-optical-stage=off]) .caption-secondary{font-size:16px!important;margin-top:18px!important;line-height:1.5!important}
 [data-optical-stage]:not([data-optical-stage=off])::after{background:radial-gradient(ellipse 95% 47% at 22% 21%,#000d 0%,#000a 48%,#0005 74%,transparent 100%)}
}

@media(max-aspect-ratio:4/5){.microstructure-slide[data-journey-motion=reduced] .microstructure-visual{background-image:url(/assets/optical/extended/br-10x-4-portrait.png)}}

/* The EBSD map keeps a clear field to the right of the narrative. */
[data-ebsd-stage]:not([data-ebsd-stage=off])::after{background:radial-gradient(ellipse at 0% 48%,#000e 0%,#0009 35%,transparent 76%)}
[data-ebsd-stage]:not([data-ebsd-stage=off]) .journey-scale{display:block;color:#fff;text-shadow:0 1px 5px #000,0 1px 12px #000;font-size:10px}
[data-ebsd-stage] .journey-scale[hidden]{display:none}
[data-ebsd-stage]:not([data-ebsd-stage=off])[data-captions-hidden=true]::after{opacity:0}
.microstructure-slide[data-journey-motion=reduced] .microstructure-visual{background-image:url(/assets/ebsd/ipf-wide-v1.png)}
.microstructure-slide[data-narrative-mode=summary]::after{background:radial-gradient(ellipse 85% 100% at 0% 45%,#000f 0%,#000d 40%,#0008 64%,transparent 100%)}
@media(max-aspect-ratio:4/5){
 [data-ebsd-stage]:not([data-ebsd-stage=off]) .narrative-host{align-self:flex-start;margin-top:2svh}
 [data-ebsd-stage]:not([data-ebsd-stage=off]) .caption-primary{font-size:clamp(26px,6.9vw,34px)!important;line-height:1.14!important}
 [data-ebsd-stage]:not([data-ebsd-stage=off]) .caption-secondary{font-size:16px!important;margin-top:18px!important;line-height:1.5!important}
 [data-ebsd-stage]:not([data-ebsd-stage=off])::after{background:radial-gradient(ellipse 95% 47% at 22% 21%,#000d 0%,#000a 48%,#0005 74%,transparent 100%)}
 .microstructure-slide[data-narrative-mode=summary]::after{background:radial-gradient(ellipse 110% 75% at 25% 32%,#000f 0%,#000d 48%,#0008 78%,transparent 100%)}
}

/* SEM-inspired imagery keeps full-screen proportions and local text contrast. */
[data-sem-stage]:not([data-sem-stage=off])::after{background:radial-gradient(ellipse at 0% 48%,#000d 0%,#0008 34%,transparent 73%)}
[data-sem-stage]:not([data-sem-stage=off]) .journey-scale{display:block;color:#fff;text-shadow:0 1px 5px #000,0 1px 12px #000;font-size:11px}
[data-sem-stage] .journey-scale[hidden]{display:none}
[data-sem-stage]:not([data-sem-stage=off])[data-captions-hidden=true]::after{opacity:0}
.microstructure-slide[data-journey-motion=reduced] .microstructure-visual{background-image:url(/assets/sem/sem-overview-illustrated-v2.png)}
@media(max-aspect-ratio:4/5){
 [data-sem-stage]:not([data-sem-stage=off]) .narrative-host{align-self:flex-start;margin-top:2svh}
 [data-sem-stage]:not([data-sem-stage=off]) .caption-primary{font-size:clamp(26px,6.9vw,34px)!important;line-height:1.14!important}
 [data-sem-stage]:not([data-sem-stage=off]) .caption-secondary{font-size:16px!important;margin-top:18px!important;line-height:1.5!important}
 [data-sem-stage]:not([data-sem-stage=off])::after{background:radial-gradient(ellipse 95% 47% at 22% 21%,#000d 0%,#0009 48%,#0004 74%,transparent 100%)}
}
/* The permanent summary needs a larger text-safe area than one short caption. */
.microstructure-slide[data-sem-stage][data-narrative-mode=summary]::after{background:radial-gradient(ellipse 85% 100% at 0% 45%,#000f 0%,#000d 40%,#0008 64%,transparent 100%)}
@media(max-aspect-ratio:4/5){.microstructure-slide[data-sem-stage][data-narrative-mode=summary]::after{background:radial-gradient(ellipse 110% 75% at 25% 32%,#000f 0%,#000d 48%,#0008 78%,transparent 100%)}}

/* HRTEM is a complete field, with only localized contrast beneath captions. */
[data-tem-stage]:not([data-tem-stage=off])::after{background:radial-gradient(ellipse at 0% 48%,#000e 0%,#0009 34%,transparent 73%)}
[data-tem-stage]:not([data-tem-stage=off]) .journey-scale{display:block;color:#fff;text-shadow:0 1px 5px #000,0 1px 12px #000;font-size:11px}
[data-tem-stage] .journey-scale[hidden]{display:none}
[data-tem-stage]:not([data-tem-stage=off])[data-captions-hidden=true]::after{opacity:0}
.microstructure-slide[data-journey-motion=reduced] .microstructure-visual{background-image:url(/assets/tem/hrtem-illustrated-v1.png)}
@media(max-aspect-ratio:4/5){
 [data-tem-stage]:not([data-tem-stage=off]) .narrative-host{align-self:flex-start;margin-top:2svh}
 [data-tem-stage]:not([data-tem-stage=off]) .caption-primary{font-size:clamp(26px,6.9vw,34px)!important;line-height:1.14!important}
 [data-tem-stage]:not([data-tem-stage=off]) .caption-secondary{font-size:16px!important;margin-top:18px!important;line-height:1.5!important}
 [data-tem-stage]:not([data-tem-stage=off])::after{background:radial-gradient(ellipse 95% 47% at 22% 21%,#000e 0%,#000a 48%,#0005 74%,transparent 100%)}
}
.microstructure-slide[data-tem-stage][data-narrative-mode=summary]::after{background:radial-gradient(ellipse 85% 100% at 0% 45%,#000f 0%,#000d 40%,#0008 64%,transparent 100%)}
@media(max-aspect-ratio:4/5){.microstructure-slide[data-tem-stage][data-narrative-mode=summary]::after{background:radial-gradient(ellipse 110% 75% at 25% 32%,#000f 0%,#000d 48%,#0008 78%,transparent 100%)}}
/* Camera reset fades only the artwork; the independent text shade stays put. */
.microstructure-slide[data-journey-state=loading] .microstructure-visual,
.microstructure-slide[data-journey-state=ready][data-journey-motion=full] .microstructure-visual{background:#000}

/* Only mounted inside Research Slide 2; separate from slide/progress navigation. */
#microstructural-evolution .microstructure-sound{position:absolute;z-index:6;right:7%;bottom:max(22px,env(safe-area-inset-bottom));width:48px;height:48px;display:grid;place-items:center;padding:12px;border:0;border-radius:50%;background:#04070a50;color:#d4cfc4;cursor:pointer;opacity:.65;transition:opacity .25s,color .25s,background .25s}
#microstructural-evolution .microstructure-sound svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.15;stroke-linecap:round;stroke-linejoin:round}
#microstructural-evolution .microstructure-sound:hover,#microstructural-evolution .microstructure-sound:focus-visible{opacity:1;color:#e5bd72;background:#04070ab0}
#microstructural-evolution .microstructure-sound:focus-visible{outline:1px solid #dca94f;outline-offset:3px}
#microstructural-evolution .microstructure-sound[data-sound=off] .sound-wave,#microstructural-evolution .microstructure-sound[data-sound=on] .sound-muted{display:none}
#microstructural-evolution .microstructure-sound[data-sound=on]{color:#dcb873;opacity:.85}
#microstructural-evolution .microstructure-sound[hidden]{display:none}
@media(max-width:700px){#microstructural-evolution .microstructure-sound{right:18px;bottom:max(12px,env(safe-area-inset-bottom))}}
@media(prefers-reduced-motion:reduce){#microstructural-evolution .microstructure-sound{transition:none}}
