/* Xingchen action fusion v2
 *
 * Reuses one scene-light system for the validated sit-and-look action plus the
 * sleeping and running actions. Each action keeps only the small differences
 * that belong to its pose: contact-shadow geometry and a restrained exposure
 * compensation. Motion paths and action timing remain in the existing bundle.
 */

.room-scene {
  --xc-scene-brightness: 1.02;
  --xc-scene-saturation: 0.98;
  --xc-scene-contrast: 1;
  --xc-scene-hue: 0deg;
  --xc-scene-sepia: 0.055;
  --xc-edge-shadow-y: 18px;
  --xc-edge-shadow-blur: 22px;
  --xc-edge-shadow-color: rgb(80 51 36 / 18%);
  --xc-scene-glow: drop-shadow(0 0 0 rgb(0 0 0 / 0%));
  --xc-ground-color: rgb(83 53 38 / 25%);
  --xc-ground-opacity: 0.66;
  --xc-ground-blur: 13px;
  --xc-ground-glow: 0 0 0 rgb(0 0 0 / 0%);
}

.room-scene.scene-forest {
  --xc-scene-brightness: 0.96;
  --xc-scene-saturation: 0.9;
  --xc-scene-contrast: 1.02;
  --xc-scene-hue: 4deg;
  --xc-scene-sepia: 0;
  --xc-edge-shadow-y: 16px;
  --xc-edge-shadow-blur: 20px;
  --xc-edge-shadow-color: rgb(30 56 43 / 22%);
  --xc-ground-color: rgb(30 58 43 / 28%);
  --xc-ground-glow: 0 0 15px rgb(79 117 91 / 10%);
}

.room-scene.scene-creek {
  --xc-scene-brightness: 0.99;
  --xc-scene-saturation: 0.87;
  --xc-scene-contrast: 1.025;
  --xc-scene-hue: 7deg;
  --xc-scene-sepia: 0;
  --xc-edge-shadow-y: 16px;
  --xc-edge-shadow-blur: 21px;
  --xc-edge-shadow-color: rgb(25 57 61 / 20%);
  --xc-ground-color: rgb(29 61 56 / 25%);
  --xc-ground-glow: 0 0 17px rgb(91 151 143 / 10%);
}

.room-scene.scene-beach {
  --xc-scene-brightness: 1.065;
  --xc-scene-saturation: 0.9;
  --xc-scene-contrast: 0.985;
  --xc-scene-hue: 2deg;
  --xc-scene-sepia: 0;
  --xc-edge-shadow-y: 14px;
  --xc-edge-shadow-blur: 19px;
  --xc-edge-shadow-color: rgb(61 78 80 / 16%);
  --xc-ground-color: rgb(66 83 76 / 19%);
  --xc-ground-opacity: 0.46;
  --xc-ground-blur: 16px;
  --xc-ground-glow: 0 0 0 rgb(0 0 0 / 0%);
}

.room-scene.scene-summit {
  --xc-scene-brightness: 0.78;
  --xc-scene-saturation: 0.76;
  --xc-scene-contrast: 1.04;
  --xc-scene-hue: 10deg;
  --xc-scene-sepia: 0;
  --xc-edge-shadow-y: 16px;
  --xc-edge-shadow-blur: 22px;
  --xc-edge-shadow-color: rgb(10 20 42 / 38%);
  --xc-scene-glow: drop-shadow(0 0 6px rgb(170 196 235 / 22%));
  --xc-ground-color: rgb(13 24 51 / 42%);
  --xc-ground-opacity: 0.62;
  --xc-ground-blur: 14px;
  --xc-ground-glow: 0 0 19px rgb(126 157 207 / 14%);
}

.period-evening .room-scene.scene-room {
  --xc-scene-brightness: 0.95;
  --xc-scene-saturation: 0.96;
  --xc-scene-contrast: 1;
  --xc-scene-hue: 0deg;
  --xc-scene-sepia: 0.09;
  --xc-edge-shadow-color: rgb(80 51 36 / 20%);
}

.period-night .room-scene.scene-room {
  --xc-scene-brightness: 0.86;
  --xc-scene-saturation: 0.88;
  --xc-scene-contrast: 1.02;
  --xc-scene-hue: 4deg;
  --xc-scene-sepia: 0;
  --xc-edge-shadow-y: 16px;
  --xc-edge-shadow-color: rgb(28 34 55 / 28%);
}

.period-evening .room-scene.scene-forest {
  --xc-scene-brightness: 0.86;
  --xc-scene-saturation: 0.84;
  --xc-edge-shadow-blur: 21px;
  --xc-edge-shadow-color: rgb(36 52 43 / 24%);
}

.period-evening .room-scene.scene-creek {
  --xc-scene-brightness: 0.88;
  --xc-scene-saturation: 0.82;
  --xc-edge-shadow-blur: 21px;
  --xc-edge-shadow-color: rgb(32 52 50 / 23%);
}

.period-evening .room-scene.scene-beach {
  --xc-scene-brightness: 0.92;
  --xc-scene-saturation: 0.84;
  --xc-scene-contrast: 1;
  --xc-edge-shadow-y: 15px;
  --xc-edge-shadow-blur: 20px;
  --xc-edge-shadow-color: rgb(49 57 58 / 20%);
}

.period-night .room-scene.scene-forest {
  --xc-scene-brightness: 0.7;
  --xc-scene-saturation: 0.76;
  --xc-scene-contrast: 1.04;
  --xc-scene-hue: 9deg;
  --xc-edge-shadow-blur: 22px;
  --xc-edge-shadow-color: rgb(13 29 43 / 34%);
}

.period-night .room-scene.scene-creek {
  --xc-scene-brightness: 0.72;
  --xc-scene-saturation: 0.74;
  --xc-scene-contrast: 1.04;
  --xc-scene-hue: 12deg;
  --xc-edge-shadow-blur: 22px;
  --xc-edge-shadow-color: rgb(12 31 47 / 34%);
}

.period-night .room-scene.scene-beach {
  --xc-scene-brightness: 0.75;
  --xc-scene-saturation: 0.76;
  --xc-scene-contrast: 1.02;
  --xc-scene-hue: 8deg;
  --xc-edge-shadow-y: 15px;
  --xc-edge-shadow-blur: 21px;
  --xc-edge-shadow-color: rgb(15 31 49 / 31%);
}

.room-scene.scene-action-look {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
}

.room-scene.scene-action-sleep {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
  --xc-sleep-y-offset: 10%;
}

.room-scene.scene-action-run {
  --xc-action-brightness: 1.02;
  --xc-action-contrast: 1;
}

.room-scene.scene-action-sphinx {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
}

.room-scene.scene-action-snack {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
}

.room-scene.scene-action-playbow {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
}

.room-scene.scene-action-paw {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
}

/*
 * Sleep v4.2 is calibrated against the accepted neutral look asset. Scene light
 * now does the exposure work; the sleeping action no longer needs a daylight
 * brightness or contrast correction of its own.
 */
.period-morning .room-scene.scene-action-sleep:not(.scene-summit),
.period-day .room-scene.scene-action-sleep:not(.scene-summit) {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
}

.room-scene.scene-action-look .dog-art-look,
.room-scene.scene-action-sleep .dog-art-sleep,
.room-scene.scene-action-run .dog-art-run,
.room-scene.scene-action-sphinx .dog-art-sphinx,
.room-scene.scene-action-snack .dog-art-snack,
.room-scene.scene-action-playbow .dog-art-playbow,
.room-scene.scene-action-paw .dog-art-paw {
  filter: brightness(var(--xc-scene-brightness))
    brightness(var(--xc-action-brightness))
    saturate(var(--xc-scene-saturation)) contrast(var(--xc-scene-contrast))
    contrast(var(--xc-action-contrast))
    hue-rotate(var(--xc-scene-hue)) sepia(var(--xc-scene-sepia))
    var(--xc-scene-glow)
    drop-shadow(
      0 var(--xc-edge-shadow-y) var(--xc-edge-shadow-blur)
        var(--xc-edge-shadow-color)
    );
}

.room-scene:is(
    .scene-action-look,
    .scene-action-sleep,
    .scene-action-run,
    .scene-action-sphinx,
    .scene-action-snack,
    .scene-action-playbow,
    .scene-action-paw
  )
  .dog-shadow {
  opacity: var(--xc-ground-opacity);
  filter: blur(var(--xc-ground-blur));
  background: var(--xc-ground-color);
  box-shadow: var(--xc-ground-glow);
}

/* A sleeping body contacts the floor across its chest, belly and curled tail. */
.room-scene.scene-action-sleep .dog-shadow {
  width: 50%;
  height: 7%;
  left: 25%;
  bottom: 18%;
  border-radius: 46%;
}

/*
 * The 1254px sleep canvas keeps 230px of transparent space below the visible
 * fur. Move only the sleeping stage (dog and contact shadow together) so its
 * visible body sits on the scene plane without altering the shared stage or
 * the breathing transform.
 */
.room-scene.scene-action-sleep .dog-stage.action-sleep {
  translate: 0 var(--xc-sleep-y-offset);
}

/* Keep the existing horizontal run-shadow motion; only tune its shape/light. */
.room-scene.scene-action-run .dog-shadow {
  width: 42%;
  height: 7.5%;
  bottom: 3%;
}

/* The sphinx canvas leaves more transparent space below the paws than the
 * accepted sit-and-look asset. Lower only the image and keep a broad, soft
 * contact shadow under the chest and both front paws. */
.room-scene.scene-action-sphinx .dog-art-sphinx {
  bottom: -3.5%;
}

.room-scene.scene-action-sphinx .dog-shadow {
  width: 60%;
  height: 7.5%;
  left: 20%;
  bottom: 3.4%;
}

/* The snack pose shares the accepted upright sitting footprint. Keep the
 * floating treat out of the contact calculation and ground only the paws,
 * hips and tail. */
.room-scene.scene-action-snack .dog-shadow {
  width: 56%;
  height: 7.5%;
  left: 22%;
  bottom: 3.4%;
}

/* The play-bow pose has three visible contact zones: both lowered front paws,
 * the low chest, and the rear support paw. Use a wide but shallow footprint so
 * the pose reads as weight-bearing without turning into a floating cutout. */
.room-scene.scene-action-playbow .dog-shadow {
  width: 68%;
  height: 7.5%;
  left: 16%;
  bottom: 3.2%;
}

/* The human hand enters from the left but is not a floor contact. Shift the
 * footprint under the seated body, planted front paw, haunches and tail base. */
.room-scene.scene-action-paw .dog-shadow {
  width: 56%;
  height: 7.5%;
  left: 34%;
  bottom: 3.4%;
}

.room-scene.scene-summit.scene-action-sleep {
  --xc-action-brightness: 1;
  --xc-action-contrast: 1;
  --xc-sleep-y-offset: 5%;
}

.room-scene.scene-summit.scene-action-run {
  --xc-action-brightness: 1.045;
}

.time-page.wallpaper-mode .room-scene.scene-action-sleep .dog-shadow {
  width: 66%;
  left: 17%;
  bottom: 18%;
}

.time-page.wallpaper-mode .room-scene.scene-action-sleep {
  --xc-sleep-y-offset: 7%;
}

.time-page.wallpaper-mode .room-scene.scene-summit.scene-action-sleep {
  --xc-sleep-y-offset: 4%;
}

.time-page.wallpaper-mode .room-scene.scene-action-run .dog-shadow {
  width: 42%;
  left: 0;
  bottom: 3%;
}

.time-page.wallpaper-mode .room-scene.scene-action-sphinx .dog-art-sphinx {
  bottom: -5%;
}

.time-page.wallpaper-mode .room-scene.scene-action-sphinx .dog-shadow {
  width: 64%;
  left: 18%;
  bottom: 3.4%;
}

.time-page.wallpaper-mode .room-scene.scene-action-snack .dog-shadow {
  width: 60%;
  left: 20%;
  bottom: 3.4%;
}

.time-page.wallpaper-mode .room-scene.scene-action-playbow .dog-shadow {
  width: 72%;
  left: 14%;
  bottom: 2.6%;
}

.time-page.wallpaper-mode .room-scene.scene-action-paw .dog-shadow {
  width: 60%;
  left: 32%;
  bottom: 2.8%;
}

@media (prefers-reduced-motion: reduce) {
  .room-scene.scene-action-sleep .dog-art-sleep,
  .room-scene.scene-action-run .dog-art-run,
  .room-scene.scene-action-sphinx .dog-art-sphinx,
  .room-scene.scene-action-snack .dog-art-snack,
  .room-scene.scene-action-playbow .dog-art-playbow,
  .room-scene.scene-action-paw .dog-art-paw {
    animation: none;
  }
}
