/* ==========================================================================
   Mattress Palace Trading Gallery Page Styles — White + Green + Blue Theme
   ========================================================================== */

.gallery-hero {
  padding: 8rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 83vh;
  background: var(--bg);
  isolation: isolate;
}

.gallery-hero-inner {
  max-width: 800px;
  margin: 0 auto;
}

.gallery-hero-meta {
  margin-top: 1.8rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.8rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.gallery-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 6px !important;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
}

.gallery-hero-meta i {
  color: var(--green-primary);
  width: 1rem;
  height: 1rem;
}

/* Category Filter Bar */
.filter-bar-container {
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.gal-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 6px !important;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s ease;
}

.gal-cat-btn:hover {
  color: var(--fg);
  border-color: var(--blue-accent);
  background: var(--blue-light);
}

.gal-cat-btn.active {
  color: #FFFFFF;
  background: var(--green-primary);
  border-color: var(--green-primary);
  box-shadow: var(--shadow-sm);
}

.gal-cat-btn .count-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px !important;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

/* Spotlight Card */
.spotlight-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px !important;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.spotlight-card:hover {
  border-color: var(--blue-accent);
  box-shadow: var(--shadow-hover);
}

/* ==========================================================================
   Hero Background — image / video toggle
   ========================================================================== */
.hero-bg-image { display: block; }
.hero-bg-video { display: none; }
.hero-bg--video .hero-bg-image { display: none; }
.hero-bg--video .hero-bg-video { display: block; }

/* ==========================================================================
   Bento Grid — 3 columns x 2 rows of square items, extras hidden until
   "Load More" is clicked
   ========================================================================== */
#mainGalleryGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

#mainGalleryGrid .gal-item {
  grid-column: span 1 !important; /* override any "wide" 2-col span */
  aspect-ratio: 1 / 1;
  width: 100%;
  height: 100%;
}

#mainGalleryGrid .gal-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Extra items (7-9) stay hidden until Load More reveals them */
#mainGalleryGrid .gal-extra {
  display: none;
}

@media (max-width: 900px) {
  #mainGalleryGrid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  #mainGalleryGrid { grid-template-columns: 1fr; }
}

.load-more-container {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
}

.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.8rem;
  border-radius: 6px !important;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-load-more:hover {
  border-color: var(--blue-accent);
  background: var(--blue-light);
}

.btn-load-more i {
  width: 1rem;
  height: 1rem;
}

.btn-load-more .spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--green-primary);
  border-radius: 50%;
  animation: gal-spin 0.7s linear infinite;
}

@keyframes gal-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Before / After Transformation Slider
   ========================================================================== */
.ba-section { background: var(--bg-2); }

.ba-slider-container {
  position: relative;
  max-width: 900px;
  margin: 3rem auto 0;
  aspect-ratio: 16 / 9;
  border-radius: 6px !important;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  cursor: ew-resize;
  user-select: none;
}

.ba-image {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ba-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ba-before { z-index: 1; }

.ba-after {
  z-index: 2;
  width: 50%;
}

.ba-after img {
  width: var(--ba-img-width, 900px);
  max-width: none;
}

.ba-label {
  position: absolute;
  bottom: 1rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px !important;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #FFFFFF;
  background: rgba(22, 24, 29, 0.65);
  backdrop-filter: blur(4px);
}

.before-label { left: 1rem; }
.after-label { right: 1rem; }

.ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 3;
  width: 3px;
  background: #FFFFFF;
  transform: translateX(-50%);
  pointer-events: none;
}

.ba-handle-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% !important;
  background: var(--green-primary);
  color: #FFFFFF;
  font-size: 1rem;
  box-shadow: var(--shadow-hover);
  pointer-events: auto;
}

/* ==========================================================================
   Featured Project Spotlight
   ========================================================================== */
.featured-project {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  border-radius: 6px !important;
  overflow: hidden;
  max-width: 100%;
}

.featured-img-wrap {
  position: relative;
  min-height: 320px;
  min-width: 0;
}

.featured-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.featured-badge-top {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px !important;
  font-size: 0.78rem;
  font-weight: 700;
  color: #FFFFFF;
  background: var(--green-primary);
  box-shadow: var(--shadow-sm);
}

.featured-content {
  padding: 2.5rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

.featured-content h2,
.featured-content p {
  overflow-wrap: break-word;
  word-break: break-word;
}

.featured-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin: 0.5rem 0 0.5rem;
}

.f-stat-v {
  font-size: 1.8rem;
  font-weight: 600;
}

.f-stat-l {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.featured-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.5rem;
}

@media (max-width: 860px) {
  .featured-project { grid-template-columns: minmax(0, 1fr); }
  .featured-img-wrap { min-height: 220px; }
}

@media (max-width: 480px) {
  .featured-content { padding: 1.5rem; gap: 0.75rem; }
  .featured-content h2 { font-size: clamp(1.5rem, 8vw, 2rem); }
  .featured-stats { gap: 1.25rem 1.75rem; }
  .f-stat-v { font-size: 1.4rem; }
  .featured-actions { flex-direction: column; }
  .featured-actions .btn { width: 100%; text-align: center; justify-content: center; }
}

/* ==========================================================================
   Video Gallery Showcase
   ========================================================================== */
.video-grid {
  margin-top: 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.video-card {
  border-radius: 6px !important;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.video-card:hover {
  border-color: var(--blue-accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

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

.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3.2rem;
  height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.92);
  color: var(--green-primary);
  box-shadow: var(--shadow-hover);
}

.video-play-btn i { width: 1.3rem; height: 1.3rem; }

.video-duration {
  position: absolute;
  bottom: 0.7rem;
  right: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px !important;
  font-size: 0.72rem;
  font-weight: 600;
  color: #FFFFFF;
  background: rgba(22, 24, 29, 0.7);
}

.video-info { padding: 1.25rem; }
.video-info h3 { font-size: 1.05rem; }
.video-info p {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .video-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Video Modal — hidden by default, shown when JS adds .open
   ========================================================================== */
.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  background: rgba(22, 24, 29, 0.75);
  backdrop-filter: blur(4px);
  padding: 2rem;
}

.video-modal.open { display: flex; }

.video-modal-inner {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px !important;
  overflow: hidden;
  box-shadow: var(--shadow-deep);
}

.video-modal-inner iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.video-modal-close {
  position: absolute;
  top: -2.6rem;
  right: 0;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.video-modal-close:hover { background: rgba(255, 255, 255, 0.3); }

@media (max-width: 480px) {
  .video-modal { padding: 1rem; }
  .video-modal-close { top: -2.4rem; }
}

/* ==========================================================================
   Gallery Zoom Trigger (corner expand icon on each gal-item)
   ========================================================================== */
.gal-zoom {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 4;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px !important;
  background: rgba(22, 24, 29, 0.55);
  backdrop-filter: blur(4px);
  color: #FFFFFF;
  cursor: zoom-in;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
}

.gal-zoom i {
  width: 1.05rem;
  height: 1.05rem;
}

.gal-item {
  position: relative;
  cursor: pointer;
}

.gal-item:hover .gal-zoom {
  opacity: 1;
  transform: translateY(0);
}

.gal-zoom:hover {
  background: var(--green-primary);
}

/* ==========================================================================
   Lightbox — full image viewer, opened by the .gal-zoom corner arrow
   ========================================================================== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: rgba(22, 24, 29, 0.85);
  backdrop-filter: blur(6px);
  padding: 2rem;
}

.lightbox.open { display: flex; }

.lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1000px;
  width: 100%;
  max-height: 88vh;
}

.lightbox-inner img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px !important;
  box-shadow: var(--shadow-deep);
  background: #000;
}

.lightbox-info {
  margin-top: 1.1rem;
  text-align: center;
  color: #FFFFFF;
  max-width: 640px;
}

.lightbox-info h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.lightbox-info p {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.lightbox-close {
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  z-index: 301;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% !important;
  background: #000000;
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox-close:hover { background: #222222; }

.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  flex-shrink: 0;
  width: 2.8rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
  z-index: 301;
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--green-primary);
  transform: translateY(-50%) scale(1.06);
}

.lightbox-prev i,
.lightbox-next i {
  width: 1.3rem;
  height: 1.3rem;
}

@media (max-width: 720px) {
  .lightbox { padding: 1rem; gap: 0.6rem; }
  .lightbox-close { top: 0.5rem; right: 0.5rem; }
  .lightbox-prev,
  .lightbox-next {
    width: 2.2rem;
    height: 2.2rem;
  }
  .lightbox-prev { left: 0.6rem; }
  .lightbox-next { right: 0.6rem; }
  .lightbox-inner img { max-height: 55vh; }
}