.gallery-page {
  min-height: 100vh;
  background: var(--paper);
}

.gallery-hero {
  position: relative;
  min-height: 62vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: white;
}

.gallery-hero::after {
  content: '';
  position: absolute;
  left: -1%;
  right: -1%;
  bottom: -1px;
  height: 104px;
  z-index: 2;
  background: var(--paper);
  clip-path: polygon(0 64%, 7% 58%, 14% 62%, 21% 54%, 29% 60%, 37% 53%, 45% 61%, 54% 55%, 63% 62%, 72% 54%, 81% 61%, 90% 55%, 100% 62%, 100% 100%, 0 100%);
}

.gallery-hero__image,
.gallery-hero__overlay {
  position: absolute;
  inset: 0;
}

.gallery-hero__image {
  background: url('../assets/foto-referencia-7.jpeg') center 42% / cover no-repeat;
  filter: grayscale(34%) saturate(.78);
  transform: scale(1.02);
}

.gallery-hero__overlay {
  background: linear-gradient(180deg, rgba(21, 40, 31, .2), rgba(21, 40, 31, .62));
}

.gallery-hero__back {
  position: absolute;
  left: clamp(18px, 5vw, 64px);
  top: 24px;
  z-index: 3;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .44);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  backdrop-filter: blur(5px);
  font-size: .88rem;
}

.gallery-hero__monogram {
  position: absolute;
  right: clamp(20px, 6vw, 82px);
  top: 26px;
  z-index: 3;
  width: 84px;
  height: 84px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.5rem;
  letter-spacing: -.08em;
  padding-right: 4px;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(4px);
}

.gallery-hero__content {
  position: relative;
  z-index: 1;
  width: min(860px, calc(100% - 36px));
  padding-bottom: 48px;
  text-align: center;
}

.gallery-hero__content span {
  text-transform: uppercase;
  letter-spacing: .36em;
  font-size: .8rem;
}

.gallery-hero__content h1 {
  margin-top: 16px;
  font-family: 'Great Vibes', cursive;
  font-size: clamp(3.5rem, 9vw, 7.5rem);
  line-height: .94;
  font-weight: 400;
}

.gallery-hero__content p {
  width: min(680px, 100%);
  margin: 22px auto 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  line-height: 1.4;
}

.gallery-main {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.gallery-intro {
  width: min(900px, 100%);
  margin: 0 auto;
  text-align: center;
}

.gallery-intro__eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: .78rem;
}

.gallery-intro h2 {
  margin-top: 10px;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 1;
  color: var(--green-dark);
  font-weight: 600;
}

.gallery-intro p {
  width: min(720px, 100%);
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.gallery-toolbar {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: end;
  gap: 12px;
}

.gallery-toolbar__sort {
  display: grid;
  gap: 6px;
  color: var(--green-dark);
  font-size: .82rem;
  font-weight: 600;
  text-align: left;
}

.gallery-toolbar select {
  min-height: 52px;
  padding: 0 42px 0 16px;
  border: 1px solid rgba(47, 90, 70, .26);
  border-radius: 18px;
  background: rgba(255, 255, 255, .54);
  color: var(--text);
}

.gallery-outline-button,
.gallery-load-more {
  min-height: 54px;
  padding: 0 24px;
  border: 1px solid rgba(47, 90, 70, .34);
  border-radius: 18px;
  background: rgba(255, 255, 255, .42);
  color: var(--green-dark);
  text-transform: uppercase;
  letter-spacing: .03em;
  cursor: pointer;
}

.community-gallery {
  margin-top: 46px;
}

.gallery-message {
  min-height: 24px;
  margin-bottom: 20px;
  color: var(--muted);
  text-align: center;
}

.masonry-gallery {
  column-count: 4;
  column-gap: 18px;
}

.memory-card {
  position: relative;
  margin: 0 0 18px;
  break-inside: avoid;
  overflow: hidden;
  border-radius: 6px;
  background: #dedbd5;
  box-shadow: 0 12px 24px rgba(61, 55, 48, .09);
  cursor: zoom-in;
}

.memory-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 68%, rgba(20, 31, 25, .48));
  opacity: 0;
  transition: opacity .25s ease;
}

.memory-card:hover::after {
  opacity: 1;
}

.memory-card img {
  width: 100%;
  height: auto;
  transition: transform .45s ease;
}

.memory-card:hover img {
  transform: scale(1.025);
}

.memory-card__date {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 1;
  color: white;
  font-size: .74rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .25s ease, transform .25s ease;
}

.memory-card:hover .memory-card__date {
  opacity: 1;
  transform: translateY(0);
}

.gallery-load-more {
  display: flex;
  margin: 34px auto 0;
}

.gallery-load-more[hidden] {
  display: none;
}

.gallery-footer {
  padding: 44px 20px 30px;
  background: #bfc6b6;
  color: white;
  text-align: center;
}

.gallery-footer__signature {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(3rem, 7vw, 5rem);
}

.gallery-footer p {
  margin-top: 6px;
  opacity: .9;
}

.modal__dialog--manage {
  width: min(820px, 100%);
}

.manage-code-form {
  width: min(590px, 100%);
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  text-align: left;
}

.manage-code-form label {
  color: var(--green-dark);
  font-weight: 600;
}

.manage-code-form input {
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  padding: 0 16px;
  border: 1px solid rgba(76, 64, 52, .2);
  border-radius: 12px;
  background: rgba(255, 255, 255, .78);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.manage-status {
  min-height: 24px;
  margin-top: 18px;
  color: var(--green-dark);
}

.owned-photos-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.owned-photo {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: #ddd;
}

.owned-photo img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.owned-photo button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: #814c3f;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .14);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(18, 24, 21, .92);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(1100px, 94vw);
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .36);
}

.lightbox__close {
  position: absolute;
  right: 22px;
  top: 16px;
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 2.4rem;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .masonry-gallery { column-count: 3; }
}

@media (max-width: 760px) {
  .gallery-hero { min-height: 54vh; }
  .gallery-hero__monogram { width: 66px; height: 66px; font-size: 2rem; }
  .gallery-main { padding-left: 14px; padding-right: 14px; }
  .masonry-gallery { column-count: 2; column-gap: 10px; }
  .memory-card { margin-bottom: 10px; }
  .gallery-toolbar { display: grid; }
  .gallery-toolbar > * { width: 100%; }
  .gallery-toolbar__sort select { width: 100%; }
  .manage-code-form { grid-template-columns: 1fr; }
  .owned-photos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 440px) {
  .gallery-hero__back { top: 16px; left: 12px; font-size: .76rem; }
  .gallery-hero__monogram { right: 12px; top: 14px; }
  .gallery-hero__content { padding-top: 70px; }
  .masonry-gallery { column-count: 1; }
  .owned-photos-grid { grid-template-columns: 1fr; }
}

/* Ajuste del título principal de la galería */


@media (min-width: 761px) {
  .gallery-hero__content {
    width: min(1180px, calc(100% - 80px));
  }

  .gallery-hero__content h1 {
    font-size: clamp(3.4rem, 7vw, 6.5rem);
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  .gallery-hero__content h1 {
    font-size: clamp(3rem, 12vw, 4.2rem);
    line-height: 0.96;
  }
}

/* ===== Título principal de la galería ===== */

.gallery-hero__title {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;

  font-family: 'Great Vibes', cursive;
  font-size: clamp(3.8rem, 7.5vw, 6.8rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: normal;
  text-transform: none;
  text-align: center;
  color: #ffffff;

  white-space: nowrap;
}

.gallery-hero__title .gallery-hero__title-group {
  display: inline;

  font-family: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
  font-style: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
  text-transform: none !important;
  color: inherit !important;

  white-space: nowrap;
}

/* Ajuste para teléfonos */
@media (max-width: 760px) {
  .gallery-hero__title {
    max-width: 420px;
    padding: 0 10px;
    font-size: clamp(3rem, 13vw, 4.4rem);
    line-height: 0.92;
    white-space: normal;
  }

  .gallery-hero__title .gallery-hero__title-group {
    display: block;
    white-space: nowrap;
  }
}