/* The Santa Tree – the room as one lit space (wall, floor, light, depth).
   Drawn by depth.js behind everything else; nothing here changes how decorations are placed.
   Settings live in config.js → room.depth (see CHANGE-GUIDE.md, "The room: wall, floor and light"). */

#roomBack{position:absolute;left:0;top:0;width:100%;height:0;z-index:0;pointer-events:none;overflow:hidden;
  --J:400px;            /* where the wall meets the floor (set by depth.js) */
  --lx:20%; --ly:70%;   /* the lantern (warm light) */
  --wx:75%; --wy:40%;   /* the window (cool moonlight) */
  --wall-a:color-mix(in srgb,var(--bg2,#020a1e) 74%,#3b5a86);
  --wall-b:color-mix(in srgb,var(--bg2,#020a1e) 80%,#2f4a72);
  --wall-c:color-mix(in srgb,var(--bg1,#00020e) 68%,#1b2b49);
  --panel-line:rgba(0,0,0,.26); --panel-hi:rgba(255,255,255,.035);
  --floor-a:#3b2416; --floor-b:#24160d; --floor-c:#0b0705}
html.pearl #roomBack{--wall-a:#e9e6df;--wall-b:#dcd9d2;--wall-c:#bfc3cb;--panel-line:rgba(60,50,40,.16);--panel-hi:rgba(255,255,255,.5);--floor-a:#b08a62;--floor-b:#8a6646;--floor-c:#5d432e}

/* ---- the back wall ---- */
#roomBack .rb-wall{position:absolute;left:-3%;right:-3%;top:0;height:var(--J);
  background:linear-gradient(180deg,var(--wall-c) 0%,var(--wall-b) 38%,var(--wall-a) 100%);translate:calc(var(--px,0)*-5px) calc(var(--py,0)*-2px)}
/* tongue-and-groove panelling on the lower wall, with a rail on top and a skirting board at the floor */
#roomBack .rb-panel{position:absolute;left:0;right:0;bottom:0;height:var(--dado,34%);
  background:
    linear-gradient(180deg,rgba(0,0,0,.34),rgba(0,0,0,0) 5px),
    repeating-linear-gradient(90deg,var(--panel-line) 0 1px,var(--panel-hi) 1px 2px,transparent 2px var(--plank,46px)),
    linear-gradient(180deg,rgba(255,255,255,.03),rgba(0,0,0,.12))}
#roomBack .rb-rail{position:absolute;left:0;right:0;bottom:var(--dado,34%);height:7px;
  background:linear-gradient(180deg,color-mix(in srgb,var(--wall-a) 80%,#fff) 0,var(--wall-a) 45%,rgba(0,0,0,.5) 100%);box-shadow:0 3px 6px rgba(0,0,0,.35)}
#roomBack .rb-skirt{position:absolute;left:0;right:0;bottom:0;height:var(--skirt,13px);
  background:linear-gradient(180deg,color-mix(in srgb,var(--wall-a) 72%,#fff) 0,var(--wall-a) 22%,var(--wall-b) 80%,rgba(0,0,0,.65) 100%);box-shadow:0 -1px 0 rgba(0,0,0,.35)}
/* light on the wall: warm from the lantern, cool from the window, darker corners */
#roomBack .rb-wlight{position:absolute;inset:0;
  background:
    radial-gradient(ellipse 34% 62% at var(--lx) 100%,rgba(255,168,74,.30),rgba(255,140,50,.10) 55%,transparent 78%),
    radial-gradient(ellipse 26% 46% at var(--wx) var(--wy),rgba(150,190,255,.13),transparent 72%),
    radial-gradient(ellipse 85% 120% at 52% 100%,transparent 45%,rgba(0,0,0,.5) 100%)}
html.pearl #roomBack .rb-wlight{background:
    radial-gradient(ellipse 34% 62% at var(--lx) 100%,rgba(255,180,90,.28),transparent 78%),
    radial-gradient(ellipse 85% 120% at 52% 100%,transparent 55%,rgba(60,70,90,.22) 100%)}
#roomBack .rb-warm{animation:rbflick 5.5s ease-in-out infinite}
@keyframes rbflick{0%,100%{opacity:.82}18%{opacity:1}31%{opacity:.88}47%{opacity:.97}63%{opacity:.8}80%{opacity:.95}}

/* ---- the left wall (wide screens: the bookcase stands along it) ---- */
#roomBack .rb-left{position:absolute;left:0;top:0;width:var(--cx,0px);height:calc(var(--J) + var(--cdrop,0px));display:none;
  clip-path:polygon(0 0,100% 0,100% var(--J),0 100%)}
#roomBack.has-left .rb-left{display:block}
#roomBack .rb-left>div{position:absolute;inset:0}
#roomBack .rb-lwall{background:linear-gradient(180deg,var(--wall-c),var(--wall-b) 40%,var(--wall-a))}
/* the panelling, rail and skirting board carry on round the corner, in perspective (27 Nov) */
#roomBack .rb-ldado{clip-path:polygon(0 var(--lr0),100% var(--lr),100% var(--J),0 var(--lf0));
  background:repeating-linear-gradient(90deg,var(--panel-line) 0 1px,var(--panel-hi) 1px 2px,transparent 2px 34px),
    var(--dado-bg,linear-gradient(180deg,var(--wall-b),var(--wall-a)))}
#roomBack .rb-lrail{clip-path:polygon(0 var(--lrt0),100% var(--lrt),100% var(--lr),0 var(--lr0));
  background:linear-gradient(180deg,color-mix(in srgb,var(--wall-a) 82%,#fff),color-mix(in srgb,var(--wall-a) 70%,#000))}
#roomBack .rb-lskirt{clip-path:polygon(0 var(--ls0),100% var(--ls),100% var(--J),0 var(--lf0));
  background:linear-gradient(180deg,color-mix(in srgb,var(--wall-a) 78%,#fff),var(--wall-b))}
#roomBack .rb-lshade{background:linear-gradient(90deg,rgba(0,0,0,.5),rgba(0,0,0,.2) 60%,rgba(0,0,0,.34) calc(100% - 10px),rgba(0,0,0,.5) 100%)}
html.pearl #roomBack .rb-lshade{background:linear-gradient(90deg,rgba(40,30,20,.3),rgba(40,30,20,.1) 60%,rgba(40,30,20,.2) calc(100% - 10px),rgba(40,30,20,.34) 100%)}

/* ---- the floor ---- */
#roomBack .rb-floor{position:absolute;left:0;right:0;top:var(--J);bottom:0;overflow:hidden;
  -webkit-mask-image:linear-gradient(180deg,#000 calc(100% - 150px),transparent);mask-image:linear-gradient(180deg,#000 calc(100% - 150px),transparent);
  background:linear-gradient(180deg,var(--floor-b) 0,var(--floor-a) 16%,var(--floor-b) 60%,var(--floor-c) 100%)}
/* the planks run towards us: one flat sheet tilted back */
#roomBack .rb-planks{position:absolute;left:-60%;right:-60%;top:0;height:260%;transform-origin:50% 0;transform:perspective(520px) rotateX(64deg);
  translate:calc(var(--px,0)*-9px) 0;
  background:var(--floor-img,none) 50% 0/var(--ftile,46%) auto repeat}
/* slow phones: simple plank lines instead of the rough wood picture */
html.q-low #roomBack .rb-planks{background:repeating-linear-gradient(90deg,rgba(0,0,0,.5) 0 2px,rgba(255,220,170,.05) 2px 4px,transparent 4px var(--fw,4.2%))}
#roomBack .rb-flight{position:absolute;inset:0;
  background:
    radial-gradient(ellipse 30% 70% at var(--lx) 4%,rgba(255,160,70,.34),rgba(255,140,50,.08) 60%,transparent 80%),
    linear-gradient(180deg,rgba(0,0,0,.5) 0,rgba(0,0,0,0) 26px),
    linear-gradient(180deg,transparent 35%,rgba(0,0,0,.45) 100%)}
/* moonlight from the window, lying on the floor */
#roomBack .rb-moon{position:absolute;top:8%;left:calc(var(--wx) - 9%);width:20%;height:38%;transform:skewX(-24deg);
  background:linear-gradient(180deg,rgba(160,195,255,.16),rgba(160,195,255,.03));filter:blur(7px);border-radius:4px}
html.pearl #roomBack .rb-moon{display:none}

/* ---- dust in the lantern light ---- */
#roomBack .rb-dust{position:absolute;left:calc(var(--lx) - 9%);top:calc(var(--J) - 30%);width:26%;height:32%}
#roomBack .rb-dust i{position:absolute;width:2px;height:2px;border-radius:50%;background:rgba(255,220,160,.75);opacity:0;animation:rbdust 13s linear infinite}
@keyframes rbdust{0%{opacity:0;transform:translate(0,0)}15%{opacity:.7}85%{opacity:.5}100%{opacity:0;transform:translate(26px,-70px)}}

/* ---- light and shadow on the things in the room ---- */
.room .stage::before,.room .stage::after{content:'';position:absolute;pointer-events:none;z-index:4;mix-blend-mode:soft-light}
/* warm side of the tree (towards the lantern) and cool side (towards the window) */
.room .stage::before{left:-2%;top:34%;width:50%;height:60%;background:radial-gradient(closest-side,rgba(255,170,80,.55),rgba(255,170,80,.2) 55%,transparent);animation:rbflick 5.5s ease-in-out infinite}
.room .stage::after{right:0;top:14%;width:46%;height:58%;background:radial-gradient(closest-side,rgba(150,190,255,.42),rgba(150,190,255,.14) 55%,transparent)}
html.rb-on .floorshadow{background:radial-gradient(ellipse at 50% 50%,rgba(0,0,0,.72),rgba(0,0,0,.4) 45%,transparent 72%)!important;width:74%;height:9%}
/* the door and the window sit on the far wall: a tight shadow, not a floating one */
html.rb-on .roomdoor img{filter:drop-shadow(0 0 5px rgba(0,0,0,.6)) drop-shadow(3px 0 3px rgba(0,0,0,.35))}
html.rb-on .roomwin img{filter:drop-shadow(0 3px 5px rgba(0,0,0,.6))}
html.rb-on .roomdoor::after{content:'';position:absolute;left:-12%;right:-12%;bottom:-3px;height:7px;background:radial-gradient(ellipse at 50% 0,rgba(0,0,0,.6),transparent 70%)}
html.rb-on .bookcase .bcside{filter:drop-shadow(8px 12px 10px rgba(0,0,0,.6))}

/* ---- depth: nearer things move a little more than far ones (pointer, tilt, scroll) ---- */
html.rb-par .roomdoor{translate:calc(var(--px,0)*-5px) calc(var(--py,0)*-2px)}
html.rb-par .bookcase{translate:calc(var(--px,0)*-5px) calc(var(--py,0)*-2px)}   /* the same as the wall it stands against */
html.rb-par #roomBack .rb-left{translate:calc(var(--px,0)*-5px) 0;left:-6px;width:calc(var(--cx,0px) + 6px)}
html.rb-par .sideboard{translate:calc(var(--px,0)*-8px) calc(var(--py,0)*-3px)}
html.rb-par .room .stage{translate:calc(var(--px,0)*-12px) calc(var(--py,0)*-4px)}
html.rb-par .roomwin{translate:calc(var(--px,0)*7px) calc(var(--py,0)*2px)}   /* the window is inside the stage but hangs on the far wall */
html.rb-par #snow{translate:calc(var(--px,0)*-16px) calc(var(--py,0)*-5px)}

/* ---- quality levels (set automatically by depth.js) ---- */
html.q-low #roomBack .rb-dust,html.q-low #roomBack .rb-moon{display:none}
html.q-low .room .stage::before,html.q-low .room .stage::after{mix-blend-mode:normal;opacity:.18}
html.q-low #roomBack .rb-warm,html.q-low .room .stage::before{animation:none}
@media (prefers-reduced-motion:reduce){ #roomBack .rb-warm,.room .stage::before{animation:none} #roomBack .rb-dust{display:none} }

/* ---- phone: the decorations come right under the room; Share and Wishes below them; nothing hides behind the controls bar ---- */
@media (max-width:640px){ body{padding-bottom:78px} #roomBack{--plank:30px;--skirt:8px;--fw:5.6%;--ftile:62%} #roomBack .rb-rail{height:4px} }
/* ---- tablet: the bookcase and the door were phone-sized here; there is room for them to be bigger ---- */
@media (min-width:641px) and (max-width:820px){ .bookcase{height:250px;bottom:13%} }

/* ---- snow outside the window (winsnow.js): the glass of the window picture is 15.3 % / 11.8 % from the left / top, 69.9 % x 70.9 % ---- */
.roomwin .winglass{position:absolute;left:15.3%;top:11.8%;width:69.9%;height:70.9%;overflow:hidden;pointer-events:none;border-radius:1px}
.roomwin .winsnow{position:absolute;inset:0;width:100%;height:100%;display:block}
.roomwin .winhaze{position:absolute;inset:0;opacity:0;transition:opacity 1.6s ease;
  background:linear-gradient(100deg,rgba(214,226,243,.78),rgba(176,196,224,.62) 55%,rgba(226,236,250,.8))}
.roomwin .winhaze::after{content:'';position:absolute;left:-4%;right:-4%;bottom:-2px;height:9%;border-radius:50% 50% 0 0/100% 100% 0 0;background:linear-gradient(180deg,rgba(255,255,255,.92),rgba(222,233,248,.9));opacity:0;transition:opacity 2.5s ease;filter:blur(1.5px)}
.roomwin[data-snow="3"] .winhaze{opacity:calc(.5 + var(--gust,.5)*.3)}
.roomwin[data-snow="3"] .winhaze::after{opacity:1}
/* a hard storm shakes the glass a little */
.roomwin[data-snow="3"] .winglass{animation:winshake .9s ease-in-out infinite}
@keyframes winshake{0%,100%{transform:translate(0,0)}25%{transform:translate(.6px,-.3px)}50%{transform:translate(-.4px,.4px)}75%{transform:translate(.5px,.2px)}}
@media (prefers-reduced-motion:reduce){ .roomwin[data-snow="3"] .winglass{animation:none} .roomwin .winhaze,.roomwin .winhaze::after{transition:none} }
html.q-low .roomwin[data-snow="3"] .winglass{animation:none}

/* 27 Nov: a soft contact shadow on the floor along the side wall */
#roomBack .rb-floor{isolation:isolate}
#roomBack.has-left .rb-floor::before{content:'';position:absolute;left:-20px;top:0;width:calc(var(--cx,0px) + 20px);height:calc(var(--cdrop,0px) + 40px);pointer-events:none;z-index:1;
  background:rgba(0,0,0,.42);filter:blur(7px);
  clip-path:polygon(0 calc(100% - 44px),100% -4px,100% 10px,0 calc(100% - 14px))}
html.pearl #roomBack.has-left .rb-floor::before{background:rgba(60,40,20,.3)}

/* ---- 27 Nov evening: the right side wall, from just before the fire extinguisher (rightwall.js). Same panelling, rail, skirting and wallpaper as the left wall ---- */
#roomBack .rb-right{position:absolute;top:0;display:none;pointer-events:none;overflow:hidden}
#roomBack .rb-right>.rr,#roomBack .rb-right>.rb-rfloor{position:absolute;inset:0}
#roomBack .rb-rshade{background:linear-gradient(270deg,rgba(0,0,0,.5),rgba(0,0,0,.2) 60%,rgba(0,0,0,.3) calc(100% - 10px),rgba(0,0,0,.45) 100%)}
html.pearl #roomBack .rb-rshade{background:linear-gradient(270deg,rgba(40,30,20,.28),rgba(40,30,20,.1) 60%,rgba(40,30,20,.16) calc(100% - 10px),rgba(40,30,20,.3) 100%)}
#roomBack .rb-rfloor{background:rgba(0,0,0,.4);filter:blur(7px)}
html.pearl #roomBack .rb-rfloor{background:rgba(60,40,20,.26)}
/* the door in the side wall: scenery only for now */
#roomBack .rb-rdoor{position:absolute;left:0;top:0;transform-origin:0 0;max-width:none;pointer-events:none;z-index:1}
html.rb-par #roomBack .rb-right{translate:calc(var(--px,0)*-5px) 0}
html.q-low #roomBack .rb-rfloor{filter:none;opacity:.6}
