/* ============================================================
   LIBRARY.CSS — Librairie créative (Pinterest style)
   ============================================================ */

/* ── Hero ───────────────────────────────────────────────────── */
#library-hero {
  position: relative;
  height: 55vh;
  min-height: 400px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 80px;
  overflow: hidden;
}
#library-hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('https://images.unsplash.com/photo-1558618666-fcd25c85cd64?auto=format&fit=crop&w=1920&q=80');
  background-size: cover;
  background-position: center 40%;
  filter: brightness(0.2) saturate(0.7);
  transform: scale(1.03);
  transition: transform 10s ease;
}
#library-hero:hover #library-hero-bg { transform: scale(1); }
#library-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(10,10,10,0.8) 0%, rgba(10,10,10,0.2) 60%, transparent 100%);
}
#library-hero-content {
  position: relative;
  z-index: 1;
  padding: 0 48px;
  padding-top: var(--nav-h);
}

#library-title {
  font-family: var(--font-title);
  font-size: clamp(4rem, 12vw, 10rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(245,245,245,0.15);
  position: relative;
}
#library-title::after {
  content: 'Librairie';
  position: absolute;
  inset: 0;
  color: var(--white);
  -webkit-text-stroke: 0;
  clip-path: inset(0 60% 0 0);
  animation: titleReveal 1.2s cubic-bezier(0.25,0.46,0.45,0.94) forwards 0.3s;
}
@keyframes titleReveal {
  to { clip-path: inset(0 0% 0 0); }
}
.library-subtitle {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--grey);
  text-transform: uppercase;
  margin-top: 16px;
}

/* ── Filters ─────────────────────────────────────────────────── */
#library-filters {
  padding: 48px 0 0;
  position: sticky;
  top: var(--nav-h);
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
/* .filter-bar et .filter-btn définis dans main.css */

/* ── Count ───────────────────────────────────────────────────── */
.library-count {
  font-size: 0.75rem;
  color: var(--grey);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 20px 0 0;
}

/* ── Masonry Grid ────────────────────────────────────────────── */
#library-grid-section {
  padding: 16px 0 120px;
}

#library-grid {
  /* Masonry.js gère les colonnes */
}

.lib-item {
  width: calc(25% - 15px);
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--surface);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease,
              box-shadow var(--transition);
}
.lib-item.visible {
  opacity: 1;
  transform: translateY(0);
}
.lib-item:hover {
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  z-index: 2;
}
.lib-item img {
  width: 100%;
  display: block;
  transition: transform var(--transition);
}
.lib-item:hover img { transform: scale(1.04); }

.lib-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--transition);
}
.lib-item:hover .lib-item-overlay { opacity: 1; }

.lib-item-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.lib-item-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}
.lib-item-tags {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.lib-item-year {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(245,245,245,0.5);
  white-space: nowrap;
}
.lib-item-expand {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--white);
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
}
.lib-item:hover .lib-item-expand { opacity: 1; }
.lib-item:hover .lib-item-expand:hover { background: var(--gold); color: #0a0a0a; }

/* ── Loader dots ─────────────────────────────────────────────── */
.library-loader {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 40px 0;
}
.library-loader span {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: loaderPulse 1.2s ease infinite;
}
.library-loader span:nth-child(2) { animation-delay: 0.2s; }
.library-loader span:nth-child(3) { animation-delay: 0.4s; }
@keyframes loaderPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}
.library-loader.hidden { display: none; }

/* ── Empty ───────────────────────────────────────────────────── */
#library-empty {
  text-align: center;
  padding: 80px 0;
  color: var(--grey);
}
#library-empty i { font-size: 3rem; margin-bottom: 16px; display: block; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .lib-item { width: calc(33.333% - 14px); }
}
@media (max-width: 900px) {
  .lib-item { width: calc(50% - 10px); }
  #library-hero-content { padding: 0 24px; }
}
@media (max-width: 600px) {
  .lib-item { width: 100%; }
  #library-hero-content, .filter-bar { padding: 0 16px; }
  #library-filters { position: static; }
}
