/* ============================================================
   gallery.css — Hotel Malleberg
   Room carousels + photo gallery + lightbox
   Mobile-first. No external dependencies.
   ============================================================ */

/* ── ROOM CAROUSEL ──────────────────────────────────────────── */
.room-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 4px 4px 0 0;
  background: var(--beige-mid);
  user-select: none;
  -webkit-user-select: none;
}

.room-carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.room-carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.room-carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}

/* Placeholder inside carousel */
.room-carousel-slide .ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(90,80,71,0.5);
  font-style: italic;
  font-family: var(--font-body);
}

/* Prev / Next buttons */
.room-carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(247,243,238,0.82);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  transition: background 0.2s, opacity 0.2s;
  opacity: 0;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.room-carousel:hover .room-carousel-btn,
.room-carousel:focus-within .room-carousel-btn { opacity: 1; }
@media (hover: none) {
  /* Always visible on touch */
  .room-carousel-btn { opacity: 0.85; }
}
.room-carousel-btn:hover { background: rgba(247,243,238,1); }
.room-carousel-btn.prev { left: 0.5rem; }
.room-carousel-btn.next { right: 0.5rem; }
.room-carousel-btn:disabled { opacity: 0.25 !important; pointer-events: none; }

/* Dot nav */
.room-carousel-dots {
  position: absolute;
  bottom: 0.6rem;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  z-index: 10;
}
.room-carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(247,243,238,0.45);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.room-carousel-dot.active {
  background: rgba(247,243,238,0.95);
  transform: scale(1.25);
}

/* Photo count badge */
.room-carousel-count {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(28,26,24,0.55);
  color: rgba(247,243,238,0.9);
  font-size: 0.68rem;
  font-family: var(--font-body);
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 2rem;
  z-index: 10;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* ── PHOTO GALLERY ───────────────────────────────────────────── */
.gallery-section {
  padding: var(--sp-xl) 0;
  background: var(--taupe);
}
.gallery-section .section-label {
  color: rgba(247,243,238,0.6);
}
.gallery-section h2 {
  color: var(--off-white);
}
.gallery-section .gallery-intro {
  color: rgba(247,243,238,0.72);
  font-size: 0.9rem;
  font-weight: 300;
  margin-bottom: var(--sp-md);
  max-width: 560px;
}

/* Masonry-style CSS grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 180px;
  gap: clamp(0.4rem, 1.2vw, 0.65rem);
}
@media (min-width: 540px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 200px; }
}
@media (min-width: 860px) {
  .gallery-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 220px; }
}
@media (min-width: 1100px) {
  .gallery-grid { grid-auto-rows: 240px; }
}

.g-item {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  cursor: pointer;
  background: rgba(255,255,255,0.08);
  /* Polaroid-style: white border */
  box-shadow:
    0 0 0 5px rgba(247,243,238,0.85),
    0 4px 16px rgba(0,0,0,0.18);
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s;
}

/* Row span variants */
.g-item.tall  { grid-row: span 2; }
.g-item.wide  { grid-column: span 2; }

.g-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
  pointer-events: none;
}

.g-item:hover {
  transform: scale(1.03) rotate(-0.4deg);
  box-shadow:
    0 0 0 6px rgba(247,243,238,1),
    0 12px 40px rgba(0,0,0,0.3);
  z-index: 2;
}
.g-item:hover img { transform: scale(1.06); }

/* Overlay on hover */
.g-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(30,58,47,0);
  transition: background 0.3s;
}
.g-item:hover::after {
  background: rgba(30,58,47,0.12);
}

/* Zoom icon */
.g-item::before {
  content: '⊕';
  position: absolute;
  bottom: 0.6rem;
  right: 0.75rem;
  z-index: 5;
  font-size: 1.1rem;
  color: rgba(247,243,238,0);
  transition: color 0.25s;
  pointer-events: none;
  line-height: 1;
}
.g-item:hover::before { color: rgba(247,243,238,0.85); }

/* Placeholder divs inside gallery */
.g-item .g-ph {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.35);
  font-size: 0.72rem; font-style: italic;
  font-family: var(--font-body);
}

/* ── LIGHTBOX ────────────────────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15,12,10,0.97);
  align-items: center;
  justify-content: center;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
}
#lightbox.lb-open {
  display: flex;
}

.lb-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: min(92vw, 1100px);
  max-height: 88svh;
}

.lb-img-el {
  max-width: 100%;
  max-height: 86svh;
  object-fit: contain;
  border-radius: 3px;
  display: block;
  box-shadow:
    0 0 0 6px rgba(247,243,238,0.08),
    0 30px 80px rgba(0,0,0,0.7);
  /* Animate in */
  animation: lbFadeIn 0.22s ease;
}
@keyframes lbFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* Placeholder for when img isn't loaded yet */
.lb-ph {
  width: min(75vw, 700px);
  aspect-ratio: 4 / 3;
  background: rgba(237,227,214,0.07);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(247,243,238,0.3);
  font-size: 0.85rem;
  font-family: var(--font-body);
  border: 1px solid rgba(247,243,238,0.08);
}

/* Close */
.lb-close {
  position: fixed;
  top: 1rem; right: 1rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(247,243,238,0.1);
  border: 1px solid rgba(247,243,238,0.15);
  color: rgba(247,243,238,0.9);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  z-index: 1010;
}
.lb-close:hover { background: rgba(247,243,238,0.2); }

/* Prev / Next */
.lb-prev, .lb-next {
  position: fixed;
  top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(247,243,238,0.08);
  border: 1px solid rgba(247,243,238,0.14);
  color: rgba(247,243,238,0.85);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  z-index: 1010;
}
.lb-prev { left: 0.75rem; }
.lb-next { right: 0.75rem; }
.lb-prev:hover, .lb-next:hover { background: rgba(247,243,238,0.16); }
@media (max-width: 480px) {
  .lb-prev { left: 0.35rem; }
  .lb-next { right: 0.35rem; }
  .lb-prev, .lb-next { width: 40px; height: 40px; font-size: 1.2rem; }
}

/* Caption + counter */
.lb-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 1rem 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 1010;
  background: linear-gradient(to top, rgba(15,12,10,0.75) 0%, transparent 100%);
}
.lb-caption-text {
  font-size: 0.8rem;
  color: rgba(247,243,238,0.55);
  font-style: italic;
  font-family: var(--font-body);
  flex: 1;
}
.lb-counter-text {
  font-size: 0.75rem;
  color: rgba(247,243,238,0.35);
  font-family: var(--font-body);
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Dot strip in lightbox */
.lb-dots {
  position: fixed;
  bottom: 3.5rem; left: 50%; transform: translateX(-50%);
  display: flex; gap: 0.4rem; z-index: 1010;
}
.lb-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(247,243,238,0.2);
  cursor: pointer; border: none; padding: 0;
  transition: background 0.2s, transform 0.2s;
}
.lb-dot.active {
  background: rgba(247,243,238,0.85);
  transform: scale(1.4);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .room-carousel-track,
  .room-carousel-btn,
  .g-item,
  .g-item img,
  .lb-img-el { transition: none; animation: none; }
}
