/* ==========================================
   FANU · BASE STYLES
   Reset, typography, layout, splash, header, map
   ========================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--bg-0);
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: background 0.4s ease, color 0.4s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.serif { font-family: 'Newsreader', Georgia, serif; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==========================================
   SPLASH SCREEN
   ========================================== */
.splash {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 24px;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-mark {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 400;
  font-size: 80px;
  letter-spacing: -0.05em;
  color: var(--text);
  position: relative;
  animation: markFadeIn 1.2s var(--ease-in-out);
}
.splash-mark::after {
  content: '';
  position: absolute;
  bottom: 14px;
  right: -10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 2s ease-in-out infinite;
}
@keyframes markFadeIn {
  from { opacity: 0; transform: translateY(10px); letter-spacing: 0; }
  to { opacity: 1; transform: translateY(0); letter-spacing: -0.05em; }
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
.splash-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}
.splash-line {
  width: 100px;
  height: 1px;
  background: var(--hairline-strong);
  position: relative;
  overflow: hidden;
}
.splash-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  animation: lineSlide 1.6s ease-in-out infinite;
}
@keyframes lineSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ==========================================
   HEADER
   ========================================== */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 22px 14px;
  background: var(--surface);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border-bottom: 0.5px solid var(--hairline);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  line-height: 1;
}
.brand-mark {
  font-family: 'Newsreader', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  margin-bottom: 4px;
}
.brand-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
}
.statusbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 100px;
  background: rgba(48, 209, 88, 0.12);
  font-size: 11px;
  font-weight: 600;
  color: var(--good);
  transition: all 0.3s ease;
}
.live-pill .indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  position: relative;
}
.live-pill .indicator::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--good);
  opacity: 0.4;
  animation: ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.live-pill.offline {
  background: rgba(255, 159, 10, 0.12);
  color: var(--accent);
}
.live-pill.offline .indicator { background: var(--accent); }
.live-pill.offline .indicator::before { background: var(--accent); }
@keyframes ping {
  75%, 100% { transform: scale(2.2); opacity: 0; }
}

/* ==========================================
   MAIN + MAP
   ========================================== */
main {
  flex: 1;
  position: relative;
  overflow: hidden;
}
#map {
  position: absolute;
  inset: 0;
  background: var(--bg-1);
  z-index: 1;
}
.leaflet-container {
  background: var(--bg-1) !important;
  font-family: 'Manrope', sans-serif !important;
  outline: none;
}
.leaflet-tile-pane {
  filter: brightness(0.7) saturate(0.85);
}
[data-theme="light"] .leaflet-tile-pane {
  filter: none;
}
.leaflet-control-zoom {
  border: none !important;
  box-shadow: none !important;
  margin: 14px !important;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.leaflet-control-zoom a {
  background: var(--surface-elevated) !important;
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  color: var(--text) !important;
  border: none !important;
  border-radius: 10px !important;
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  font-weight: 300 !important;
  font-size: 22px !important;
  box-shadow: var(--shadow-sm) !important;
  transition: all 0.2s ease;
}
.leaflet-control-zoom a:hover {
  background: var(--bg-3) !important;
  color: var(--accent) !important;
}
.leaflet-control-zoom-in { border-radius: 10px 10px 4px 4px !important; }
.leaflet-control-zoom-out { border-radius: 4px 4px 10px 10px !important; }
.leaflet-control-attribution {
  background: var(--surface) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-3) !important;
  font-size: 9.5px !important;
  font-family: 'JetBrains Mono', monospace !important;
  padding: 2px 7px !important;
  border-radius: 4px !important;
  margin: 4px !important;
  border: 0.5px solid var(--hairline);
}
.leaflet-control-attribution a { color: var(--text-2) !important; }

/* Hide leaflet zoom on tiny screens to leave more map */
@media (max-width: 380px) {
  .leaflet-control-zoom { display: none; }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 420px) {
  .splash-mark { font-size: 64px; }
  .statusbar { padding: calc(var(--safe-top) + 12px) 18px 12px; }
  .brand-mark { font-size: 22px; }
}
