/* ═══════════════════════════════════════════════
   GALLERY PAGE STYLES
   /css/gallery.css
═══════════════════════════════════════════════ */

/* ── Hero ────────────────────────────────────── */
.gallery-hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  background-image: url('https://connect.mediaserve.io/storage/v1/object/public/media/78dba5ff-e514-44fd-bc2d-1f49dd7a0a6f/f4523b1a-7fe7-4198-b28d-08d172eb2245/media/images/new-roof-installation.webp');
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.gallery-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(11, 100, 244, 0.82) 0%, rgba(17, 24, 39, 0.88) 100%);
  z-index: 0;
}

.gallery-hero-content {
  position: relative;
  z-index: 1;
  padding-top: calc(var(--header-height, 140px) + var(--space-16));
  padding-bottom: var(--space-16);
  align-items: center;
  text-align: center;
}

.gallery-hero-label {
  color: rgba(255, 255, 255, 0.85);
  align-self: center;
}

.gallery-hero-title {
  color: #fff;
  margin-bottom: var(--space-5);
  max-width: 700px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.gallery-hero-sub {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.9);
  max-width: 620px;
  margin-bottom: var(--space-8);
  line-height: var(--leading-relaxed);
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.gallery-hero-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ── Section Header ──────────────────────────── */
.gallery-section-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--space-12);
}

.gallery-section-title {
  color: var(--heading-light);
  margin-bottom: var(--space-4);
}

.gallery-section-sub {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--text-light);
  max-width: 640px;
  line-height: var(--leading-relaxed);
}

/* ── Gallery Grid ────────────────────────────── */
.gallery-grid-section {
  background: var(--light-bg);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  width: 100%;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  background: var(--gray-200);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-200) var(--ease-default),
              transform var(--duration-200) var(--ease-default);
}

.gallery-item:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-3px);
}

.gallery-item:focus-visible {
  outline: 3px solid var(--primary-500);
  outline-offset: 3px;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--duration-300) var(--ease-default);
}

.gallery-item:hover img {
  transform: scale(1.07);
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 100, 244, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: #fff;
  opacity: 0;
  transition: opacity var(--duration-200) var(--ease-default);
  backdrop-filter: blur(2px);
}

.gallery-item:hover .gallery-item-overlay,
.gallery-item:focus-visible .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-overlay span {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  padding: 0 var(--space-3);
}

/* ── CTA Section ─────────────────────────────── */
.gallery-cta-section {
  position: relative;
  background-image: url('https://connect.mediaserve.io/storage/v1/object/public/media/78dba5ff-e514-44fd-bc2d-1f49dd7a0a6f/f4523b1a-7fe7-4198-b28d-08d172eb2245/media/images/full-roof.webp');
  background-size: cover;
  background-position: center;
}

.gallery-cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 0;
}

.gallery-cta-inner {
  position: relative;
  z-index: 1;
  gap: var(--space-10);
}

.gallery-cta-label {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.75);
  align-self: flex-start;
}

.gallery-cta-title {
  position: relative;
  z-index: 1;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  margin-bottom: var(--space-4);
}

.gallery-cta-body {
  position: relative;
  z-index: 1;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  line-height: var(--leading-relaxed);
  max-width: 620px;
}

.gallery-cta-actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-8);
}

/* ── Services Grid ───────────────────────────── */
.gallery-services-section {
  background: #fff;
}

.gallery-services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  width: 100%;
}

.gallery-service-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  background: var(--light-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-base);
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--duration-200) var(--ease-default),
              transform var(--duration-200) var(--ease-default),
              border-color var(--duration-200) var(--ease-default);
}

.gallery-service-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--primary-300);
}

.gallery-service-card h3 {
  color: var(--heading-light);
  margin-bottom: var(--space-2);
}

.gallery-service-card p {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-light);
  line-height: var(--leading-relaxed);
  flex: 1;
  margin-bottom: var(--space-4);
}

.gallery-service-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary-600);
  text-decoration: none;
  margin-top: auto;
}

.gallery-service-card:hover .gallery-service-link {
  color: var(--primary-800);
}

/* ── Lightbox ────────────────────────────────── */
.gallery-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
}

.gallery-lightbox.active {
  display: flex;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
  z-index: 0;
}

.gallery-lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  gap: var(--space-3);
}

.gallery-lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2xl);
}

.gallery-lightbox-caption {
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  text-align: center;
}

.gallery-lightbox-close {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: var(--radius-full);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-150) var(--ease-default);
  z-index: 2;
}

.gallery-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: var(--radius-full);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--duration-150) var(--ease-default);
  z-index: 2;
}

.gallery-lightbox-prev { left: var(--space-5); }
.gallery-lightbox-next { right: var(--space-5); }

.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .gallery-hero {
    min-height: 380px;
  }

  .gallery-hero-title {
    font-size: var(--text-3xl);
  }

  .gallery-hero-sub {
    font-size: var(--text-base);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .gallery-services-grid {
    grid-template-columns: 1fr;
  }

  .gallery-cta-actions {
    flex-direction: column;
  }

  .gallery-lightbox-prev { left: var(--space-2); }
  .gallery-lightbox-next { right: var(--space-2); }
}

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