/* LabAncestral · territorio.css
   Estilos exclusivos de la página Territorio. */

.te-page {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  background: #F6EFE1;
  color: #152514;
  font-family: 'IBM Plex Sans', sans-serif;
}

.te-page *,
.te-page *::before,
.te-page *::after {
  min-width: 0;
}

.te-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

/* Hero */
.te-hero {
  width: 100%;
  padding: 62px 44px 0;
}

.te-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: end;
  gap: 48px;
  padding-bottom: 54px;
}

.te-title {
  max-width: 100%;
  margin: 0 0 22px;
  color: #fff;
  font-family: 'Spectral', serif;
  font-size: 60px;
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -.02em;
}

.te-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.te-stats > div {
  min-width: 0;
}

/* Mapa */
.te-map-section {
  width: 100%;
  padding: 0 44px 86px;
}

.te-map-card {
  display: grid;
  grid-template-columns: minmax(230px, .72fr) minmax(0, 1.28fr);
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.te-map-visual {
  min-height: 560px;
}

.te-map-image {
  display: block;
  width: 100%;
  min-height: 560px;
  height: 100%;
  flex: 1 1 auto;
  object-fit: cover;
}

.te-map-caption {
  max-width: calc(100% - 28px);
  overflow-wrap: normal;
}

/* Secciones de contenido */
.te-section {
  width: 100%;
  padding: 88px 44px;
}

.te-ecological-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.te-ecological-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #ece1c9;
  border-radius: 14px;
  background: #fff;
}

.te-ecological-row > div:first-child {
  display: flex;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
}

.te-ecological-row > div:last-child {
  display: flex;
  align-items: center;
  padding: 24px 28px;
}

.te-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 38px;
}

.te-communes {
  padding-top: 84px;
  padding-bottom: 84px;
}

.te-communes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.te-communes-grid > * {
  min-width: 0;
}

/* Tablet */
@media (max-width: 980px) {
  .te-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  .te-title {
    max-width: 760px;
  }

  .te-stats {
    max-width: 640px;
  }

  .te-map-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .te-map-legend {
    border-right: 0 !important;
    border-bottom: 1px solid #1f5a3e;
  }

  .te-map-visual,
  .te-map-image {
    min-height: 420px;
  }

  .te-communes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Móvil */
@media (max-width: 700px) {
  .te-hero {
    padding: 48px 20px 0;
  }

  .te-hero-grid {
    gap: 30px;
    padding-bottom: 44px;
  }

  .te-title {
    font-size: clamp(38px, 12vw, 50px);
    line-height: 1.04;
  }

  .te-hero-grid p {
    font-size: 16px !important;
  }

  .te-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
  }

  .te-stats > div {
    padding: 16px !important;
  }

  .te-map-section {
    padding: 0 20px 60px;
  }

  .te-map-card {
    border-radius: 16px !important;
  }

  .te-map-legend {
    padding: 26px 22px !important;
  }

  .te-map-legend a {
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .te-map-visual,
  .te-map-image {
    min-height: 300px;
  }

  .te-map-image {
    height: 300px;
  }

  .te-map-caption {
    right: 10px !important;
    bottom: 10px !important;
    max-width: calc(100% - 20px);
    font-size: 9px !important;
  }

  .te-section,
  .te-communes {
    padding: 60px 20px;
  }

  .te-section h2 {
    font-size: clamp(30px, 9vw, 38px) !important;
  }

  .te-ecological-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .te-ecological-row > div:first-child,
  .te-ecological-row > div:last-child {
    padding: 22px !important;
  }

  .te-section-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 30px;
  }
}

/* Teléfonos estrechos */
@media (max-width: 430px) {
  .te-hero {
    padding-right: 16px;
    padding-left: 16px;
  }

  .te-stats,
  .te-communes-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .te-map-section,
  .te-section,
  .te-communes {
    padding-right: 16px;
    padding-left: 16px;
  }

  .te-map-legend {
    padding: 24px 18px !important;
  }

  .te-map-visual,
  .te-map-image {
    min-height: 250px;
  }

  .te-map-image {
    height: 250px;
  }

  .te-ecological-row > div:first-child,
  .te-ecological-row > div:last-child {
    padding: 20px 18px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .te-page *,
  .te-page *::before,
  .te-page *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}