/* ZIP assets share one source canvas and identity registration. No trimming or per-object zoom. */
.world .landscape{background-image:url('./assets/master-1672/background-clean-plate.png');filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light)) blur(6px);opacity:.8}
.world .garden,.garden-front-viewport{display:none}
.window-frame,.window-scene[data-scene="portrait"] .window-frame{display:block;left:0;top:0;width:1672px;height:941px;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light));mask-image:linear-gradient(to right,transparent,#000 3%,#000 97%,transparent),linear-gradient(#000 0 90%,transparent 100%);mask-composite:intersect}
.still-life img,.window-scene[data-scene="portrait"] .still-life img{display:block;width:1672px;height:941px;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light))}
.cat-breath{clip-path:polygon(7% 49%,26% 49%,27% 76%,9% 77%);transform-origin:18% 80%}
.cat-ear{clip-path:polygon(15% 33%,25% 33%,25% 43%,15% 43%);transform-origin:20% 43%}
.cat-tail{clip-path:polygon(6% 75%,30% 75%,30% 85%,6% 85%);transform-origin:18% 80%}
.still-life .iced-coffee{display:none}
body[data-season="summer"] .still-life .coffee-cup{display:none}
body[data-season="summer"] .still-life .iced-coffee{display:block}


body[data-scene-mode="portrait"] .world .landscape{background-position:75% 50%;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light));opacity:1}
body[data-season="summer"] .window-scene .still-life .iced-coffee{display:block}
body:not([data-season="summer"]) .window-scene .still-life .iced-coffee{display:none}

/* Independent cherry branch in viewport space, above the paper edge. */
.sakura-foreground{position:fixed;z-index:5;pointer-events:none;--branch-width:clamp(320px,calc(100vw - var(--paper-left) - var(--paper-width) + 230px),1000px);right:-60px;top:min(calc(var(--paper-top,150px) + 10px),calc(100svh - var(--branch-width)*.65));width:var(--branch-width);height:auto;filter:var(--scene-filter) brightness(var(--foreground-light));transform-origin:100% 24%;animation:sakura-sway 8s ease-in-out infinite}
body[data-scene-mode="portrait"] .sakura-foreground{--branch-width:280px;right:-60px;top:-8px}
@keyframes sakura-sway{0%,100%{transform:rotate(-2deg)}50%{transform:rotate(2deg)}}
body[data-paused="true"] .sakura-foreground{animation-play-state:paused}
@media(prefers-reduced-motion:reduce){.sakura-foreground{animation:none}}

/* Uploaded outdoor plates remain separate from the common transparent interior. */
body[data-season="spring"]{--outdoor-image:url('./assets/user-outdoors/spring.webp')}
body[data-season="summer"]{--outdoor-image:url('./assets/user-outdoors/summer.webp')}
body[data-season="autumn"]{--outdoor-image:url('./assets/user-outdoors/autumn.webp')}
body[data-season="winter"]{--outdoor-image:url('./assets/user-outdoors/winter.webp')}
.world .landscape{background-image:var(--outdoor-image)}
.room-overlay{position:absolute;left:0;top:0;width:1672px;height:941px;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light));pointer-events:none}
body:not([data-season="spring"]) .sakura-foreground{visibility:hidden}
/* One outdoor projection for the whole viewport: never redraw it inside the vignette. */
.world .landscape,body[data-scene-mode="portrait"] .world .landscape{position:absolute;inset:0;left:0;top:0;width:100%;height:100%;transform:none;background-size:cover;background-position:50% 50%;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light));opacity:1}
.window-frame,.window-scene[data-scene="portrait"] .window-frame{display:none}
.room-overlay{mask-image:linear-gradient(#000 0 90%,transparent 100%)}

/* Portrait uses its clipped sky only; the world sky must not draw a second star/moon. */
body[data-scene-mode="portrait"] .world .sky{display:none}

/* Night: indoor cutouts keep enough ambient light across all layout presets. */
body[data-time="night"] .window-scene .still-life img{filter:var(--scene-filter) brightness(.68)}
body[data-time="night"] .window-scene .room-overlay{filter:var(--scene-filter) brightness(.48)}
body[data-time="night"] .window-scene .still-life .coffee-steam{filter:brightness(.68)}

/* Visual review repair: keep scenery and reading surfaces in distinct depth planes. */
.sakura-foreground{position:absolute;--branch-anchor:60px;--branch-overlap:24px;right:calc(-1 * var(--branch-anchor));top:calc(var(--mobile-frame-top,200px) + clamp(180px,calc(var(--paper-height,520px) * .5),300px) - var(--branch-width) * .56);animation-name:branch-breeze;animation-duration:7.2s}
body[data-scene-mode="portrait"] .sakura-foreground{--branch-anchor:54px;--branch-overlap:16px;--branch-width:calc((var(--layout-width) - var(--paper-left) - var(--paper-width) + var(--branch-anchor) + var(--branch-overlap)) / .86);right:calc(-1 * var(--branch-anchor));top:calc(var(--mobile-frame-top,200px) + clamp(180px,calc(var(--paper-height,520px) * .5),300px) - var(--branch-width) * .56)}
@keyframes branch-breeze{0%,100%{transform:translateY(-1px) rotate(-2deg)}50%{transform:translateY(1px) rotate(2deg)}}
.still-life .cat-breath,.still-life .cat-ear,.still-life .cat-tail{display:none!important}
.still-life .still-base{animation:quiet-cat-breath 7.4s ease-in-out infinite;transform-origin:18% 85%}
@keyframes quiet-cat-breath{0%,100%{transform:scale(1)}50%{transform:scale(1.001,1.0015)}}
.mountain-wash{opacity:.12}
.frame{transition:background-color 1.4s ease-in-out}
body[data-time="evening"]{--paper:#f1e7d7}
body[data-time="night"]{--paper:#d8cbb7}
body[data-time="night"] .frame{box-shadow:0 1px 0 #fff3 inset,0 8px 28px #0002}
body[data-time="night"] .mountain-wash{opacity:.06}
body[data-scene-mode="portrait"] .intro{font-size:13px;line-height:1.95;text-wrap:pretty}
.intro .mobile-break{display:none}
body[data-scene-mode="portrait"] .intro .mobile-break{display:initial}
.composition{overflow-x:clip}
body[data-layout="mobile"] .detail p{font-size:13px;line-height:2}
body[data-layout="mobile"] .scenery-status{font-size:10px;max-width:calc(100vw - 24px)}
body[data-layout="mobile"] .preview-toggle{min-height:40px;font-size:10px;background:#fcf9f2d9}
@media(prefers-reduced-motion:reduce){.still-life .still-base,.sakura-foreground{animation:none!important}.frame{transition:none!important}}

/* Width presets retain their identity; aspect selects side-by-side or stacked composition. */
body[data-scene-mode="desktop"] .detail{padding-left:var(--scene-text-inset,0px)}
body[data-scene-mode="desktop"] .detail h1{margin-left:0}
body[data-scene-mode="portrait"] .detail h1{margin-inline:0;text-align:left}
body[data-scene-mode="portrait"] .composition{min-height:max(100svh,var(--scene-bottom,0px))}

/* The right half contains only a detached lower sill; retain the window, vase and desk. */
.room-overlay{--visible-fraction:.505;clip-path:inset(0 49.5% 0 0)}

/* The supporting tabletop shares the cup's native transform and stops before text. */
.desk-foreground{position:absolute;left:0;top:0;width:1672px;height:941px;clip-path:polygon(0 760px,var(--desk-front-end) 760px,var(--desk-front-end) 941px,0 941px);mask-image:linear-gradient(to right,#000 calc(var(--desk-front-end) - 14px),transparent var(--desk-front-end)),linear-gradient(#000 0 90%,transparent 100%);mask-composite:intersect;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light));pointer-events:none}
body[data-scene-mode="portrait"] .desk-foreground{display:none}
body[data-time="night"] .desk-foreground{filter:var(--scene-filter) brightness(.48)}
body[data-layout="small-pc"][data-scene-mode="desktop"] .intro .mobile-break{display:initial}

/* A tall PC uses stacked composition while retaining its width-preset typography. */
body[data-scene-mode="portrait"]:not([data-layout="mobile"]) .intro{font-size:var(--intro-size)}

/* A single reference-space camera prevents tiny detached foregrounds on large viewports. */
body{--composition-scale:1;--layout-width:100vw;--layout-height:100svh}
.composition,body[data-scene-mode="portrait"] .composition{width:var(--layout-width);min-height:max(var(--layout-height),var(--scene-bottom,0px));transform:scale(var(--composition-scale));transform-origin:0 0}
.sakura-foreground{--branch-width:calc((var(--layout-width) - var(--paper-left) - var(--paper-width) + var(--branch-anchor) + var(--branch-overlap)) / .86)}
.preview-toggle{transform:scale(var(--composition-scale));transform-origin:top right;top:calc(18px * var(--composition-scale));right:calc(22px * var(--composition-scale))}
.preview{transform:scale(var(--composition-scale));transform-origin:top right;top:calc(66px * var(--composition-scale));right:calc(22px * var(--composition-scale));max-height:calc(var(--layout-height) - 100px)}
.scenery-status{transform:scale(var(--composition-scale));transform-origin:bottom right;bottom:calc(18px * var(--composition-scale));right:calc(22px * var(--composition-scale))}

/* Viewport sky stays outside the transformed composition, behind its indoor alpha layers. */
.composition{z-index:2}
body[data-scene-mode="portrait"] .mobile-sky{z-index:1}

/* The requested diagonal tabletop has no detached right sill to crop away. */
.window-scene[data-room="diagonal"] .room-overlay{--visible-fraction:1;clip-path:none}

/* Approved bottom-anchored PC composition: scenery grows upward, wall remains a narrow band. */
.left-room-extension,.upper-jamb-extension{position:absolute;z-index:1;top:0;height:var(--upper-room-height,0px);background:#75451f url('./assets/left-wall-grain-v1.webp') left top / calc(320px * var(--bottom-scene-scale,1)) auto repeat-y;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light)) brightness(.8);pointer-events:none}
.left-room-extension{left:0;width:var(--left-room-width,0px)}
.upper-jamb-extension{left:var(--upper-jamb-left,0px);width:var(--upper-jamb-width,0px);box-shadow:inset 2px 0 #eac38f70,inset -3px 0 #3e2616a0}
.bottom-wall-base{position:absolute;z-index:0;left:0;right:0;bottom:0;height:calc(21px * var(--bottom-scene-scale,1) + 1px);background:#e9dfcd;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light));pointer-events:none}
.bottom-table{position:absolute;left:0;bottom:0;width:100%;height:calc(941px * var(--bottom-scene-scale,1));pointer-events:none;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light))}
.bottom-table-back{z-index:1}.bottom-table-front{z-index:3;clip-path:inset(0 calc(100% - var(--desk-support-right)) 0 0);mask-image:linear-gradient(to right,#000 calc(var(--desk-support-right) - 14px),transparent var(--desk-support-right))}
 .window-scene[data-scene="desktop"] .room-overlay{--visible-fraction:.28708134;clip-path:inset(0 1192px 21px 0);mask-image:linear-gradient(to right,#000 0 475px,transparent 480px),linear-gradient(to bottom,transparent,#000 80px);mask-composite:intersect}
body[data-scene-mode="desktop"] .desk-foreground{display:none}
body:not([data-scene-mode="desktop"]) :is(.left-room-extension,.upper-jamb-extension,.bottom-wall-base,.bottom-table){display:none}
body[data-time="night"] :is(.bottom-table,.bottom-wall-base){filter:var(--scene-filter) brightness(.48)}
body[data-time="night"] :is(.left-room-extension,.upper-jamb-extension){filter:var(--scene-filter) brightness(.384)}

/* Books and knitted throw sit above the new supporting tabletop, with their shared native transform. */
body[data-scene-mode="desktop"] .desk-foreground{display:block;clip-path:polygon(0 630px,320px 630px,320px 941px,0 941px);mask-image:linear-gradient(to right,#000 270px,transparent 320px)}

/* One continuous left opening, independent of the bottom-anchored still life. */
body[data-scene-mode="desktop"] :is(.left-room-extension,.upper-jamb-extension){height:auto;bottom:calc(21px * var(--bottom-scene-scale));background-size:calc(320px * var(--bottom-scene-scale)) 100%;background-repeat:no-repeat}
body[data-scene-mode="desktop"] .room-overlay{display:none}
.left-window-rails{position:absolute;z-index:1;inset:0;pointer-events:none}
.window-rail{position:absolute;left:calc(195px * var(--bottom-scene-scale));width:calc(230px * var(--bottom-scene-scale));height:calc(24px * var(--bottom-scene-scale));background:#82532e url('./assets/window-table-diagonal-v1.webp') calc(-180px * var(--bottom-scene-scale)) calc(-155px * var(--bottom-scene-scale)) / calc(1672px * var(--bottom-scene-scale)) calc(941px * var(--bottom-scene-scale));box-shadow:0 2px 3px #28170c70,inset 0 2px #e4b47c80,inset 0 -2px #402311a0;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light))}
.left-room-lantern{position:absolute;z-index:2;left:calc(42px * var(--bottom-scene-scale));top:var(--lantern-top);width:calc(118px * var(--bottom-scene-scale));height:auto;pointer-events:none;filter:var(--scene-filter) brightness(var(--foreground-light)) brightness(var(--mobile-weather-light))}
body[data-scene-mode="desktop"] .desk-foreground{clip-path:none;mask-image:none}
body:not([data-scene-mode="desktop"]) :is(.left-window-rails,.left-room-lantern){display:none}
body[data-time="night"] .window-rail{filter:var(--scene-filter) brightness(.48)}
body[data-time="night"] .left-room-lantern{filter:var(--scene-filter) brightness(.68)}

/* Location uses the existing outdoor projection; foreground geometry is unchanged. */
#scenery-note,#scenery-status{font-size:11px;line-height:1.65;margin:6px 0;color:#756653}
#scenery-status{min-height:1.65em;margin-bottom:14px}
body[data-scenery-state="error"] #scenery-status{color:#8c442a}

/* Night exposure follows the committed outdoor plate. */
body[data-time="night"] {
  --night-landscape-light: .57;
  --night-landscape-wash: #14253980;
}
body[data-time="night"][data-scenery="kamikochi"] {
  --night-landscape-light: .60;
}
body[data-time="night"][data-scenery="numazu"] {
  --night-landscape-light: .66;
  --night-landscape-wash: #14253973;
}
body[data-time="night"][data-scenery="kamakura"] {
  --night-landscape-light: .59;
}
body[data-time="night"][data-scenery="biei"] {
  --night-landscape-light: .52;
  --night-landscape-wash: #14253988;
}
body[data-time="night"][data-scenery="toyama"] {
  --night-landscape-light: .58;
}
body[data-time="night"][data-scenery="chichibugahama"] {
  --night-landscape-light: .49;
  --night-landscape-wash: #14253989;
}
/* Dedicated night plates already contain the city lights and dark sky. */
body[data-time="night"][data-scenery-time="night"][data-scenery="nagasaki"] {
  --night-landscape-light: 1.15;
  --night-landscape-wash: #14253918;
}
body[data-time="night"][data-scenery-time="night"][data-scenery="tokyo"] {
  --night-landscape-light: 1.10;
  --night-landscape-wash: #14253918;
}
body[data-time="night"] .world > .landscape {
  filter: var(--scene-filter) brightness(var(--night-landscape-light)) brightness(var(--mobile-weather-light));
}
body[data-time="night"] .world > .light {
  background: var(--night-landscape-wash);
}
body[data-time="night"]:is([data-weather="cloudy"], [data-weather="rain"], [data-weather="snow"]) .world > .light {
  background: linear-gradient(#6d7c8a38, #a5afa818), var(--night-landscape-wash);
}
body[data-time="night"][data-weather="thunderstorm"] .world > .light {
  background: linear-gradient(#30445870, #59667042), var(--night-landscape-wash);
}

/* Keep Tokyo Tower in the upper-right window opening on narrow screens. */
body[data-scene-mode="portrait"][data-scenery="tokyo"] .world .landscape{background-size:auto max(120svh,56.3vw);background-position:80% 100%}

/* Preserve the paper's dimensions so the shared scenery retains its framing. */
#main[inert] { visibility: hidden; }
