:root {
  --bg: #050a12;
  --panel: rgba(8, 17, 30, 0.93);
  --panel-2: rgba(13, 26, 43, 0.88);
  --line: rgba(255,255,255,0.09);
  --text: #f7fbff;
  --muted: #92a5b8;
  --accent: #59d9ff;
  --accent-2: #a7ffca;
  --shadow: 0 24px 70px rgba(0,0,0,.42);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(89,217,255,.12), transparent 26rem),
    radial-gradient(circle at 82% 82%, rgba(167,255,202,.08), transparent 28rem),
    var(--bg);
  overflow: hidden;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { height: 100%; display: grid; grid-template-rows: 78px minmax(0,1fr) 46px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(5,10,18,.82);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 1000;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 900; letter-spacing: -.04em;
  color: #02111a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px rgba(89,217,255,.18);
}
.brand strong { display: block; font-size: .95rem; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: .76rem; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.ghost-btn, .portfolio-btn {
  border-radius: 13px; padding: 10px 14px; font-weight: 750; font-size: .84rem;
  transition: .2s ease; cursor: pointer;
}
.ghost-btn { border: 1px solid var(--line); background: rgba(255,255,255,.035); color: var(--text); }
.portfolio-btn { background: var(--text); color: #08111c; border: 1px solid var(--text); }
.ghost-btn:hover, .portfolio-btn:hover { transform: translateY(-1px); }

.map-layout { min-height: 0; display: grid; grid-template-columns: 390px minmax(0,1fr); }
.sidebar {
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  background: rgba(7,15,26,.92);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
  z-index: 800;
}
.intro-card, .controls-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.018));
  border-radius: 22px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.intro-card h1 { margin: 7px 0 8px; font-size: clamp(1.8rem,3vw,2.6rem); line-height: .98; letter-spacing: -.06em; }
.intro-card p { color: var(--muted); line-height: 1.58; margin: 12px 0 20px; font-size: .9rem; }
.eyebrow { color: var(--accent); font-weight: 900; letter-spacing: .16em; font-size: .66rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.stats-grid div { padding: 11px 9px; border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.055); }
.stats-grid strong { display: block; font-size: 1.24rem; }
.stats-grid span { color: var(--muted); font-size: .68rem; }
.controls-card { margin-top: 12px; padding: 16px; box-shadow: none; }
.controls-card label { display: block; font-size: .75rem; font-weight: 800; margin-bottom: 8px; color: #d9e7f3; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; width: 17px; height: 17px; left: 13px; top: 50%; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; }
.search-wrap input {
  width: 100%; border: 1px solid var(--line); background: rgba(0,0,0,.18); color: var(--text);
  border-radius: 13px; padding: 11px 12px 11px 39px; outline: none;
}
.search-wrap input:focus { border-color: rgba(89,217,255,.45); box-shadow: 0 0 0 3px rgba(89,217,255,.08); }
.filter-row { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.filter-chip { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--muted); border-radius: 999px; padding: 7px 10px; font-size: .71rem; cursor: pointer; }
.filter-chip.active { color: #06111b; background: var(--accent); border-color: var(--accent); font-weight: 850; }
.locations-panel { padding: 18px 1px 24px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 0 5px 11px; }
.section-heading h2 { margin: 4px 0 0; font-size: 1rem; }
.result-count { font-size: .72rem; color: var(--muted); }
.location-list { display: grid; gap: 8px; }
.location-card {
  width: 100%; display: grid; grid-template-columns: 35px 1fr auto; gap: 11px; align-items: center;
  color: var(--text); text-align: left; border: 1px solid transparent; border-radius: 15px;
  background: transparent; padding: 10px; cursor: pointer; transition: .18s ease;
}
.location-card:hover, .location-card.active { background: rgba(255,255,255,.048); border-color: var(--line); transform: translateX(2px); }
.location-card.active { box-shadow: inset 3px 0 0 var(--accent); }
.location-index { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: rgba(89,217,255,.09); color: var(--accent); font-size: .7rem; font-weight: 900; }
.location-name { display: block; font-size: .86rem; }
.location-meta { display: block; margin-top: 3px; color: var(--muted); font-size: .69rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.location-arrow { color: var(--muted); font-size: .85rem; }
.empty-state { color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 16px; padding: 28px 12px; font-size: .84rem; }

.map-panel { position: relative; min-width: 0; min-height: 0; }
#map { position: absolute; inset: 0; background: #091421; }
.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { background: rgba(5,10,18,.72)!important; color: #a8b6c4!important; backdrop-filter: blur(10px); }
.leaflet-control-attribution a { color: #d8edf7!important; }
.leaflet-bar a { background: #0b1727!important; color: #f5fbff!important; border-color: var(--line)!important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: rgba(7,16,28,.97); color: var(--text); }
.leaflet-popup-content-wrapper { border: 1px solid rgba(255,255,255,.11); border-radius: 18px; box-shadow: 0 22px 60px rgba(0,0,0,.45); }
.leaflet-popup-content { margin: 16px; width: 245px!important; }
.trip-popup .popup-kicker { color: var(--accent); font-size: .62rem; font-weight: 900; letter-spacing: .15em; }
.trip-popup h3 { margin: 5px 0 7px; font-size: 1.28rem; letter-spacing: -.04em; }
.trip-popup .popup-date { color: #dbe7f2; font-size: .76rem; margin-bottom: 9px; }
.trip-popup p { color: var(--muted); font-size: .78rem; line-height: 1.45; margin: 0 0 13px; }
.trip-popup a { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 10px 12px; border-radius: 11px; background: linear-gradient(135deg,var(--accent),var(--accent-2)); color: #041019; font-weight: 900; font-size: .76rem; }
.custom-marker { background: transparent; border: 0; }
.marker-pulse { position: relative; width: 26px; height: 26px; display: grid; place-items: center; }
.marker-pulse::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: rgba(89,217,255,.17); animation: pulse 2.2s infinite; }
.marker-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid #e9fbff; box-shadow: 0 4px 16px rgba(89,217,255,.55); position: relative; z-index: 2; }
@keyframes pulse { 0%{transform:scale(.65);opacity:.8} 70%{transform:scale(1.8);opacity:0} 100%{opacity:0} }
.map-overlay { position: absolute; z-index: 700; pointer-events: none; }
.map-overlay > * { pointer-events: auto; }
.top-left { top: 12px; left: 12px; }
.top-right { top: 12px; right: 12px; }
.bottom-right { right: 12px; bottom: 22px; }
.legend { display: flex; gap: 8px; align-items: center; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line); background: rgba(5,10,18,.78); backdrop-filter: blur(14px); font-size: .7rem; color: #cbd8e4; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(89,217,255,.13); }
.map-control { border: 1px solid var(--line); background: rgba(5,10,18,.86); color: white; border-radius: 12px; width: 42px; height: 42px; font-size: 1.1rem; }
.mobile-only { display: none; }

.sidebar-close {
  position: sticky;
  top: 0;
  margin: 0 0 10px auto;
  z-index: 20;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,10,18,.94);
  color: var(--text);
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,.28);
}


@media (max-width: 820px) {
  body { overflow: hidden; }
  .app-shell { grid-template-rows: 68px 1fr; }
  .topbar { padding: 0 14px; }
  .brand small, .ghost-btn { display: none; }
  .portfolio-btn { padding: 9px 11px; }
  .map-layout { grid-template-columns: 1fr; position: relative; }
  .sidebar {
    position: absolute; inset: 0 auto 0 0; width: min(89vw,380px); z-index: 900;
    transform: translateX(-102%); transition: transform .26s ease; box-shadow: 30px 0 80px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: block; }
  .map-menu-overlay { display: block; }
  .sidebar.open + .map-panel .map-menu-overlay { display: none; }
  .bottom-right { bottom: 28px; }
  .leaflet-top.leaflet-left { top: 0; }
  .leaflet-top.leaflet-right { top: 58px; }
}

/* Production hardening */
#map { width: 100%; height: 100%; }
.leaflet-map-pane,.leaflet-tile-pane,.leaflet-overlay-pane,.leaflet-shadow-pane,.leaflet-marker-pane,.leaflet-tooltip-pane,.leaflet-popup-pane { position: absolute; inset: 0 auto auto 0; }
.map-load-error { position:absolute; inset:24px; display:grid; place-items:center; text-align:center; border:1px solid var(--line); border-radius:22px; background:rgba(5,10,18,.92); color:var(--muted); padding:30px; z-index:1200; }
.map-load-error strong { display:block; color:var(--text); font-size:1.15rem; margin-bottom:7px; }
@media (min-width: 821px) and (max-width: 1180px) { .map-layout { grid-template-columns: 330px minmax(0,1fr); } .sidebar { padding:14px; } }

.site-footer {
  min-width:0; display:flex; align-items:center; justify-content:space-between; gap:18px;
  padding:0 24px; border-top:1px solid var(--line); background:rgba(5,10,18,.94);
  color:var(--muted); font-size:.72rem; position:relative; z-index:1000;
}
.footer-links { display:flex; align-items:center; gap:18px; }
.site-footer a { transition:color .18s ease; }
.site-footer a:hover { color:var(--text); }
@media (max-width:820px) {
  .app-shell { grid-template-rows:68px minmax(0,1fr) 58px; }
  .site-footer { padding:7px 14px; gap:5px; flex-direction:column; justify-content:center; text-align:center; font-size:.65rem; }
  .footer-links { gap:10px; flex-wrap:wrap; justify-content:center; }
}
