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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fafafa;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: white;
  padding: 28px 32px 20px;
  border-bottom: 1px solid #e0e0e0;
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.brand .logo {
  height: 36px;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

header h1 {
  font-size: 17px;
  font-weight: 400;
  color: #666;
}

/* Gallery */
main {
  flex: 1;
  padding: 28px 32px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.loading, .empty-state {
  text-align: center;
  color: #999;
  padding: 80px 24px;
  font-size: 16px;
}

/* Date group */
.date-group {
  margin-bottom: 32px;
}

.date-group h2 {
  font-size: 14px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Justified grid */
.justified-grid {
  width: 100%;
}

/* Media card */
.media-card {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #e8e8e8;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.media-card.loaded {
  opacity: 1;
}

.media-card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 1;
}

.media-card img,
.media-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Video overlay */
.play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-content video {
  max-width: 92vw;
  max-height: 85vh;
  border-radius: 4px;
  background: #000;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 36px;
  cursor: pointer;
  z-index: 10;
  opacity: 0.7;
  transition: opacity 0.2s;
  line-height: 1;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  font-size: 48px;
  cursor: pointer;
  z-index: 10;
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 16px;
  line-height: 1;
}

.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; }

.lightbox-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  text-align: center;
  z-index: 10;
}

.lightbox-meta {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

/* Footer */
footer {
  padding: 24px;
  text-align: center;
  color: #bbb;
  font-size: 13px;
  border-top: 1px solid #eee;
}

/* Toast notification */
#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
  main {
    padding: 16px;
  }

  header {
    padding: 16px;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 36px;
    padding: 8px;
  }
}
