/*
 * X11 Dubai South - Sections CSS
 * Sections flow one after another
 */

:root {
  --primary-color: #c28a6b;
  --secondary-color: #000000;
  --text-dark: #FFFFFF;
  --text-light: #CCCCCC;
  --bg-light: #1a1a1a;
}

/* ==================== SECTIONS FLOW: each section below the previous ==================== */
/* Override Spark template: sections stack vertically, no full-height on content sections */
body,
html {
  overflow-x: hidden;
  overflow-y: auto !important;
  height: auto !important;
  min-height: 100%;
}

/* Only #content (hero) keeps full viewport; all other sections size to content */
section.amenities-section,
section.bamx-section,
section.dubai-south-section,
section.invest-section,
section.info-section#projects,
section.x11-gallery-section,
section.revolutionary-cta-section,
section.location-map-section {
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  position: relative !important;
  display: block !important;
  overflow: visible !important;
}

/* Wave dividers: block flow */
.wave-divider {
  width: 100%;
  height: auto;
  min-height: 0;
  position: relative;
  display: block;
}

/* ==================== X11 GALLERY SECTION (Professional Bento) ==================== */
/* Override layout.css #gallery (fixed 700px height) so content is not cut on mobile */
section.x11-gallery-section#gallery {
  position: relative !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  top: auto !important;
  left: auto !important;
  overflow: visible !important;
}

.x11-gallery-section {
  background: #080808;
  padding: clamp(48px, 8vw, 61px) clamp(16px, 4vw, 24px) clamp(64px, 10vw, 64px);
  position: relative;
  overflow: visible;
  scroll-margin-top: 80px;
}

.x11-gallery-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(194, 138, 107, 0.35), transparent);
  opacity: 0.8;
}

.x11-gallery-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(8px, 2vw, 16px);
  box-sizing: border-box;
  overflow: visible;
}

.x11-gallery-header {
  text-align: center;
  margin-bottom: clamp(32px, 5vw, 56px);
}

.x11-gallery-badge {
  display: inline-block;
  font-size: clamp(0.65rem, 1.5vw, 0.7rem);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 12px;
  font-weight: 600;
}

.x11-gallery-title {
  font-size: clamp(1.75rem, 4.5vw + 1rem, 3.25rem);
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.x11-gallery-subtitle {
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
  padding: 0 12px;
}

/* Filter pills - single row, scrollable */
.x11-gallery-filters {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 1.5vw, 12px);
  margin-bottom: clamp(32px, 5vw, 48px);
  padding: 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.x11-gallery-filters::-webkit-scrollbar {
  display: none;
}

.x11-gallery-filter {
  flex-shrink: 0;
  padding: clamp(6px, 1vw, 8px) clamp(12px, 2vw, 18px);
  min-height: 36px;
  font-size: clamp(0.8rem, 1.2vw, 0.9rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), background 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), border-color 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
  -webkit-tap-highlight-color: transparent;
}

.x11-gallery-filters .x11-gallery-filter.off {
  transform: none !important;
  opacity: 1 !important;
  z-index: 1 !important;
}

.x11-gallery-filter:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(194, 138, 107, 0.4);
}

.x11-gallery-filter.active {
  color: #000;
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.x11-gallery-filter:active {
  transform: scale(0.97);
}

/* Bento grid - fluid, responsive */
.x11-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(200px, 220px);
  gap: clamp(12px, 1.5vw, 16px);
  margin-bottom: clamp(40px, 6vw, 56px);
  min-height: 360px;
  transition: opacity 0.25s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.x11-gallery-item {
  min-width: 0;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.x11-gallery-item.hidden {
  display: none;
}

/* Featured item: 2 cols × 2 rows */
.x11-gallery-item.gallery-item--featured {
  grid-column: span 2;
  grid-row: span 2;
}

.x11-gallery-item.gallery-item--featured .x11-gallery-card {
  aspect-ratio: auto;
  height: 100%;
  min-height: 100%;
}

.x11-gallery-item.gallery-item--featured .x11-gallery-card img {
  min-height: 100%;
  object-fit: cover;
}

/* Cards - smooth hover, touch-friendly */
.x11-gallery-card {
  position: relative;
  border-radius: clamp(12px, 2vw, 16px);
  overflow: hidden;
  height: 100%;
  min-height: 180px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  aspect-ratio: 4/3;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: border-color 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

@media (hover: hover) {
  .x11-gallery-card:hover {
    border-color: rgba(194, 138, 107, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(-3px);
  }
  .x11-gallery-card:hover::before {
    opacity: 0.9;
  }
  .x11-gallery-card:hover img {
    transform: scale(1.05);
  }
  .x11-gallery-card:hover .x11-gallery-zoom-icon {
    opacity: 1;
    transform: scale(1);
    color: var(--primary-color);
  }
}

.x11-gallery-card:active {
  transform: scale(0.99);
}

.x11-gallery-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, 0.85) 100%);
  z-index: 1;
  opacity: 0.85;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.x11-gallery-card img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  background: #1a1a1a;
}

/* Overlay: label + zoom icon */
.x11-gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: clamp(16px, 2.5vw, 24px) clamp(14px, 2vw, 20px);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.x11-gallery-overlay span {
  font-size: clamp(0.75rem, 1.2vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #fff;
  text-transform: uppercase;
}

.x11-gallery-zoom-icon {
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  color: rgba(255, 255, 255, 0.8);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease;
}

@media (hover: none) {
  .x11-gallery-zoom-icon {
    opacity: 0.7;
    color: var(--primary-color);
  }
}

.x11-gallery-cta {
  text-align: center;
  padding: 0 12px;
}

.x11-gallery-cta .cta-button-primary {
  display: inline-block;
}

/* ==================== Gallery Lightbox ==================== */
.x11-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(48px, 10vw, 60px) clamp(16px, 4vw, 20px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s ease;
}

.x11-gallery-lightbox.active {
  opacity: 1;
  visibility: visible;
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.x11-gallery-lightbox-close {
  position: absolute;
  top: clamp(12px, 3vw, 24px);
  right: clamp(12px, 3vw, 24px);
  width: clamp(44px, 10vw, 48px);
  height: clamp(44px, 10vw, 48px);
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  transition: background 0.25s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease, transform 0.2s ease;
  z-index: 10002;
  -webkit-tap-highlight-color: transparent;
}

.x11-gallery-lightbox-close:hover {
  background: var(--primary-color);
  color: #000;
  transform: scale(1.05);
}

.x11-gallery-lightbox-inner {
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.x11-gallery-lightbox-inner img {
  max-width: 100%;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: clamp(6px, 1.5vw, 8px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .x11-gallery-section,
  .x11-gallery-item,
  .x11-gallery-card,
  .x11-gallery-card img,
  .x11-gallery-filter,
  .x11-gallery-zoom-icon,
  .x11-gallery-lightbox,
  .x11-gallery-lightbox-close {
    transition-duration: 0.01ms !important;
  }
  .x11-gallery-card:hover img {
    transform: none;
  }
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .x11-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: minmax(180px, 200px);
    gap: clamp(10px, 1.5vw, 14px);
  }
  .x11-gallery-item.gallery-item--featured {
    grid-column: span 2;
    grid-row: span 2;
  }
  .x11-gallery-card {
    min-height: 160px;
  }
}

/* Responsive - Mobile landscape / small tablet */
@media (max-width: 768px) {
  .x11-gallery-section {
    padding-left: 12px;
    padding-right: 12px;
  }
  .x11-gallery-container {
    padding: 0 4px;
  }
  .x11-gallery-header {
    margin-bottom: 28px;
  }
  /* Filters in one row with horizontal scroll on mobile */
  .x11-gallery-filters {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 24px;
    padding: 0 4px 8px;
    gap: 8px;
  }
  .x11-gallery-filters::-webkit-scrollbar {
    display: none;
  }
  .x11-gallery-filter {
    flex-shrink: 0;
  }
  .x11-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(160px, 200px);
    gap: 10px;
    margin-bottom: 40px;
    min-height: 0;
  }
  .x11-gallery-item.gallery-item--featured {
    grid-column: span 2;
    grid-row: span 2;
  }
  .x11-gallery-item.gallery-item--featured .x11-gallery-card,
  .x11-gallery-card {
    min-height: 160px;
  }
  .x11-gallery-overlay {
    padding: 14px 12px;
  }
}

/* Responsive - Mobile portrait */
@media (max-width: 480px) {
  .x11-gallery-section {
    padding-left: 10px;
    padding-right: 10px;
  }
  .x11-gallery-container {
    padding: 0 2px;
  }
  .x11-gallery-header {
    margin-bottom: 22px;
  }
  .x11-gallery-title {
    font-size: clamp(1.5rem, 6vw, 1.85rem);
  }
  .x11-gallery-subtitle {
    padding: 0 4px;
    font-size: 0.9rem;
  }
  .x11-gallery-filters {
    margin-bottom: 20px;
    padding: 0 2px 6px;
  }
  .x11-gallery-filter {
    padding: 6px 14px;
    min-height: 36px;
    font-size: 0.85rem;
  }
  .x11-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(160px, 200px);
    gap: 10px;
    min-height: 0;
  }
  .x11-gallery-item.gallery-item--featured {
    grid-column: span 2;
    grid-row: span 2;
  }
  .x11-gallery-item.gallery-item--featured .x11-gallery-card,
  .x11-gallery-card {
    min-height: 160px;
  }
  .x11-gallery-cta {
    padding: 0 8px;
  }
  .x11-gallery-cta .cta-button-primary {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    text-align: center;
  }
}

/* Very small screens - two columns */
@media (max-width: 360px) {
  .x11-gallery-section {
    padding-left: 8px;
    padding-right: 8px;
  }
  .x11-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(140px, 180px);
    gap: 8px;
  }
  .x11-gallery-item.gallery-item--featured .x11-gallery-card,
  .x11-gallery-card {
    min-height: 140px;
  }
}

/* ==================== MAP: Pin marker (Google Maps style) with logo inside ==================== */
.map-marker-pin {
  border: none;
  background: transparent;
}

.location-map-section .pin-wrap {
  position: relative;
  width: 44px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.35));
}

.location-map-section .pin-head {
  width: 44px;
  height: 44px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(145deg, #1a1a1a 0%, #2d2d2d 100%);
  border: 3px solid rgba(194, 138, 107, 0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 2px 8px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  z-index: 1;
}

.location-map-section .pin-head .pin-logo {
  width: 26px;
  height: 26px;
  object-fit: contain;
  transform: rotate(45deg);
  filter: brightness(1.05);
}

.location-map-section .pin-tail {
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 12px solid rgba(194, 138, 107, 0.95);
  margin-top: -3px;
  z-index: 0;
}

.location-map-section .map-popup-above.leaflet-popup {
  margin-bottom: 12px;
}

.location-map-section .map-popup-above .leaflet-popup-content-wrapper {
  background: var(--bg-light, #1a1a1a);
  color: var(--text-dark, #fff);
  border: 1px solid rgba(194, 138, 107, 0.4);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.location-map-section .map-popup-above .leaflet-popup-tip {
  background: var(--bg-light, #1a1a1a);
  border: 1px solid rgba(194, 138, 107, 0.4);
}

.location-map-section .map-popup-content {
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}
