/* Awesome Hotel editorial gallery. Every selector is scoped to the plugin. */
.agm-gallery,
.agm-gallery *,
.agm-gallery *::before,
.agm-gallery *::after {
  box-sizing: border-box;
}

.agm-gallery {
  --agm-gold: var(--gold, #b58a54);
  --agm-gold-pale: var(--gold-pale, #f3e2bd);
  --agm-ivory: var(--ivory, #fbf5ea);
  --agm-sand: var(--sand, #f2eadc);
  --agm-navy: var(--navy, #2f2418);
  --agm-ink: var(--ink, #37291d);
  --agm-taupe: var(--taupe, #8b7458);
  --agm-rule: var(--gold-dim, rgba(181, 138, 84, 0.26));
  align-self: start;
  min-width: 0;
  min-height: 0;
  padding-block: clamp(58px, 8vw, 126px);
  scroll-margin-block-start: var(--agm-sticky-offset, 110px);
  background: var(--agm-ivory);
  color: var(--agm-ink);
  container-type: inline-size;
}

.agm-gallery__shell {
  width: min(100%, 1440px);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 64px);
}

.agm-gallery__layout {
  display: grid;
  grid-template-columns: clamp(194px, 20vw, 268px) minmax(0, 1fr);
  gap: clamp(30px, 6vw, 104px);
  align-items: start;
}

.agm-gallery__intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.52fr);
  gap: clamp(22px, 5vw, 86px);
  align-items: end;
  padding-bottom: clamp(28px, 4vw, 54px);
  border-bottom: 1px solid var(--agm-rule);
}

.agm-gallery__intro + .agm-gallery__layout {
  margin-top: clamp(30px, 5vw, 72px);
}

.agm-gallery__intro-title {
  max-width: 960px;
  margin: 0;
  color: var(--agm-ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(3rem, 6.4cqw, 6.9rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.88;
  text-wrap: balance;
}

.agm-gallery__intro-copy {
  max-width: 500px;
  color: rgba(55, 41, 29, 0.72);
  font-family: "Jost", sans-serif;
  font-size: clamp(0.93rem, 1.15cqw, 1.08rem);
  font-weight: 350;
  line-height: 1.75;
}

.agm-gallery__intro-copy > :first-child {
  margin-top: 0;
}

.agm-gallery__intro-copy > :last-child {
  margin-bottom: 0;
}

.agm-gallery__rail {
  position: sticky;
  top: var(--agm-sticky-offset, 110px);
  z-index: 2;
  align-self: start;
  block-size: fit-content;
  min-width: 0;
}

.agm-gallery__rail-inner {
  position: static;
  border-top: 1px solid var(--agm-rule);
  border-bottom: 1px solid var(--agm-rule);
}

.agm-gallery__rail-label {
  margin: 0;
  padding: 17px 0 14px;
  color: var(--agm-taupe);
  font-family: "Jost", sans-serif;
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  line-height: 1.25;
  text-transform: uppercase;
}

.agm-gallery__tabs {
  border-top: 1px solid var(--agm-rule);
}

.agm-gallery__tab {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 24px 0fr minmax(0, 1fr);
  gap: 0;
  align-items: center;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--agm-rule);
  border-radius: 0;
  background: transparent;
  color: var(--agm-ink);
  cursor: pointer;
  text-align: left;
  transition: color 180ms ease, background-color 180ms ease;
}

.agm-gallery__tabs .agm-gallery__tab:last-child {
  border-bottom: 0;
}

.agm-gallery__tab-order {
  color: var(--agm-gold);
  font-family: "Jost", sans-serif;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.agm-gallery__tab-preview {
  width: 0;
  height: 36px;
  overflow: hidden;
  opacity: 0;
  transition: width 220ms ease, opacity 160ms ease, margin 220ms ease;
}

.agm-gallery__tab-preview img {
  display: block;
  width: 52px;
  height: 36px;
  object-fit: cover;
}

.agm-gallery__tab-name {
  min-width: 0;
  overflow: hidden;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.25rem, 1.8vw, 1.7rem);
  font-weight: 500;
  line-height: 0.96;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agm-gallery__tab:hover,
.agm-gallery__tab[aria-selected="true"] {
  color: var(--agm-gold);
}

.agm-gallery__tab[aria-selected="true"] {
  grid-template-columns: 24px 52px minmax(0, 1fr);
  gap: 10px;
  padding-left: 10px;
  background: var(--agm-sand);
}

.agm-gallery__tab[aria-selected="true"] .agm-gallery__tab-preview {
  width: 52px;
  margin-left: 0;
  opacity: 1;
}

.agm-gallery__tab:focus-visible,
.agm-gallery__image-button:focus-visible,
.agm-gallery__control:focus-visible,
.agm-gallery__dialog button:focus-visible {
  outline: 2px solid var(--agm-gold);
  outline-offset: 4px;
}

.agm-gallery__panels,
.agm-gallery__panel {
  min-width: 0;
  min-height: 0;
}

.agm-gallery__album-header {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(180px, 0.55fr);
  gap: clamp(18px, 4vw, 72px);
  align-items: end;
  padding-bottom: clamp(28px, 4vw, 50px);
  margin-bottom: clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--agm-rule);
}

.agm-gallery__album-title {
  max-width: 860px;
  margin: 0;
  color: var(--agm-ink);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.55rem, 5.3cqw, 5.25rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 0.84;
  text-wrap: balance;
}

.agm-gallery__album-description {
  max-width: 420px;
  margin-bottom: 3px;
  color: rgba(55, 41, 29, 0.72);
  font-family: "Jost", sans-serif;
  font-size: clamp(0.91rem, 1.1cqw, 1.05rem);
  font-weight: 350;
  line-height: 1.72;
}

.agm-gallery__album-description > :first-child {
  margin-top: 0;
}

.agm-gallery__album-description > :last-child {
  margin-bottom: 0;
}

.agm-gallery__grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: row dense;
  /*
   * A measured editorial contact sheet, rather than a loose masonry layout.
   * Each paired spread shares the same row span, so a portrait never leaves
   * an accidental ivory void beside a landscape image.
   */
  grid-auto-rows: clamp(7px, 0.7cqw, 12px);
  gap: clamp(8px, 1.15vw, 16px);
}

.agm-gallery__photo {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  background: var(--agm-sand);
  grid-row: span 18;
  aspect-ratio: auto;
}

.agm-gallery__photo:nth-child(9n + 1) {
  grid-column: span 7;
  grid-row: span 18;
}

.agm-gallery__photo:nth-child(9n + 2) {
  grid-column: span 5;
  grid-row: span 18;
}

.agm-gallery__photo:nth-child(9n + 3) {
  grid-column: span 4;
  grid-row: span 20;
}

.agm-gallery__photo:nth-child(9n + 4) {
  grid-column: span 8;
  grid-row: span 20;
}

.agm-gallery__photo:nth-child(9n + 5) {
  grid-column: span 6;
  grid-row: span 15;
}

.agm-gallery__photo:nth-child(9n + 6) {
  grid-column: span 6;
  grid-row: span 15;
}

.agm-gallery__photo:nth-child(9n + 7) {
  grid-column: span 5;
  grid-row: span 18;
}

.agm-gallery__photo:nth-child(9n + 8) {
  grid-column: span 7;
  grid-row: span 18;
}

.agm-gallery__photo:nth-child(9n + 9) {
  grid-column: span 12;
  grid-row: span 13;
}

/* A partial final spread becomes a full-width closing image, never a blank half-row. */
.agm-gallery__photo:nth-child(9n + 1):last-child,
.agm-gallery__photo:nth-child(9n + 3):last-child,
.agm-gallery__photo:nth-child(9n + 5):last-child,
.agm-gallery__photo:nth-child(9n + 7):last-child {
  grid-column: span 12;
  grid-row: span 13;
}

.agm-gallery__image-button {
  position: absolute !important;
  inset: 0;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: zoom-in;
}

.agm-gallery__image {
  position: absolute !important;
  inset: 0;
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover !important;
  object-position: center;
  transform: scale(1.001);
  transition: transform 360ms ease, filter 360ms ease;
}

.agm-gallery__image-button:hover .agm-gallery__image,
.agm-gallery__image-button:focus-visible .agm-gallery__image {
  filter: saturate(0.95) contrast(1.02);
  transform: scale(1.028);
}

.agm-gallery__controls {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding-top: clamp(28px, 4vw, 48px);
}

.agm-gallery__control {
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: var(--agm-ink);
  font-family: "Jost", sans-serif;
  font-size: 0.69rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 180ms ease, letter-spacing 180ms ease;
}

.agm-gallery__control:hover {
  color: var(--agm-gold);
  letter-spacing: 0.16em;
}

.agm-gallery__dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding-top: max(clamp(14px, 3vw, 40px), env(safe-area-inset-top));
  padding-right: max(clamp(14px, 3vw, 40px), env(safe-area-inset-right));
  padding-bottom: max(clamp(14px, 3vw, 40px), env(safe-area-inset-bottom));
  padding-left: max(clamp(14px, 3vw, 40px), env(safe-area-inset-left));
  overflow: hidden;
  border: 0;
  background: var(--agm-navy);
  color: var(--agm-ivory);
  opacity: 0;
  transition: opacity 240ms ease;
}

.agm-gallery__dialog::backdrop {
  background: rgba(47, 36, 24, 0);
  transition: background-color 280ms ease;
}

.agm-gallery__dialog.is-open {
  opacity: 1;
}

.agm-gallery__dialog.is-open::backdrop {
  background: rgba(47, 36, 24, 0.88);
}

.agm-gallery__dialog.is-closing {
  opacity: 0;
  transition-duration: 220ms;
}

.agm-gallery__dialog.is-closing::backdrop {
  background: rgba(47, 36, 24, 0);
  transition-duration: 220ms;
}

.agm-gallery__dialog-shell {
  width: min(100%, 1540px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  margin-inline: auto;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transform-origin: 50% 52%;
  transition:
    opacity 300ms ease,
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.agm-gallery__dialog.is-open .agm-gallery__dialog-shell {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.agm-gallery__dialog.is-closing .agm-gallery__dialog-shell {
  opacity: 0;
  transform: translateY(6px) scale(0.992);
  transition:
    opacity 190ms ease,
    transform 220ms cubic-bezier(0.4, 0, 1, 1);
}

.agm-gallery__dialog-topbar {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid rgba(243, 226, 189, 0.28);
}

.agm-gallery__dialog-status {
  margin: 0;
  color: var(--agm-gold-pale);
  font-family: "Jost", sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 220ms ease 70ms, transform 260ms ease 70ms;
}

.agm-gallery__dialog.is-open .agm-gallery__dialog-status {
  opacity: 1;
  transform: translateY(0);
}

.agm-gallery__dialog.is-closing .agm-gallery__dialog-status {
  opacity: 0;
  transform: translateY(2px);
  transition-delay: 0ms;
}

.agm-gallery__dialog-close,
.agm-gallery__dialog-arrow {
  width: 48px;
  min-width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(243, 226, 189, 0.42);
  border-radius: 0;
  background: transparent;
  color: var(--agm-ivory);
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.agm-gallery__dialog-close {
  font-family: Arial, sans-serif;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 1;
}

.agm-gallery__dialog-arrow {
  display: grid;
  place-items: center;
  font-family: Arial, sans-serif;
  font-size: 1.4rem;
  line-height: 1;
}

.agm-gallery__dialog-close:hover,
.agm-gallery__dialog-arrow:hover {
  border-color: var(--agm-gold-pale);
  background: rgba(181, 138, 84, 0.21);
  color: var(--agm-gold-pale);
}

.agm-gallery__dialog-arrow:disabled {
  opacity: 0.4;
  cursor: default;
}

.agm-gallery__dialog-stage {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: clamp(10px, 2vw, 28px);
  align-items: center;
  overflow: hidden;
}

.agm-gallery__dialog-figure {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  display: grid;
  margin: 0;
  place-items: center;
  overflow: hidden;
}

.agm-gallery__dialog-figure img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  opacity: 1;
  transform: scale(1);
  transition: opacity 150ms ease, transform 190ms cubic-bezier(0.22, 1, 0.36, 1);
}

.agm-gallery__dialog-figure.is-changing img {
  opacity: 0;
  transform: scale(0.992);
}

.agm-gallery-lock {
  overflow: hidden;
}

.agm-editor-notice {
  padding: 14px 16px;
  border-left: 3px solid var(--gold, #b58a54);
  background: var(--ivory, #fbf5ea);
  color: var(--ink, #37291d);
  font-family: "Jost", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

@container (max-width: 980px) {
  .agm-gallery__layout {
    display: block;
  }

  .agm-gallery__rail {
    top: var(--agm-sticky-offset, 72px);
    margin-bottom: clamp(34px, 5vw, 54px);
  }

  .agm-gallery__rail-inner {
    position: static;
    margin-inline: calc(-1 * clamp(16px, 4vw, 64px));
    padding-inline: clamp(16px, 4vw, 64px);
    background: var(--agm-ivory);
    box-shadow: 0 7px 14px rgba(55, 41, 29, 0.06);
  }

  .agm-gallery__rail-label {
    padding-top: 15px;
  }

  .agm-gallery__tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-padding-inline: clamp(16px, 4vw, 64px);
    scroll-snap-type: inline proximity;
  }

  .agm-gallery__tabs::-webkit-scrollbar {
    display: none;
  }

  .agm-gallery__tab,
  .agm-gallery__tab[aria-selected="true"] {
    width: auto;
    min-width: 126px;
    min-height: 70px;
    flex: 0 0 auto;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    padding: 10px 15px;
    border-right: 1px solid var(--agm-rule);
    border-bottom: 0;
    background: transparent;
    scroll-snap-align: start;
  }

  .agm-gallery__tab[aria-selected="true"] {
    min-width: 206px;
    grid-template-columns: 22px 48px minmax(0, 1fr);
    background: var(--agm-sand);
  }

  .agm-gallery__tab-preview,
  .agm-gallery__tab[aria-selected="true"] .agm-gallery__tab-preview {
    width: 48px;
    height: 34px;
    opacity: 1;
  }

  .agm-gallery__tab-preview img {
    width: 48px;
    height: 34px;
  }

  .agm-gallery__album-header {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .agm-gallery__intro {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .agm-gallery__intro-copy {
    max-width: 640px;
  }

  .agm-gallery__album-description {
    max-width: 640px;
  }

  .agm-gallery__photo:nth-child(n) {
    grid-column: span 6;
    grid-row: auto;
    aspect-ratio: 4 / 5;
  }

  .agm-gallery__photo:nth-child(n):last-child {
    grid-column: span 6;
    grid-row: auto;
  }

  .agm-gallery__photo:nth-child(6n + 1) {
    grid-column: span 12;
    grid-row: auto;
    aspect-ratio: 16 / 9;
  }
}

@container (min-width: 641px) and (max-width: 980px) {
  .agm-gallery__tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .agm-gallery__tab,
  .agm-gallery__tab[aria-selected="true"] {
    width: 100%;
    min-width: 0;
    min-height: 72px;
    flex: initial;
    padding: 10px 12px;
    border-right: 1px solid var(--agm-rule);
    border-bottom: 1px solid var(--agm-rule);
  }

  .agm-gallery__tab[aria-selected="true"] {
    grid-template-columns: 22px 44px minmax(0, 1fr);
    gap: 8px;
  }

  .agm-gallery__tab:nth-child(3n) {
    border-right: 0;
  }

  .agm-gallery__tab-preview,
  .agm-gallery__tab[aria-selected="true"] .agm-gallery__tab-preview,
  .agm-gallery__tab-preview img {
    width: 44px;
    height: 32px;
  }
}

@container (max-width: 640px) {
  .agm-gallery {
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    padding-block: clamp(38px, 11vw, 52px);
  }

  .agm-gallery__shell {
    padding-inline: 16px;
  }

  .agm-gallery__rail-inner {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .agm-gallery__tab,
  .agm-gallery__tab[aria-selected="true"] {
    min-width: max-content;
    min-height: 60px;
    grid-template-columns: 18px max-content;
    gap: 8px;
    padding-inline: 14px;
  }

  .agm-gallery__tab[aria-selected="true"] {
    min-width: max-content;
    grid-template-columns: 18px max-content;
    gap: 8px;
  }

  .agm-gallery__tab-preview,
  .agm-gallery__tab[aria-selected="true"] .agm-gallery__tab-preview,
  .agm-gallery__tab-preview img {
    display: none;
  }

  .agm-gallery__tab-name {
    overflow: visible;
    font-size: 1.1rem;
    text-overflow: clip;
  }

  .agm-gallery__album-title {
    font-size: clamp(2.25rem, 10.5vw, 3.15rem);
  }

  .agm-gallery__intro-title {
    font-size: clamp(3rem, 17vw, 5.2rem);
  }

  .agm-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 8px;
  }

  .agm-gallery__photo:nth-child(n) {
    grid-column: span 1;
    aspect-ratio: 4 / 5;
  }

  .agm-gallery__photo:nth-child(5n + 1) {
    grid-column: span 2;
    aspect-ratio: 16 / 11;
  }

  .agm-gallery__dialog {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .agm-gallery__dialog-stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .agm-gallery__dialog-figure {
    grid-column: 1 / -1;
  }

  .agm-gallery__dialog-arrow {
    width: 48px;
    justify-self: start;
  }

  .agm-gallery__dialog-arrow--next {
    justify-self: end;
  }
}

@container (max-width: 430px) {
  /*
   * Keep the mobile composition as a real one-column grid. Spacing lives on
   * the grid rather than on figure margins, so Elementor/theme figure resets
   * cannot collapse the space between consecutive gallery images.
   */
  .agm-gallery__grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    row-gap: clamp(12px, 3vw, 18px) !important;
    column-gap: 0 !important;
  }

  .agm-gallery__photo:nth-child(n) {
    display: block !important;
    position: relative !important;
    width: 100%;
    height: clamp(236px, 76vw, 340px) !important;
    min-height: clamp(236px, 76vw, 340px) !important;
    margin: 0 !important;
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    aspect-ratio: auto !important;
  }

  .agm-gallery__photo:nth-child(3n + 2) {
    height: clamp(188px, 58vw, 248px) !important;
    min-height: clamp(188px, 58vw, 248px) !important;
  }
}

/* Viewport fallbacks keep Elementor previews from inheriting the desktop mosaic. */
@media (min-width: 768px) and (max-width: 1024px) {
  .agm-gallery__layout {
    display: block !important;
  }

  .agm-gallery__rail {
    position: static !important;
    margin-bottom: clamp(32px, 5vw, 48px);
  }

  .agm-gallery__tabs {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible !important;
  }

  .agm-gallery__tab,
  .agm-gallery__tab[aria-selected="true"] {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 70px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--agm-rule);
  }

  .agm-gallery__tab[aria-selected="true"] {
    grid-template-columns: 22px 42px minmax(0, 1fr);
    gap: 8px;
  }

  .agm-gallery__tab:nth-child(3n) {
    border-right: 0;
  }

  .agm-gallery__tab-preview,
  .agm-gallery__tab[aria-selected="true"] .agm-gallery__tab-preview,
  .agm-gallery__tab-preview img {
    width: 42px;
    height: 30px;
  }

  .agm-gallery__grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: clamp(12px, 2vw, 18px);
  }

  .agm-gallery__photo:nth-child(n) {
    display: block !important;
    grid-column: span 1 !important;
    grid-row: auto !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 4 / 5 !important;
  }

  .agm-gallery__photo:nth-child(4n + 1) {
    grid-column: span 2 !important;
    aspect-ratio: 16 / 10 !important;
  }

  .agm-gallery__photo:nth-child(4n + 2) {
    aspect-ratio: 3 / 4 !important;
  }

  .agm-gallery__photo:nth-child(4n + 4) {
    aspect-ratio: 4 / 3 !important;
  }
}

@media (max-width: 767px) {
  .agm-gallery {
    height: auto !important;
    min-height: 0 !important;
    padding-block: clamp(36px, 8vw, 50px);
  }

  .agm-gallery__layout {
    display: block !important;
  }

  .agm-gallery__rail {
    position: static !important;
    margin-bottom: 30px;
  }

  .agm-gallery__rail-inner {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .agm-gallery__tabs {
    display: flex !important;
    overflow-x: auto !important;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
  }

  .agm-gallery__tab,
  .agm-gallery__tab[aria-selected="true"] {
    width: max-content !important;
    min-width: max-content !important;
    min-height: 58px;
    flex: 0 0 auto;
    grid-template-columns: 18px max-content;
    gap: 8px;
    padding: 10px 14px;
    scroll-snap-align: start;
  }

  .agm-gallery__tab-preview,
  .agm-gallery__tab[aria-selected="true"] .agm-gallery__tab-preview,
  .agm-gallery__tab-preview img {
    display: none !important;
  }

  .agm-gallery__tab-name {
    overflow: visible;
    font-size: 1.08rem;
    text-overflow: clip;
  }

  .agm-gallery__album-title {
    font-size: clamp(2.2rem, 9vw, 3rem);
  }

  .agm-gallery__grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    row-gap: clamp(12px, 3vw, 18px) !important;
    column-gap: 0 !important;
  }

  .agm-gallery__photo:nth-child(n) {
    display: block !important;
    position: relative !important;
    width: 100%;
    height: clamp(256px, 76vw, 480px) !important;
    min-height: clamp(256px, 76vw, 480px) !important;
    margin: 0 !important;
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    aspect-ratio: auto !important;
  }

  .agm-gallery__photo:nth-child(3n + 2) {
    height: clamp(192px, 55vw, 330px) !important;
    min-height: clamp(192px, 55vw, 330px) !important;
  }

  .agm-gallery__dialog {
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: max(10px, env(safe-area-inset-right));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    padding-left: max(10px, env(safe-area-inset-left));
  }

  .agm-gallery__dialog-shell {
    grid-template-rows: 54px minmax(0, 1fr);
  }

  .agm-gallery__dialog-stage {
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    gap: 0;
    overflow: hidden;
  }

  .agm-gallery__dialog-figure {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    grid-column: 1 !important;
    grid-row: 1 !important;
    place-items: center;
    overflow: hidden;
  }

  .agm-gallery__dialog-arrow {
    position: absolute !important;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
  }

  .agm-gallery__dialog-arrow--previous {
    left: 0;
  }

  .agm-gallery__dialog-arrow--next {
    right: 0;
  }
}

@media (max-height: 560px) {
  .agm-gallery__dialog {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .agm-gallery__dialog-shell {
    grid-template-rows: 46px minmax(0, 1fr);
  }

  .agm-gallery__dialog-topbar {
    min-height: 46px;
  }

  .agm-gallery__dialog-close,
  .agm-gallery__dialog-arrow {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .agm-gallery__dialog-status {
    font-size: 0.62rem;
    letter-spacing: 0.11em;
  }
}

/* Elementor containers occasionally retain a fixed mobile height from a page template. */
@media (max-width: 980px) {
  .agm-gallery-host,
  .agm-gallery-widget-host,
  .agm-gallery-widget-host > .elementor-widget-container {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .agm-gallery-host,
  .agm-gallery-widget-host {
    align-self: stretch;
    flex: 0 0 auto !important;
  }

  .agm-gallery-host {
    min-block-size: var(--agm-gallery-host-min-block-size, 0px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agm-gallery *,
  .agm-gallery *::before,
  .agm-gallery *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
