/* Inicio: header + metricas comparten 100dvh en escritorio y tabletas. */
body:is([data-route="/"],[data-route="/en/"]) #page-main { --home-metrics-height:151px; }
body:is([data-route="/"],[data-route="/en/"]) #page-main > .hero-home {
  box-sizing:border-box!important;height:calc(100vh - var(--home-metrics-height))!important;
  height:calc(100dvh - var(--home-metrics-height))!important;
  min-height:0!important;max-height:none!important;
}
body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics {
  box-sizing:border-box!important;height:var(--home-metrics-height)!important;
  min-height:var(--home-metrics-height)!important;max-height:var(--home-metrics-height)!important;
  padding:0!important;
}
body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics > .metrics-grid {
  height:100%!important;min-height:0!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;
  grid-template-rows:1fr!important;
}
body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics > .metrics-grid > div {
  box-sizing:border-box!important;min-height:0!important;height:100%!important;
}
@media (min-width:601px) and (max-width:1200px) and (orientation:portrait) {
  body:is([data-route="/"],[data-route="/en/"]) #page-main {--home-metrics-height:250px;}
  body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics > .metrics-grid {
    grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;
  }
  body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics > .metrics-grid > div:nth-child(-n+2){border-bottom:1px solid #1d1d1d!important;}
}
/* Teléfonos: hero ocupa una pantalla entera; métricas aparecen después. */
@media (max-width:600px), (max-width:1000px) and (orientation:landscape) and (max-height:500px) {
  body:is([data-route="/"],[data-route="/en/"]) #page-main > .hero-home {
    height:100vh!important;height:100dvh!important;min-height:0!important;
  }
  body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics {height:auto!important;min-height:0!important;max-height:none!important;}
  body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics > .metrics-grid {
    height:auto!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:auto!important;
  }
  body:is([data-route="/"],[data-route="/en/"]) #page-main > .metrics > .metrics-grid > div {height:auto!important;min-height:110px!important;}
}

/* Inicio — viewport real: bloque de portada y métricas en conjunto.
   Definición más específica que las reglas heredadas de .hero y .hero-home. */
@media (min-width:601px) and (min-height:501px) {
  body[data-route="/"] #page-main > section.hero.hero-home,
  body[data-route="/en/"] #page-main > section.hero.hero-home {
    height:calc(100vh - var(--home-metrics-height, 151px)) !important;
    height:calc(100dvh - var(--home-metrics-height, 151px)) !important;
    min-height:0 !important;
    max-height:none !important;
    margin-block:0 !important;
  }
  body[data-route="/"] #page-main > section.metrics,
  body[data-route="/en/"] #page-main > section.metrics {
    height:var(--home-metrics-height, 151px) !important;
    min-height:0 !important;
    max-height:var(--home-metrics-height, 151px) !important;
    margin-block:0 !important;
    padding-block:0 !important;
  }
}
/* En tabletas verticales las métricas usan dos filas. */
@media (min-width:601px) and (max-width:1200px) and (orientation:portrait) and (min-height:501px) {
  body[data-route="/"] #page-main,
  body[data-route="/en/"] #page-main { --home-metrics-height:250px; }
}
/* Celulares: el hero llena el viewport y las métricas quedan abajo. */
@media (max-width:600px), (max-height:500px) and (max-width:1000px) {
  body[data-route="/"] #page-main > section.hero.hero-home,
  body[data-route="/en/"] #page-main > section.hero.hero-home {
    height:100vh !important;height:100dvh !important;min-height:0 !important;
  }
  body[data-route="/"] #page-main > section.metrics,
  body[data-route="/en/"] #page-main > section.metrics {
    height:auto !important;min-height:0 !important;max-height:none !important;
  }
}

/* Inicio: alinear el contenido del hero con el mismo grid de las métricas.
   Evita que los offsets antiguos saquen el texto de la zona del panel. */
body[data-route="/"] #page-main > section.hero.hero-home > .hero-content.shell,
body[data-route="/en/"] #page-main > section.hero.hero-home > .hero-content.shell {
  position:absolute !important;
  left:0 !important;
  right:0 !important;
  width:min(calc(100% - (var(--gutter) * 2)), var(--max)) !important;
  max-width:var(--max) !important;
  margin-left:auto !important;
  margin-right:auto !important;
  padding-left:0 !important;
  padding-right:0 !important;
  bottom:clamp(16px,2.2vh,32px) !important;
  box-sizing:border-box !important;
}
@media(max-width:767px) {
  body[data-route="/"] #page-main > section.hero.hero-home > .hero-content.shell,
  body[data-route="/en/"] #page-main > section.hero.hero-home > .hero-content.shell {
    width:calc(100% - 32px) !important;
    bottom:20px !important;
  }
}


/* Inicio ES/EN: altura estable al ocultarse las barras de Safari/Chrome.
   svh usa el viewport pequeño fijo; evita saltos que provoca dvh.
   Solo aplica a pantallas moviles y tabletas. */
@media screen and (max-width:1200px), screen and (pointer:coarse) {
  body[data-route="/"] #page-main > section.hero.hero-home,
  body[data-route="/en/"] #page-main > section.hero.hero-home {
    height:100vh !important; /* fallback */
    height:100svh !important;
    min-height:0 !important;
    max-height:none !important;
  }
}
/* Tabletas: conservar visible en la misma pantalla la franja de métricas. */
@media screen and (min-width:601px) and (min-height:501px) and (max-width:1200px),
       screen and (min-width:601px) and (min-height:501px) and (pointer:coarse) {
  body[data-route="/"] #page-main > section.hero.hero-home,
  body[data-route="/en/"] #page-main > section.hero.hero-home {
    height:calc(100vh - var(--home-metrics-height,151px)) !important;
    height:calc(100svh - var(--home-metrics-height,151px)) !important;
    min-height:0 !important;
    max-height:none !important;
  }
}
