/* ============================================================================
 * Pocket Austin — Track 3.2: 4-Phase Solar Cycle, Austin Night & Bat Countdown
 * Warm ligne claire editorial aesthetic matching --paper / --ink / --accent
 * ============================================================================ */

/* Smooth map atmospheric filter transitions */
#map {
  transition: filter 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 4-Phase Solar Filter Grades (override base body.dusk #map cleanly) */
body.solar-day #map,
body.dusk.solar-day #map {
  filter: none;
}

body.solar-golden #map,
body.dusk.solar-golden #map {
  filter: saturate(1.16) sepia(0.14) brightness(0.95) contrast(1.04) hue-rotate(-6deg);
}

body.solar-dusk #map,
body.dusk.solar-dusk #map {
  filter: saturate(1.06) brightness(0.68) contrast(1.08) sepia(0.14) hue-rotate(-20deg);
}

body.solar-night #map,
body.dusk.solar-night #map {
  filter: saturate(0.92) brightness(0.42) contrast(1.18) sepia(0.10) hue-rotate(-26deg);
}

/* Matching cartographic vignette tuning per solar phase */
#paper-frame {
  transition: background 0.85s ease, opacity 0.85s ease;
}

body.solar-golden #paper-frame {
  background: radial-gradient(
    ellipse at 32% 72%,
    rgba(255, 224, 168, 0) 58%,
    rgba(66, 36, 16, 0.28) 100%
  );
}

body.solar-dusk #paper-frame {
  background: radial-gradient(
    ellipse at center,
    rgba(40, 32, 68, 0) 56%,
    rgba(18, 16, 36, 0.42) 100%
  );
}

body.solar-night #paper-frame {
  background: radial-gradient(
    ellipse at center,
    rgba(10, 14, 34, 0) 50%,
    rgba(6, 9, 22, 0.56) 100%
  );
}

/* --- Compact 4-Phase + Auto Solar Cycle Control in #hud --- */
#solar-cycle-bar {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(74, 59, 44, 0.16);
}

.solar-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
}

.solar-bar-title {
  font-size: 9.8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.solar-phase-readout {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.solar-phase-readout .solar-auto-tag {
  color: var(--teal);
  font-weight: 800;
}

.solar-segmented {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 2px;
  background: rgba(74, 59, 44, 0.08);
  border: 1.2px solid var(--border);
  border-radius: 8px;
}

.solar-seg-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 2px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.solar-seg-btn:hover {
  background: rgba(251, 246, 234, 0.72);
}

.solar-seg-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.solar-seg-btn.active {
  background: var(--ink);
  color: #fbf6ea;
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(24, 18, 12, 0.24);
}

.solar-seg-btn[data-solar-target="golden"].active {
  background: #9c4a1d;
  border-color: #6b2f10;
  color: #fff8eb;
}

.solar-seg-btn[data-solar-target="dusk"].active {
  background: #443563;
  border-color: #2c2144;
  color: #f8f2ff;
}

.solar-seg-btn[data-solar-target="night"].active {
  background: #1b2847;
  border-color: #0e162b;
  color: #eef4ff;
}

.solar-seg-btn[data-solar-target="auto"].active {
  background: var(--teal);
  border-color: #346863;
  color: #fbf6ea;
}

.solar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(44, 34, 26, 0.35);
}

.solar-seg-btn.active .solar-dot {
  border-color: rgba(251, 246, 234, 0.65);
}

.solar-dot.dot-auto {
  background: linear-gradient(135deg, #e5a93b 0%, #4c8e88 100%);
}
.solar-dot.dot-day {
  background: #ebb442;
}
.solar-dot.dot-golden {
  background: #d97732;
}
.solar-dot.dot-dusk {
  background: #8462b0;
}
.solar-dot.dot-night {
  background: #2e4884;
}

/* Enhanced phase-aware #btn-dusk pill styling */
#btn-dusk[data-solar-phase="golden"] {
  background: #f5dfb8;
  border-color: #9c4a1d;
  color: #4d220a;
}

#btn-dusk[data-solar-phase="dusk"] {
  background: #443563;
  border-color: #2c2144;
  color: #fbf6ea;
}

#btn-dusk[data-solar-phase="night"] {
  background: #1b2847;
  border-color: #0e162b;
  color: #eef4ff;
}

/* --- Live Congress Bridge Bat Emergence Countdown Pill --- */
#status-line .status-row:first-child {
  flex-wrap: wrap;
  row-gap: 4px;
}

#sunset-status.atmo-bat-pill {
  flex: 1 0 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid rgba(74, 59, 44, 0.34);
  background: rgba(255, 250, 240, 0.78);
  color: var(--ink);
  font-size: 10.6px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

#sunset-status.atmo-bat-pill:hover {
  background: #f2e8d4;
  border-color: var(--border);
}

#sunset-status.atmo-bat-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(196, 87, 53, 0.55);
}

#sunset-status.atmo-bat-pill.pulsing {
  border-color: var(--accent);
  background: rgba(196, 87, 53, 0.13);
  color: #5a2211;
}

#sunset-status.atmo-bat-pill.pulsing::before {
  background: #d95a32;
  animation: atmo-bat-pulse 1.9s ease-out infinite;
}

#sunset-status.atmo-bat-pill.emerging {
  border-color: #6b468f;
  background: linear-gradient(90deg, rgba(68, 53, 99, 0.94), rgba(112, 54, 48, 0.92));
  color: #fbf6ea;
  box-shadow: 0 2px 10px rgba(68, 53, 99, 0.28);
}

#sunset-status.atmo-bat-pill.emerging:hover {
  background: linear-gradient(90deg, rgba(78, 60, 114, 0.98), rgba(128, 60, 52, 0.96));
}

#sunset-status.atmo-bat-pill.emerging::before {
  background: #ffbf5e;
  box-shadow: 0 0 0 0 rgba(255, 191, 94, 0.72);
  animation: atmo-bat-pulse-gold 1.5s ease-out infinite;
}

@keyframes atmo-bat-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(217, 90, 50, 0.65);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(217, 90, 50, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(217, 90, 50, 0);
  }
}

@keyframes atmo-bat-pulse-gold {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 191, 94, 0.78);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(255, 191, 94, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 191, 94, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #map,
  #paper-frame {
    transition: none;
  }
  #sunset-status.atmo-bat-pill.pulsing::before,
  #sunset-status.atmo-bat-pill.emerging::before {
    animation: none;
  }
}

@media (max-width: 760px) {
  .solar-seg-btn {
    padding: 6px 2px;
    font-size: 9.5px;
  }
}
