/* =========================================
   Project Cards — Masonry layout
   Column widths are set here; Masonry JS
   handles the vertical stacking.

   project-cards.js sets Masonry's own gutter
   option to 0 on purpose: the "- 1.4rem" /
   "- 1rem" reductions below are the entire
   gutter allowance already. If you change
   these calc() values (or add a new
   breakpoint), nothing needs to change in the
   JS — it just measures whatever width this
   CSS produces.
   ========================================= */

/* Masonry sizer defines the full column pitch — undiminished. The card
   itself is narrower (see below); the difference between the two is
   what renders as the visual gutter between columns. Keeping these two
   separate is what lets gutter stay 0 in project-cards.js: the gutter
   is fully expressed here, in CSS, rather than needing to match a JS
   number. */
.projects-grid__sizer {
  width: 33.333%;
}

.project-card {
  width: calc(33.333% - 1.4rem);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 40px 0 transparent;
  transition:
    transform 0.3s var(--ease-interaction),
    box-shadow 0.3s var(--ease-interaction);
  display: flex;
  flex-direction: column;
  margin-bottom: 2rem;
}

.project-card::before {
  content: "";
  background: linear-gradient(0deg, rgba(44, 44, 44, 0) 6.56%, rgba(44, 44, 44, 0.8) 71.72%);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 50%;
  transition: opacity 0.6s var(--ease-interaction);
  z-index: 1;
  opacity: 0;
}

.project-card.card--active {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px 0 rgba(0, 0, 0, 0.25);
}

.project-card.card--active::before {
  content: "";
  opacity: 1;
}

.project-card__link {
  pointer-events: none;
}

/* =========================================
   Before / After Image Wrapper
   ========================================= */

.project-before-after {
  position: relative;
  font-size: 0; /* collapse inline whitespace */
  -ms-touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: col-resize;
  overflow: hidden;
}

/* Before — base image, natural height drives the card height */
.project-img--before {
  width: 100%;
  height: auto;
  display: block;
}

/* After — background-image overlay, covers full width by default */
.project-img--after {
  background-size: cover;
  background-position: left center;
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
}

/* Applied only during the delayed auto-reset, not during live dragging */
.project-img--after--transition {
  transition: width 0.6s ease;
}

.project-labels {
  position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    display: flex;
    z-index: 1;
}

/* Before / After labels */
.project-before-label,
.project-after-label {
  padding: 0.5rem 1rem;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--e-global-color-primary);
  background: var(--e-global-color-secondary);
  pointer-events: none;
}

.project-before-label {
  right: 0;
  border-radius: 100px 0 0 100px;
  opacity: 0.5;
  transition: opacity 0.6s var(--ease-interaction);
}

.project-card.card--active .project-before-label {
  opacity: 1;
}

.project-after-label {
  left: 0;
  border-radius: 0 100px 100px 0;
}

/* Single image fallback */
.project-img--single {
  width: 100%;
  height: auto;
  display: block;
}

/* =========================================
   Card Body
   ========================================= */

.project-card__body {
  position: absolute;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2;
  pointer-events: none;
}

.project-card__body > * {
  pointer-events: auto;
}

.project-card__title-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#projects-grid .project-card__title {
  color: var(--e-global-color-primary);
  margin: 0;
}

.project-card__location {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--e-global-color-16a22a5);
}

/* =========================================
   Room Tags
   ========================================= */

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
  gap: 0.4rem;
}

.project-tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 4px;
  background: var(--e-global-color-accent);
  color: var(--e-global-color-secondary);
}

/* =========================================
   View Project Link
   ========================================= */

#projects-grid .project-card__button {
  background-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.313rem;
  margin-top: 0.5rem;
  padding: 0;
  font-style: normal;
  font-weight: 700;
  line-height: normal;
  text-transform: uppercase;
  border: none;
  color: var(--e-global-color-accent);
  transition: color 0.3s var(--ease-interaction);
}

.projects-grid__empty {
  display: none;
  width: 100%;
  margin: 2rem 0 0;
  padding: 2rem 1.5rem;
  border: 1px dashed rgba(0, 0, 0, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--e-global-color-16a22a5);
  font-weight: 600;
  text-align: center;
}

/* =========================================
   Responsive — 2 columns then 1
   ========================================= */

@media (width <= 900px) {
  .projects-grid__sizer {
    width: 50%;
  }

  .project-card {
    width: calc(50% - 1rem);
  }
}

@media (width <= 575px) {
  .projects-grid__sizer,
  .project-card {
    width: 100%;
  }

  .project-card::before {
    transform: rotate(180deg);
    top: initial;
    bottom: 0;
  }

  .project-card__body {
    top: 0;
    height: 100%;
  }

  .project-card__title-wrapper {
    position: relative;
    bottom: -30px;
    margin-top: auto;
    opacity: 0;
    transition:
      opacity 0.6s var(--ease-interaction),
      bottom 0.6s var(--ease-interaction);    
  }

  .project-card.card--active .project-card__title-wrapper {
    bottom: 0;
    opacity: 1;
  }    
}

@media (width >= 576px) {
  #projects-grid {
    margin-left: 2%;
  }

  .project-card__body {
    top: -30px;
    opacity: 0;
    transition:
      opacity 0.6s var(--ease-interaction),
      top 0.6s var(--ease-interaction);        
  }

  .project-card.card--active .project-card__body {
    top: 0;
    opacity: 1;
  }  
}