/* Wall, window frame, light switch and room lighting. */

.wall {
  /* bleeds past the stage so letterboxed screens show continuous wall.
     The box starts 1200px left of / 600px above the stage, so glow positions are offset by that. */
  inset: -600px -1200px 0;
  background:
    /* neon spill from the window onto the wall (window center ≈ stage 800, 296) */
    radial-gradient(ellipse 620px 420px at 2000px 896px, rgba(120, 70, 255, .16), transparent 70%),
    radial-gradient(ellipse 380px 260px at 1760px 1120px, rgba(255, 60, 200, .08), transparent 70%),
    radial-gradient(ellipse 380px 260px at 2240px 1120px, rgba(60, 240, 255, .08), transparent 70%),
    /* real plaster (Poly Haven "Painted Plaster Wall", CC0), overlaid on the night tint */
    url("../assets/textures/plaster-wall.webp") 0 0 / 420px,
    linear-gradient(180deg, #2a2534 0%, #221e2b 55%, #1a1721 100%);
  background-blend-mode: normal, normal, normal, overlay, normal;
}

/* ---------- Window ---------- */

.window {
  left: 370px;
  top: 46px;
  width: 860px;
  height: 500px;
}

/* Outer frame with bevel; the inner "reveal" shows the wall's thickness for depth. */
.window__reveal {
  position: absolute;
  inset: 0;
  padding: 18px;
  border-radius: 4px;
  background: linear-gradient(160deg, #3b3646, #262230 60%, #1c1924);
  box-shadow:
    0 0 0 3px #15121b,
    0 0 70px 10px rgba(140, 90, 255, .18),
    inset 0 2px 0 rgba(255, 255, 255, .08),
    0 18px 40px rgba(0, 0, 0, .55);
}

.window__glass {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070514;
  /* inner reveal shading: top/left in shadow, bottom catches city light */
  box-shadow:
    inset 0 14px 18px -6px rgba(0, 0, 0, .8),
    inset 12px 0 16px -8px rgba(0, 0, 0, .7),
    inset -12px 0 16px -8px rgba(0, 0, 0, .7),
    0 0 0 6px #120f18;
}

.window__reflection {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    /* faint reflection of the desk lamp in the glass */
    radial-gradient(ellipse 70px 40px at 4% 96%, rgba(255, 210, 150, .16), transparent 70%),
    linear-gradient(115deg, transparent 18%, rgba(255, 255, 255, .055) 22%, transparent 30%,
      transparent 58%, rgba(255, 255, 255, .035) 61%, transparent 66%),
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 40%);
  mix-blend-mode: screen;
}

.window__sill {
  left: -34px;
  right: -34px;
  bottom: -26px;
  height: 26px;
  border-radius: 3px;
  background: linear-gradient(180deg, #4a4456 0%, #322d3c 45%, #1d1a24 100%);
  box-shadow: 0 16px 22px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .15);
}

/* ---------- Light switch ---------- */

.switch {
  left: 1300px;
  top: 270px;
  width: 58px;
  height: 92px;
  border-radius: 6px;
  background: linear-gradient(145deg, #e9e4da, #bdb6a8);
  box-shadow:
    3px 6px 10px rgba(0, 0, 0, .55),
    inset 0 1px 0 rgba(255, 255, 255, .7),
    inset 0 -2px 3px rgba(0, 0, 0, .2);
}

.switch__toggle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 34px;
  margin: -17px 0 0 -9px;
  border-radius: 3px;
  background: #d8d2c6;
  box-shadow: inset 0 0 0 2px #a59e90;
}

.switch__toggle::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, #fbf8f2, #cfc8bb);
  box-shadow: 0 3px 4px rgba(0, 0, 0, .35);
  transition: top .15s var(--ease-out), box-shadow .15s;
  top: 2px;
}

.switch[aria-pressed="false"] .switch__toggle::after {
  top: 14px;
  box-shadow: 0 -3px 4px rgba(0, 0, 0, .35);
}

/* ---------- Room lighting ---------- */

/* Warm pool from the desk lamp. */
.lamp-glow {
  inset: 0;
  pointer-events: none;
  z-index: 30;
  background:
    radial-gradient(ellipse 520px 260px at 470px 740px, rgba(255, 196, 120, .30), transparent 70%),
    radial-gradient(ellipse 300px 220px at 450px 500px, rgba(255, 196, 120, .12), transparent 70%);
  mix-blend-mode: soft-light;
  transition: opacity .25s;
}

/* Overall ambient darkness; deepens when the lamp is off. Bleeds past the stage like the wall. */
.room-shade {
  inset: -600px -1200px;
  pointer-events: none;
  z-index: 31;
  background: radial-gradient(ellipse 1300px 900px at 2000px 1050px, transparent 45%, rgba(5, 3, 10, .6) 100%);
  transition: background-color .3s;
}

#stage:not(.lights-on) .lamp-glow { opacity: 0; }
#stage:not(.lights-on) .window__reflection { opacity: .6; }
#stage:not(.lights-on) .room-shade { background-color: rgba(5, 3, 12, .38); }
