/**
 * Elementor Home Page — layout parity + uniform image sizing.
 */

/* ─── Hero wave ─────────────────────────────────────────────── */
.elementor-page .elementor-shape-bottom .elementor-shape-fill {
  fill: #F3F2EE;
}

.elementor-page .elementor-shape-bottom svg {
  height: 34px;
}

.ecoimpact-home-elementor {
  overflow-x: hidden;
}

.ecoimpact-home-elementor .elementor-section.elementor-section-stretched {
  width: 100vw;
  max-width: 100vw;
  left: 50% !important;
  transform: translateX(-50%);
}

.ecoimpact-home-elementor .entry-header,
.ecoimpact-home-elementor .page-title {
  display: none;
}

/* Trek packages section — above Recent Articles */
.ecoimpact-home-packages {
  background: #ffffff;
}

.ecoimpact-home-packages .trek-packages {
  max-width: 1280px;
  margin: 0 auto;
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}

.ecoimpact-home-elementor .elementor-top-section:nth-of-type(3) {
  background: #ffffff;
}

/* Gallery is section 2 inner; packages is 3rd top section */

/* ─── Shared image crop utility ─────────────────────────────── */
.ecoimpact-home-elementor .ecoimpact-img-frame {
  display: block;
  width: 100%;
  overflow: hidden;
  position: relative;
}

.ecoimpact-home-elementor .ecoimpact-img-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* ─── Gallery row — 3 equal square tiles (Eden reference) ───── */
.ecoimpact-home-gallery > .elementor-container,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child > .elementor-container {
  display: flex;
  align-items: stretch;
}

.ecoimpact-home-gallery .elementor-column,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-column {
  display: flex;
  flex-direction: column;
}

.ecoimpact-home-gallery .elementor-widget-wrap,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ecoimpact-home-gallery .elementor-widget-image,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}

.ecoimpact-home-gallery .elementor-widget-image .elementor-widget-container,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image .elementor-widget-container {
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  line-height: 0;
}

.ecoimpact-home-gallery .elementor-widget-image a,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image a {
  display: block;
  width: 100%;
  height: 100%;
}

.ecoimpact-home-gallery .elementor-widget-image img,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image img {
  width: 100%;
  height: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 0 12px 4px rgba(115, 114, 109, 0.56);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ecoimpact-home-gallery .elementor-widget-image:hover img,
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image:hover img {
  transform: scale(1.04);
}

/* Kill intrinsic img height so aspect-ratio box controls size */
.ecoimpact-home-gallery .elementor-widget-image img[width],
.ecoimpact-home-gallery .elementor-widget-image img[height],
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image img[width],
.ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image img[height] {
  height: 100% !important;
  max-height: none;
}

/* ─── About row — image locked to green panel height ──────── */
.ecoimpact-home-about > .elementor-container {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 0 !important;
}

.ecoimpact-home-about > .elementor-container > .elementor-column {
  flex: 1 1 50% !important;
  width: 50% !important;
  max-width: 50% !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Kill default column gap padding */
.ecoimpact-home-about > .elementor-container.elementor-column-gap-default > .elementor-column > .elementor-element-populated,
.ecoimpact-home-about > .elementor-container > .elementor-column > .elementor-element-populated {
  padding-top: 0;
  padding-bottom: 0;
}

/* Image column — absolute fill inside measured height (set by about-balance.js) */
.ecoimpact-home-about .elementor-column:first-child > .elementor-element-populated {
  position: relative;
  overflow: hidden;
  padding: 0 !important;
  margin: 0;
  height: 100%;
  min-height: 380px;
}

.ecoimpact-home-about .elementor-column:first-child .elementor-widget-image,
.ecoimpact-home-about-image.elementor-widget-image {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.ecoimpact-home-about .elementor-column:first-child .elementor-widget-image img,
.ecoimpact-home-about-image img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  object-fit: cover;
  object-position: center;
}

/* Green text panel — defines row height */
.ecoimpact-home-about .elementor-column:last-child > .elementor-element-populated {
  background-color: #0A4A27;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: auto;
  padding: 40px !important;
}

/* ─── Blog / Recent articles — uniform card thumbnails ──────── */
.ecoimpact-posts-grid {
  display: grid;
  grid-template-columns: repeat(var(--eco-cols, 4), minmax(0, 1fr));
  gap: 35px 30px;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .ecoimpact-posts-grid {
    grid-template-columns: repeat(var(--eco-cols-tab, 2), minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .ecoimpact-posts-grid {
    grid-template-columns: repeat(var(--eco-cols-mob, 2), minmax(0, 1fr));
    gap: 24px 16px;
  }
}

.ecoimpact-post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
}

.ecoimpact-post-card__thumb-link {
  display: block;
  text-decoration: none;
}

.ecoimpact-post-card__thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  width: 100%;
}

.ecoimpact-post-card__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.ecoimpact-post-card__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding-top: 22px;
}

.ecoimpact-post-card__title {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 20px;
  text-transform: capitalize;
}

.ecoimpact-post-card__title a {
  color: inherit;
  text-decoration: none;
}

.ecoimpact-post-card__title a:hover {
  color: #0A4A27;
}

.ecoimpact-post-card__excerpt p {
  color: #032940;
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.4;
  margin: 0 0 12px;
}

.ecoimpact-post-card__read-more-wrap {
  margin-top: auto;
}

.ecoimpact-post-card__read-more {
  color: #ED1C24;
  font-family: "DM Sans", sans-serif;
  font-size: 16px;
  font-weight: 400;
  text-decoration: none;
  text-transform: capitalize;
}

.ecoimpact-post-card__read-more:hover {
  text-decoration: underline;
}

.ecoimpact-posts-grid__empty {
  text-align: center;
  color: #032940;
}

/* Elementor Pro posts widget (if used) */
.ecoimpact-home-elementor .elementor-posts--thumbnail-top .elementor-post__thumbnail {
  position: relative;
  overflow: hidden;
  padding-bottom: 75% !important; /* 4:3 ratio — consistent card height */
}

.ecoimpact-home-elementor .elementor-posts--thumbnail-top .elementor-post__thumbnail img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.ecoimpact-home-elementor .elementor-posts-container {
  gap: 30px;
  align-items: stretch;
}

.ecoimpact-home-elementor .elementor-post {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ecoimpact-home-elementor .elementor-post__text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.ecoimpact-home-elementor .elementor-post__read-more {
  color: #ED1C24;
  text-transform: capitalize;
  margin-top: auto;
}

.ecoimpact-home-elementor .elementor-post__excerpt p {
  color: #032940;
}

.ecoimpact-home-articles {
  background-color: #F3F2EE !important;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ecoimpact-home-about > .elementor-container > .elementor-column {
    flex: 1 1 50% !important;
    width: 50% !important;
    max-width: 50% !important;
  }
}

@media (max-width: 767px) {
  .ecoimpact-home-gallery,
  .ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child {
    margin-top: -40px !important;
  }

  /* Stack gallery — still square tiles, not random heights */
  .ecoimpact-home-gallery .elementor-widget-image .elementor-widget-container,
  .ecoimpact-home-elementor .elementor-top-section:nth-of-type(2) .elementor-inner-section:first-child .elementor-widget-image .elementor-widget-container {
    aspect-ratio: 1 / 1;
    max-height: none;
  }

  .ecoimpact-home-about > .elementor-container {
    flex-direction: column !important;
  }

  .ecoimpact-home-about > .elementor-container > .elementor-column {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .ecoimpact-home-about .elementor-column:first-child > .elementor-element-populated {
    min-height: 280px;
    height: auto !important;
  }

  .ecoimpact-home-about .elementor-column:first-child .elementor-widget-image,
  .ecoimpact-home-about-image.elementor-widget-image {
    position: relative;
    inset: auto;
    min-height: 280px;
  }

  .ecoimpact-home-about .elementor-column:first-child .elementor-widget-image img,
  .ecoimpact-home-about-image img {
    min-height: 280px;
  }

  .ecoimpact-home-elementor .elementor-posts--thumbnail-top .elementor-post__thumbnail {
    padding-bottom: 75% !important;
  }

  .ecoimpact-home-elementor .elementor-posts--thumbnail-top .elementor-post__thumbnail__link {
    width: 100% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ecoimpact-home-gallery .elementor-widget-image img {
    transition: none;
  }
}
