:root {
  --bg: #0e0f11;
  --surface: #17191d;
  --surface-hover: #1f2228;
  --text: #f0f2f5;
  --text-muted: #9aa0a6;
  --accent: #4ea8de;
  --border: #262930;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header & Boutons supérieurs */
.site-header {
  padding: 1.5rem 1.5rem 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.header-top-links {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  max-width: 1400px;
  margin: 0 auto 1.2rem;
}

.ghost-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface);
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-size: 0.95rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

.filter-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.filter-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 500;
}

/* Barre de recherche, tri et compteur */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.search-box input,
#sort-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input {
  width: 240px;
}

.search-box input:focus,
#sort-select:focus {
  border-color: var(--accent);
}

.photo-counter {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 0.3rem;
}

/* Grille Masonry responsive + Blur-up */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.gallery-grid {
  columns: 3 320px;
  column-gap: 1.25rem;
}

.photo-card {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  cursor: zoom-in;
}

.photo-card img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.4s ease;
}

.photo-card img.loaded {
  opacity: 1;
}

.photo-card:hover img {
  transform: scale(1.02);
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.25) 45%, transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
}

.photo-card:hover .card-overlay {
  opacity: 1;
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
}

.card-latin {
  font-size: 0.8rem;
  color: #b8c0cc;
  font-style: italic;
}

.card-meta {
  font-size: 0.78rem;
  color: #d0d4dc;
  margin-top: 0.2rem;
}

.card-exif {
  font-size: 0.74rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 0.25rem;
}

/* Lightbox plein écran */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 11, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.lightbox.open {
  display: flex;
}

.lb-top-bar {
  position: fixed;
  top: 1.1rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1010;
}

.lb-action-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.lb-action-btn:hover {
  background: var(--accent);
  color: #0e0f11;
  border-color: var(--accent);
  font-weight: 500;
}

.lb-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lb-content img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.lb-caption {
  width: 100%;
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}

.lb-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.lb-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.lb-latin {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.lb-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lb-exif {
  font-size: 0.85rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.lb-close, .lb-nav {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lb-close:hover, .lb-nav:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lb-close { font-size: 1.8rem; }
.lb-prev, .lb-next { position: fixed; top: 50%; transform: translateY(-50%); }
.lb-prev { left: 1.2rem; }
.lb-next { right: 1.2rem; }

/* Tiroir latéral Matériel & Modale Carte */
.drawer, .modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
}

.drawer.open, .modal.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(440px, 92vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 2.2rem 1.8rem;
  overflow-y: auto;
}

.drawer-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
}

.drawer-panel h2, .modal-panel h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.drawer-intro, .modal-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.gear-block {
  margin-bottom: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.gear-block h3 {
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.gear-block ul {
  list-style: none;
  font-size: 0.9rem;
}

.gear-block li {
  margin-bottom: 0.45rem;
  color: #dce0e6;
}

.modal-panel {
  position: relative;
  width: min(820px, 92vw);
  margin: 6vh auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.8rem;
}

#spots-map {
  height: 420px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

@media (max-width: 600px) {
  .lb-nav { width: 36px; height: 36px; font-size: 1.1rem; }
  .lb-prev { left: 0.5rem; }
  .lb-next { right: 0.5rem; }
  .search-box input { width: 100%; }
}
