/* The portal print and the room are the same drawing, seen at different scales. */
.journey-exhibit {
  --paper:#101b38; --letter:#f7efd8; --secondary:#c9d1e6; --line:#60718e;
  position:relative; overflow:hidden; isolation:isolate;
  background:var(--paper); color:var(--letter);
}
[data-exhibit=brain-folds] {--paper:#291e2e;--letter:#fff1d6;--secondary:#e8d0cf;--line:#927782;}
[data-exhibit=filament-light] {--paper:#17232a;--letter:#fff0ce;--secondary:#e2d3b8;--line:#927e60;}
[data-exhibit=reel-camera] {--paper:#bbd5cb;--letter:#20332c;--secondary:#394f45;--line:#7e998d;}
[data-exhibit=route-map] {--paper:#eee6ce;--letter:#20483e;--secondary:#435647;--line:#b0b59e;}
[data-exhibit=exploded-watch] {--paper:#142d30;--letter:#f6e7b7;--secondary:#c4d2c4;--line:#65817c;}
[data-exhibit=modular-print] {--paper:#e2bd64;--letter:#392b35;--secondary:#55412d;--line:#a27e47;}
[data-exhibit=ink-registration] {--paper:#efc2ae;--letter:#462e41;--secondary:#694b4f;--line:#b28d85;}
/* Let the browser defer the lunar photograph while the unpinned gallery is offscreen. */
[data-portal-track]:not([data-scroll-ready=true]) [data-exhibit=lunar-frame] .journey-plate {content-visibility:auto;}
[data-exhibit=lunar-frame] {--paper:#0b100f;--letter:#f3eddb;--secondary:#bec6bf;--line:#636e6a;}
[data-exhibit=staggered-wave] {--paper:#37243c;--letter:#eddcef;--secondary:#e0c4df;--line:#947790;}

.journey-layout {
  box-sizing:border-box; width:min(100%,94rem); margin:auto;
  padding:clamp(1.7rem,6vw,6rem) clamp(1.15rem,5.6vw,5.5rem);
  display:grid; grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);
  align-items:center; gap:clamp(1.35rem,4vw,5.5rem);
}
.journey-copy {min-width:0;position:relative;z-index:1;}
.journey-copy :is(h1,h2) {
  margin:0;max-width:9.2ch;text-wrap:balance;color:inherit;
  font:500 clamp(3.4rem,7.8vw,8.75rem)/.87 "Baskerville","Iowan Old Style",Georgia,serif;letter-spacing:-.069em;
}
.journey-copy :is(h1,h2) i {font-weight:400;}
.journey-copy :is(h1,h2):focus-visible {outline:2px solid currentColor;outline-offset:.22em;}
.journey-copy p {margin:clamp(.85rem,1.8vw,1.5rem) 0 0;max-width:34ch;color:var(--secondary);font:450 clamp(.96rem,1.4vw,1.25rem)/1.48 var(--font-body,system-ui);}
.journey-study-link,.journey-credit a,.journey-reading nav a {color:inherit;text-decoration-thickness:1px;text-underline-offset:.22em;}
.journey-study-link {display:inline-flex;align-items:center;gap:.6em;min-height:44px;margin-top:.4rem;font:650 .87rem/1.2 var(--font-body,system-ui);}
.journey-credit {display:block;margin-top:.5rem;color:var(--secondary);font:440 .7rem/1.45 var(--font-body,system-ui);}
.journey-plate {width:100%;height:auto;max-height:min(66svh,43rem);display:block;overflow:hidden;}
:where(.portal-study-page,[data-portal-track]:not([data-scroll-ready=true])) .journey-exhibit:has(.journey-frames input[value=middle]:checked) .journey-plate {--study-progress:.5;}
:where(.portal-study-page,[data-portal-track]:not([data-scroll-ready=true])) .journey-exhibit:has(.journey-frames input[value=after]:checked) .journey-plate {--study-progress:1;}

.journey-frames {display:flex;align-items:center;gap:.2rem;flex-wrap:wrap;margin:1rem 0 0;padding:0;border:0;}
.journey-frames legend {margin:0 0 .35rem;padding:0;color:var(--secondary);font:550 .74rem/1.35 var(--font-body,system-ui);}
.journey-frames label {position:relative;cursor:pointer;}
.journey-frames input {position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;margin:0;}
.journey-frames span {display:grid;place-items:center;min-height:42px;min-width:3.5rem;padding:0 .65rem;border:1px solid var(--line);font:620 .8rem/1 var(--font-body,system-ui);}
.journey-frames input:checked + span {background:var(--letter);color:var(--paper);border-color:var(--letter);}
.journey-frames input:focus-visible + span,.journey-exhibit a:focus-visible,.journey-steps button:focus-visible,.journey-reading a:focus-visible {outline:2px solid currentColor;outline-offset:3px;}
.journey-steps,.journey-signal {display:none;}

[data-scroll-ready=true] .journey-exhibit {position:absolute;inset:0;display:none;}
[data-scroll-ready=true] .journey-exhibit .journey-layout {height:100%;padding-block:clamp(1.3rem,5svh,4rem) clamp(3.6rem,8svh,6rem);}
[data-scroll-ready=true] .journey-frames {display:none;}
[data-journey-stop=brain-folds] [data-exhibit=brain-folds],
[data-journey-stop=filament-light] [data-exhibit=filament-light],
[data-journey-stop=star-field] [data-exhibit=star-field],
[data-journey-stop=reel-camera] [data-exhibit=reel-camera],
[data-journey-stop=route-map] [data-exhibit=route-map],
[data-journey-stop=exploded-watch] [data-exhibit=exploded-watch],
[data-journey-stop=modular-print] [data-exhibit=modular-print],
[data-journey-stop=ink-registration] [data-exhibit=ink-registration],
[data-journey-stop=lunar-frame] [data-exhibit=lunar-frame],
[data-journey-stop=staggered-wave] [data-exhibit=staggered-wave] {display:grid;}
[data-scroll-ready=true] [data-exhibit-next] {
  display:grid;z-index:2;pointer-events:none;
  clip-path:polygon(0 0,calc(var(--join-progress,0)*114% - 14%) 0,calc(var(--join-progress,0)*114%) 100%,0 100%);
}
[data-scroll-ready=true] .journey-steps {
  display:flex;position:absolute;z-index:3;bottom:clamp(.55rem,2.5svh,1.7rem);right:clamp(1.1rem,5.6vw,5.5rem);
  align-items:center;gap:.25rem;color:#fff5e2;background:#22232a;border:1px solid #938c82;border-radius:2rem;padding:.12rem .28rem;
}
.journey-steps button {
  white-space:nowrap;color:inherit;font:600 .8rem/1.2 var(--font-body,system-ui);background:none;border:0;border-radius:2rem;
  min-height:42px;padding:0 .75rem;cursor:pointer;
}
.journey-exit {display:inline-flex;align-items:center;min-height:42px;padding:0 .65rem;color:#e6dfd3;text-decoration:underline;text-underline-offset:.18em;font:550 .75rem/1 var(--font-body,system-ui);}
.journey-exit:focus-visible {outline:2px solid currentColor;outline-offset:-2px;}
[data-journey-stop=filament-light] .journey-exit {display:none;}
.journey-steps button:hover {background:#40414a;}
.journey-steps button:disabled {opacity:.6;cursor:default;}
.journey-room:has([data-exhibit=lunar-frame]) .journey-credit {margin-bottom:.35rem;}

.portal-study-page {min-width:0;}
.portal-study-page .journey-layout {min-height:min(40rem,72svh);}
.journey-reading {
  max-width:83rem;margin:auto;display:flex;gap:2rem;align-items:start;justify-content:space-between;
  padding:clamp(2rem,4vw,5rem) clamp(1.15rem,5.6vw,5.5rem);
}
.journey-reading h2 {font:500 clamp(1.8rem,3.3vw,3.25rem)/1.1 "Baskerville",Georgia,serif;margin:0;}
.journey-reading p {max-width:56ch;margin:.8rem 0 0;line-height:1.55;}
.journey-reading nav {display:grid;gap:.4rem;margin-top:.2rem;}
.journey-reading nav a {display:flex;align-items:center;min-height:40px;font-weight:600;font-size:.88rem;}

.pj-star-drift {transform:rotate(calc(var(--study-progress,0) * 4deg)) scale(calc(1 + var(--study-progress,0) * .17));}
.pj-star-tails {opacity:calc(var(--study-progress,0)*.8);}
.pj-star-near {transform:rotate(calc(var(--study-progress,0) * 15deg)) scale(calc(1 + var(--study-progress,0) * 1.58));}
.pj-route-line {stroke-dashoffset:calc(100 - var(--route) * 100);}
.pj-map-pin {stroke-dashoffset:calc(0 - var(--route) * 100);}
.pj-constellation {--reveal:clamp(0,(var(--study-progress,0) - .38) * 2,1);opacity:var(--reveal);}
.pj-constellation path:first-child {stroke-dashoffset:calc(1 - var(--reveal));}
.pj-spark-halo {opacity:calc(.36 + var(--study-progress,0)*.62);}
.pj-star-rays {--flare:clamp(0,(var(--study-progress,0) - .54)*2.9,1);opacity:calc(.18 + var(--flare)*.59);transform:rotate(-15deg) scale(calc(.48 + var(--flare)*.52));}
.pj-route-line,.pj-map-pin {--route:calc(clamp(0,var(--study-progress,0)*1.32,.38) + clamp(0,(var(--study-progress,0) - .43)*1.17,.62));}
.pj-market-stop {--arrival:clamp(0,(var(--study-progress,0) - .21)*10,1);opacity:min(var(--arrival),clamp(0,(.5 - var(--study-progress,0))*9,1));transform-origin:-6px 11px;transform:scale(calc(.69 + var(--arrival)*.6));}
.pj-route-film {opacity:clamp(0,(var(--study-progress,0) - .76)*5.8,1);}
.pj-tile-turn {--rotation:clamp(0,(var(--study-progress,0) - .09)*1.65,1);transform:rotate(calc(-90deg + var(--rotation)*90deg));}
.pj-circuit-current {stroke-dashoffset:calc(1 - clamp(0,(var(--study-progress,0) - .79)*8.5,1));}
.pj-circuit-lit {opacity:clamp(0,(var(--study-progress,0) - .89)*12,1);}
.pj-ink-trace {stroke-dashoffset:calc(1 - clamp(0,(var(--study-progress,0) - .76)*5.8,1));}
.pj-ink-red {--register:clamp(0,var(--study-progress,0)*1.51,1);mix-blend-mode:multiply;transform:translate(calc(16px - var(--register)*16px),calc(-10px + var(--register)*10px));}
.pj-lunar-frame {--reframe:min(1,var(--study-progress,0)*1.18);transform-origin:11px -7px;transform:scale(calc(3.1 - var(--reframe)*2.1));}
.pj-wave-column {--delay:0;--turn:clamp(0,calc(var(--study-progress,0)*2.2 - var(--delay)),1);}
.pj-wave-glint {opacity:clamp(0,min(var(--turn)*3,(1 - var(--turn))*2.8 + .14),1);}
.pj-wave-wire {stroke-dashoffset:calc(1 - clamp(0,(var(--study-progress,0) - .86)*7.3,1));}
.pj-wave-column[data-column="1"] {--delay:.2;}
.pj-wave-column[data-column="2"] {--delay:.4;}
.pj-wave-column[data-column="3"] {--delay:.6;}
.pj-wave-column[data-column="4"] {--delay:.8;}
.pj-wave-column[data-column="5"] {--delay:1;}
.pj-wave-column[data-column="6"] {--delay:1.2;}
.pj-wave-petal {transform:rotate(calc(-28deg + var(--turn)*154deg)) scale(calc(.52 + var(--turn)*.48));}

@media(max-width:45rem) and (min-aspect-ratio:1/1) {
  .journey-layout {gap:.8rem;}
  .journey-copy :is(h1,h2) {font-size:clamp(2.45rem,7vw,4.2rem);}
}
@media(max-width:45rem) and (max-aspect-ratio:1/1) {
  .journey-layout {grid-template-columns:1fr;gap:1.15rem;padding-block:2rem;align-content:center;}
  .journey-plate {width:100%;height:min(38svh,74vw);max-height:24rem;}
  .journey-copy :is(h1,h2) {font-size:clamp(2.85rem,11.3vw,4.7rem);max-width:none;}
  .journey-copy p {max-width:40ch;font-size:.96rem;line-height:1.35;margin:.7rem 0 0;}
  .journey-study-link {min-height:42px;margin:.2rem 0 0;}
  [data-scroll-ready=true] .journey-exhibit .journey-layout {padding-block:1rem 3.8rem;gap:.45rem;}
  [data-scroll-ready=true] .journey-exhibit .journey-plate {height:min(39svh,76vw);}
  .journey-reading {flex-direction:column;gap:.85rem;}
}
@media(max-width:23rem) and (max-height:40rem) {
  [data-scroll-ready=true] .journey-exhibit .journey-plate {height:29svh;}
  [data-scroll-ready=true] .journey-copy p {font-size:.87rem;}
  [data-scroll-ready=true] .journey-copy :is(h1,h2) {font-size:2.55rem;}
}
@media(max-height:34rem) and (min-aspect-ratio:5/4) {
  [data-scroll-ready=true] .journey-exhibit .journey-layout {padding-block:.3rem 2.8rem;}
  .journey-plate {max-height:43svh;}
  .journey-copy :is(h1,h2) {font-size:clamp(2rem,6.5svh,3rem);}
  .journey-copy p {font-size:.83rem;margin-top:.4rem;}
  .journey-study-link {min-height:32px;}
  [data-scroll-ready=true] .journey-steps {bottom:.15rem;}
  .journey-steps button {min-height:34px;}
}

[data-journey-phase=flight] .portal-lens-shade {opacity:0;}
.journey-player:not([hidden]) {display:flex;flex-wrap:wrap;align-items:center;gap:.5rem .65rem;margin-top:1.2rem;color:var(--letter);}
.journey-player button {
  background:var(--letter);color:var(--paper);border:1px solid var(--letter);border-radius:2rem;padding:.35rem .85rem;
  min-height:42px;min-width:5.7rem;font:650 .82rem/1.15 var(--font-body,system-ui);cursor:pointer;
}
.journey-player button[hidden] {display:none;}
.journey-player label {display:inline-flex;align-items:center;gap:.5rem;min-height:42px;font:550 .8rem/1.2 var(--font-body,system-ui);}
.journey-player input {width:clamp(4.2rem,8vw,7.4rem);accent-color:var(--letter);min-height:42px;margin:0;cursor:pointer;}
.journey-player output {font:550 .75rem/1 var(--font-mono,monospace);min-width:4ch;}
.journey-player :is(input,button):focus-visible {outline:2px solid var(--letter);outline-offset:3px;}
[data-study-enhanced]:not([data-study-quiet]) .journey-frames {display:none;}
.journey-reading .journey-source {font-size:.83rem;}
.journey-source a {color:inherit;text-underline-offset:.2em;}

[data-journey-phase=transition] .journey-copy {opacity:clamp(0,calc(1 - var(--join-progress,0)*3.3),1);}
[data-journey-phase=transition] [data-exhibit-next] .journey-copy {opacity:clamp(0,calc((var(--join-progress,0) - .55)*3),1);}
.journey-steps [data-journey-position] {padding:0 .35rem 0 .7rem;font:520 .69rem/1.1 var(--font-mono,monospace);white-space:nowrap;color:#e6dfd3;}
@media(max-width:24rem) {
  .journey-steps button {padding-inline:.42rem;}
  .journey-exit {padding-inline:.5rem;}
  .journey-steps [data-journey-position] {padding-inline:.5rem .1rem;font-size:.65rem;}
}

/* As the camera enters the fold, blend the magnified surface into the room. */
[data-exhibit=brain-folds] .journey-plate {
  mask-image:radial-gradient(ellipse closest-side at center,#000 calc(128% - var(--study-progress,0) * 62%),transparent calc(151% - var(--study-progress,0) * 52%));
}
@media(max-width:45rem) and (max-aspect-ratio:1/1) {
  [data-scroll-ready=true] .journey-steps {right:max(.5rem,env(safe-area-inset-right));}
}
