/**
 * Public Gallery — albums, masonry, Cover Flow viewer
 */

body.mmco-site .gallery-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

body.mmco-site .gallery-folder-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(43, 45, 49, 0.08);
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(43, 45, 49, 0.04);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
  animation: galleryRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--g-delay, 0s);
}

body.mmco-site .gallery-folder-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(43, 45, 49, 0.12);
}

body.mmco-site .gallery-folder-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 220px;
  overflow: hidden;
  background: #e8eaed;
}

body.mmco-site .gallery-folder-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

body.mmco-site .gallery-folder-card:hover .gallery-folder-card__media img {
  transform: scale(1.06);
}

body.mmco-site .gallery-folder-card__placeholder {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 30% 30%, rgba(197, 160, 40, 0.2), transparent 50%),
    linear-gradient(145deg, #dfe2e6, #f2f3f4);
}

body.mmco-site .gallery-folder-card__count {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(43, 45, 49, 0.78);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.mmco-site .gallery-folder-card__body {
  padding: 1.1rem 1.15rem 1.25rem;
}

body.mmco-site .gallery-folder-card__body h2,
body.mmco-site .gallery-folder-card__body h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--charcoal, #2b2d31);
}

body.mmco-site .gallery-folder-card__body p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--gray-medium, #6b7078);
}

body.mmco-site .gallery-folder-card__cta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--charcoal, #2b2d31);
}

body.mmco-site .gallery-album-toolbar {
  margin-bottom: 1.25rem;
}

body.mmco-site .gallery-back {
  font-weight: 700;
  color: var(--charcoal, #2b2d31);
  text-decoration: none;
}

body.mmco-site .gallery-back:hover {
  color: var(--gold, #c5a028);
}

body.mmco-site .gallery-photo-masonry {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 110px;
  gap: 0.85rem;
}

body.mmco-site .gallery-photo {
  position: relative;
  grid-column: span 3;
  grid-row: span 2;
  border: 0;
  padding: 0;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  cursor: zoom-in;
  background: #dfe2e6;
  box-shadow: 0 2px 12px rgba(43, 45, 49, 0.06);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
  animation: galleryRise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--g-delay, 0s);
}

body.mmco-site .gallery-photo--wide {
  grid-column: span 6;
}

body.mmco-site .gallery-photo--tall {
  grid-row: span 3;
}

body.mmco-site .gallery-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

body.mmco-site .gallery-photo:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 36px rgba(43, 45, 49, 0.14);
  z-index: 2;
}

body.mmco-site .gallery-photo:hover img {
  transform: scale(1.05);
}

body.mmco-site .gallery-photo__shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.18) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.7s ease;
  pointer-events: none;
}

body.mmco-site .gallery-photo:hover .gallery-photo__shine {
  transform: translateX(120%);
}

/* ——— Cover Flow viewer ——— */
html.gallery-coverflow-open,
html.gallery-coverflow-open body {
  overflow: hidden;
}

.gallery-coverflow {
  border: 0;
  padding: 0;
  margin: auto;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100vh;
  background: transparent;
  color: #fff;
  overflow: hidden;
  box-sizing: border-box;
}

.gallery-coverflow::backdrop {
  background: rgba(18, 20, 24, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.gallery-coverflow__shell {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto auto auto;
  align-items: center;
  justify-items: center;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  padding: 3.5rem 0.75rem 1.35rem;
  box-sizing: border-box;
}

.gallery-coverflow__close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 5;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.gallery-coverflow__close:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

.gallery-coverflow__stage {
  position: relative;
  width: min(1280px, 100%);
  height: 100%;
  min-height: 320px;
  max-height: min(78vh, 760px);
  outline: none;
  overflow: hidden;
}

.gallery-coverflow__track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.gallery-coverflow__card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, 72vw);
  height: min(68vh, 620px);
  max-height: 100%;
  aspect-ratio: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 22px;
  overflow: hidden;
  background: #2b2d31;
  cursor: pointer;
  transform-origin: center center;
  transform: translate3d(-50%, -50%, 0);
  opacity: 0;
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease,
    box-shadow 0.4s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

.gallery-coverflow__card.is-active {
  width: min(560px, 78vw);
  height: min(72vh, 680px);
  cursor: default;
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.1);
}

.gallery-coverflow__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  background: #111;
  /* Keep photos sharp while scaling */
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.gallery-coverflow__caption {
  margin: 0;
  min-height: 1.35em;
  max-width: min(36rem, 90vw);
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.45;
}

.gallery-coverflow__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
}

.gallery-coverflow__btn {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.25s ease;
}

.gallery-coverflow__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: #fff;
  transform: scale(1.06);
}

.gallery-coverflow__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.gallery-coverflow__dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  max-width: min(90vw, 28rem);
}

.gallery-coverflow__dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: width 0.3s ease, background 0.3s ease;
}

.gallery-coverflow__dot.is-active {
  width: 22px;
  background: var(--gold, #c5a028);
}

@keyframes galleryRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 900px) {
  body.mmco-site .gallery-photo,
  body.mmco-site .gallery-photo--wide,
  body.mmco-site .gallery-photo--tall {
    grid-column: span 6;
    grid-row: span 2;
  }

  .gallery-coverflow__card,
  .gallery-coverflow__card.is-active {
    width: min(440px, 82vw);
    height: min(64vh, 560px);
    border-radius: 18px;
  }

  .gallery-coverflow__stage {
    max-height: min(70vh, 620px);
  }
}

@media (max-width: 560px) {
  body.mmco-site .gallery-photo-masonry {
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 100px;
  }

  body.mmco-site .gallery-photo,
  body.mmco-site .gallery-photo--wide,
  body.mmco-site .gallery-photo--tall {
    grid-column: span 6;
  }

  .gallery-coverflow__shell {
    padding: 3.25rem 0.5rem 1.15rem;
    gap: 0.55rem;
  }

  .gallery-coverflow__card,
  .gallery-coverflow__card.is-active {
    width: min(92vw, 360px);
    height: min(58vh, 480px);
    border-radius: 16px;
  }

  .gallery-coverflow__stage {
    max-height: min(62vh, 500px);
  }

  .gallery-coverflow__btn {
    width: 44px;
    height: 44px;
  }

  .gallery-coverflow__caption {
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.mmco-site .gallery-folder-card,
  body.mmco-site .gallery-photo {
    animation: none;
  }

  .gallery-coverflow__card {
    transition: none;
  }
}
