/* ══════════════════════════════════════════════
   VARIABLES & RESET
══════════════════════════════════════════════ */
:root {
  --gold:        #c9921a;
  --gold-light:  #e8b84b;
  --gold-dim:    #7a5510;
  --parchment:   #f5ead0;
  --parchment-dark: #e8d4a8;
  --ink:         #2b1a08;
  --ink-mid:     #5c3d18;
  --ink-light:   #8b6133;
  --bg-deep:     #0f0a04;
  --bg-dark:     #1a1005;
  --bg-panel:    #211608;
  --border:      rgba(201,146,26,.35);
  --border-glow: rgba(232,184,75,.6);
  --shadow:      0 4px 24px rgba(0,0,0,.7);
  --radius:      6px;
  --font-title:  'Cinzel', serif;
  --font-body:   'Crimson Pro', Georgia, serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(201,146,26,.12) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='4' height='4' fill='%230f0a04'/%3E%3Crect x='0' y='0' width='1' height='1' fill='%23ffffff05'/%3E%3C/svg%3E");
}

/* ══════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ══════════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════════ */
.site-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ══════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════ */
header {
  text-align: center;
  padding: 48px 20px 32px;
  position: relative;
}

.header-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.header-ornament::before,
.header-ornament::after {
  content: '';
  flex: 1;
  max-width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}

.header-ornament .gem {
  width: 10px;
  height: 10px;
  background: var(--gold-light);
  transform: rotate(45deg);
  box-shadow: 0 0 12px var(--gold-light);
}

h1 {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dim) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(201,146,26,.4));
}

.subtitle {
  font-size: .95rem;
  color: var(--ink-light);
  letter-spacing: .06em;
  font-style: italic;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════
   BREADCRUMB
══════════════════════════════════════════════ */
.breadcrumb-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 2px;
  padding: 10px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-size: .88rem;
  font-family: var(--font-title);
  letter-spacing: .04em;
}

.breadcrumb-bar a {
  color: var(--gold);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background .15s, color .15s;
}
.breadcrumb-bar a:hover { background: rgba(201,146,26,.15); color: var(--gold-light); }

.breadcrumb-bar .sep {
  color: var(--gold-dim);
  font-size: .7em;
  margin: 0 2px;
  user-select: none;
}

.breadcrumb-bar .current {
  color: var(--parchment);
  padding: 2px 6px;
}

/* ══════════════════════════════════════════════
   TOOLBAR
══════════════════════════════════════════════ */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .82rem;
  color: var(--ink-light);
  font-family: var(--font-title);
  letter-spacing: .04em;
}

.stat-badge strong { color: var(--gold); }

.btn-zip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #7a5510 0%, #c9921a 50%, #7a5510 100%);
  background-size: 200% 100%;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  color: var(--parchment);
  font-family: var(--font-title);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-position .3s, box-shadow .3s, transform .15s;
  box-shadow: 0 2px 12px rgba(201,146,26,.3), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-zip:hover {
  background-position: 100% 0;
  box-shadow: 0 4px 20px rgba(201,146,26,.5), inset 0 1px 0 rgba(255,255,255,.15);
  transform: translateY(-1px);
}
.btn-zip:active { transform: translateY(0); }
.btn-zip svg { flex-shrink: 0; }

/* ══════════════════════════════════════════════
   SEARCH
══════════════════════════════════════════════ */
.search-wrap {
  position: relative;
  width: 220px;
}
.search-wrap input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: .9rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.search-wrap input::placeholder { color: var(--ink-light); }
.search-wrap input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,146,26,.2);
}
.search-wrap .search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--gold-dim);
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   FOLDER GRID
══════════════════════════════════════════════ */
.section-label {
  font-family: var(--font-title);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 32px;
}

.folder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--parchment);
  font-family: var(--font-title);
  font-size: .78rem;
  letter-spacing: .03em;
  transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.folder-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201,146,26,.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .2s;
}
.folder-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 0 1px rgba(201,146,26,.2);
}
.folder-card:hover::before { opacity: 1; }

.folder-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(201,146,26,.4));
}

.folder-name {
  text-align: center;
  word-break: break-word;
  line-height: 1.3;
}

.folder-count {
  font-size: .7rem;
  color: var(--ink-light);
  font-family: var(--font-body);
  font-style: italic;
}

/* ══════════════════════════════════════════════
   IMAGE GRID
══════════════════════════════════════════════ */
.image-section { margin-top: 8px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}

.img-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.img-cell:hover {
  border-color: var(--gold);
  transform: scale(1.08);
  z-index: 2;
  box-shadow: 0 4px 16px rgba(0,0,0,.6), 0 0 0 1px rgba(201,146,26,.3);
}

.img-cell img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.img-cell .img-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,10,4,.95);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: .72rem;
  color: var(--parchment);
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  font-family: var(--font-body);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.img-cell:hover .img-tooltip { display: block; }

/* ══════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════ */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,3,1,.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: lb-in .15s ease;
}
#lightbox.active { display: flex; }

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

.lb-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
  max-height: 90vh;
}

.lb-inner img {
  max-width: min(600px, 80vw);
  max-height: 70vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgba(201,146,26,.2);
  background: repeating-conic-gradient(#2a1e08 0% 25%, #1a1005 0% 50%) 0 0 / 16px 16px;
}

.lb-name {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-light);
  font-size: .9rem;
}

.lb-close {
  position: fixed;
  top: 20px; right: 24px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  color: var(--gold);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.lb-close:hover { background: rgba(201,146,26,.15); border-color: var(--gold); }

.lb-nav {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  background: rgba(15,10,4,.8);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px; height: 40px;
  color: var(--gold);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  user-select: none;
}
.lb-nav:hover { background: rgba(201,146,26,.2); }
#lb-prev { left: 16px; }
#lb-next { right: 16px; }

/* ══════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-light);
  font-style: italic;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }

/* ══════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════ */
footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
  font-size: .8rem;
  color: var(--gold-dim);
  font-family: var(--font-title);
  letter-spacing: .08em;
}

/* ══════════════════════════════════════════════
   RETOUR EN HAUT
══════════════════════════════════════════════ */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #7a5510, #c9921a);
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--parchment);
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.6), 0 0 0 1px rgba(201,146,26,.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .25s, transform .25s, box-shadow .2s;
  z-index: 500;
}
#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#back-to-top:hover {
  box-shadow: 0 6px 22px rgba(201,146,26,.45);
  transform: translateY(-2px);
}

/* ══════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════ */
@media (max-width: 600px) {
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; }
  .folder-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  #lb-prev { left: 4px; }
  #lb-next { right: 4px; }
}
