/* ==========================================================================
   Section Header & Toggle Bar
   ========================================================================== */

.section-header-wrap1 {
  font-family: 'Montserrat', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: #333333;
  line-height: 1.35;
  letter-spacing: -0.5px;
  text-align: center;
  margin-bottom: 20px;
}

.section-header-wrap1 h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: #333333;
  line-height: 1.35;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.section-header-wrap1 p {
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 15px;
}

/* NOTE: the .section-toggle-bar rules live in masonry-item.css (the only page that has this bar).
   The expand/collapse rules below are also in masonry-item.css. They are repeated here on
   purpose (same values), so the gallery's expand/collapse works with either file version. */

.toggle-icon {
  font-size: 1.2rem;
  color: #333;
  transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
  transform: rotate(180deg);
}

/* ==========================================================================
   Collapsible Animation Container
   ========================================================================== */

.collapsible-content {
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, visibility 0.3s;
  max-height: 5000px;
  opacity: 1;
  overflow: visible; /* so shadows and hovered thumbnails are not cut off */
}

/* Hidden = collapsed AND removed from the Tab order and from screen readers */
.collapsible-content.is-hidden {
  max-height: 0 !important;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
}

/* ==========================================================================
   Before & After Grid Layout
   ========================================================================== */

.before-after-section {
  font-family: 'Montserrat', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: #333333;
  line-height: 1.35;
  letter-spacing: -0.5px;
  max-width: 1200px;
  margin: 0 0 1px auto;
  padding: 60px 20px 40px 20px;
  background-color: #f9f9f9;
}

.before-after-grid {
  display: flex;
  justify-content: center;
}

.ba-card {
  width: 100%;
  max-width: 700px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border: 1px solid #eee;
}

.ba-title {
  padding: 15px 20px;
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  background: #f8f9fa;
  color: #333;
  text-align: center;
}

/* ==========================================================================
   Image Container & Split-View Mechanics (Fixed Box Size)
   ========================================================================== */

.ba-container {
  position: relative;
  width: 100%;
  height: 480px;
  overflow: hidden;
  user-select: none;
  background-color: #ffffff;
}

.ba-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  object-position: center;
}

.ba-before-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
  clip-path: inset(0 50% 0 0);
}

.ba-before-wrapper .ba-before {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
}

.ba-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 4;
  cursor: ew-resize;
  margin: 0;
}

/* ==========================================================================
   Visual Handle & Drag Divider
   ========================================================================== */

.ba-handle {
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  height: 100%;
  background: #ffffff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  z-index: 3;
  pointer-events: none;
  transform: translateX(-50%);
}

.ba-handle::after {
  content: '‹ ›';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: #f1f1f1;
  color: #666666;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -2px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* The slider itself is invisible, so when the keyboard is on it, ring the round knob instead */
.ba-slider:focus-visible + .ba-handle::after {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

/* ==========================================================================
   Badges & Caption Metadata
   ========================================================================== */

.ba-badge {
  position: absolute;
  bottom: 12px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  border-radius: 4px;
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.badge-after {
  right: 12px;
  /* Darker green so the white text is easy to read (the old bright green was about 2:1) */
  background: rgba(30, 132, 73, 0.92);
}

.badge-before {
  left: 12px;
  background: rgba(0, 0, 0, 0.65);
}

.ba-caption {
  padding: 10px 15px;
  background-color: #fafafa;
  border-top: 1px solid #eeeeee;
  font-size: 0.85rem;
  color: #666666;
  text-align: center;
}

.ba-caption i {
  color: #2c3e50;
  margin-right: 6px;
}

/* ==========================================================================
   Gallery Navigation Buttons
   ========================================================================== */

.ba-nav-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
}

.ba-btn {
  background-color: #F1F1F1;
  color: #666666;
  border: none;
  padding: 12px 24px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease, transform 0.1s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ba-btn:hover {
  background-color: #e2e2e2;
  transform: translateY(-1px);
}

.ba-btn:active {
  transform: translateY(0);
}

/* The buttons are switched off while the projects load, or when there is only one project */
.ba-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   Responsive Adjustments for Smartphones & Tablets
   ========================================================================== */

@media (max-width: 768px) {
  .before-after-section {
    margin: 30px auto 20px auto;
    padding: 0 10px;
  }

  .section-header-wrap1 h2 {
    font-size: 1.8rem;
  }

  .ba-container {
    height: 320px;
  }

  .ba-btn {
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  .ba-nav-buttons {
    gap: 10px;
    margin-top: 20px;
  }
}

@media (max-width: 480px) {
  .ba-container {
    height: 250px;
  }

  .ba-caption {
    font-size: 0.8rem;
    padding: 8px 10px;
  }
}