/* ═══════════════════════════════════════════════════════════
   AGED PLASTER WALL — loaded after style.css and hero-window.css.
   Overrides only the wall layers (.room-base, .wall-texture, .spill--day,
   .grain) and the window's shadows on the wall. Window, pull cord,
   typography and scripts are untouched. No image files: textures are
   inline SVG filters.
   ═══════════════════════════════════════════════════════════ */

/* muted terracotta → tobacco → warm umber (day). Night palette unchanged. */
:root { --room-core: #9C5D3C; --room-mid: #5C3822; --room-edge: #1C1009; }

.room-base {
  background:
    /* soft darker edges: ceiling and floor lines */
    linear-gradient(to bottom, rgba(10,5,2,.34) 0%, transparent 15%, transparent 80%, rgba(10,5,2,.42) 100%),
    /* natural imperfections: uneven, low-contrast patches and a faint damp bloom low on the right */
    radial-gradient(30% 22% at 14% 26%, rgba(236,200,160,.06) 0%, transparent 72%),
    radial-gradient(26% 20% at 86% 14%, rgba(26,12,5,.20) 0%, transparent 72%),
    radial-gradient(22% 30% at 80% 64%, rgba(26,12,5,.14) 0%, transparent 72%),
    radial-gradient(9% 18% at 71% 74%, rgba(60,32,16,.16) 0%, transparent 70%),
    radial-gradient(34% 24% at 22% 82%, rgba(20,9,4,.24) 0%, transparent 72%),
    radial-gradient(16% 12% at 36% 58%, rgba(236,196,150,.035) 0%, transparent 70%),
    radial-gradient(14% 22% at 94% 42%, rgba(18,8,3,.16) 0%, transparent 70%),
    radial-gradient(12% 9% at 8% 50%, rgba(236,200,160,.04) 0%, transparent 70%),
    /* warm bounce from the left wall */
    radial-gradient(ellipse 30% 55% at -4% 46%, rgba(170,112,70,.12) 0%, transparent 65%),
    /* broad room light: wider and flatter, so there is no hot spot behind the window */
    radial-gradient(ellipse 110% 92% at 50% 34%,
      var(--room-core) 0%,
      color-mix(in srgb, var(--room-core) 62%, var(--room-mid)) 30%,
      var(--room-mid) 56%,
      var(--room-edge) 84%,
      #0b0603 100%);
}

/* the window's own glow on the wall, kept but calmer and less saturated */
.spill--day {
  background: radial-gradient(ellipse 52% 42% at 50% 44%,
    rgba(240, 186, 120, 0.20) 0%,
    rgba(232, 172, 108, 0.10) 40%,
    rgba(220, 160, 96, 0.04) 66%,
    transparent 86%);
}

/* late sun from an off-screen window on the left: a soft, slanted shaft with a faint glazing-bar shadow */
.room-base::after {
  content: "";
  position: absolute;
  left: -6%;
  top: 0;
  width: 42vw;
  height: 78vh;
  background:
    linear-gradient(112deg, transparent 0 41%, rgba(24,10,3,.12) 43.5% 45%, transparent 47.5%),
    linear-gradient(112deg, transparent 18%, rgba(244,200,146,.16) 30%, rgba(240,194,140,.18) 46%, rgba(232,184,128,.09) 54%, transparent 64%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.8) 50%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,.8) 50%, transparent 100%);
  mix-blend-mode: screen;
  transition: opacity 1.4s ease-in-out;
}
body.night .room-base::after { opacity: 0; }

/* plaster surface: broad trowel relief + fine plaster that roughens in patches, both lit from the upper left */
.wall-texture {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='560' height='560'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.11 0.085' numOctaves='4' seed='31' stitchTiles='stitch' result='n'/%3E%3CfeDiffuseLighting in='n' surfaceScale='1.6' diffuseConstant='1' lighting-color='%23fff' result='l'%3E%3CfeDistantLight azimuth='250' elevation='58'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix in='l' type='matrix' values='1 0 0 0 -0.31  0 1 0 0 -0.31  0 0 1 0 -0.31  0 0 0 0 1' result='g'/%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.006' numOctaves='2' seed='5' stitchTiles='stitch' result='m'/%3E%3CfeColorMatrix in='m' type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  2.6 0 0 0 -0.95' result='ma'/%3E%3CfeComposite in='g' in2='ma' operator='in'/%3E%3C/filter%3E%3Crect width='560' height='560' filter='url(%23f)'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0032 0.0046' numOctaves='5' seed='17' stitchTiles='stitch' result='n'/%3E%3CfeDiffuseLighting in='n' surfaceScale='3.2' diffuseConstant='1' lighting-color='%23fff' result='l'%3E%3CfeDistantLight azimuth='250' elevation='50'/%3E%3C/feDiffuseLighting%3E%3CfeColorMatrix in='l' type='matrix' values='1 0 0 0 -0.31  0 1 0 0 -0.31  0 0 1 0 -0.31  0 0 0 0 1' result='g'/%3E%3C/filter%3E%3Crect width='900' height='900' filter='url(%23f)'/%3E%3C/svg%3E");
  background-size: 560px 560px, 900px 900px;
  background-position: 211px 67px, 0 0;
  mix-blend-mode: soft-light;
  opacity: .62;
}
/* slow colour drift across the wall — warm umber in places, dusty ochre in others */
.wall-texture::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1100' height='1100'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0019 0.0026' numOctaves='3' seed='9' stitchTiles='stitch' result='t'/%3E%3CfeColorMatrix in='t' type='matrix' values='0 0 0 0 0.42  0 0 0 0 0.30  0 0 0 0 0.22  1.7 0 0 0 -0.62'/%3E%3C/filter%3E%3Crect width='1100' height='1100' filter='url(%23f)'/%3E%3C/svg%3E");
  background-size: 1100px 1100px;
  mix-blend-mode: multiply;
  opacity: .22;
}
body.night .wall-texture { opacity: .45; }
body.night .wall-texture::before { opacity: .14; }

/* film grain stays but quieter, so the plaster carries the surface */
.grain { opacity: calc(var(--g-opacity) * .5); }

/* ── shadows of the window on the wall: soft, falling down and to the right, away from the light ── */
.ww-ao {
  opacity: .46;   /* position unchanged: its outline mask is applied after the blur, so moving it would expose a hard edge */
}
body.night .ww-ao { opacity: .6; }
.window-shadow {
  filter:
    brightness(0)
    blur(calc(6px * var(--fs) / 0.4))
    drop-shadow(calc(6px * var(--fs) / 0.4) calc(10px * var(--fs) / 0.4) calc(24px * var(--fs) / 0.4) rgba(0, 0, 0, 0.42));
  opacity: .5;
}
.ww-sill-shadow {
  left: calc(110px * var(--fs)); width: calc(960px * var(--fs));
  height: calc(190px * var(--fs));
  background:
    radial-gradient(ellipse 46% 28% at 52% 0%, rgba(0,0,0,.58) 0%, rgba(0,0,0,.24) 55%, transparent 100%),
    radial-gradient(ellipse 50% 70% at 56% 0%, rgba(0,0,0,.20) 0%, transparent 100%);
  filter: blur(calc(9px * var(--fs) / 0.4));
}

@media (max-width: 760px) {
  .room-base::after { left: -14%; width: 60vw; height: 60vh; }
}
