/* ============================================================
   THEMES — time-of-day custom properties and per-element overrides
   Active themes: dawn · day · night
   (golden and dusk removed — restore here if more times of day return)
   All transitions on transitioning elements are 3s ease.
   ============================================================ */

/* ============================================================
   Custom properties — one block per theme
   ============================================================ */

.scene.dawn {
  --sky-primary:    #c9a8d0;
  --sky-secondary:  #f5c8b0;
  --ground-tone:    #8a9a6a;
  --orb-color:      #fff5e0;
  --orb-glow:       rgba(255, 235, 180, 0.6);
  --text-cream:     rgba(255, 236, 217, 0.95);
  --star-opacity:   0.15;
  --cloud-filter:   none;
  --sky-edge-bg:    #c9a8d0;
}

.scene.day {
  --sky-primary:    #5b8fc9;
  --sky-secondary:  #edf3f8;
  --ground-tone:    #7a9a5a;
  --orb-color:      #fffbe0;
  --orb-glow:       rgba(255, 255, 200, 0.8);
  --text-cream:     rgba(255, 236, 217, 0.95);
  --star-opacity:   0;
  --cloud-filter:   brightness(1.15) saturate(0.7);
  --sky-edge-bg:    #5b8fc9;
}

.scene.night {
  --sky-primary:    #03080f;
  --sky-secondary:  #202e50;
  --ground-tone:    #3a4030;
  --orb-color:      #d0d8f0;
  --orb-glow:       rgba(180, 190, 230, 0.5);
  --text-cream:     rgba(255, 236, 217, 0.95);
  --star-opacity:   1;
  --cloud-filter:   brightness(0.35) saturate(0.5) hue-rotate(200deg);
  --sky-edge-bg:    #03080f;
}

/* ============================================================
   Layer 1 — Sky background
   ============================================================ */

/* Dawn: PNG exists */
.scene.dawn .layer-sky {
  background-image: url('../images/sky/sky_dawn.png');
  background-color: #c9a8d0;
}

/* Day: PNG exists */
.scene.day .layer-sky {
  background-image: url('../images/sky/sky_day.png');
  background-color: #5b8fc9;
}

/* Night: CSS gradient — SWAP url() in when sky_night.png is painted */
.scene.night .layer-sky {
  background-image: url('../images/sky/sky_night.png');
  background-color: #03080f;
}

/* Sky crossfade — .layer-sky-prev backgrounds, mirrors .layer-sky rules above */
.layer-sky-prev.dawn {
  background-image: url('../images/sky/sky_dawn.png');
  background-color: #c9a8d0;
}
.layer-sky-prev.day {
  background-image: url('../images/sky/sky_day.png');
  background-color: #5b8fc9;
}
.layer-sky-prev.night {
  background-image: url('../images/sky/sky_night.png');
  background-color: #03080f;
}

/* ============================================================
   Layer 2 — Stars
   ============================================================ */

.scene.dawn  .star { opacity: 0.15; animation-play-state: paused; }
.scene.day   .star { opacity: 0;    pointer-events: none; }
.scene.night .star { opacity: 1; }

/* ============================================================
   Layer 3 — Orb
   Position anchors the centre of the orb (offset via translate(-50%,-50%))
   JS arc animation fires when crossing the night boundary.
   These left/top values must be mirrored in ORB_TOPS / ORB_LEFTS in main.js.
   ============================================================ */

/* Dawn — warm cream, low near horizon */
.scene.dawn .orb {
  left:       30%;
  top:        77%;
  width:      130px;
  height:     130px;
  background: radial-gradient(circle, #fff8e8 0%, #ffe8c0 35%, transparent 70%);
  filter:     blur(3px);
  opacity:    0.95;
  box-shadow: none;
  animation-duration: 6s;
}

/* Day — bright white-yellow, high in sky */
.scene.day .orb {
  left:       40%;
  top:        15%;
  width:      90px;
  height:     90px;
  background: radial-gradient(circle, #ffffff 0%, #fffbe0 35%, transparent 70%);
  filter:     blur(1px);
  opacity:    1;
  box-shadow: none;
  animation-duration: 4s;
}

/* Night — cool silver-white moon, upper sky */
.scene.night .orb {
  left:       72%;
  top:        10%;
  width:      75px;
  height:     75px;
  background: radial-gradient(circle, #e8eeff 0%, #b0c0e8 40%, transparent 70%);
  filter:     blur(1px);
  opacity:    0.95;
  /* Inset shadow suggests crescent lit from upper-right */
  box-shadow: inset -10px -7px 0 3px rgba(15, 20, 55, 0.65),
              0 0 24px rgba(180, 190, 230, 0.35);
  animation-duration: 10s;
}

/* ============================================================
   Layer 4 — CSS Atmospheric Blobs
   ============================================================ */

/* Dawn — lavender, dusty pink, warm peach */
.scene.dawn .blob-a { background: radial-gradient(ellipse, rgb(180,160,210) 0%, transparent 70%); }
.scene.dawn .blob-b { background: radial-gradient(ellipse, rgb(220,170,180) 0%, transparent 70%); }
.scene.dawn .blob-c { background: radial-gradient(ellipse, rgb(240,200,170) 0%, transparent 70%); }

/* Day — sky blues */
.scene.day .blob-a { background: radial-gradient(ellipse, rgb(180,210,240) 0%, transparent 70%); }
.scene.day .blob-b { background: radial-gradient(ellipse, rgb(230,240,255) 0%, transparent 70%); }
.scene.day .blob-c { background: radial-gradient(ellipse, rgb(200,215,230) 0%, transparent 70%); }

/* Night — deep blue, indigo, near-black */
.scene.night .blob-a { background: radial-gradient(ellipse, rgb(40,60,120)  0%, transparent 70%); }
.scene.night .blob-b { background: radial-gradient(ellipse, rgb(60,40,100)  0%, transparent 70%); }
.scene.night .blob-c { background: radial-gradient(ellipse, rgb(20,15,50)   0%, transparent 70%); }

/* ============================================================
   Layer 5 — Background cloud PNGs (filter per theme)
   ============================================================ */

/* Dawn/night shared cloud elements (.cloud-bg) */
.scene.dawn  .cloud-bg { filter: none; }
.scene.day   .cloud-bg { opacity: 0; }       /* day uses .cloud-bg-day instead */
.scene.night .cloud-bg { opacity: 0; }       /* night uses .cloud-bg-night instead */

/* Day-specific bg cloud elements (.cloud-bg-day) */
.scene.dawn  .cloud-bg-day,
.scene.night .cloud-bg-day { opacity: 0; }
.scene.day   .cloud-bg-day { filter: brightness(1.15) saturate(0.7); opacity: 1; }

/* Night-specific bg cloud elements (.cloud-bg-night) */
.scene.dawn  .cloud-bg-night,
.scene.day   .cloud-bg-night { opacity: 0; }
.scene.night .cloud-bg-night { filter: none; opacity: 1; }

/* ============================================================
   Layer 6 — Depth overlay
   ============================================================ */

.scene.dawn  .layer-depth { background: transparent; }
.scene.day   .layer-depth { background: transparent; }
.scene.night .layer-depth {
  background: linear-gradient(180deg, rgba(5,5,20,0.4) 0%, rgba(10,5,30,0.55) 100%);
}

/* ============================================================
   Layer 7 — Foreground cloud PNGs (filter per theme)
   ============================================================ */

/* Dawn/night shared cloud elements (.cloud-fg) */
.scene.dawn  .cloud-fg { filter: none; opacity: 1; }
.scene.day   .cloud-fg { opacity: 0; }       /* day uses .cloud-fg-day instead */
.scene.night .cloud-fg { opacity: 0; pointer-events: none; }

/* Day-specific fg cloud elements (.cloud-fg-day) */
.scene.dawn  .cloud-fg-day,
.scene.night .cloud-fg-day { opacity: 0; pointer-events: none; }
.scene.day   .cloud-fg-day { filter: brightness(1.02) saturate(.9); opacity: .95; }

/* Night-specific fg cloud elements (.cloud-fg-night) */
.scene.dawn  .cloud-fg-night,
.scene.day   .cloud-fg-night { opacity: 0; pointer-events: none; }
.scene.night .cloud-fg-night { filter: brightness(.75) saturate(.9); opacity: 1; }

/* ============================================================
   Day CSS cloud layer — visible on day only
   ============================================================ */

.scene.day .css-cloud-day--1 {
  opacity: 0.75;
  background: radial-gradient(ellipse, rgb(255,255,255) 0%, transparent 68%);
}
.scene.day .css-cloud-day--2 {
  opacity: 0.65;
  background: radial-gradient(ellipse, rgb(230,242,255) 0%, transparent 68%);
}
.scene.day .css-cloud-day--3 {
  opacity: 0.60;
  background: radial-gradient(ellipse, rgb(200,220,240) 0%, transparent 68%);
}
.scene.day .css-cloud-day--4 {
  opacity: 0.65;
  background: radial-gradient(ellipse, rgb(245,250,255) 0%, transparent 68%);
}
.scene.day .css-cloud-day--5 {
  opacity: 0.55;
  background: radial-gradient(ellipse, rgb(210,228,245) 0%, transparent 68%);
}

/* ============================================================
   Scene labels — dim on night theme
   ============================================================ */

.scene.night .scene-label {
  filter: brightness(0.45);
}

/* ============================================================
   Constellation Easter egg — night only
   ============================================================ */

.scene.dawn  .constellation,
.scene.day   .constellation { opacity: 0; pointer-events: none; }
.scene.night .constellation { opacity: 0.45; pointer-events: auto; }

/* ============================================================
   Ground — swap dawn/night images
   ============================================================ */

.scene.night .layer-ground--dawn  { opacity: 0; }
.scene.dawn  .layer-ground--night,
.scene.day   .layer-ground--night { opacity: 0; }
.scene.night .layer-ground--night { opacity: 1; }

/* Desktop split ground / foreground / signature: dawn+day set vs night set */
.land-t--dawn, .land-t--night { transition: opacity 3s ease; }
.scene.night .land-t--dawn  { opacity: 0; }
.scene.dawn  .land-t--night,
.scene.day   .land-t--night { opacity: 0; }

/* ============================================================
   Body background — matches sky edge for ultrawide monitors
   ============================================================ */

body[data-theme="dawn"]  { background-color: #c9a8d0; }
body[data-theme="day"]   { background-color: #5b8fc9; }
body[data-theme="night"] { background-color: #03080f; }
