/* ── Media card (galerie) ─────────────────────────────────────────────────── */
.media-grid {
  columns: 2;
  column-gap: var(--gap-gallery-mobile);
  padding: var(--gap-gallery-mobile);
}
@media (min-width: 768px) {
  .media-grid {
    columns: 3;
    column-gap: var(--gap-gallery-desktop);
    padding: var(--gap-gallery-desktop);
  }
}
@media (min-width: 1100px) {
  .media-grid { columns: 4; }
}

.media-card {
  position: relative;
  break-inside: avoid;
  margin-bottom: var(--gap-gallery-mobile);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--ivory-deep);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 768px) {
  .media-card { margin-bottom: var(--gap-gallery-desktop); }
  .media-card:hover { transform: scale(1.015); box-shadow: var(--shadow-md); }
}

.media-card img, .media-card video {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s;
}
.media-card img.loading { opacity: 0; }

/* Badge type (photo / vidéo) */
.media-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(11,31,58,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 20px;
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ivory);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.media-badge svg { width: 12px; height: 12px; }

/* Durée vidéo */
.media-duration {
  position: absolute;
  bottom: 8px; left: 8px;
  background: rgba(11,31,58,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--ivory);
  font-size: 10px;
  font-family: var(--font-sans);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Sélection */
.media-card .check-circle {
  position: absolute;
  top: 8px; left: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--gold);
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.selection-mode .media-card .check-circle { display: flex; }
.media-card.selected .check-circle {
  background: var(--navy);
  border-color: var(--gold);
}
.media-card.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  pointer-events: none;
}
.check-circle svg { width: 13px; height: 13px; color: var(--gold); display: none; }
.media-card.selected .check-circle svg { display: block; }

/* ── Filtres galerie ─────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
  background: var(--ivory);
  position: sticky;
  top: 56px;
  z-index: 90;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-btn {
  height: 32px;
  padding: 0 14px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.filter-btn.active {
  background: var(--navy);
  color: var(--ivory);
}
.filter-btn:not(.active):hover { background: var(--ivory-deep); color: var(--navy); }

.filter-count {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
  padding-left: 12px;
  font-style: italic;
  font-family: var(--font-serif);
}

/* ── Barre d'actions sélection ───────────────────────────────────────────── */
.selection-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--ivory);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(11,31,58,0.1);
  padding: 12px 20px max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.32, 0, 0.67, 0);
  z-index: 200;
}
.selection-bar.visible { transform: translateY(0); }
.selection-bar .count {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  flex: 1;
}
.selection-bar .btn { min-height: 40px; padding: 0 16px; }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--overlay-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.lightbox.open { opacity: 1; pointer-events: auto; }

.lightbox-media {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox-controls {
  position: absolute;
  top: 16px; right: 16px;
  display: flex;
  gap: 8px;
}

.lightbox-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.6);
  padding: 16px;
  cursor: pointer;
  transition: color 0.15s;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-nav:hover { color: var(--ivory); }
.lightbox-nav.prev { left: 8px; }
.lightbox-nav.next { right: 8px; }
.lightbox-nav svg { width: 24px; height: 24px; stroke-width: 1px; }

.lightbox-meta {
  position: absolute;
  bottom: 24px; left: 0; right: 0;
  text-align: center;
  color: var(--gold-pale);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── Upload queue ────────────────────────────────────────────────────────── */
.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.upload-thumb {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--ivory-deep);
  flex-shrink: 0;
}
.upload-info { flex: 1; min-width: 0; }
.upload-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-progress-bar {
  height: 2px;
  background: var(--line);
  border-radius: 1px;
  margin-top: 6px;
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 1px;
  transition: width 0.1s;
}
.upload-status {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.upload-status.done { color: var(--success); }
.upload-status.error { color: var(--danger); }
.upload-retry {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  text-decoration: underline;
}

/* ── Livre d'or messages ─────────────────────────────────────────────────── */
.message-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  animation: fade-up 0.3s ease;
}
.message-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--navy);
}
.message-sig {
  margin-top: 10px;
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── Modale ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(11,31,58,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--ivory);
  border-radius: var(--radius-md);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.2s;
}
.modal-backdrop.open .modal { transform: scale(1); }
.modal-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  justify-content: flex-end;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fade-in 0.3s ease; }
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Sentinel (infinite scroll) ──────────────────────────────────────────── */
.sentinel {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9rem;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-family: var(--font-serif); font-style: italic; font-size: 1.1rem; }
