/* One optical view of the Chalet; one optional, separately captioned exposure in the park. */
.ch-outlook {
  --edge:clamp(1.3rem,5.3vw,6.2rem);
  --ink:#16232a;--paper:#fff9ee;
  position:fixed;inset:0;width:100%;height:100dvh;max-width:100%;max-height:100dvh;
  margin:0;padding:0;border:0;overflow:hidden;background:transparent;color:var(--paper);font-family:var(--sans);
}
.ch-outlook::backdrop {background:transparent;}
html.ch-viewing {overflow:hidden;}
.ch-mountain,.ch-passage,.ch-pan,.ch-park {position:absolute;inset:0;}
.ch-passage {background:var(--ink);}
.ch-pan {overflow-x:auto;overflow-y:hidden;overscroll-behavior:contain;}
.ch-pan img {display:block;width:100%;height:100%;max-width:none;object-fit:cover;}
.ch-pan img {object-position:50% 54%;}
.ch-passage::after,.ch-park::after {
  content:"";position:absolute;inset:0;pointer-events:none;
  background:linear-gradient(#0d172698,transparent 19%,transparent 60%,#0e1a26e8);
}
.ch-outlook button {
  border:0;padding:0;min-height:44px;display:inline-flex;align-items:center;gap:.55em;background:none;color:inherit;
  font:500 .95rem/1.25 var(--sans);cursor:pointer;-webkit-tap-highlight-color:transparent;
}
.ch-return,.ch-park-back {
  position:absolute;top:max(.8rem,env(safe-area-inset-top));text-shadow:0 1px 5px #10202d,0 0 12px #10202d;
}
.ch-return {right:max(var(--edge),env(safe-area-inset-right));z-index:3;}
.ch-return span {font-weight:350;font-size:1.25em;}
.ch-park-back {left:max(var(--edge),env(safe-area-inset-left));z-index:2;}
.ch-outlook-caption,.ch-park-caption {
  position:absolute;z-index:1;inset:auto var(--edge) max(2.6rem,calc(env(safe-area-inset-bottom) + 1.25rem));pointer-events:none;
}
.ch-outlook h2 {margin:0;font:400 clamp(2.45rem,4.4vw,5rem)/1 var(--serif);letter-spacing:-.038em;}
.ch-outlook-caption p,.ch-park-caption p {margin:.65rem 0 0;color:#e2e7df;font:.89rem/1.4 var(--sans);}
.ch-outlook .ch-pan-hint {display:none;}
.ch-park {background:#152328;}
.ch-park-caption p:first-child {margin:0 0 .48rem;color:#f3e7cd;}
.ch-status {position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}
.ch-outlook button:focus-visible {text-decoration:underline double 2px;text-underline-offset:.26em;}
.ch-outlook[data-input=keyboard]:has(.ch-pan:focus-visible) .ch-pan-hint {text-decoration:underline double 2px;text-underline-offset:.16em;}

@media(max-aspect-ratio:1/1) {
  .ch-pan {bottom:16%;scrollbar-width:none;}
  .ch-pan img {width:auto;min-width:100%;height:100%;}
  .ch-passage::after {background:linear-gradient(#1221359c,transparent 18%,transparent 52%,#16232a9e 69%,#16232a 84%);}
  .ch-outlook-caption h2 {max-width:12ch;font-size:clamp(2.65rem,10.4vw,4.5rem);}
  .ch-outlook-caption {bottom:max(1.85rem,calc(env(safe-area-inset-bottom) + 1rem));}
  .ch-outlook .ch-pan-hint {display:block;margin:0 0 .55rem;font-size:.79rem;}
  .ch-park::after {content:none;}
  .ch-park-caption {bottom:max(2.2rem,calc(env(safe-area-inset-bottom) + 1.5rem));}
  .ch-park-caption h2 {font-size:clamp(2.85rem,11.5vw,4.5rem);}
}
@media(max-width:750px) and (min-aspect-ratio:1/1) {
  .ch-outlook-caption h2 {max-width:12ch;font-size:2.15rem;}
}
@media(prefers-reduced-motion:no-preference) {
  .ch-outlook.ch-unfolding .ch-outlook-caption {opacity:0;}
  .ch-outlook-caption {transition:opacity 140ms ease-out;}
  .ch-outlook.ch-unfolding .ch-passage {will-change:clip-path;}
  .ch-park:not([hidden]) {animation:appear-in-view 300ms ease-out both;}
  @keyframes appear-in-view {from{opacity:0}to{opacity:1}}
}

/* The verified exposure and the lens use the same coordinate system through every crop. */
.lens-stage {
  position:absolute;inset:0;overflow:hidden;opacity:0;visibility:hidden;
  --horizon-x:50%;--lens-x:80.0625%;--lens-y:34.08854%;
  --photo-px:calc(100vw / 1280);
  --glass-width:calc(11.9 * var(--photo-px));--glass-height:calc(37 * var(--photo-px));--glass-angle:23deg;
}
.lens-stage>img,.stay-switch .stay-portrait .lens-stage>img {
  position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;
  object-position:var(--horizon-x) 50%;
}
.ch-lens {
  position:absolute;z-index:1;left:var(--lens-x);top:var(--lens-y);transform:translate(-50%,-50%);
  display:block;width:60px;height:60px;border-radius:50%;touch-action:manipulation;text-decoration:none;
}
#chalet-lens {scroll-margin-block-start:3.6rem}
html:has(#chalet-lens:target) {scroll-behavior:auto}
/* One reflected edge on the photographed objective. The invisible hit area also
   runs along the barrel, so touching the instrument anywhere on the tube works. */
.ch-lens {cursor:pointer}
.ch-lens::after {
  content:"";position:absolute;left:50%;top:calc(50% - 22px);height:44px;width:calc(210 * var(--photo-px));
  transform:rotate(21deg);transform-origin:left center;
}
.ch-glint {
  position:absolute;pointer-events:none;left:50%;top:50%;
  width:var(--glass-width);height:var(--glass-height);
  overflow:hidden;border-radius:50%;transform:translate(-50%,-50%) rotate(var(--glass-angle));
  background:radial-gradient(ellipse at 16% 37%,#fffce5 2%,#ffedb5dc 14%,#dfecdb80 32%,#78958a24 61%,transparent 72%);
  box-shadow:inset 1.2px .4px 1px #fff4cfdb,-1px 0 4px #fce7b080;
}
.ch-glint::after {
  content:"";position:absolute;inset:-15% -90%;
  background:linear-gradient(128deg,transparent 34%,#fff8df55 43%,#fffef0 49%,#fff6d87d 55%,transparent 65%);
  transform:translateX(-100%);
}
.ch-lens:is(:hover,:focus-visible) .ch-glint {
  box-shadow:inset 2px .5px 2px #fffce2,0 0 6px 1px #fff0acb8;
}
@media(prefers-reduced-motion:no-preference) {
  .in-daylight .ch-glint::after {animation:glass-reflection 3s ease-in-out infinite}
  .in-daylight .ch-lens::before {animation:barrel-reflection 3s ease-in-out infinite}
  @keyframes glass-reflection {
    0%,7% {transform:translateX(-76%);opacity:0}
    16%,32% {opacity:1}
    45%,100% {transform:translateX(76%);opacity:0}
  }
}
@media(forced-colors:active) {
  .ch-lens .ch-glint {border-left:2px solid ButtonText;forced-color-adjust:none}
  .ch-lens:focus-visible .ch-glint {border-color:Highlight}
}
.lens-caption {display:none}
#chapter-inside:checked~.ch-picker .lens-caption,#inside:checked~.stay-switch-labels .lens-caption {
  position:absolute;right:calc(100% + clamp(.65rem,1.55vw,1.65rem));top:50%;transform:translateY(-50%);
  display:inline-flex;align-items:center;min-height:44px;color:#fff9eb;white-space:nowrap;text-decoration:underline;text-decoration-thickness:1px;
  font:500 .9rem/1.2 var(--sans);text-underline-offset:.33em;text-decoration-color:#dddacebd;text-shadow:0 1px 5px #101b1c;
}
#chapter-inside:checked~.ch-canvas .lens-stage,#inside:checked~.stay-portrait .lens-stage {visibility:visible;opacity:1}
#inside:checked~.stay-portrait #exterior-photo {visibility:hidden;opacity:0}
.ch-picker,.stay-switch-labels {grid-template-columns:repeat(3,minmax(0,1fr))}
.ch-picker::before {width:calc((100% - .32rem)/3)}
.stay-switch-labels::before {width:calc((100% - 4px)/3)}
#chapter-inside:checked~.ch-picker::before,#inside:checked~.stay-switch-labels::before {transform:translateX(100%)}
#chapter-deck:checked~.ch-picker::before,#deck:checked~.stay-switch-labels::before {transform:translateX(200%)}
#chapter-inside:checked~.ch-picker [for=chapter-inside],#inside:checked~.stay-switch-labels [for=inside] {color:#233026}
#chapter-inside:focus-visible~.ch-picker [for=chapter-inside],#inside:focus-visible~.stay-switch-labels [for=inside] {box-shadow:inset 0 0 0 2px currentColor;text-decoration:underline;text-underline-offset:.2em}
@media(max-width:900px) {
  .lens-stage {--horizon-x:79%}
}
@media(prefers-reduced-motion:no-preference) {
  .lens-stage {transition:opacity 640ms cubic-bezier(.32,0,.16,1),visibility 0s linear 640ms}
  #chapter-inside:checked~.ch-canvas .lens-stage,#inside:checked~.stay-portrait .lens-stage {transition-delay:0s}
}
#inside:checked~.stay-portrait #deck-photo {visibility:hidden;opacity:0}
@media(max-width:360px) {
  .stay-switch-labels label,.ch-picker label {min-width:3.9rem;padding-inline:.55rem}
}
/* Browsers without native dialogs can still open the photograph and return. */
#chapter-outlook:target:not([open]) {display:block;position:fixed;inset:0;z-index:12;margin:0}
#chapter-outlook .fallback-return {display:none}
#chapter-outlook:target:not([open]) .fallback-return {display:inline-flex}
#chapter-outlook:target:not([open]) button.ch-return {display:none}

.ch-park-caption a {display:inline-flex;align-items:center;min-height:44px;pointer-events:auto}
.fallback-return {min-height:44px;align-items:center;color:inherit;text-decoration:underline}
@media(min-aspect-ratio:1/1) {
  .ch-park::after {content:none}
  .ch-park-caption {bottom:.7rem}
  .ch-park-caption h2 {font-size:clamp(1.9rem,4.2vw,3.6rem)}
  .ch-park-caption p:last-child {position:absolute;bottom:0;right:0}
}
@media(max-height:450px) and (orientation:landscape) {
  .ch-park-caption p:first-child {margin:0;font-size:.7rem}
  .ch-park-caption h2 {font-size:1.5rem}
}

.ch-outlook[data-input=pointer] :is(.ch-return,.ch-park-back):focus-visible {text-decoration:none!important}

/* The crossing has its own location and film credit. */
.ch-outlook[data-scene=park] {background:var(--ink)}
.ch-outlook .ch-park:not([hidden]) {animation:none}

/* The evening study kept the room around the eyepiece. The same single-scale
   outlook can move horizontally inside the glass until the visitor closes it. */
.ch-outlook[open][data-scene=outlook]::backdrop {
  background:#0e171c;
}
.ch-outlook[open][data-scene=outlook] {background:#0e171c}
.ch-outlook[open][data-scene=outlook]::before {
  content:"";position:absolute;pointer-events:none;
  left:var(--room-left);top:var(--room-top);width:var(--room-width);height:var(--room-height);
  background:linear-gradient(130deg,#0d171edc,#111a20b5 57%,#0c151dda),
             url("/assets/chalet-telescope-window.jpg") var(--room-position) 50% / cover no-repeat;
  mask-image:linear-gradient(180deg,transparent,#000 10%,#000 73%,transparent);
}
html.ch-viewing :is(.mast,.stay-mast,.ch-picker,.stay-switch-labels,.ch-copy,.stay-intro) {visibility:hidden}
.ch-outlook[open] .ch-passage {
  inset:var(--eye-y) auto auto var(--eye-x);width:var(--eye-size);height:var(--eye-size);
  border-radius:50%;isolation:isolate;overflow:hidden;background:#18252a;
}
.ch-outlook[open] .ch-passage::after {
  border-radius:50%;background:radial-gradient(circle closest-side,transparent 80%,#0b131a0d 94%,#0b131a5e 99.7%,#0b131a99);
}
.ch-outlook[open] .ch-pan {inset:0;scrollbar-width:none;cursor:grab;user-select:none}
.ch-outlook[open] .ch-pan:active {cursor:grabbing}
.ch-outlook[open] .ch-pan img {
  min-width:0;max-width:none;width:154%;height:100%;object-fit:cover;object-position:50% 36%;pointer-events:none;
}
.ch-outlook[open] .ch-outlook-caption {text-shadow:0 1px 8px #0c161c}
.ch-outlook[open] .ch-pan-hint {display:block;margin:0 0 .45rem;font-size:.88rem}
@media(max-height:470px) and (orientation:landscape) {
  .ch-outlook[open] .ch-outlook-caption {bottom:max(.65rem,env(safe-area-inset-bottom))}
  .ch-outlook[open] .ch-outlook-caption h2 {font-size:clamp(1.4rem,5.8vh,2.2rem)}
  .ch-outlook[open] .ch-pan-hint {display:none}
}

/* Without scripting the same cover geometry is available in the photograph's own coordinates. */
@media (scripting:none) {
  #chalet-lens :is(.ch-canvas,.stay-portrait) {container-type:size}
  .lens-stage {
    --photo-px:max(.078125cqw,.104166667cqh);
    --lens-x:calc(50% + 384.8 * var(--photo-px));
    --lens-y:calc(50% - 152.75 * var(--photo-px));
  }
}
@media (scripting:none) and (max-width:900px) {
  .lens-stage {--lens-x:calc(79% + 13.6 * var(--photo-px))}
}

.ch-crossing {
  position:absolute;inset:3.8rem 0 9rem;display:flex;align-items:center;justify-content:center;
}
.ch-crossing video {display:block;width:100%;height:100%;max-width:1280px;object-fit:contain}
.ch-park [hidden] {display:none}
.ch-park .park-credit a {font-size:.8rem;color:#d1d8d0}
.film-unavailable {
  position:absolute;bottom:0;inset-inline:var(--edge);margin:0;padding:.7rem;
  color:#fff9eb;background:#152328;font:400 .95rem/1.5 var(--sans);text-align:center
}
.film-unavailable a {color:inherit}
@media(max-aspect-ratio:1/1) {
  .ch-crossing {
    inset:46% 0 auto;height:min(100vw,calc(100dvh - 18rem));transform:translateY(-50%)
  }
  .ch-crossing video {object-fit:cover;object-position:58% 50%}
  .ch-park-caption {bottom:max(1.1rem,calc(env(safe-area-inset-bottom) + .65rem))}
  .ch-park .park-credit {margin:0}
}
@media(max-height:470px) and (orientation:landscape) {
  .ch-crossing {inset:2.75rem 0 5rem}
  .ch-park-caption {bottom:.2rem}
  .ch-park .park-credit a {font-size:.75rem}
}

/* Light travels along the actual upper rim of the photographed barrel into its objective. */
.ch-lens::before {
  content:"";position:absolute;left:calc(50% + 7.9 * var(--photo-px));top:calc(50% - 15 * var(--photo-px));pointer-events:none;
  width:calc(70 * var(--photo-px));height:calc(2.4 * var(--photo-px));
  transform:rotate(21deg);transform-origin:0 50%;border-radius:50%;
  background:linear-gradient(90deg,transparent 22%,#fff4d780 39%,#fffae8 50%,#ffedc798 60%,transparent 76%)
    100% 50% / 240% 100% no-repeat;opacity:0
}
@keyframes barrel-reflection {
  0% {opacity:0;background-position:0% 50%}
  7% {opacity:.92}
  19% {opacity:1}
  28% {opacity:0;background-position:100% 50%}
  100% {opacity:0;background-position:100% 50%}
}
.ch-lens:focus-visible .ch-glint {box-shadow:0 0 0 2px #17252c,0 0 0 4px #fff3cd}
.ch-outlook[open] .ch-passage::after {
  background:radial-gradient(circle closest-side,transparent 80%,#0b131a0d 94%,#0b131a5e 99.7%,#0b131a99),
    linear-gradient(to top,#102325eb 0%,#112426bd 18%,#192c2c88 31%,transparent 48%)
}
.ch-invite {
  position:absolute;left:10%;right:10%;bottom:8%;z-index:1;display:flex;flex-direction:column;align-items:center;
  text-align:center;pointer-events:none;color:#fffdf3;text-shadow:0 1px 5px #0b1a21
}
.ch-outlook .ch-aside {margin:0;color:#f8efdb;font:400 clamp(.95rem,calc(var(--eye-size) * .039),1.55rem)/1.04 var(--serif)}
.ch-invite[hidden] {display:none}
@media(prefers-reduced-motion:no-preference) {
  .ch-invite:not([hidden]) {animation:appear-in-view 180ms ease-out both}
}
.ch-outlook .ch-visit {
  pointer-events:auto;min-height:44px;gap:.5em;font-weight:550;font-size:clamp(.92rem,calc(var(--eye-size) * .043),1.15rem);
  text-decoration:underline;text-underline-offset:.32em;text-decoration-color:#eddfc1a8
}
#park-location {font:400 clamp(.67rem,calc(var(--eye-size) * .03),.82rem)/1.2 var(--sans);color:#f3f1e6}
.ch-outlook[data-scene=park].is-coming-home {background:transparent}
.ch-outlook.is-coming-home :is(.ch-return,.ch-park-back,.ch-park-caption) {opacity:0;pointer-events:none}
.ch-outlook.is-coming-home .ch-park {will-change:clip-path}
.ch-outlook.is-coming-home::backdrop {background:transparent}
@media(max-width:600px) {
  .ch-picker label,.stay-switch-labels label {min-width:3.75rem;padding-inline:.58rem}
  #chapter-inside:checked~.ch-picker .lens-caption,#inside:checked~.stay-switch-labels .lens-caption {
    right:calc(100% + .85rem);width:6.4rem;max-width:none;white-space:normal;line-height:1.2;text-align:right;justify-content:flex-end;
    font-size:.89rem;text-wrap:balance;text-shadow:0 1px 3px #101a1d,0 0 7px #0e1922
  }
}
@media(max-width:370px) {
  .ch-picker,.stay-switch-labels {grid-template-columns:repeat(3,3.45rem)}
  .ch-picker label,.stay-switch-labels label {min-width:0;padding-inline:.22rem}
  #chapter-inside:checked~.ch-picker .lens-caption,#inside:checked~.stay-switch-labels .lens-caption {width:4.9rem;right:calc(100% + .5rem);font-size:.82rem}
}
@media(max-height:470px) and (orientation:landscape) {
  .ch-invite {bottom:9%}
  .ch-invite .ch-aside {font-size:.92rem}
}

.crossing-screen {
  position:relative;display:grid;place-items:center;width:100%;height:100%;padding:0;
  background:transparent
}
.crossing-screen video {grid-area:1/1;width:100%;height:100%;min-width:0;min-height:0;pointer-events:none}
.crossing-screen .film-start {
  grid-area:1/1;z-index:1;display:inline-flex;align-items:center;gap:.6rem;color:#fff;
  font:500 1rem/1.3 var(--sans);text-shadow:0 1px 5px #0a1015,0 0 12px #0a1015
}
.film-start::before {content:"";border:solid transparent;border-width:.3em 0 .3em .47em;border-left-color:currentColor}

/* The photograph stays fixed to the glass as the native scroll surface moves.
   The far edge is a defocused exposure of the same pixels, at the same scale. */
.ch-field,.ch-periphery {position:absolute;inset:0;overflow:hidden;pointer-events:none}
.ch-outlook[open] .ch-field img {
  display:block;max-width:none;width:154%;height:100%;object-fit:cover;object-position:50% 36%;
  transform:translate3d(var(--field-x,0px),0,0)
}
.ch-periphery {display:none}
.ch-outlook:target:not([open]) .ch-field>img {width:100%;height:100%;object-fit:cover}
@supports (mask-image:linear-gradient(black,transparent)) {
.ch-outlook[open] .ch-periphery {
  display:block;
  mask-image:linear-gradient(to right,rgba(0,0,0,var(--left-softness,0)),transparent 24% 76%,rgba(0,0,0,var(--right-softness,0)))
}
}
.ch-outlook[open] .ch-periphery img {filter:blur(clamp(3px,calc(var(--eye-size) * .015),11px))}
.ch-outlook[open] .has-optics .ch-pan {
  overscroll-behavior-x:none;touch-action:pan-x pinch-zoom;background:transparent
}
.ch-outlook[open] .has-optics .ch-pan::before {content:"";display:block;width:154%;height:100%}
