/* Solar Pink Pong — status site */
:root {
  --pink: #ff00d8; --pink-dark: #d900b8; --purple: #9d5c94; --yellow: #ffd519;
  --bg: #eef0f3; --surface: #ffffff; --surface-2: #f2f3f6; --text: #17181c; --muted: #5f6370;
  --border: rgba(0, 0, 0, .09); --topbar: #111318; --topbar-text: #fff;
  --shadow: 0 12px 32px rgba(0, 0, 0, .22); --radius: 14px; --topbar-h: 56px; --panel-w: 384px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #181b22; --surface-2: #21252e; --text: #eef0f4; --muted: #a0a6b4;
    --border: rgba(255, 255, 255, .1); --shadow: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); background: var(--bg); display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--pink-dark); }
p { margin: 0 0 10px; }
h1 { font-size: 20px; line-height: 1.25; margin: 0 0 10px; }
h2 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; }

/* top bar */
.topbar {
  flex: none; position: relative; z-index: 1100; min-height: var(--topbar-h);
  padding: 0 16px; padding-top: env(safe-area-inset-top, 0px);
  background: var(--topbar); color: var(--topbar-text);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand img { height: 24px; width: auto; display: block; }
.brand .slogan { height: 19px; opacity: .8; }
.actions { display: flex; gap: 8px; align-items: center; flex: none; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 999px;
  padding: 8px 15px; font: inherit; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:hover { background: var(--pink-dark); }
.btn-ghost { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .22); }
.btn-ghost:hover { background: rgba(255, 255, 255, .16); }

/* stage + map */
.stage { flex: 1; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 11px; }
.leaflet-top, .leaflet-bottom { z-index: 900; }

/* side panel */
.panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; z-index: 1000;
  width: min(var(--panel-w), calc(100% - 24px));
  background: var(--surface); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: auto; overscroll-behavior: contain;
  transform: translateX(calc(100% + 24px)); opacity: 0; visibility: hidden;
  transition: transform .3s ease, opacity .3s ease, visibility 0s .3s;
}
.panel.is-open { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
.panel-close {
  position: absolute; top: 8px; right: 8px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.panel-body { padding: 18px 20px 16px; }

/* carousel */
.carousel { position: relative; aspect-ratio: 3 / 2; background: #000; overflow: hidden; outline: none; }
.carousel:focus-visible { box-shadow: inset 0 0 0 3px var(--pink); }
.slides, .slide { position: absolute; inset: 0; margin: 0; }
.slide { opacity: 0; transition: opacity .7s ease; }
.slide.is-current { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel .nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .2s;
}
.carousel:hover .nav, .carousel:focus-within .nav { opacity: 1; }
.carousel .prev { left: 10px; } .carousel .next { right: 10px; }
.dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.dots button { width: 8px; height: 8px; border-radius: 50%; border: 0; padding: 0; background: rgba(255, 255, 255, .55); cursor: pointer; transition: transform .15s; }
.dots button.is-current { background: var(--pink); transform: scale(1.3); }

/* units */
.unit-list { list-style: none; margin: 0; padding: 0; }
.unit {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
  font: inherit; color: inherit; cursor: pointer; transition: border-color .15s;
}
.unit:hover, .unit:focus-visible { border-color: var(--pink); outline: none; }
.unit-body { display: flex; flex-direction: column; min-width: 0; }
.unit-name { font-weight: 600; }
.unit-meta { font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, #999); flex: none; margin-top: 6px; box-shadow: 0 0 0 2px var(--surface); }
.legend { list-style: none; padding: 0; margin: 10px 0 4px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend .dot { margin: 0 6px 0 0; vertical-align: -1px; }
.live .video { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.live iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.panel-footer { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; }

/* map markers */
.spp-marker { background: none; border: 0; }
.spp-marker .pin {
  position: absolute; left: 4px; top: 3px; width: 22px; height: 22px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.spp-marker .pin::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; opacity: .9; }
.spp-marker.is-active .pin::before {
  content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--c);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }

/* popups */
.spp-popup .leaflet-popup-content-wrapper { background: var(--surface); color: var(--text); border-radius: 12px; box-shadow: var(--shadow); }
.spp-popup .leaflet-popup-tip { background: var(--surface); }
.spp-popup .leaflet-popup-content { margin: 14px 16px; font: inherit; line-height: 1.45; }
.spp-popup .leaflet-popup-close-button { color: var(--muted); }
.popup h3 { margin: 0 0 2px; font-size: 16px; }
.popup .unit-no { color: var(--pink); }
.popup .place { margin: 0 0 8px; color: var(--muted); }
.popup .status .dot { margin: 0 6px 0 0; vertical-align: -1px; }
.energy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.energy div { background: var(--surface-2); border-radius: 8px; padding: 6px 8px; }
.energy dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.energy dd { margin: 0; font-weight: 600; }
.popup .btn { margin-top: 4px; }
@media (prefers-color-scheme: dark) {
  .leaflet-control-attribution, .leaflet-bar a { background: rgba(24, 27, 34, .92); color: #ddd; }
  .leaflet-bar a { border-bottom-color: #333; }
  .leaflet-control-attribution a { color: #9cc4ff; }
}

/* phones */
@media (max-width: 759px) {
  .brand .slogan { display: none; }
  .btn-ghost span { display: none; }
  .btn-ghost { padding: 8px 11px; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 72%;
    border-radius: var(--radius) var(--radius) 0 0; transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .panel.is-open { transform: none; }
  .carousel { aspect-ratio: 2 / 1; }
}
@media (prefers-reduced-motion: reduce) {
  .slide, .panel, .dots button { transition: none; }
  .spp-marker.is-active .pin::before { animation: none; }
}

/* dark-mode treatment for the OpenStreetMap tiles (no dark tile set without an API key) */
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane .base-tiles { filter: invert(1) hue-rotate(180deg) brightness(.82) contrast(.92) saturate(.55); }
}
