html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #213452 }
#viewport {
  width: 100%; height: 100vh; height: 100dvh; overflow-x: auto; overflow-y: hidden; position: relative;
  overscroll-behavior: none; scrollbar-width: none; touch-action: pan-x pinch-zoom;
}
#viewport::-webkit-scrollbar { display: none }
#stage {
  position: relative; isolation: isolate;
  height: 100%; width: calc(100vh * 1600 / 983); width: calc(100dvh * 1600 / 983); margin-inline: auto;
}
.room-edges { position: absolute; inset: 0; pointer-events: none }
@media (min-aspect-ratio: 1600/983) {
  .room-edges[data-light=day] { --left-art: url(day-edge-left.webp); --right-art: url(day-edge-right.webp) }
  .room-edges[data-light=night] { --left-art: url(night-edge-left.webp); --right-art: url(night-edge-right.webp) }
  .room-edges[data-light=sleep] { --left-art: url(sleep-edge-left.webp); --right-art: url(sleep-edge-right.webp) }
  .room-edges[data-light]::before, .room-edges[data-light]::after {
    content: ""; position: absolute; inset-block: 0; width: calc((100vw - 100%) / 2 + .5px);
    background-repeat: no-repeat;
    background-size: auto 100%;
  }
  .room-edges::before { right: calc(100% - .5px); background-image: var(--left-art); background-position: right center }
  .room-edges::after { left: calc(100% - .5px); background-image: var(--right-art); background-position: left center }
}
/* Beyond the painted panorama, expand only its outer expanse of blue wall. */
@media (min-aspect-ratio: 2880/983) {
  .room-edges[data-light]::before, .room-edges[data-light]::after { background-image: none; border: 0 solid transparent }
  .room-edges[data-light]::before {
    border-image: var(--left-art) 0 320 0 0 fill / 0 calc(100dvh * 320 / 983) 0 0;
  }
  .room-edges[data-light]::after {
    border-image: var(--right-art) 0 0 0 320 fill / 0 0 0 calc(100dvh * 320 / 983);
  }
}
#poster { user-select: none; -webkit-user-drag: none }
#poster,#room,#objects{position:absolute;inset:0;width:100%;height:100%;display:block}
#room{opacity:0}#room.painted{opacity:1}
#studio-sign {
  position: absolute; left: 1.25%; top: calc(68 / 983 * 100%); width: 17.375%; height: auto;
  pointer-events: none; user-select: none;
  --sign-light: brightness(.96) saturate(.9) hue-rotate(0deg);
  filter: var(--sign-light) drop-shadow(-.13vh .23vh .16vh rgb(12 23 43 / 60%));
  transition: filter 1.24s cubic-bezier(.4, 0, .6, 1);
}
body[data-light=night] #studio-sign { --sign-light: brightness(.81) saturate(1.12) hue-rotate(-4deg) }
body[data-light=sleep] #studio-sign { --sign-light: brightness(.48) saturate(.35) hue-rotate(-64deg) }
.spot{position:absolute;display:block;background:none;border:0;outline:0;border-radius:2px;cursor:zoom-in;padding:0}
[data-art],.fixture{left:calc(var(--x) * 100% / 1600);top:calc(var(--y) * 100% / 983);width:calc((var(--r) - var(--x)) * 100% / 1600);height:calc((var(--b) - var(--y)) * 100% / 983)}
.day-lamp-scene{position:absolute;inset:0;opacity:0;pointer-events:none}
.day-lamp-scene img{display:block;width:100%;height:100%}

#lamp-motion{position:absolute;inset:0;width:100%;height:100%}
#stage.day-lamp-on #cat{clip-path:polygon(4% 43%,14% 34%,26% 13%,42% 2%,48% 9%,63% 3%,80% 11%,94% 32%,100% 63%,93% 84%,69% 96%,43% 93%,18% 83%,8% 65%)}
#stage.day-lamp-on #objects:has(#cat:enabled:is(:hover,:focus-visible)) .nap-edge{opacity:1;filter:drop-shadow(0 0 3px #ffbd5a)}
#stage.day-lamp-on :is(.cat-edge,.window-edge){visibility:hidden}

/* The links remain native focus targets. Only the inked perimeter is lit. */
.spot:focus-visible { outline: 0 }
.spot[data-shots]::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 2px solid transparent; transition: border-color .16s, box-shadow .16s }
.spot[data-shots]:focus-visible::after { border-color: #fff0b9; box-shadow: inset 0 0 4px #ffd187, 0 0 7px #ffc978 }
@media(hover:hover) { .spot[data-shots]:hover::after { border-color: #fff0b9; box-shadow: inset 0 0 4px #ffd187, 0 0 7px #ffc978 } }
.computer,#window { clip-path: var(--shape) }
.fixture,.note,.cat { cursor: pointer }
#lamp { border-radius: 50% }
.cat { border-radius: 45% }
@media(pointer:fine) { .cat { border-radius: 0; clip-path: url(#cat-hit) } }
.cat:disabled { pointer-events: none }
#object-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; fill: none; stroke: #fff2c4; stroke-width: 2.35; stroke-linecap: round; stroke-linejoin: round }
#object-edges > * { opacity: 0; transition: opacity .14s ease-out }
#objects:has(#lamp:is(:hover,:focus-visible)) .lamp-edge,
#objects:has(#window:is(:hover,:focus-visible)) .window-edge,
#objects:has(.note:is(:hover,:focus-visible)) .note-edge,
#objects:has([data-screen=left]:is(:hover,:focus-visible)) .left-edge,
#objects:has([data-screen=right]:is(:hover,:focus-visible)) .right-edge,
#objects:has(#cat:enabled:is(:hover,:focus-visible)) .cat-edge { opacity: 1; filter: drop-shadow(0 0 2px #ffbd5a) drop-shadow(0 0 4px #ffdb92) }
#objects:has(#cat:disabled) :is(.cat-edge,.window-edge) { opacity: 0; transition: none }
@media(hover:none) {
  #objects:not(:has(.spot:active,.spot:focus-visible)) #object-edges > * { opacity: 0 }
}
/* The foreground duck occludes the lower left of this frame, including its hit area. */
.desk-duck [data-art=leaf]{
 clip-path:polygon(0 0,100% 0,100% 100%,55.6% 100%,57.6% 94%,58.4% 87%,58.1% 78%,56.8% 71%,54.5% 64.5%,51.3% 59%,47.4% 54%,42.7% 49.7%,37.4% 46.2%,31.7% 43.4%,26.4% 42.8%,20% 43.6%,14% 45.8%,8.7% 49.8%,4.3% 55.4%,1.7% 61.2%,0 68%)
}
#options {
  position: fixed; inset: auto; margin: 0; width: min(245px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px); overflow: auto; padding: 17px;
  color: #343b39; background: #fcf3df; border: 1px solid #a98a5e;
  border-radius: 3px; box-shadow: 0 8px 26px #18213659;
}
#options h2 { margin: 0 0 12px; font: 650 19px/1.3 Georgia,SimSun,serif }
#options button { background: transparent; border: 0; font-size: 14px }
.scenes { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #c5b89f; padding-bottom: 10px }
.scenes span{margin-right:auto}.scenes + .scenes{padding-top:7px}.scenes button { min-width:3.4em; padding: 5px 9px; border-radius: 3px }
#options button[aria-pressed=true] { color: #f8eedb; background: #344657 }
.menu { display: grid; padding-top: 5px }
.menu button { text-align: left; padding: 7px; border-radius: 3px }
.menu button:hover,.scenes button:hover { background: #e6dac3 }
#notebook { clip-path: polygon(2% 67%,34% 21%,50% 3%,94% 20%,96% 33%,71% 67%,52% 97%,2% 84%) }
#objects:has(#notebook:is(:hover,:focus-visible)) .notebook-edge { opacity: 1; filter: drop-shadow(0 0 2px #ffbd5a) drop-shadow(0 0 4px #ffdb92) }
#contact-info{padding:clamp(8px,2.2vw,28px);max-height:calc(100svh - 60px);overflow:auto;transform-origin:0 0}
#contact-info h2{font-size:clamp(22px,2.5vw,32px);margin:0 0 8px}
#contact-info p{margin:0 0 17px;color:#4d5556}
#contact-info .social-contact { padding-top: 14px; border-top: 1px solid #d7c8af }
#contact-email{display:block;width:fit-content;font-size:clamp(19px,2vw,27px);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:4px}
#copy-email{margin:16px 8px 0 0;background:#304957;color:#fff8e9;border:0;border-radius:4px;padding:6px 13px}#copy-status{font-size:13px}
.sr{position:absolute;top:0;left:0;margin:0;padding:0;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
[hidden]{display:none!important}
#preview {
  position: fixed; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%);
  --margin: clamp(10px, 3vw, 48px);
  --available-width: calc(100vw - 2 * var(--margin));
  --available-height: calc(100svh - 96px);
}
#preview[data-kind=project] {
  --rail: clamp(7px, .8vw, 13px);
  --frame-width: min(var(--available-width), clamp(485px, 40vw, 850px), calc(36svh * var(--ratio) + 2 * var(--rail)));
  --framed-height: calc((var(--frame-width) - 2 * var(--rail)) / var(--ratio) + 2 * var(--rail));
  width: min(var(--available-width), max(355px, var(--frame-width)));
  display: grid; justify-items: center;
}
#media { width: 100%; transform-origin: 0 0 }
#preview[data-kind=project] #media {
  grid-area: 1 / 1; width: var(--frame-width);
  border: var(--rail) solid #865429; border-image-repeat: stretch; border-image-slice: var(--slice);
  box-shadow: 0 4px 12px #13203342;
}
.art-print { display: flex; width: 100%; aspect-ratio: var(--ratio) }
#preview[data-picture=coast] { --slice: 6.05% 3.22% 6.05% 3.49% }
#preview[data-picture=moon] { --slice: 5.58% 3.06% 5.58% 2.81% }
#preview[data-picture=leaf] { --slice: 6.82% 5.56% 7.58% 5% }
#preview[data-picture=sun] { --slice: 6.82% 4.95% 7.58% 4.95% }
#preview[data-picture=ducks] { --slice: 8.33% 4.51% 7.58% 3.69% }
#preview[data-kind=project] #media img { display: block; height: 100%; width: auto; min-width: 0; object-fit: contain }
#art-caption {
  display: block; width: 100%; position: relative; z-index: 1;
  max-height: min(calc(60svh - 50px), calc(100svh - 88px - var(--framed-height))); overflow: auto; overscroll-behavior: contain;
  padding: clamp(15px, 1.7vw, 26px) clamp(19px, 2.5vw, 36px);
  background: #fbf2de; color: #293746; box-shadow: 0 10px 28px #101e3245;
}
#art-caption h2 { font: 650 clamp(21px,2.1vw,33px)/1.26 Georgia,SimSun,serif; margin: 5px 0 10px }
.art-category { display: block; color: #865532; font: 600 12px/1.4 "Microsoft YaHei",sans-serif; letter-spacing: .055em }
#art-caption p { margin: 0; font-size: clamp(14px,1.08vw,17px); line-height: 1.72; text-wrap: pretty }
#art-caption .art-story { margin-top: 6px; color: #524e45 }
#art-caption .art-decision { margin-top: 9px; border-left: 2px solid #baa582; padding-left: 10px; font-size: clamp(13px, 1vw, 15px); color: #5b513f }
.art-link { display: inline-flex; gap: 9px; align-items: center; margin-top: 12px; font-size: 13px; font-weight: 650; color: #744326 }
.art-link span { font: 16px/1 Georgia,serif }
#art-caption:hover .art-link { text-decoration: underline; text-underline-offset: 3px }
@media(max-width:650px) {
  #preview[data-kind=project] { --frame-width: min(var(--available-width), calc(32svh * var(--ratio) + 2 * var(--rail)), 440px) }
  #art-caption { padding: 13px 17px 14px }
  #art-caption h2 { margin: 3px 0 7px }
  .art-link { margin-top: 7px }
}
@media(max-width:600px) and (orientation:portrait) {
  #preview[data-picture=leaf][data-kind=project] { --frame-width: min(var(--available-width), calc(42svh * var(--ratio) + 2 * var(--rail))) }
}
@media(max-height:460px) and (orientation:landscape) {
  #preview[data-kind=project] { --frame-width: min(62vw, calc(31svh * var(--ratio) + 2 * var(--rail))); width: min(90vw, 480px) }
  #art-caption { max-height: calc(69svh - 44px); padding: 8px 16px }
  #art-caption h2 { display: inline; font-size: 18px; margin: 0 }
  #art-caption .art-category { float: right; font-size: 10px; margin: 3px 0 3px 8px }
  #art-caption p { font-size: 13px; line-height: 1.45 }
  #art-caption .art-story { margin-top: 2px }
  .art-link { margin-top: 4px }
}
#enter { position: absolute; inset: 0; cursor: pointer }
#preview[data-kind=project] #enter { position: relative; inset: auto; grid-area: 1 / 1; width: var(--frame-width); align-self: stretch }
@media(max-height:460px) and (orientation:landscape) {
  #preview[data-kind=project] .preview-tools { top: 2px; bottom: auto; gap: 3px }
  #preview[data-kind=project] .preview-tools button { width: 31px; height: 31px }
}
@media(max-width:510px) and (max-height:460px) and (orientation:landscape) {
  #preview[data-kind=project] .preview-tools { flex-direction: column-reverse }
}
#enter:focus-visible { outline-offset: 2px }
.preview-tools {
  display: flex; gap: 4px; position: absolute; right: 0; bottom: calc(100% + 5px);
}
.preview-tools::before { content: ""; position: absolute; top: 100%; inset-inline: 0; height: 6px }
.preview-tools button {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0 0 2px;
  color: #fffaf1; border: 1px solid #fff8e57d; background: #243345eb;
  border-radius: 50%; font: 25px/1 system-ui, sans-serif;
}
.preview-tools button:hover { background: #142433 }
#preview:not([data-kind=project]) [data-step] { display: none }
#preview[data-kind=contact] {
  width: min(var(--available-width), 450px); color: #243644;
  padding: 15px; background: #fbf3e2; border: 1px solid #bca47f; border-radius: 5px;
}
#preview[data-kind=contact] :is(#media, #enter) { display: none }
#contact-info { max-height: calc(100svh - 130px) }

@media(prefers-reduced-motion:reduce){*,*:before,*:after{transition:none!important}}

