/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }

/* ── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
  --bg:       #0D0B08;
  --bg2:      #130F0B;
  --bg3:      #1A1410;
  --gold:     #C4882A;
  --gold-d:   rgba(196, 136, 42, 0.25);
  --gold-s:   rgba(196, 136, 42, 0.10);
  --txt:      #F0EDE8;
  --txt-m:    rgba(240, 237, 232, 0.55);
  --txt-s:    rgba(240, 237, 232, 0.30);
  --border:   rgba(240, 237, 232, 0.07);
  --serif:    'Cormorant', Georgia, serif;
  --sans:     'Jost', system-ui, sans-serif;
  --gap:      3px;
  --header-h: 58px;
  --r-pill:   999px;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
html {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
body { user-select: none; }

/* ── En-tête ────────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(13, 11, 8, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  opacity: 0.9;
}
.logo-svg { width: 26px; height: 26px; }
.logo-txt {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.20em;
  color: var(--txt);
}

.header-centre {
  flex: 1;
  overflow: hidden;
}
.titre {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.sous-titre {
  font-size: 11px;
  color: var(--txt-m);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.header-droite {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.nb-photos {
  font-size: 12px;
  color: var(--txt-s);
}

.btn-favoris-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  color: var(--gold);
  border: 1px solid rgba(196, 136, 42, 0.30);
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 500;
  transition: background 0.15s;
}
.btn-favoris-header:hover { background: var(--gold-s); }
.btn-favoris-header svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ── Grille ─────────────────────────────────────────────────────────────────── */
.grille {
  flex: 1;
  columns: 3 220px;
  column-gap: var(--gap);
  padding: var(--gap);
}

.grille-item {
  break-inside: avoid;
  margin-bottom: var(--gap);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg2);
}

.grille-item img {
  width: 100%;
  display: block;
  transition: transform 0.35s ease, filter 0.25s ease;
}
.grille-item:hover img {
  transform: scale(1.025);
  filter: brightness(0.80);
}
.grille-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.grille-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(7, 5, 3, 0.55) 0%,
    rgba(7, 5, 3, 0.10) 45%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.22s;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 10px;
  gap: 6px;
}
.grille-item:hover .grille-overlay { opacity: 1; }

/* Boutons overlay */
.btn-ico {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 11, 8, 0.72);
  border: 1px solid rgba(240, 237, 232, 0.14);
  color: rgba(240, 237, 232, 0.80);
  font-size: 15px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-ico svg { width: 15px; height: 15px; }
.btn-ico:hover {
  background: rgba(196, 136, 42, 0.18);
  color: var(--gold);
  border-color: rgba(196, 136, 42, 0.35);
}
.btn-ico.actif {
  color: var(--gold);
  background: rgba(196, 136, 42, 0.15);
  border-color: rgba(196, 136, 42, 0.40);
}
.btn-ico.actif svg { fill: var(--gold); }
a.btn-ico { text-decoration: none; }

/* ── États ──────────────────────────────────────────────────────────────────── */
.etat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  text-align: center;
  color: var(--txt-m);
}
.etat-ico {
  width: 40px;
  height: 40px;
  color: var(--txt-s);
}
.etat-txt {
  font-size: 15px;
  max-width: 340px;
  line-height: 1.6;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(196, 136, 42, 0.18);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Pied de page ───────────────────────────────────────────────────────────── */
.footer {
  padding: 20px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--txt-s);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-top: 1px solid var(--border);
}
.footer-luma {
  font-family: var(--serif);
  font-size: 14px;
  color: rgba(196, 136, 42, 0.75);
  letter-spacing: 0.12em;
}

/* ── Lightbox ───────────────────────────────────────────────────────────────── */
.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.lb-fond {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 2, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lb-fermer {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(240, 237, 232, 0.50);
  transition: color 0.15s;
}
.lb-fermer svg { width: 20px; height: 20px; }
.lb-fermer:hover { color: var(--txt); }

.lb-nav {
  position: relative;
  z-index: 2;
  width: 52px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(240, 237, 232, 0.45);
  background: rgba(240, 237, 232, 0.04);
  border: 1px solid rgba(240, 237, 232, 0.07);
  margin: 0 8px;
  transition: background 0.15s, color 0.15s;
}
.lb-nav svg { width: 22px; height: 22px; }
.lb-nav:hover { background: rgba(240, 237, 232, 0.09); color: var(--txt); }
.lb-nav[hidden] { visibility: hidden; pointer-events: none; }

.lb-scene {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100vh - 62px);
  padding: 12px;
  overflow: hidden;
  grid-column: 2;
  grid-row: 1;
}

.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 50px rgba(0, 0, 0, 0.70);
  transition: opacity 0.15s;
}
.lb-img.loading { opacity: 0; }

/* Barre d'actions lightbox */
.lb-barre {
  position: relative;
  z-index: 2;
  grid-column: 1 / -1;
  grid-row: 2;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(13, 11, 8, 0.88);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 0 20px;
}

.lb-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border: 1px solid rgba(240, 237, 232, 0.12);
  color: rgba(240, 237, 232, 0.65);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 400;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.lb-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.lb-btn:hover { background: rgba(240, 237, 232, 0.07); color: var(--txt); }

.lb-btn-fav.actif {
  color: var(--gold);
  border-color: rgba(196, 136, 42, 0.40);
  background: rgba(196, 136, 42, 0.09);
}
.lb-btn-fav.actif .lb-ico-fav { fill: var(--gold); }

.lb-btn-dl:hover { border-color: rgba(196, 136, 42, 0.30); }

.lb-compteur {
  font-size: 11px;
  color: var(--txt-s);
  position: absolute;
  right: 20px;
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .header { padding: 0 14px; gap: 10px; }
  .logo-txt { font-size: 15px; }
  .titre { font-size: 15px; }
  .grille { columns: 2 140px; }
  .lb-nav { display: none; }
  .lb-scene { height: calc(100vh - 56px); padding: 6px; }
  .lb-barre { gap: 6px; }
  .lb-btn { padding: 6px 10px; font-size: 12px; }
  .lb-compteur { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .grille-item img,
  .grille-overlay,
  .lb-img { transition: none; }
  .spinner { animation-duration: 1.5s; }
}
