/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0a0a0a;
  --surface:    #141414;
  --surface2:   #1e1e1e;
  --border:     rgba(255,255,255,0.08);
  --text:       #f0f0f0;
  --text-muted: #888;
  --accent:     #e8c97a;   /* warm gold */
  --accent-dim: rgba(232,201,122,0.15);
  --pin-color:  #3EB489;
  --shadow:     0 8px 40px rgba(0,0,0,0.8);
  --radius:     10px;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

/* ── Header ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: linear-gradient(to bottom, rgba(10,10,10,0.92) 0%, transparent 100%);
  pointer-events: none;
}

.site-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  pointer-events: auto;
}

.site-nav {
  display: flex;
  gap: 28px;
  pointer-events: auto;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--text); }

/* ── Map ── */
#map {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* Leaflet attribution tweak */
.leaflet-control-attribution {
  background: rgba(10,10,10,0.7) !important;
  color: #555 !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: #666 !important; }

.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover { color: var(--text) !important; }

/* ── Custom Pin Marker ── */
.map-pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pin-c, #3EB489);
  border: 2px solid var(--pin-border, rgba(62,180,137,0.4));
  box-shadow: 0 0 0 0 var(--pin-glow, rgba(62,180,137,0.6));
  cursor: pointer;
  transition: transform 0.2s ease;
  animation: pin-pulse 2.8s infinite;
}

.map-pin:hover,
.map-pin.active {
  transform: scale(1.35);
  animation: none;
  box-shadow: 0 0 0 5px var(--pin-glow-soft, rgba(62,180,137,0.25)),
              0 0 14px var(--pin-glow, rgba(62,180,137,0.4));
}

@keyframes pin-pulse {
  0%   { box-shadow: 0 0 0 0 var(--pin-glow, rgba(62,180,137,0.55)); }
  60%  { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── Hover Popup ── */
.hover-popup {
  position: fixed;
  z-index: 500;
  pointer-events: none;
  transform: translateX(-50%) translateY(-100%);
  padding-bottom: 14px;

  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hover-popup.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(calc(-100% - 4px));
}

.hover-popup-card {
  position: relative;
  background: rgba(14,14,14,0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  width: 260px;
}

.popup-location {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popup-country {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.popup-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.popup-thumb {
  aspect-ratio: 1;
  border-radius: 2px;
  object-fit: cover;
  display: block;
  background: var(--surface2);
}

.popup-thumb-loading {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--surface2);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.8; }
}

.popup-cta {
  font-size: 1.1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.popup-cta::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Arrow below popup */
.hover-popup-card::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: rgba(14,14,14,0.96);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  rotate: 45deg;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0,0,0,0.97);
  display: flex;
  align-items: stretch;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.25s ease;
  overflow: hidden;
}

.lightbox.hidden { display: none; }

.lightbox.fade-in { animation: lb-in 0.25s ease forwards; }

@keyframes lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 28px;
}

/* Header row */
.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-shrink: 0;
}

#lb-grid-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

#lb-grid-view::-webkit-scrollbar { width: 4px; }
#lb-grid-view::-webkit-scrollbar-track { background: transparent; }
#lb-grid-view::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.lb-title-group {}

#lb-location-name {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1px;
}

#lb-location-country {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0;
}

#lb-location-desc {
  display: none;
}

.lb-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
  margin-top: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.lb-close:hover { color: var(--text); }

/* Gallery loading / empty state */
.gallery-loading {
  grid-column: 1 / -1;
  padding: 80px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

/* Photo grid — 4 independent flex columns (true masonry, no row-height coupling) */
.gallery-grid {
  display: flex;
  flex-direction: row;
  gap: 3px;
  padding-bottom: 24px;
  align-items: flex-start;
}

/* Each column stacks photos top-to-bottom with a consistent gap */
.gallery-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gallery-item {
  position: relative;
  cursor: pointer;
  background: var(--surface2);
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: filter 0.25s ease;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 12px;
}

.gallery-item:hover img              { filter: brightness(0.75); }
.gallery-item:hover .gallery-item-overlay { opacity: 1; }

/* ── Full-size Photo Viewer ── */
#lb-photo-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

#lb-photo-view.hidden { display: none; }

.lb-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 36px 0 20px;
  text-align: left;
  transition: color 0.15s;
  flex-shrink: 0;
}
.lb-back:hover { color: var(--text); }

.photo-viewer-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
  overflow: hidden;
  padding-bottom: 32px;
}

.nav-arrow {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 3rem;
  cursor: pointer;
  padding: 0 16px;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 1;
  user-select: none;
}
.nav-arrow:hover { color: var(--text); }
.nav-arrow:disabled { opacity: 0.2; cursor: default; }

.photo-viewer-img-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

#photo-viewer-img {
  max-width: 100%;
  max-height: calc(100vh - 280px);
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

#photo-viewer-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* ── Utility ── */
.hidden { display: none !important; }
