/* ---------------------------------------------------------
   Site Progress Viewer
   Branding is driven by CSS variables. Override them per
   client by either:
     (a) injecting from config.json via app.js (current default), or
     (b) overriding in a client-specific override.css.
   --------------------------------------------------------- */
:root {
  --brand-color: #0a2540;
  --accent-color: #ff7a00;
  --bg: #0a2540;
  --fg: #ffffff;
  --fg-muted: rgba(255, 255, 255, 0.7);
  --ctl-bg: rgba(10, 37, 64, 0.92);
  --btn-bg: rgba(255, 255, 255, 0.1);
  --btn-bg-hover: rgba(255, 255, 255, 0.2);
  --hdr-h: 56px;
  --ctl-h: 96px;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }

/* Alpine.js: prevent flash of un-bound content before init() runs */
[x-cloak] { display: none !important; }

#app {
  display: grid;
  grid-template-rows: var(--hdr-h) 1fr var(--ctl-h);
  height: 100vh;
  height: 100dvh; /* mobile-safe */
}

#app.embed {
  grid-template-rows: 1fr;
}

/* ---------- Header ---------- */
.hdr {
  background: var(--brand-color);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  z-index: 2;
}
.hdr-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { height: 36px; width: auto; max-width: 120px; object-fit: contain; background: white; padding: 4px; border-radius: 4px; }
.titles { min-width: 0; }
.project { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client { font-size: 12px; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hdr-right { display: flex; gap: 8px; }

/* ---------- Map area ---------- */
.map-wrap { position: relative; }
#map, #compare-container, #before, #after { position: absolute; inset: 0; width: 100%; height: 100%; }
#compare-container { display: grid; grid-template-columns: 1fr; }
/* maplibre-gl-compare puts #before and #after on top of each other and reveals
   via a draggable handle — we just need them to exist at full size. */

/* ---------- Bottom control bar ---------- */
.ctl {
  background: var(--ctl-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.ctl-row { display: flex; align-items: center; gap: 12px; }
.ctl-row.toggles { font-size: 13px; color: var(--fg-muted); }
.ctl-row.toggles label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.slider-wrap { flex: 1; min-width: 0; }
.slider-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--accent-color);
  height: 28px;
}
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--fg-muted); margin-top: -4px; }
.ticks .active { color: var(--accent-color); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--btn-bg);
  color: var(--fg);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 6px 12px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
  transition: background 120ms ease;
}
.btn:hover:not(:disabled) { background: var(--btn-bg-hover); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.nav { font-size: 22px; padding: 4px 12px; min-width: 36px; }

select { background: var(--btn-bg); color: var(--fg); border: 1px solid rgba(255,255,255,0.15); border-radius: var(--radius); padding: 4px 6px; font: inherit; font-size: 13px; }
.compare-picker { display: flex; align-items: center; gap: 6px; }

/* ---------- Milestone markers ---------- */
.milestone-pin {
  width: 28px;
  height: 28px;
  background: var(--accent-color);
  border: 2px solid white;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  cursor: pointer;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 600px) {
  :root { --hdr-h: 48px; --ctl-h: 110px; }
  .project { font-size: 13px; }
  .client { font-size: 11px; }
  .logo { height: 28px; max-width: 80px; }
  .ctl-row.toggles { flex-wrap: wrap; }
}
