/* CSS Background Art */
:root {
  --sky-day:          #8aaec5;
  --sky-sunset-top:   #2a1810;
  --sky-sunset-bottom:#c04518;
  --sky-night:        #140e0a;
  --cloud-day:        rgba(240, 235, 220, 0.85);
  --cloud-night:      rgba(65, 50, 42, 0.65);
  --cloud-sunset:     rgba(185, 90, 62, 0.60);
  --sun-color:        #f0c030;
  --sun-glow:         #e08018;
  --moon-color:       #d8c8a8;
}

/* ── Base ────────────────────────────────────────────────── */
.video-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background-color: var(--sky-night);
  transition: background-color 2s ease;
}

/* ── Sky ─────────────────────────────────────────────────── */
.sky {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  background-image: repeating-linear-gradient(
    -58deg,
    transparent 0, transparent 14px,
    rgba(200, 180, 140, 0.018) 14px, rgba(200, 180, 140, 0.018) 15px
  );
}

/* Stars */
.stars {
  position: absolute;
  top: 0; left: 0;
  width: 1px; height: 1px;
  background: transparent;
  border-radius: 50%;
  z-index: 2;
  opacity: 0;
  transition: opacity 3s ease;
}
body.is-night .stars {
  opacity: 1;
  animation: twinkle 8s ease-in-out infinite alternate;
}

/* Celestial body */
.celestial-body {
  position: absolute;
  width: 52px; height: 52px;
  border-radius: 50%;
  top: 25%; left: 70%;
  background: var(--moon-color);
  box-shadow:
    0 0 0 2px rgba(200, 180, 130, 0.50),
    0 0 0 5px rgba(200, 180, 130, 0.12),
    0 0 18px 4px rgba(200, 180, 130, 0.25);
  transition: all 2s ease;
  z-index: 3;
}

.sun-glow {
  position: absolute;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(240, 180, 30, 0.30) 0%,
    rgba(220, 120, 0, 0) 65%);
  top: 25%; left: 70%;
  transform: translate(-110px, -110px);
  z-index: 1;
  opacity: 0;
  transition: opacity 2s ease;
}

/* ── Clouds ──────────────────────────────────────────────── */
.clouds {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 3;
}

.cloud {
  position: absolute;
  background: var(--cloud-night);
  border-radius: 50px;
  box-shadow: inset 0 -3px 8px rgba(0,0,0,0.18);
  transition: background-color 2s ease;
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: var(--cloud-night);
  border-radius: 50%;
  transition: background-color 2s ease;
}

body.is-day    .cloud, body.is-day    .cloud::before, body.is-day    .cloud::after { background: var(--cloud-day); }
body.is-night  .cloud, body.is-night  .cloud::before, body.is-night  .cloud::after { background: var(--cloud-night); }
body.is-sunset .cloud, body.is-sunset .cloud::before, body.is-sunset .cloud::after { background: var(--cloud-sunset); }

.cloud-1 { width: 150px; height: 48px; top: 15%; left: -150px; opacity: 0.85; }
.cloud-1::before { width: 68px;  height: 68px;  top: -28px; left: 20px; }
.cloud-1::after  { width: 85px;  height: 85px;  top: -38px; right: 20px; }

.cloud-2 { width: 220px; height: 58px; top: 5%; left: -250px; opacity: 0.65; }
.cloud-2::before { width: 78px;  height: 78px;  top: -38px; left: 30px; }
.cloud-2::after  { width: 105px; height: 105px; top: -48px; right: 40px; }

.cloud-3 { width: 120px; height: 38px; top: 25%; left: -100px; opacity: 0.75; }
.cloud-3::before { width: 50px;  height: 50px;  top: -24px; left: 14px; }
.cloud-3::after  { width: 58px;  height: 58px;  top: -28px; right: 14px; }

.cloud-4 { width: 180px; height: 52px; top: 10%; left: -200px; opacity: 0.55; }
.cloud-4::before { width: 72px;  height: 72px;  top: -32px; left: 24px; }
.cloud-4::after  { width: 82px;  height: 82px;  top: -42px; right: 28px; }

/* ── Cityscape ───────────────────────────────────────────── */
.cityscape {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 25%;
  z-index: 2;
  overflow: visible;
}

.cityscape-svg {
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 100%;
  overflow: visible;
}

/* Windows: dark during day, amber glow at night.
   Transitions are slow so the cross-fade is gradual as time passes the horizon. */
.win {
  fill: rgba(120, 160, 200, 0.18);
  stroke: rgba(160, 200, 240, 0.25);
  stroke-width: 0.5;
  filter: none;
  transition: fill 3s ease, filter 3s ease, stroke 3s ease;
}

body.is-night .win {
  fill: #d4841a;
  stroke: rgba(220, 160, 60, 0.4);
  filter: drop-shadow(0 0 3px rgba(210, 130, 20, 0.9));
}

body.is-night .win:nth-child(5n+4) {
  fill: #04070a;
  stroke: none;
  filter: none;
}

body.is-sunset .win {
  fill: rgba(200, 100, 40, 0.22);
  stroke: rgba(220, 130, 60, 0.3);
}

/* A dimmer warm variant for some */
body.is-night .win:nth-child(7n+5) {
  fill: #9a5c0e;
  filter: drop-shadow(0 0 2px rgba(150, 88, 14, 0.55));
}

/* Sunrise/sunset: windows fade toward off as day breaks, or glow dimly */
body.is-sunset .win {
  fill: #7a4a0a;
  filter: drop-shadow(0 0 2px rgba(120, 72, 10, 0.4));
}
body.is-sunset .win:nth-child(4n+3) {
  fill: #04070a;
  filter: none;
}

/* ── Weather ─────────────────────────────────────────────── */
.weather-effects {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* Storm sky: keep each time-of-day readable instead of pitch black */
body.stormy            .video-bg { background-color: #0c0806 !important; }  /* night storm: near-black */
body.is-day.stormy     .video-bg { background-color: #2e3d4a !important; }  /* day storm: dark overcast blue-grey */
body.is-sunset.stormy  .video-bg { background-color: #1c1008 !important; }  /* sunset storm: deep murky orange-black */
body.stormy .cityscape-svg { opacity: 0.75; }
body.stormy .cloud,
body.stormy .cloud::before,
body.stormy .cloud::after  { background: #3a2828; }
.stormy .sky               { animation: lightning 10s infinite; }

@keyframes lightning {
  0%, 95%, 98%, 100% { background: transparent; }
  96%, 99%           { background: rgba(255, 230, 210, 0.10); }
}

.rain {
  position: absolute;
  width: 1px; height: 18px;
  top: -20px;
  background: rgba(200, 180, 160, 0.24);
  animation: fall 0.5s linear infinite;
}

/* ── Animations ──────────────────────────────────────────── */
@keyframes moveClouds {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 300px)); }
}
@keyframes twinkle {
  0%   { opacity: 0.70; }
  50%  { opacity: 1.00; }
  100% { opacity: 0.82; }
}
@keyframes fall { to { transform: translateY(100vh); } }

.cloud-1 { animation: moveClouds  50s linear infinite; }
.cloud-2 { animation: moveClouds  70s linear infinite; animation-delay: -20s; }
.cloud-3 { animation: moveClouds  60s linear infinite; animation-delay: -10s; }
.cloud-4 { animation: moveClouds  80s linear infinite; animation-delay: -35s; }

/* ── Scene Clock (visible only in bg-viewing mode) ───────── */
.scene-clock {
  position: fixed;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;

  background: rgba(8, 12, 18, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(160, 180, 210, 0.12);
  border-radius: 14px;
  padding: 0.75rem 1.1rem 0.6rem;
  min-width: 260px;
  max-width: 320px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  user-select: none;
}

/* Visible but ghosted when not hovered; pointer-events stay on so hover fires */
body.bg-viewing .scene-clock {
  opacity: 0.08;
  pointer-events: auto;
  transform: translateX(-50%) translateY(4px);
}
body.bg-viewing .scene-clock:hover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.scene-clock-header {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.scene-time-display {
  font-size: 1rem;
  font-weight: 600;
  color: #e8d8b8;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.scene-phase-display {
  font-size: 0.72rem;
  color: rgba(200, 180, 140, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex: 1;
}

/* Live/reset button */
.scene-time-reset {
  background: none;
  border: 1px solid rgba(160, 180, 210, 0.2);
  border-radius: 6px;
  color: rgba(180, 200, 230, 0.55);
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.scene-time-reset:hover {
  color: rgba(200, 220, 255, 0.9);
  border-color: rgba(160, 180, 210, 0.5);
}
/* Hide reset when not overriding (controlled via JS class) */
.scene-time-reset.hidden { opacity: 0; pointer-events: none; }

/* Slider track */
.scene-time-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  /* gradient: midnight → dawn (blue) → day (gold) → dusk (orange) → midnight */
  background: linear-gradient(to right,
    #0d1520 0%,
    #1a2d4a 20%,
    #c8901a 35%,
    #8ab0c8 45%,
    #8ab0c8 70%,
    #c04518 80%,
    #0d1520 100%
  );
}
.scene-time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e8d0a0;
  border: 2px solid rgba(255, 240, 200, 0.6);
  box-shadow: 0 0 6px rgba(220, 160, 40, 0.5);
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s;
}
.scene-time-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(220, 160, 40, 0.8);
}
.scene-time-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e8d0a0;
  border: 2px solid rgba(255, 240, 200, 0.6);
  box-shadow: 0 0 6px rgba(220, 160, 40, 0.5);
  cursor: grab;
}

/* Tick labels */
.scene-clock-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 0.3rem;
  font-size: 0.6rem;
  color: rgba(160, 170, 190, 0.4);
  letter-spacing: 0.02em;
}


/* Songs page link in music widget */
.music-list-link {
  color: var(--text-muted, #8b949e);
  text-decoration: none;
  font-size: 1rem;
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  transition: color 0.2s;
  line-height: 1;
}
.music-list-link:hover { color: var(--accent, #58a6ff); }
