/* =========================================================
   THE GROOT OOTY — Auto-Scrolling Property Gallery & Lightbox
   ========================================================= */

/* --- Section Container --- */
.property-marquee-section {
  position: relative;
  width: 100%;
  background-color: var(--bg-primary, #FFFFFF);
  padding: clamp(2rem, 3.5vw, 3rem) 0 clamp(1.75rem, 3vw, 2.5rem);
  overflow: hidden;
  border-top: 1px solid rgba(17, 27, 18, 0.06);
  border-bottom: 1px solid rgba(17, 27, 18, 0.06);
}

/* Outer wrapper with edge fade masks on desktop */
.marquee-outer {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 0.5rem 0;
  -webkit-mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 3%,
    rgba(0, 0, 0, 1) 97%,
    rgba(0, 0, 0, 0) 100%
  );
  mask-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 3%,
    rgba(0, 0, 0, 1) 97%,
    rgba(0, 0, 0, 0) 100%
  );
}

@media (max-width: 640px) {
  .marquee-outer {
    -webkit-mask-image: linear-gradient(
      to right,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 1) 1.5%,
      rgba(0, 0, 0, 1) 98.5%,
      rgba(0, 0, 0, 0) 100%
    );
    mask-image: linear-gradient(
      to right,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 1) 1.5%,
      rgba(0, 0, 0, 1) 98.5%,
      rgba(0, 0, 0, 0) 100%
    );
  }
}

/* Inner flex container holding two continuous tracks */
.marquee-inner {
  display: flex;
  width: max-content;
  gap: var(--marquee-gap, 1.25rem);
  will-change: transform;
}

/* Individual track of 14 cards */
.marquee-group {
  display: flex;
  align-items: center;
  gap: var(--marquee-gap, 1.25rem);
  flex-shrink: 0;
  min-width: max-content;
  animation: marqueeScroll 110s linear infinite;
  will-change: transform;
}

/* Pause on hover (Desktop) and on focus/interaction */
.marquee-outer:hover .marquee-group,
.marquee-outer:focus-within .marquee-group,
.marquee-group.is-paused {
  animation-play-state: paused !important;
}

/* Seamless right-to-left infinite loop */
@keyframes marqueeScroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(calc(-100% - var(--marquee-gap, 1.25rem)), 0, 0);
  }
}

/* Image Card Styles */
.marquee-card {
  position: relative;
  display: block;
  flex-shrink: 0;
  width: clamp(260px, 22vw, 360px);
  aspect-ratio: 16 / 10;
  border-radius: 16px;
  overflow: hidden;
  background-color: #1a221b;
  border: 1px solid rgba(17, 27, 18, 0.08);
  box-shadow: 0 8px 24px -4px rgba(17, 27, 18, 0.12), 0 2px 6px -1px rgba(17, 27, 18, 0.06);
  padding: 0;
  cursor: pointer;
  text-align: left;
  outline: none;
  touch-action: pan-y;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.35s ease;
}

.marquee-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 16px 36px -6px rgba(17, 27, 18, 0.22), 0 4px 12px -2px rgba(17, 27, 18, 0.10);
  border-color: rgba(159, 207, 73, 0.5);
  z-index: 2;
}

.marquee-card:focus-visible {
  outline: 3px solid #9FCF49;
  outline-offset: 3px;
}

/* Card Image */
.marquee-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  transform: scale(1.01);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.marquee-card:hover .marquee-card-img {
  transform: scale(1.06);
}

/* Card Subtle Overlay & Caption */
.marquee-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 18, 12, 0.85) 0%,
    rgba(10, 18, 12, 0.45) 45%,
    transparent 75%
  );
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  opacity: 0.95;
  transition: opacity 0.3s ease;
}

.marquee-card:hover .marquee-card-overlay {
  opacity: 1;
}

.marquee-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: calc(100% - 38px);
}

.marquee-card-title {
  color: #FFFFFF;
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: clamp(0.85rem, 1.1vw, 0.95rem);
  font-weight: 600;
  line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marquee-card-subtitle {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marquee-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #FFFFFF;
  flex-shrink: 0;
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}

.marquee-card:hover .marquee-card-badge {
  background: #9FCF49;
  color: #111111;
  border-color: #9FCF49;
  transform: scale(1.08);
}

.marquee-card-badge svg {
  width: 15px;
  height: 15px;
}

/* =========================================================
   FULLSCREEN LIGHTBOX MODAL
   ========================================================= */

.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Dark subtle backdrop with blur */
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(10, 15, 12, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
}

/* Lightbox Content Container */
.lightbox-container {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
  pointer-events: none;
}

.lightbox-container > * {
  pointer-events: auto;
}

/* Top Bar: Counter & Close Button */
.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  z-index: 10;
  padding-bottom: 0.5rem;
}

.lightbox-counter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.lightbox-counter-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #9FCF49;
}

/* Close & Nav Buttons */
.lightbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  transition: all 0.22s ease;
}

.lightbox-btn:hover {
  background: #9FCF49;
  border-color: #9FCF49;
  color: #111111;
  transform: scale(1.08);
}

.lightbox-btn:focus-visible {
  outline: 3px solid #9FCF49;
  outline-offset: 3px;
}

.lightbox-close-btn {
  width: 44px;
  height: 44px;
}

/* Stage Area (Image + Desktop Arrows) */
.lightbox-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 0.5rem 0;
}

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  z-index: 10;
}

.lightbox-prev-btn {
  left: 0.5rem;
}

.lightbox-next-btn {
  right: 0.5rem;
}

.lightbox-nav-btn:hover {
  transform: translateY(-50%) scale(1.08);
}

/* Figure & Image Wrapper */
.lightbox-figure {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 100%;
  margin: 0;
}

.lightbox-img-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.12);
  background: #111812;
}

.lightbox-img {
  display: block;
  max-width: min(88vw, 1100px);
  max-height: min(72vh, 800px);
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.lightbox-img.is-transitioning {
  opacity: 0.4;
  transform: scale(0.98);
}

/* Bottom Bar: Captions & Mobile Nav */
.lightbox-bottombar {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  z-index: 10;
}

.lightbox-caption-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-width: 680px;
}

.lightbox-caption-title {
  color: #FFFFFF;
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
}

.lightbox-caption-desc {
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(0.8rem, 1.1vw, 0.88rem);
  margin: 0;
}

/* Mobile Quick Controls Bar (Visible on mobile/tablet) */
.lightbox-mobile-controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
}

.lightbox-mobile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lightbox-mobile-btn:active {
  background: #9FCF49;
  color: #111111;
  border-color: #9FCF49;
  transform: scale(0.96);
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .lightbox-container {
    padding: 1rem 0.85rem;
  }
  .lightbox-nav-btn {
    display: none; /* Rely on mobile bottom bar and swipe on touch screens */
  }
  .lightbox-mobile-controls {
    display: flex;
  }
  .lightbox-img {
    max-width: 94vw;
    max-height: 62vh;
  }
  .lightbox-close-btn {
    width: 40px;
    height: 40px;
  }
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .marquee-group {
    animation: none !important;
  }
  .marquee-outer {
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .marquee-card {
    transition: none !important;
  }
  .marquee-card-img {
    transition: none !important;
  }
  .lightbox-modal {
    transition: none !important;
  }
  .lightbox-img {
    transition: none !important;
  }
}
