*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root { --gap: 5px; --radius: 8px; }

html { scroll-behavior: auto; }

body {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #faf6f6;
  color: #2a1a1a;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(250,246,246,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(169,112,112,0.15);
}

header h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #2a1a1a;
}

.hright { display: flex; align-items: center; gap: 10px; }

.badge {
  font-size: 0.75rem;
  color: #a97070;
  background: rgba(212,148,155,0.14);
  border: 1px solid rgba(169,112,112,0.3);
  padding: 3px 10px;
  border-radius: 20px;
}

.back-link {
  font-family: 'Lato', sans-serif;
  font-size: 0.82rem;
  color: #fff;
  text-decoration: none;
  background: #a97070;
  border: none;
  padding: 6px 16px;
  border-radius: 50px;
  transition: filter 0.15s;
}
.back-link:hover { filter: brightness(1.12); }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 16px 48px;
  flex-wrap: wrap;
}
.page-btn {
  background: #fff;
  border: 1px solid rgba(169,112,112,0.25);
  color: #6b4040;
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  cursor: pointer;
}
.page-btn:hover { background: rgba(212,148,155,0.12); border-color: #d4949b; color: #2a1a1a; }
.page-btn.active {
  background: #d4949b;
  border-color: #d4949b;
  color: #fff;
  font-weight: 600;
  pointer-events: none;
}
.page-btn.disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: default;
}

/* ── Grid ──────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 130px;
  grid-auto-flow: dense;
  gap: var(--gap);
  padding: 64px 8px 80px;
}

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 110px; }
  .grid-item.large { grid-column: span 2; }
}
@media (min-width: 900px)  { .grid { grid-template-columns: repeat(8, 1fr);  grid-auto-rows: 140px; } }
@media (min-width: 1300px) { .grid { grid-template-columns: repeat(10, 1fr); grid-auto-rows: 150px; } }

/* Size variants */
.grid-item               { grid-column: span 1; grid-row: span 1; }
.grid-item.wide          { grid-column: span 2; grid-row: span 1; }
.grid-item.tall          { grid-column: span 1; grid-row: span 2; }
.grid-item.med           { grid-column: span 2; grid-row: span 2; }
.grid-item.large         { grid-column: span 3; grid-row: span 2; }

.grid-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
  background: #e8dede;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius);
  transition: transform 0.5s cubic-bezier(.25,.46,.45,.94),
              filter 0.4s ease;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.grid-item:hover img {
  transform: scale(1.06);
  filter: brightness(1.12) saturate(1.1);
}

/* Gradient overlay on hover */
.grid-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(212,148,155,0.12) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  border-radius: var(--radius);
  pointer-events: none;
  z-index: 1;
}
.grid-item:hover::after { opacity: 1; }

/* Tiny shine line at top on hover */
.grid-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 2;
  pointer-events: none;
}
.grid-item:hover::before { opacity: 1; }

.shield {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: var(--radius);
  transition: background 0.3s ease;
}
.grid-item:hover .shield {
  background:
    rgba(30, 10, 10, 0.32)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cpolyline points='9 21 3 21 3 15'/%3E%3Cline x1='21' y1='3' x2='14' y2='10'/%3E%3Cline x1='3' y1='21' x2='10' y2='14'/%3E%3C/svg%3E")
    center / 34px no-repeat;
}

.empty {
  text-align: center;
  color: #8a6060;
  padding: 120px 20px 40px;
  font-size: 1rem;
}

/* ── Lightbox ───────────────────────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(42, 18, 18, 0.96);
  backdrop-filter: blur(24px) saturate(1.2);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#lightbox.open {
  display: flex;
  animation: lb-in 0.2s ease forwards;
}
@keyframes lb-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

#lb-img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  transition: opacity 0.15s ease;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(212,148,155,0.15);
}

#lb-close {
  position: fixed;
  top: 14px; right: 16px;
  background: rgba(212,148,155,0.15);
  border: 1px solid rgba(212,148,155,0.35);
  color: #f0d0d3;
  font-size: 1.1rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#lb-close:hover { background: rgba(212,148,155,0.32); }

#lb-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.nav-btn {
  background: rgba(212,148,155,0.12);
  border: 1px solid rgba(212,148,155,0.3);
  color: #f0d0d3;
  font-size: 1.5rem;
  padding: 7px 22px;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}
.nav-btn:hover { background: rgba(212,148,155,0.28); }

#lb-counter {
  font-family: 'Lato', sans-serif;
  font-size: 0.8rem;
  color: rgba(212,148,155,0.7);
  min-width: 56px;
  text-align: center;
}
