/* Daylight washes tint the complete painting without filtering live canvases. */

.daylight-sky {
  position: absolute;
  inset: 0;
  width: var(--painting-width);
  left: var(--painting-left);
  right: auto;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.daylight-sun {
  position: absolute;
  width: 66px;
  height: 66px;
  margin: -33px 0 0 -33px;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 42% 38%, var(--sun-core, #f7dfa4) 0 34%, var(--sun-mid, #f2cf9a) 52%, transparent 72%);
  box-shadow:
    0 0 22px 8px var(--sun-glow, #f2d9a833),
    0 0 70px 22px var(--sun-halo, #f2d9a822);
  z-index: 1;
}

.daylight-sun:focus-visible {
  outline: 2px solid var(--terra, #a96549);
  outline-offset: 6px;
}

/* Twilight fireflies rendered by daylight.js; shown near the evening end. */
.daylight-firefly {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff3c4;
  box-shadow: 0 0 10px 3px #ffefba55;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.world.twilight .daylight-firefly { opacity: .85; }

.world.twilight.motion-ok .daylight-firefly {
  animation: daylight-blink 6s ease-in-out infinite;
}

.world.twilight.motion-ok .daylight-firefly:nth-child(3n) { animation-delay: -2s; }
.world.twilight.motion-ok .daylight-firefly:nth-child(3n+1) { animation-delay: -4s; }

@keyframes daylight-blink {
  0%, 100% { opacity: 0; transform: translate(0, 0); }
  50% { opacity: .9; transform: translate(14px, -12px); }
}

/* Both washes sit above terrain, river, grass, duck and veil inside the
   painting's stacking context; sky objects remain independently lit. */

/* Horizontal sun gesture must never block vertical scroll. */
.world { touch-action: pan-y; }

/* Match the painting geometry so the sun tracks the landscape. */
@media (max-width: 700px) {
  .daylight-sun {
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .daylight-sky *,
  .daylight-firefly {
    animation: none !important;
    transition: none !important;
  }
}
/* A cool dawn sky, pink horizon and sage dew wash preserve painted texture. */
.painting::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, #b7dceccc 0%, #c6e1edb8 23%, #efd4e080 43%, #b9d4cf66 60%, #99bda766 100%);
  opacity: var(--morning, 0);
  pointer-events: none;
}
/* Night is last: no bright untinted live grass or river above its wash. */
.painting::after { content: ""; position: absolute; inset: 0; z-index: 2; background: #14233e; opacity: calc(var(--night, 0) * .78); pointer-events: none; }
.night-moon { position: absolute; width: 62px; height: 62px; left: 76%; top: var(--moon-y, 51%); opacity: var(--night, 0); background: radial-gradient(circle, #fff2c54a, transparent 70%); transform: translate(-50%, -50%); pointer-events: none; user-select: none; }
.night-moon svg { width: 100%; height: 100%; display: block; }
.night-stars { position: absolute; inset: 0; opacity: var(--night, 0); pointer-events: none; user-select: none; }
.night-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff5d8; box-shadow: 0 0 5px #fff5d86b; display: block; }
.world.is-night { color: #ede8d2; }
.world.is-night header { border-color: #eee4c830; }
.world.is-night h1 em, .world.is-night .logo-dot, .world.is-night .nav-count { color: #e9bf96; }
.world.is-night .intro-copy, .world.is-night .introduction > .eyebrow, .world.is-night .header-note, .world.is-night footer, .world.is-night .footer-center, .world.is-night .landscape-caption { color: #e2e2cd; }
.world.is-night .wordmark svg, .world.is-night .footer-left svg { stroke: #e4ce9e; }
.world.is-night .enc-ground-shadow { opacity: 0; }
.world.is-night .enc-glow { opacity: .8; }
/* Mobile sky follows the painting's 120%-wide frame. */
@media (max-width: 700px) { .night-moon { width: 48px; height: 48px; left: 63%; } }
