/* ══════════════════════════════════════════════════════════════
   PHOTO GALLERY — featured grid + full-screen viewer
   Loaded only on pages that have a photo gallery (not sitewide).
   Uses the site's own colors, fonts and square corners.
   ══════════════════════════════════════════════════════════════ */

/* ── FEATURED GRID (on the page) ── */
.photo-gallery {
  background: var(--ivory);
  width: 100%;
  padding: var(--section-pad-y-sm) 0;
}
.pg-inner {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.pg-wrap { position: relative; }

/* The box keeps its shape before the photos arrive, so nothing jumps. */
.pg-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 5 / 2;
  min-height: 240px;
  background: transparent;
}
.pg-item {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: var(--beige);
  cursor: pointer;
  min-width: 0;
  min-height: 0;
}
.pg-item--0 { grid-row: 1 / span 2; }
.pg-item picture,
.pg-item img { display: block; width: 100%; height: 100%; }
.pg-item img { object-fit: cover; transition: transform 0.5s ease; }
.pg-item:hover img { transform: scale(1.025); }
.pg-item:focus-visible,
.pg-viewall:focus-visible { outline: 2px solid var(--charcoal); outline-offset: 3px; }

.pg-viewall {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  padding: 14px 20px;
  background: var(--ivory);
  color: var(--charcoal);
  border: 0;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 20, 18, 0.18);
  transition: background 0.2s ease;
}
.pg-viewall:hover { background: #ece8e1; }

/* Phones: one large photo with the button on it. */
@media (max-width: 699px) {
  .pg-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    aspect-ratio: 4 / 3;
  }
  .pg-item--0 { grid-row: auto; }
  .pg-item:not(.pg-item--0) { display: none; }
  .pg-viewall { right: 10px; bottom: 10px; padding: 14px 18px; }
}

/* ── CAROUSEL (sideways row — 3 across on desktop, 1.2 on phones) ── */
.photo-gallery[data-layout="carousel"] { padding: 0; background: none; }
.pg-carousel { position: relative; }
.pg-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pg-track::-webkit-scrollbar { display: none; }
.pg-track:focus-visible { outline: 2px solid var(--charcoal); outline-offset: 4px; }
.pg-slide {
  flex: 0 0 calc((100% - 32px) / 3);
  scroll-snap-align: start;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  color: var(--charcoal);
  min-width: 0;
}
.pg-slide-photo { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--beige); }
.pg-slide-photo picture, .pg-slide-photo img { display: block; width: 100%; height: 100%; }
.pg-slide-photo img { object-fit: cover; transition: transform 0.5s ease; }
.pg-slide:hover .pg-slide-photo img { transform: scale(1.025); }
.pg-slide:focus-visible { outline: 2px solid var(--charcoal); outline-offset: 4px; }
.pg-slide-cap {
  display: block;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.5;
}
.pg-nav {
  position: absolute;
  top: calc((100% - 36px) / 2 - 24px);
  z-index: 2;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ivory);
  color: var(--charcoal);
  box-shadow: 0 6px 18px rgba(15, 20, 18, 0.22);
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.pg-nav:hover { background: #ece8e1; }
.pg-nav:focus-visible { outline: 2px solid var(--charcoal); outline-offset: 3px; }
.pg-nav[disabled] { opacity: 0; pointer-events: none; }
.pg-nav--prev { left: -18px; }
.pg-nav--next { right: -18px; }
.pg-actions { margin-top: 28px; text-align: center; }
.pg-viewall--solid {
  position: static;
  background: var(--charcoal);
  color: var(--ivory);
  box-shadow: none;
}
.pg-viewall--solid:hover { background: #1f1f1f; }

@media (max-width: 699px) {
  /* 1.2 photos visible: the next one peeks in from the right edge of the screen */
  .pg-track { margin-right: calc(var(--gutter) * -1); padding-right: var(--gutter); gap: 12px; }
  .pg-slide { flex: 0 0 83%; }
  .pg-nav { display: none; }
  .pg-actions { margin-top: 22px; }
  .pg-viewall--solid { display: block; width: 100%; text-align: center; padding: 16px 18px; }
}

/* Section that holds a carousel gallery (heading above, carousel below) */
.resort-gallery-section { background: var(--ivory); padding: var(--section-pad-y) 0; }
.resort-gallery-section .section-header { margin-bottom: 26px; }
.resort-gallery-section .section-header p {
  margin-top: 14px;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--charcoal);
}

.resort-credit {
  width: 100%;
  max-width: var(--content-max);
  margin: 18px auto 0;
  padding-inline: var(--gutter);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(47, 47, 47, 0.78);
  text-align: center;
}

/* ── FULL-SCREEN VIEWER (PhotoSwipe, restyled to match the site) ── */
.pswp.pg-viewer {
  --pswp-bg: #232323;
  --pswp-placeholder-bg: #2f2f2f;
  --pswp-icon-color: #f6f4ef;
  --pswp-icon-color-secondary: rgba(15, 20, 18, 0.6);
  font-family: 'Montserrat', sans-serif;
  color: var(--ivory);
}

/* Counter — "12 of 62" — always visible, top left */
.pg-viewer .pswp__counter {
  font-size: 14px;
  letter-spacing: 0.1em;
  font-weight: 500;
  opacity: 1;
  margin-inline-start: 20px;
  height: 60px;
  line-height: 60px;
  align-self: center;
  margin-right: auto;
  color: var(--ivory);
}
.pg-viewer .pswp--one-slide .pswp__counter { display: block; }

/* Big, obvious close button */
.pg-viewer .pswp__button--close {
  width: 52px;
  height: 52px;
  margin: 4px 10px 0 0;
  background: rgba(246, 244, 239, 0.14);
  border-radius: 50%;
}
.pg-viewer .pswp__button--close:hover { background: rgba(246, 244, 239, 0.26); }
.pg-viewer .pswp__button--close .pswp__icn { top: 10px; left: 10px; }

/* Touch screens: swipe and pinch instead of zoom/arrow buttons */
@media (pointer: coarse) {
  .pg-viewer .pswp__button--zoom,
  .pg-viewer .pswp__button--arrow { display: none; }
}

/* Category tabs — one row, swipes sideways with a thumb */
.pg-viewer .pg-tabs {
  position: absolute;
  top: 60px;
  left: 0;
  right: 0;
  z-index: 11;
  display: flex;
  gap: 4px;
  padding: 0 14px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(246, 244, 239, 0.14);
}
.pg-viewer .pg-tabs::-webkit-scrollbar { display: none; }
.pg-viewer .pg-tab {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 16px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: rgba(246, 244, 239, 0.72);
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.pg-viewer .pg-tab:hover { color: var(--ivory); }
.pg-viewer .pg-tab[aria-selected="true"] {
  color: var(--ivory);
  border-bottom-color: var(--sage);
}
.pg-viewer .pg-tab:focus-visible { outline: 2px solid var(--ivory); outline-offset: -4px; }

/* "Shared resort amenity" tag — shows on community photos so it's never mistaken for the cabin */
.pg-viewer .pg-shared {
  display: inline-block;
  margin-right: 12px;
  padding: 4px 9px;
  border: 1px solid var(--sage);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.3;
  vertical-align: 1px;
  color: var(--ivory);
}

/* Caption + Check Availability, along the bottom */
.pg-viewer .pg-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(35, 35, 35, 0.92), rgba(35, 35, 35, 0));
}
.pg-viewer .pg-caption {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ivory);
}
.pg-viewer .pg-cta {
  flex: 0 0 auto;
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 15px 28px;
  background: var(--ivory);
  color: var(--charcoal);
  transition: background 0.2s ease;
}
.pg-viewer .pg-cta:hover { background: #ece8e1; }

@media (max-width: 699px) {
  .pg-viewer .pg-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    text-align: center;
  }
  .pg-viewer .pg-shared { display: block; width: fit-content; margin: 0 auto 6px; }
  .pg-viewer .pg-cta { display: block; text-align: center; padding: 15px 20px; }
}

/* Page behind stays put while the viewer is open */
html.pg-lock body {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}
