/* Gallery — hub-aligned album cards + mobile-style grid */

body.dl-gallery-page {
  background: #ffffff;
}

.dl-gallery-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 36px 0 56px;
  background: #ffffff;
}

.dl-gallery-wrap {
  width: min(1140px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 max(24px, env(safe-area-inset-bottom, 0px));
}

.dl-gallery-hero {
  margin-bottom: 24px;
  padding: 28px;
  border: 1px solid var(--dl-border);
  border-top: 3px solid var(--dl-primary);
  border-radius: var(--dl-radius);
  background: #fff;
  box-shadow: var(--dl-shadow);
}

.dl-gallery-hero__copy {
  max-width: 640px;
}

.dl-gallery-hero h1 {
  margin: 0;
  color: var(--dl-ink);
  font-size: clamp(1.85rem, 2.8vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.dl-gallery-hero .dl-section-lead {
  max-width: 58ch;
}

/* ── Level 1: album cards ── */

.dl-gallery-albums__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 16px;
}

.dl-gallery-album-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 1px solid var(--dl-border);
  border-radius: var(--dl-radius);
  background: var(--dl-surface);
  box-shadow: var(--dl-shadow);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.dl-gallery-album-card:hover {
  border-color: rgba(223, 10, 28, 0.35);
  box-shadow: var(--dl-shadow-hover);
  transform: translateY(-2px);
}

.dl-gallery-album-card:focus-visible {
  outline: 2px solid var(--dl-primary);
  outline-offset: 2px;
}

.dl-gallery-album-card__cover {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--dl-primary-soft);
  overflow: hidden;
}

.dl-gallery-album-card__cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dl-gallery-album-card__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--dl-primary);
  font-size: 2.5rem;
  opacity: 0.5;
}

.dl-gallery-album-card__count {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.dl-gallery-album-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}

.dl-gallery-album-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--dl-ink);
}

.dl-gallery-album-card__meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--dl-muted);
}

.dl-gallery-album-card__desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.5;
  color: var(--dl-muted);
}

.dl-gallery-album-card__open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dl-primary);
}

/* ── Empty states ── */

.dl-gallery-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: 12px;
  padding: clamp(36px, 6vw, 56px) 24px;
  border: 1px dashed rgba(223, 10, 28, 0.22);
  border-radius: var(--dl-radius);
  background: var(--dl-surface);
  box-shadow: var(--dl-shadow);
}

.dl-gallery-empty--page {
  margin-top: 0;
}

.dl-gallery-empty__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: #fff;
  color: var(--dl-primary);
  font-size: 1.85rem;
  box-shadow: 0 4px 14px rgba(223, 10, 28, 0.12);
}

.dl-gallery-empty__title {
  margin: 0 0 10px;
  color: var(--dl-ink);
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.dl-gallery-empty__text {
  margin: 0;
  max-width: 40ch;
  color: var(--dl-muted);
  font-size: 14px;
  line-height: 1.6;
}

.dl-gallery-empty__action {
  margin-top: 22px;
  padding: 10px 18px;
  border: 1px solid var(--dl-border);
  border-radius: 999px;
  background: #fff;
  color: var(--dl-ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.dl-gallery-empty__action:hover {
  border-color: rgba(223, 10, 28, 0.35);
  color: var(--dl-primary);
  box-shadow: var(--dl-shadow);
}

.dl-gallery-empty__action:focus-visible {
  outline: 2px solid var(--dl-primary);
  outline-offset: 2px;
}

.dl-gallery-empty__action i {
  margin-right: 6px;
}

/* ── Level 2: inner album view ── */

.dl-gallery-album-view {
  animation: dlGalleryFadeIn 0.2s ease;
}

@keyframes dlGalleryFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dl-gallery-album-view__bar {
  margin-bottom: 16px;
}

.dl-gallery-back {
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.dl-gallery-sr-title,
.dl-gallery-sr-desc {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dl-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  min-width: 0;
}

@media (min-width: 480px) {
  .dl-gallery-grid {
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .dl-gallery-grid {
    gap: 8px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* ── Media tiles ── */

.dl-gallery-tile {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: #f0f0f0;
  aspect-ratio: 1;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (min-width: 480px) {
  .dl-gallery-tile {
    border-radius: 6px;
  }
}

.dl-gallery-tile:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(23, 23, 23, 0.12);
  z-index: 1;
}

.dl-gallery-tile:focus-visible {
  outline: 2px solid var(--dl-primary);
  outline-offset: 2px;
  z-index: 2;
}

.dl-gallery-tile img,
.dl-gallery-tile video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dl-gallery-tile__media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.dl-gallery-tile__media--embed {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  color: #fff;
}

.dl-gallery-tile__media--embed > i.fab {
  font-size: 2rem;
  z-index: 0;
}

.dl-gallery-tile__media--embed img {
  position: absolute;
  inset: 0;
}

.dl-gallery-tile__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.dl-gallery-tile__play i {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--dl-primary);
  color: #fff;
  font-size: 14px;
  padding-left: 2px;
}

.dl-gallery-tile__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 10px;
}

.dl-gallery-tile__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 6px 6px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Lightbox ── */

.dl-gallery-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(12, 8, 6, 0.94);
}

.dl-gallery-lightbox.is-open {
  display: flex;
}

.dl-gallery-lb__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(1100px, 100%);
  max-height: 100%;
}

.dl-gallery-lb__stage {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(72vh, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dl-gallery-lb__stage img,
.dl-gallery-lb__stage video {
  max-width: 100%;
  max-height: min(72vh, 100%);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.dl-gallery-lb__stage iframe {
  width: min(960px, 100%);
  height: min(54vh, 540px);
  max-height: 72vh;
  border: none;
  border-radius: 8px;
  background: #000;
}

.dl-gallery-lb__title {
  margin: 12px 0 0;
  max-width: 90%;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-align: center;
}

.dl-gallery-lb__title:empty {
  display: none;
}

.dl-gallery-lb__caption {
  margin: 4px 0 0;
  max-width: 90%;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
}

.dl-gallery-lb__caption:empty {
  display: none;
}

.dl-gallery-lb__count {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.dl-gallery-lb__btn {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease;
}

.dl-gallery-lb__btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.dl-gallery-lb__btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.dl-gallery-lb__close {
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
}

.dl-gallery-lb__prev {
  left: max(8px, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-50%);
}

.dl-gallery-lb__next {
  right: max(8px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
}

@media (max-width: 479px) {
  .dl-gallery-main {
    padding: 20px 0 36px;
  }

  .dl-gallery-wrap {
    width: calc(100% - 24px);
  }

  .dl-gallery-hero {
    padding: 20px 16px;
    margin-bottom: 18px;
  }

  .dl-gallery-albums__grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dl-gallery-empty {
    padding: 32px 18px;
  }

  .dl-gallery-empty__icon {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }

  .dl-gallery-lb__btn {
    width: 44px;
    height: 44px;
  }

  .dl-gallery-lb__stage iframe {
    height: min(40vh, 360px);
  }
}
