/* gallery.css — Styles for Before/After Project Gallery */

/* ===== GALLERY WRAPPER ===== */
.gallery-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  animation: fadeIn 500ms var(--transition-fast);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== GALLERY HEADER ===== */
.gallery-header {
  text-align: center;
}

.gallery-title h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

.gallery-title p {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin: 0;
}

/* ===== FILTER BUTTONS ===== */
.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.filter-btn {
  padding: var(--space-2) var(--space-5);
  border: 2px solid var(--color-divider);
  background: transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-medium);
}

.filter-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.filter-btn.active {
  background: var(--color-cta);
  border-color: var(--color-cta);
  color: var(--color-text-inverse);
}

/* ===== GALLERY GRID ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-8);
  transition: opacity 200ms var(--transition-fast);
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1200px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== PROJECT CARD ===== */
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-medium);
  cursor: pointer;
  height: 100%;
}

.project-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-6px);
}

/* ===== COMPARISON CONTAINER ===== */
.project-comparison {
  position: relative;
  overflow: hidden;
  background: var(--color-surface-offset);
}

.comparison-container {
  position: relative;
  width: 100%;
  padding-bottom: 66.67%; /* 3:2 aspect ratio */
  overflow: hidden;
}

.comparison-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.comparison-container img:nth-of-type(2) {
  clip-path: inset(0 0 0 50%);
  width: 100%;
}

.comparison-slider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-cta);
  cursor: ew-resize;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slider-handle {
  width: 40px;
  height: 40px;
  background: var(--color-cta);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  pointer-events: none;
}

.slider-handle::before,
.slider-handle::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
}

.slider-handle::before {
  border-width: 8px 12px 8px 0;
  border-color: transparent var(--color-text-inverse) transparent transparent;
  left: -8px;
}

.slider-handle::after {
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent var(--color-text-inverse);
  right: -8px;
}

/* ===== PROJECT INFO ===== */
.project-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-6);
  flex: 1;
}

.project-service-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  background: rgba(230, 126, 34, 0.1);
  color: var(--color-cta);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

.project-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.project-location {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.project-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  flex: 1;
  margin: 0;
}

.view-details {
  margin-top: auto;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms var(--transition-medium), background 300ms var(--transition-medium);
}

.lightbox.active {
  opacity: 1;
  pointer-events: auto;
  background: rgba(26, 26, 26, 0.7);
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  z-index: 10;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-xl);
  animation: lightboxSlideUp 400ms var(--transition-fast);
}

@keyframes lightboxSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.lightbox-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  background: var(--color-cta);
  color: var(--color-text-inverse);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 11;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.lightbox-close:hover {
  background: var(--color-cta-hover);
  transform: scale(1.1);
}

.lightbox-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  padding: var(--space-8);
}

@media (max-width: 1024px) {
  .lightbox-body {
    grid-template-columns: 1fr;
    max-width: 600px;
  }
}

/* ===== LIGHTBOX COMPARISON ===== */
.lightbox-comparison {
  position: relative;
}

.lightbox-comparison-container {
  width: 100%;
  padding-bottom: 75%; /* 4:3 aspect ratio for lightbox */
}

/* ===== LIGHTBOX DETAILS ===== */
.lightbox-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.lightbox-details h2 {
  font-size: var(--text-xl);
  margin: 0;
  color: var(--color-text);
}

.lightbox-details .location {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin: 0;
}

.lightbox-details .service-type {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.lightbox-details .description {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text-muted);
  margin: 0;
}

.lightbox-cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

.lightbox-cta .btn {
  width: 100%;
}

.cta-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin: 0;
}

/* ===== EMPTY STATE ===== */
.gallery-grid:empty::after {
  content: 'No projects found for this filter.';
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-12);
  color: var(--color-text-muted);
  font-size: var(--text-base);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

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

  .gallery-filters {
    gap: var(--space-2);
  }

  .filter-btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }

  .project-info {
    gap: var(--space-2);
    padding: var(--space-4);
  }

  .lightbox-body {
    padding: var(--space-6);
    gap: var(--space-6);
  }

  .lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
  }

  .lightbox-close {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    gap: var(--space-6);
  }

  .gallery-title h2 {
    font-size: var(--text-lg);
  }

  .gallery-filters {
    gap: var(--space-2);
  }

  .filter-btn {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
  }

  .project-card {
    border-radius: var(--radius-md);
  }

  .project-info {
    padding: var(--space-3);
  }

  .project-title {
    font-size: var(--text-base);
  }

  .lightbox-body {
    padding: var(--space-4);
    gap: var(--space-4);
  }

  .lightbox-close {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    top: var(--space-2);
    right: var(--space-2);
  }

  .lightbox-details h2 {
    font-size: var(--text-lg);
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  .gallery-wrapper,
  .project-card,
  .filter-btn,
  .lightbox,
  .lightbox-close,
  .comparison-slider {
    animation: none;
    transition: none;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .gallery-filters,
  .lightbox,
  .project-comparison {
    display: none;
  }

  .project-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid var(--color-border);
  }
}
