@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --font: 'Inter', system-ui, sans-serif;
  --black: #0a0a0a;
  --gray-1: #111111;
  --gray-2: #444444;
  --gray-3: #888888;
  --gray-4: #cccccc;
  --gray-5: #f0f0f0;
  --white: #ffffff;
  --radius: 4px;
  --transition: 0.22s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-5);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  height: 58px;
}

.nav-logo {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--black);
  text-decoration: none;
  white-space: nowrap;
}

.nav-divider { width: 1px; height: 18px; background: var(--gray-4); flex-shrink: 0; }

.nav-galleries {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.nav-galleries::-webkit-scrollbar { display: none; }

.nav-link {
  font-size: 12px;
  font-weight: 400;
  color: var(--gray-3);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
  letter-spacing: 0.02em;
}
.nav-link:hover { color: var(--gray-1); background: var(--gray-5); }
.nav-link.active { color: var(--black); font-weight: 500; background: var(--gray-5); }

/* ── HERO / PAGE HEADER ── */
.page-header {
  padding: 64px 32px 40px;
  max-width: 1400px;
  margin: 0 auto;
}
.page-title {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--black);
  line-height: 1.1;
}
.page-subtitle {
  font-size: 13px;
  color: var(--gray-3);
  margin-top: 10px;
  letter-spacing: 0.04em;
  font-weight: 400;
}

/* ── MAIN GALLERY GRID (index) ── */
.galleries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2px;
  padding: 0 2px 2px;
}

.gallery-card {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  cursor: pointer;
  background: var(--gray-5);
  display: block;
  text-decoration: none;
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery-card:hover img { transform: scale(1.04); }

.gallery-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 55%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  transition: opacity var(--transition);
}

.gallery-card-name {
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.gallery-card-count {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  margin-top: 4px;
  letter-spacing: 0.06em;
  font-weight: 300;
}

/* ── GALLERY DETAIL PAGE ── */
.gallery-header {
  padding: 48px 32px 32px;
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.gallery-header-left {}
.gallery-name {
  font-size: clamp(24px, 3.5vw, 42px);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--black);
}
.gallery-count {
  font-size: 12px;
  color: var(--gray-3);
  margin-top: 8px;
  letter-spacing: 0.05em;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-2);
  text-decoration: none;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border: 1px solid var(--gray-4);
  border-radius: 24px;
  transition: all var(--transition);
  white-space: nowrap;
}
.back-btn:hover { color: var(--black); border-color: var(--gray-2); background: var(--gray-5); }
.back-btn svg { width: 14px; height: 14px; }

/* ── MASONRY GRID ── */
.masonry-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 8px 64px;
}

.masonry-grid {
  column-count: 4;
  column-gap: 6px;
}

@media (max-width: 1200px) { .masonry-grid { column-count: 3; } }
@media (max-width: 800px)  { .masonry-grid { column-count: 2; } }
@media (max-width: 480px)  { .masonry-grid { column-count: 1; } }

.masonry-item {
  break-inside: avoid;
  margin-bottom: 6px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--gray-5);
  display: block;
}

.masonry-item img,
.masonry-item video {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: var(--radius);
}
.masonry-item:hover img,
.masonry-item:hover video { transform: scale(1.03); }

.masonry-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background var(--transition);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.masonry-item:hover .masonry-item-overlay { background: rgba(0,0,0,0.12); }

.play-icon {
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition), transform var(--transition);
}
.masonry-item:hover .play-icon { opacity: 1; transform: scale(1); }
.play-icon svg { width: 18px; height: 18px; margin-left: 3px; }

.video-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.item-index-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.4);
  color: rgba(255,255,255,0.8);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.masonry-item:hover .item-index-badge { opacity: 1; }

/* ── LIGHTBOX ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8,8,8,0.97);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-shrink: 0;
}
.lightbox-counter {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.06em;
  font-weight: 300;
}
.lightbox-gallery-name {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 400;
}
.lightbox-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
.lightbox-close svg { width: 16px; height: 16px; }

.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.lightbox-media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
  transition: opacity 0.18s ease;
}
.lightbox-media.fade { opacity: 0; }

.lightbox-video {
  max-width: 100%;
  max-height: 100%;
  outline: none;
}

.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.7);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
  z-index: 10;
}
.lightbox-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.lightbox-btn.prev { left: 20px; }
.lightbox-btn.next { right: 20px; }
.lightbox-btn svg { width: 20px; height: 20px; }

/* ── THUMBNAIL STRIP ── */
.lightbox-strip {
  flex-shrink: 0;
  padding: 12px 24px 20px;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  justify-content: center;
  scrollbar-width: none;
}
.lightbox-strip::-webkit-scrollbar { display: none; }

.strip-thumb {
  width: 52px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  opacity: 0.4;
  cursor: pointer;
  transition: opacity var(--transition), outline var(--transition);
  flex-shrink: 0;
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.strip-thumb:hover { opacity: 0.7; }
.strip-thumb.active { opacity: 1; outline: 2px solid rgba(255,255,255,0.8); }

.strip-thumb-video {
  width: 52px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  opacity: 0.4;
  cursor: pointer;
  transition: opacity var(--transition), outline var(--transition);
  flex-shrink: 0;
  outline: 2px solid transparent;
  outline-offset: 2px;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: 9px;
  letter-spacing: 0.04em;
  position: relative;
}
.strip-thumb-video:hover { opacity: 0.7; }
.strip-thumb-video.active { opacity: 1; outline: 2px solid rgba(255,255,255,0.8); }

/* ── FOOTER ── */
.site-footer {
  border-top: 1px solid var(--gray-5);
  padding: 24px 32px;
  text-align: center;
  font-size: 11px;
  color: var(--gray-4);
  letter-spacing: 0.04em;
}

/* ── LOADING SKELETON ── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-5) 25%, #e8e8e8 50%, var(--gray-5) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── UTILS ── */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
