:root {
  --ink: #1f2c26;
  --ink-soft: #4a5750;
  --bg: #e7ece8;
  --panel: #f6f8f5;
  --line: #c9d3cc;
  --line-soft: #dde4de;
  --moss: #386b51;
  --moss-deep: #2a5440;
  --signal: #d96531;
  --signal-deep: #b94f22;
  --shadow: 0 1px 2px rgba(31, 44, 38, .06), 0 8px 24px rgba(31, 44, 38, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

/* ---------- LEFT: gallery ---------- */
.gallery {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.gallery-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.eyebrow {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 4px;
}

.gallery-head h1 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 0;
  line-height: 1.1;
}

.head-meta { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.count {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.ghost-btn {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ghost-btn:hover { background: #fff; border-color: var(--moss); }
.ghost-btn:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }

.cards {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  scroll-margin: 16px;
}
.card:hover { border-color: var(--line); box-shadow: var(--shadow); }
.card.active {
  border-color: var(--signal);
  box-shadow: 0 0 0 1px var(--signal), var(--shadow);
}

.card-thumb {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg);
  display: block;
}

.card-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 2px 4px 2px 0; }

.card-index {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--moss);
  letter-spacing: .04em;
}

.card-caption {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card-caption.muted { color: var(--ink-soft); font-weight: 400; font-style: italic; }

.card-coords {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: auto;
}

.card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-time { font-size: 11px; color: var(--ink-soft); }

.del-btn {
  font: inherit;
  font-size: 11px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity .15s, color .15s, background .15s;
}
.card:hover .del-btn { opacity: 1; }
.del-btn:hover { color: var(--signal-deep); background: #fbeae2; }

.empty { margin: auto; text-align: center; padding: 40px; color: var(--ink-soft); }
.empty-title { font-family: "Space Grotesk", sans-serif; font-size: 17px; color: var(--ink); margin: 0 0 6px; }
.empty-sub { font-size: 14px; margin: 0; max-width: 28ch; }

/* ---------- RIGHT: map ---------- */
.map-wrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }

/* Custom survey-pin marker */
.pin {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}
.pin-dot {
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--moss);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(31,44,38,.35);
  display: grid;
  place-items: center;
}
.pin-num {
  transform: rotate(45deg);
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}
.pin.active .pin-dot { background: var(--signal); }
.pin.active::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--signal);
  animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(.6); opacity: .9; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Leaflet popup */
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content { margin: 10px; width: 200px !important; }
.popup-img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; display: block; }
.popup-cap { font-size: 13px; margin: 8px 0 4px; line-height: 1.35; }
.popup-coords { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-soft); }

/* ---------- Mobile ---------- */
.view-toggle { display: none; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .gallery { border-right: none; }
  .map-wrap { border-top: 1px solid var(--line); }

  /* Toggle between list and map on small screens */
  .layout.show-map .gallery { display: none; }
  .layout.show-list .map-wrap { display: none; }

  .view-toggle {
    display: inline-flex;
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px;
    box-shadow: var(--shadow);
  }
  .view-toggle button {
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--ink-soft);
    padding: 7px 18px;
    border-radius: 999px;
    cursor: pointer;
  }
  .view-toggle button.active { background: var(--moss); color: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  .pin.active::after { animation: none; }
  .card { transition: none; }
}

/* ---- Foto schermvullend ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: rgba(18, 26, 22, .92);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lb-img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  cursor: default;
}
.lb-caption {
  color: #f3f1ea;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  text-align: center;
  max-width: 80vw;
}
.lb-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 28px;
  line-height: 1;
  color: #f3f1ea;
  background: rgba(255, 255, 255, .1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.lb-close:hover { background: rgba(255, 255, 255, .2); }

/* ---- Arend + vlag als achtergrond van het foto-overzicht ---- */
.gallery { position: relative; overflow: hidden; background: #120d09; }

.gallery::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(10,7,5,0.78), rgba(10,7,5,0.42) 35%, rgba(10,7,5,0.62)),
    url('eagle.jpg') center / cover no-repeat;
}

/* Inhoud boven de achtergrond */
.gallery-head, .cards, .empty { position: relative; z-index: 1; }

/* Donkere achtergrond -> lichte titel en knoppen */
.gallery-head { border-bottom-color: rgba(255,255,255,0.14); }
.gallery-head h1 { color: #ffffff; text-shadow: 0 1px 4px rgba(0,0,0,0.55); }
.eyebrow { color: #e6c06a; }
.ghost-btn { color: #f0ece4; border-color: rgba(255,255,255,0.28); }
.ghost-btn:hover { background: rgba(255,255,255,0.10); border-color: #e6c06a; }
.empty-title { color: #ffffff; }
.empty, .empty-sub { color: rgba(255,255,255,0.72); }