@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;700&family=Roboto:wght@400;700&display=swap");

@font-face {
  font-family: "Alte Haas Grotesk";
  src: url("../fonts/AlteHaasGroteskRegular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00BF;
}

@font-face {
  font-family: "Alte Haas Grotesk";
  src: url("../fonts/AlteHaasGroteskBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00BF;
}

:root {
  --header-height: 130px;
  --logo-size: 210px;
  --page-side-space: 0;
  --text: #17334a;
  --header-ink: #161b4e;
  --accent: #0c5c90;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Alte Haas Grotesk", "Roboto", "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  /* Permitir scroll vertical siempre, bloquear horizontal por seguridad */
  overflow-x: hidden; 
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#inicio,
#que-hacemos,
#sobre-nosotros,
#contacto {
  scroll-margin-top: var(--header-height);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  min-height: var(--header-height);
  background: #6e8fa8;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
  transition: background 0.3s ease;
}

/* En la página de inicio el header flota sobre la imagen */
.imagen-page .site-header {
  position: fixed;
  width: 100%;
}

.site-header-inner {
  width: calc(100% - (var(--page-side-space) * 2));
  height: var(--header-height);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand-mark {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  margin-left: 2cm;
}

.brand-mark img {
  width: var(--logo-size);
  height: var(--logo-size);
  object-fit: contain;
  display: block;
}

.menu-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  color: var(--header-ink);
  background: transparent;
  cursor: pointer;
  display: none;
}

.menu-toggle-line {
  width: 24px;
  height: 2px;
  margin: 5px auto;
  display: block;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.main-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(16px, 2vw, 46px);
  transform: translateX(-10%);
}

.main-menu a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 4px solid transparent;
  color: var(--header-ink);
  text-decoration: none;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 400;
}

.main-menu a:hover,
.main-menu a.is-active {
  border-bottom-color: var(--header-ink);
}

.main-menu a.nav-contact {
  padding: 10px 16px;
  border-bottom-color: transparent;
  border-radius: 999px;
  background: rgba(12, 92, 144, 0.22);
}

.main-menu a.nav-contact:hover,
.main-menu a.nav-contact.is-active {
  border-bottom-color: transparent;
  background: rgba(12, 92, 144, 0.34);
}

.main-menu a.with-arrow::after {
  content: "";
  width: 0;
  height: 0;
  margin-top: 4px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid var(--header-ink);
}

.home {
  background: #fff;
  overflow-x: hidden;
  min-height: 100vh;
}

.home-stage {
  --card-width: min(655px, calc(100vw - 48px));
  --card-margin: clamp(36px, 6vw, 86px) auto 40px calc(var(--page-side-space) + 5vw);
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.82);
  --card-shadow: 0 14px 45px rgba(12, 67, 101, 0.2);
  --card-blur: 2px;
  min-height: calc(100vh - var(--header-height));
  padding-top: calc(var(--header-height) + 1.5cm);
  position: relative;
}

/* ELIMINADO overflow: hidden para permitir crecimiento con zoom */
.home-stage .card {
  width: var(--card-width);
  margin: var(--card-margin);
  padding: 32px 28px 34px;
  position: relative;
  z-index: 1;
  text-align: left;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(var(--card-blur));
  animation: rise 0.9s ease-out;
}

/* Resto de estilos de servicios y media queries (abreviado por espacio) */
/* Mantener igual tus definiciones de .services-grid y .service-box */

@media (max-width: 640px) {
  .home {
    overflow-x: hidden;
  }
  .site-header-inner {
    width: calc(100% - 24px);
    height: 100%;
    padding: 10px 0;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  /* ... resto de móviles ... */
}

@media (max-width: 860px) {
  :root {
    --header-height: 100px;
    --logo-size: calc(var(--header-height) - 12px);
  }

  /* Optimizaciones de rendimiento móvil */
  * {
    text-rendering: optimizeSpeed;
  }

  .site-header {
    transition: background 0.15s ease;
  }

  .site-header-inner {
    width: 100%;
    height: var(--header-height);
    padding: 0 10px;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    padding-right: 58px;
  }

  .brand-mark img {
    width: var(--logo-size);
    height: var(--logo-size);
    object-fit: contain;
  }

  .brand-mark {
    margin-left: 8px;
    align-self: center;
  }

  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
    margin-right: 0;
    color: #0f1b4a;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 10px;
    z-index: 3;
  }

  .menu-toggle-line {
    width: 18px;
    height: 2px;
  }

  .main-menu {
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 14px 16px;
    transform: none;
    background: #6e8fa8;
    border: 1px solid rgba(15, 27, 74, 0.28);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(8, 18, 44, 0.22);
  }

  .site-header-inner.menu-open .main-menu {
    display: flex;
  }

  .main-menu a {
    width: 100%;
    justify-content: space-between;
    font-size: 21px;
    line-height: 1.25;
    padding: 10px 0;
    color: #0f1b4a;
    font-weight: 400;
    border-bottom: 1px solid rgba(15, 27, 74, 0.22);
  }

  .main-menu a:hover,
  .main-menu a.is-active {
    color: #0b4b77;
    border-bottom-color: rgba(11, 75, 119, 0.42);
  }

  .main-menu a.nav-contact {
    justify-content: center;
    border-bottom: 0;
    color: #ffffff;
    background: #0c5c90;
    font-weight: 400;
  }

  .main-menu a.nav-contact:hover,
  .main-menu a.nav-contact.is-active {
    background: #08486f;
    border-bottom: 0;
  }

  .main-menu a.with-arrow::after {
    margin-top: 0;
  }

  .home-stage {
    --card-width: calc(100vw - 24px);
    --card-margin: 12px auto 18px;
    padding-top: calc(var(--header-height) + 1cm);
  }

  .home-stage .card {
    padding: 20px 16px 22px;
    border-radius: 14px;
  }
}

/* ===== Páginas de servicio — layout común ===== */
.recursos-page-main {
  background-color: #ffffff;
  min-height: 100vh;
  padding-top: clamp(20px, 4vw, 40px);
  padding-left: 5%;
  padding-right: 5%;
}

.content-wrapper {
  max-width: 694px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.content-wrapper-wide {
  max-width: 920px;
}

.recursos-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(15px, 3vw, 30px);
  margin-bottom: 35px;
}

.recursos-icon {
  width: clamp(80px, 12vw, 130px);
  height: auto;
  flex-shrink: 0;
}

.recursos-page-title {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  color: #6B564C;
  font-weight: 700;
  margin: 0;
  line-height: 1.1;
  text-align: left;
}

.recursos-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.recursos-row {
  display: grid;
  gap: 15px;
}

.row-four {
  grid-template-columns: repeat(4, 1fr);
}

.row-three {
  grid-template-columns: repeat(3, 1fr);
}

.row-two {
  grid-template-columns: repeat(2, 1fr);
  width: calc(66.66% + 10px);
  margin: 0 auto;
}

.recurso-card {
  background-color: #6B564C;
  color: #ffffff;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3.5 / 3;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transition: transform 0.3s ease;
}

.recurso-card:hover {
  transform: translateY(-3px);
}

.recurso-card p {
  margin: 0;
  font-size: clamp(0.74rem, 0.89vw, 0.93rem);
  line-height: 1.3;
  font-weight: 500;
}

.recursos-footer-text {
  margin-top: 30px;
  text-align: center;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.recursos-footer-text p {
  color: #6B564C;
  font-size: clamp(0.85rem, 1vw, 1rem);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 22px;
}

.btn-volver {
  display: inline-block;
  margin-top: 24px;
  margin-bottom: 1cm;
  padding: 10px 32px;
  background-color: #B5A6A0;
  color: #6B564C;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.2s;
}

.btn-volver:hover {
  opacity: 0.82;
}

@media (max-width: 960px) {
  .row-four {
    grid-template-columns: repeat(2, 1fr);
    max-width: 404px;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .recursos-header {
    flex-direction: column;
    text-align: center;
  }

  .recursos-page-title {
    text-align: center;
  }

  .row-four,
  .row-three,
  .row-two {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 226px;
    margin: 0 auto;
  }

  .recurso-card {
    aspect-ratio: auto;
    min-height: 81px;
  }
}
