/* ============================================================================
   hotel-gallery.css — Luxury Hotel Gallery, Lightbox & Card Styles
   Mauritius Resort Finder
   ============================================================================ */

/* ═══════════════════════════════════════════════════════════════════════════
   1. LUXURY GALLERY  (.hg)
   Airbnb-style: hero 60% left · 2×2 thumbnail grid 40% right (desktop)
   Swipeable horizontal carousel on mobile
   ═══════════════════════════════════════════════════════════════════════════ */

/*
  Desktop layout  (outer: 3fr 2fr  ≈ 60 / 40)
  ┌─────────────────────────┬────────────┬────────────┐  ↕ 260px
  │                         │  photo 2   │  photo 3   │
  │       hero (photo 1)    ├────────────┼────────────┤  ↕ 260px
  │                         │  photo 4   │  photo 5⊞  │
  └─────────────────────────┴────────────┴────────────┘
           3fr                  1fr          1fr
         ≈ 60%                ≈ 20%        ≈ 20%
*/

/* ── Container ────────────────────────────────────────────────────────────── */
.hg {
  display: grid;
  grid-template-columns: 3fr 2fr;
  grid-template-rows: 260px 260px;
  gap: 6px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
}

/* ── Hero button ──────────────────────────────────────────────────────────── */
.hg__hero {
  grid-column: 1;
  grid-row: 1 / 3;
  -webkit-appearance: none;
  appearance: none;
  background: #0c1a28;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: block;
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  border-radius: 14px 0 0 14px;
  -webkit-tap-highlight-color: transparent;
}
.hg[data-count="1"] {
  grid-template-columns: 1fr;
  grid-template-rows: 480px;
  padding: 0;           /* no gutters — image fills the full container width */
}
.hg[data-count="1"] .hg__hero {
  grid-column: 1 / -1;
  grid-row: 1;
  border-radius: 14px;
}

/* ── Right-side grid wrapper ─────────────────────────────────────────────── */
.hg__grid {
  grid-column: 2;
  grid-row: 1 / 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 6px;
}

/* Single-column when ≤ 3 thumbnails */
.hg__grid[data-cells="1"],
.hg__grid[data-cells="2"],
.hg__grid[data-cells="3"] {
  grid-template-columns: 1fr;
}

/* ── Thumbnail cells ─────────────────────────────────────────────────────── */
.hg__cell {
  -webkit-appearance: none;
  appearance: none;
  background: #0c1a28;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: block;
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Corner radii: shape the gallery into one unified card */
.hg__grid[data-cells="4"] > .hg__cell:nth-child(2) { border-radius: 0 14px 0 0; }
.hg__grid[data-cells="4"] > .hg__cell:nth-child(4) { border-radius: 0 0 14px 0; }
.hg__grid[data-cells="1"] > .hg__cell             { border-radius: 0 14px 14px 0; }
.hg__grid[data-cells="2"] > .hg__cell:first-child,
.hg__grid[data-cells="3"] > .hg__cell:first-child  { border-radius: 0 14px 0 0; }
.hg__grid[data-cells="2"] > .hg__cell:last-child,
.hg__grid[data-cells="3"] > .hg__cell:last-child   { border-radius: 0 0 14px 0; }

/* ── Image figure — fills container via absolute positioning ─────────────── */
/*   position:absolute;inset:0 is reliable regardless of how the parent's
     height is determined (grid track, flex, aspect-ratio, etc.)             */
.hg__hero .hg-img,
.hg__cell .hg-img,
.hg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;    /* reset browser <figure> margin: 1em 40px */
  padding: 0;
  overflow: hidden;
  background: #0c1a28;
  display: block;
}

/* ── The actual <img> ────────────────────────────────────────────────────── */
.hg-img__pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

.hg__hero:hover .hg-img__pic { transform: scale(1.04); }
.hg__cell:hover .hg-img__pic { transform: scale(1.08); }

.hg__hero:focus-visible,
.hg__cell:focus-visible {
  outline: 2px solid #c9a84c;
  outline-offset: 2px;
  z-index: 2;
}

/* ── Hero caption (gradient overlay) ─────────────────────────────────────── */
.hg-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.6rem 1rem;
  font-size: 0.76rem;
  font-style: italic;
  color: rgba(245, 230, 200, 0.88);
  background: linear-gradient(to top, rgba(0,0,0,0.62), transparent);
  pointer-events: none;
  z-index: 1;
}

/* ── "Show all photos" overlay on last thumbnail ─────────────────────────── */
.hg-more {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.52);
  color: rgba(255, 255, 255, 0.95);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
  transition: background 0.22s ease;
  z-index: 1;
}
.hg__cell--last:hover .hg-more { background: rgba(0,0,0,0.28); }
.hg-more svg { width: 18px; height: 18px; opacity: 0.9; flex-shrink: 0; }

/* ── "Show all photos" floating button (Airbnb-style, desktop) ───────────── */
.hg__show-all {
  position: absolute;
  bottom: 16px;
  right: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 10px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: #18181b;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  z-index: 10;
  white-space: nowrap;
}
.hg__show-all:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}
.hg__show-all svg { width: 15px; height: 15px; }

/* ── Mobile progress dots (added by JS) ──────────────────────────────────── */
.hg-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 2px;
}
.hg-dots__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(150, 130, 100, 0.4);
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.hg-dots__dot.is-active { background: #c9a84c; transform: scale(1.3); }

/* ── Mobile carousel ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .hg {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 10px;
    padding: 0 20px;
    grid-template-columns: unset;
    grid-template-rows: unset;
    max-width: 100%;
  }
  .hg::-webkit-scrollbar { display: none; }

  .hg__hero {
    flex: 0 0 84vw;
    height: 280px;
    scroll-snap-align: center;
    border-radius: 16px;
    grid-column: unset;
    grid-row: unset;
  }

  /* Flatten the grid wrapper: cells become direct flex siblings of hero */
  .hg__grid {
    display: contents;
    grid-column: unset;
    grid-row: unset;
  }

  .hg__cell {
    flex: 0 0 84vw;
    height: 280px;
    scroll-snap-align: center;
    border-radius: 16px;
    /* Override desktop corner radii */
    border-top-right-radius: 16px;
    border-bottom-right-radius: 16px;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
  }

  .hg__show-all { display: none; }
  .hg__cell--last .hg-more { display: none; }
  .hg-caption { font-size: 0.7rem; }
}

@media (max-width: 480px) {
  .hg { padding: 0 14px; gap: 8px; }
  .hg__hero, .hg__cell { flex: 0 0 88vw; height: 240px; }
}

@media (prefers-reduced-motion: reduce) {
  .hg-img__pic, .hg__show-all { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   2. HOTEL CARD THUMBNAIL  (persona / ranking pages)
   ═══════════════════════════════════════════════════════════════════════════ */

.hotel-img {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #0c1a28;
  display: block;
  width: 100%;
}
.hotel-img__real {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}
.hotel-img--hero    { aspect-ratio: 3 / 2; }
.hotel-img--gallery { aspect-ratio: 4 / 3; }
.hotel-img--thumb   { aspect-ratio: 4 / 3; }

.hotel-card__thumb {
  margin: -28px -32px 20px;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  height: 200px;
}
.hotel-card__thumb .hotel-img,
.hotel-card__thumb figure {
  border-radius: 0;
  height: 100%;
  aspect-ratio: unset;
}
.hotel-card__thumb .hotel-img__real { border-radius: 0; }

@media (max-width: 640px) {
  .hotel-card__thumb { margin: -20px -16px 16px; height: 160px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   3. CSS GRADIENT PLACEHOLDER  (hotels with no real photos)
   ═══════════════════════════════════════════════════════════════════════════ */

.hotel-img--placeholder { cursor: default; }

.hotel-img__grad {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      155deg,
      hsl(var(--hi-hue, 210), 42%, 11%) 0%,
      hsl(var(--hi-hue, 210), 58%, 17%) 45%,
      hsl(var(--hi-hue, 210), 35%,  9%) 100%
    );
}
.hotel-img__grad::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 28px 28px;
}

.hotel-img__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1.25rem 1rem;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 55%);
  text-align: center;
}
.hotel-img__region {
  display: block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.85);
  margin-bottom: .2rem;
}
.hotel-img__name {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(245, 230, 200, 0.95);
  line-height: 1.2;
  margin-bottom: .15rem;
}
.hotel-img--thumb   .hotel-img__name { font-size: .82rem; }
.hotel-img--gallery .hotel-img__name { font-size: .88rem; }
.hotel-img__note {
  display: block;
  font-size: .62rem;
  color: rgba(200, 190, 175, 0.6);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   4. LIGHTBOX  (.hg-lb)
   Full-screen gallery modal with keyboard + touch support (wired by JS)
   ═══════════════════════════════════════════════════════════════════════════ */

.hg-lb {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 18, 0.97);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}
.hg-lb.is-open { opacity: 1; visibility: visible; }

.hg-lb__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(92vw, 980px);
  max-height: 92vh;
}

.hg-lb__frame {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 4 / 3;
  background: #08111f;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
}
.hg-lb__frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 14px;
}

.hg-lb__caption {
  font-size: .84rem;
  color: rgba(245, 230, 200, 0.72);
  text-align: center;
  font-style: italic;
  min-height: 1.3em;
  margin: 0;
}
.hg-lb__counter {
  font-size: .7rem;
  color: rgba(200, 190, 175, 0.42);
  letter-spacing: .08em;
  margin: 0;
}

.hg-lb__close {
  position: absolute;
  top: -52px;
  right: 0;
  background: rgba(201,168,76,.12);
  border: 1px solid rgba(201,168,76,.28);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245,230,200,.85);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}
.hg-lb__close:hover { background: rgba(201,168,76,.3); color: #f5e6c8; }

.hg-lb__prev,
.hg-lb__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(201,168,76,.12);
  border: 1px solid rgba(201,168,76,.24);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245,230,200,.88);
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  z-index: 10;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}
.hg-lb__prev { left: -62px; }
.hg-lb__next { right: -62px; }
.hg-lb__prev:hover,
.hg-lb__next:hover { background: rgba(201,168,76,.3); transform: translateY(-50%) scale(1.06); }

@media (max-width: 820px) {
  .hg-lb__prev { left: 8px; }
  .hg-lb__next { right: 8px; }
}

.hg-lb__thumbs {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
}
.hg-lb__thumb {
  width: 60px;
  height: 46px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  padding: 0;
  margin: 0;
  background: #0c1a28;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.18s, transform 0.18s;
  flex-shrink: 0;
}
.hg-lb__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hg-lb__thumb.is-active { border-color: #c9a84c; transform: scale(1.1); }

@media (prefers-reduced-motion: reduce) {
  .hg-lb, .hg-img__pic, .hg__show-all, .hg-lb__prev, .hg-lb__next, .hg-lb__thumb {
    transition: none;
  }
}
