/* EDESCO S.A.S. Estilos de la landing, según el manual de marca (logo final, opción 14).
   Paleta: azul EDESCO (texto e ícono), azul medio (acento), azul claro (acento sobre oscuro),
   azul noche (fondos oscuros) y papel (fondos claros).
   Tipografías: Plus Jakarta Sans Bold para títulos e Inter para el texto. Las dos autohospedadas (OFL).
   scripts/iconos.mjs lee la paleta de :root para el ícono de iPhone y la imagen para redes.
   Todo el movimiento vive en el bloque prefers-reduced-motion: no-preference del final. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/assets/fonts/plus-jakarta-sans-latin-v1.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin-v1.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --azul: #1f3a5f;
  --azul-medio: #2b4c7e;
  --azul-claro: #8fb0d9;
  --azul-noche: #13233a;
  --papel: #f6f5f2;
  --texto-suave: rgb(31 58 95 / 0.82);
  --papel-suave: rgb(246 245 242 / 0.8);
  --linea: rgb(31 58 95 / 0.16);
  --linea-fuerte: rgb(31 58 95 / 0.4);
  --titulos: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --texto: "Inter", "Segoe UI", system-ui, sans-serif;
  --alto-cabecera: 4.75rem;
  --ancho: 75rem;
  --margen: clamp(1.25rem, 4vw, 3rem);
  --suave: cubic-bezier(0.2, 0.6, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--alto-cabecera) + 1rem);
}

body {
  margin: 0;
  background: var(--papel);
  color: var(--azul);
  font-family: var(--texto);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--titulos);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--azul-medio);
  color: var(--papel);
}

:focus-visible {
  outline: 2px solid var(--azul-medio);
  outline-offset: 3px;
}

.marco {
  width: 100%;
  max-width: calc(var(--ancho) + 2 * var(--margen));
  margin-inline: auto;
  padding-inline: var(--margen);
}

.saltar {
  position: absolute;
  top: -5rem;
  left: var(--margen);
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--azul);
  color: var(--papel);
  text-decoration: none;
}

.saltar:focus {
  top: 0.75rem;
}

/* Lo que falta confirmar se ve como marcador, no como texto terminado. */
.por-confirmar {
  padding-inline: 0.25em;
  border-radius: 2px;
  background: rgb(143 176 217 / 0.35);
  color: var(--azul);
  font-style: normal;
}

/* Rótulos en mayúsculas: la etiqueta sobre los títulos y los nombres de campo. */
.etiqueta,
.bloque h3,
.datos dt {
  font-family: var(--texto);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.etiqueta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--azul-medio);
}

.etiqueta::before {
  content: "";
  flex: none;
  width: 1.75rem;
  height: 2px;
  background: currentColor;
}

/* Botones: azul EDESCO, como en el header del manual. */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.75rem 1.4rem;
  border: 1px solid var(--azul);
  border-radius: 2px;
  background: var(--azul);
  color: var(--papel);
  font: 600 1rem/1.2 var(--texto);
  text-decoration: none;
}

.boton:hover {
  border-color: var(--azul-medio);
  background: var(--azul-medio);
}

.boton-claro {
  border-color: var(--linea-fuerte);
  background: transparent;
  color: var(--azul);
}

.boton-claro:hover {
  border-color: var(--azul);
  background: rgb(31 58 95 / 0.06);
}

/* Cabecera: logo horizontal a color con descriptor, enlaces y botón a la derecha. */
.cabecera {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--linea);
  background: var(--papel);
}

.cabecera-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--alto-cabecera);
}

.logo img {
  width: auto;
  height: 3rem;
}

.menu ul {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.menu a:not(.boton) {
  display: block;
  padding-block: 0.4rem;
  background: linear-gradient(var(--azul-medio), var(--azul-medio)) no-repeat left bottom / 0 2px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.menu a:not(.boton):hover,
.menu a[aria-current]:not(.boton) {
  background-size: 100% 2px;
}

.menu a[aria-current]:not(.boton) {
  color: var(--azul-medio);
}

.menu .boton {
  min-height: 2.75rem;
  padding-block: 0.55rem;
  font-size: 0.9375rem;
}

.menu-boton {
  display: none;
}

@media (max-width: 59.99rem) {
  :root {
    --alto-cabecera: 4.25rem;
  }

  .logo img {
    height: 2.5rem;
  }

  /* Sin JavaScript (o si main.js no llega) el botón no abriría nada: los enlaces quedan en una fila
     bajo el logo. */
  .cabecera-in {
    flex-wrap: wrap;
    gap: 0 1.5rem;
    padding-block: 0.75rem;
  }

  .menu ul {
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
  }
}

/* Con main.js en marcha (pone .js en <html>), en celular y tableta el menú es un desplegable detrás
   del botón. Se ata a la clase y no a (scripting: enabled) para que, si el script no carga, el menú
   siga a la vista. */
@media (max-width: 59.99rem) {
  .js .cabecera-in {
    flex-wrap: nowrap;
    padding-block: 0;
  }

  .js .menu-boton {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--linea-fuerte);
    border-radius: 2px;
    background: none;
    color: var(--azul);
    font: 600 0.9375rem/1 var(--texto);
    cursor: pointer;
  }

  .js .menu {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    border-bottom: 1px solid var(--linea);
    background: var(--papel);
  }

  .js .menu:not(.abierto) {
    display: none;
  }

  .js .menu ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem var(--margen) 1.5rem;
  }

  .js .menu a:not(.boton) {
    padding-block: 0.7rem;
    background-position: left 85%;
    font-family: var(--titulos);
    font-size: 1.375rem;
    font-weight: 700;
  }

  .js .menu a:not(.boton):hover,
  .js .menu a[aria-current]:not(.boton) {
    background-size: 2.5rem 2px;
  }

  .js .menu-contacto {
    margin-top: 0.75rem;
  }

  .js .menu .boton {
    width: 100%;
  }
}

/* Portada */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--linea);
}

.curvas {
  position: absolute;
  top: 0;
  right: -62vw;
  z-index: -1;
  width: 130vw;
  aspect-ratio: 1;
  translate: 0 -18%;
  fill: none;
  stroke: var(--azul-medio);
  opacity: 0.4;
  mask-image: radial-gradient(closest-side, #000 50%, transparent);
}

.curvas path {
  vector-effect: non-scaling-stroke;
}

.curvas path:nth-child(4n) {
  stroke: var(--azul-claro);
  stroke-width: 2;
}

.hero-in {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(calc(100svh - var(--alto-cabecera)), 52rem);
  padding-block: clamp(4rem, 11vh, 8rem) clamp(5rem, 12vh, 8rem);
}

.hero h1 {
  max-width: 14em;
  margin-top: 1.5rem;
  font-size: clamp(2.25rem, 1.2rem + 4vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.hero-apoyo {
  max-width: 40rem;
  margin-top: 1.75rem;
  color: var(--texto-suave);
  font-size: clamp(1.0625rem, 0.95rem + 0.4vw, 1.25rem);
  line-height: 1.6;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.5rem;
}

/* Control de pausa del movimiento en bucle: solo se muestra si hay movimiento y JavaScript (ver el final). */
.pausa {
  display: none;
  position: absolute;
  right: var(--margen);
  bottom: 1.5rem;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.25rem;
  padding: 0.4rem 0.8rem 0.4rem 0.7rem;
  border: 1px solid var(--linea);
  border-radius: 2px;
  background: rgb(246 245 242 / 0.9);
  color: var(--azul);
  font: 600 0.8125rem/1 var(--texto);
  cursor: pointer;
}

.pausa:hover {
  border-color: var(--linea-fuerte);
}

.pausa::before {
  content: "";
  width: 0.6rem;
  height: 0.7rem;
  border-inline: 0.2rem solid currentColor;
}

.quieto .pausa::before {
  border: 0;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Secciones */
.seccion {
  padding-block: clamp(4.5rem, 9vw, 7.5rem);
}

.seccion + .seccion {
  border-top: 1px solid var(--linea);
}

.seccion-cabeza {
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.seccion-cabeza h2 {
  margin-top: 1rem;
}

.seccion-cabeza h2,
.contacto-in h2 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.875rem);
  line-height: 1.12;
}

.seccion-nota {
  max-width: 40rem;
  margin-top: 1.25rem;
  color: var(--texto-suave);
}

.entrada {
  font-size: clamp(1.125rem, 1rem + 0.45vw, 1.3125rem);
  line-height: 1.6;
}

.texto {
  max-width: 44rem;
  margin-top: 1.5rem;
  color: var(--texto-suave);
}

/* Quiénes somos */
.quienes {
  display: grid;
  gap: 0 4rem;
}

.mision-vision {
  display: grid;
  gap: 0 3rem;
  margin-top: 2.5rem;
}

.bloque {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding-block: 1.5rem 1.75rem;
  border-top: 2px solid var(--azul);
}

.bloque h3 {
  color: var(--azul-medio);
}

.bloque p {
  color: var(--texto-suave);
}

/* Líneas y clientes: rejilla de bloques con filete arriba */
.lineas,
.entidades {
  display: grid;
  gap: 0 3rem;
}

.linea,
.entidad {
  position: relative;
  padding-block: 1.5rem 1.75rem;
  border-top: 1px solid var(--linea);
}

.linea::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 3rem;
  height: 3px;
  background: var(--azul-medio);
  transform-origin: left;
}

.linea h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  line-height: 1.25;
}

.entidad,
.datos dd {
  font-family: var(--titulos);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* Proyectos */
.proyectos {
  border-bottom: 1px solid var(--linea);
}

.proyecto {
  display: grid;
  grid-template-areas: "entidad" "titulo";
  gap: 0.5rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--linea);
}

.proyecto-titulo {
  grid-area: titulo;
  font-family: var(--texto);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
}

.proyecto-entidad {
  grid-area: entidad;
  color: var(--azul-medio);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Territorio: fondo azul noche, acento azul claro */
.territorio {
  background: var(--azul-noche);
  color: var(--papel);
}

.territorio .etiqueta {
  color: var(--azul-claro);
}

.territorio-in {
  display: grid;
  gap: 2.5rem 4rem;
  align-items: end;
}

.territorio h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 1.25rem;
  margin-top: 1.5rem;
  font-size: clamp(1.75rem, 1.2rem + 2.4vw, 3rem);
  line-height: 1.1;
}

.cifra {
  color: var(--azul-claro);
  font-size: clamp(6rem, 3rem + 12vw, 11rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.territorio-texto {
  max-width: 30rem;
  color: var(--papel-suave);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
}

/* Contacto */
.contacto-in {
  display: grid;
  gap: 2.5rem 5rem;
  align-items: end;
}

.contacto-in .acciones {
  margin-top: 2rem;
}

.datos {
  border-top: 1px solid var(--linea);
}

.datos div {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--linea);
}

.datos dt {
  color: var(--azul-medio);
}

.datos dd {
  overflow-wrap: anywhere;
}

.datos a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

/* Pie: azul noche con el logo en blanco, como pide el manual para fondos oscuros. */
.pie {
  padding-block: 3rem;
  background: var(--azul-noche);
  color: var(--papel-suave);
  font-size: 0.9375rem;
}

.pie-in {
  display: grid;
  gap: 1.5rem 3rem;
}

.pie img {
  width: auto;
  height: 2.75rem;
}

.pie a {
  justify-self: start;
  color: var(--papel);
  text-underline-offset: 0.22em;
}

/* Página 404 */
.aviso {
  display: grid;
  align-content: center;
  gap: 1.5rem;
  min-height: calc(100svh - var(--alto-cabecera));
  padding-block: 4rem;
}

.aviso h1 {
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
  line-height: 1.08;
}

.aviso p:not(.etiqueta) {
  max-width: 34rem;
  color: var(--texto-suave);
}

/* Anchos */
@media (min-width: 48rem) {
  .lineas,
  .entidades,
  .mision-vision {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pie-in {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
}

@media (min-width: 60rem) {
  body {
    font-size: 1.0625rem;
  }

  .curvas {
    top: 50%;
    right: -16rem;
    width: min(66rem, 80vw);
    translate: 0 -50%;
  }

  .quienes {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  }

  .proyecto {
    grid-template-areas: "entidad titulo";
    grid-template-columns: 17rem minmax(0, 1fr);
    gap: 2.5rem;
    align-items: baseline;
  }

  .territorio-in,
  .contacto-in {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .entidades {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Movimiento: solo si la persona no pidió reducirlo. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .boton,
  .pausa {
    transition: background-color 0.25s, border-color 0.25s, color 0.25s;
  }

  .menu a:not(.boton) {
    transition: background-size 0.35s var(--suave), color 0.25s;
  }

  /* Las curvas se dibujan una vez y luego el relieve respira despacio, en bucle. El bucle va atado a
     .animar (lo pone main.js), igual que el control de pausa: sin script, no hay bucle sin pausa. */
  .animar .curvas {
    animation: respirar 16s ease-in-out infinite alternate;
  }

  .curvas path {
    stroke-dasharray: 1;
    animation: dibujar 2.4s cubic-bezier(0.3, 0.1, 0.2, 1) both;
  }

  .curvas path:nth-child(2) { animation-delay: 0.08s; }
  .curvas path:nth-child(3) { animation-delay: 0.16s; }
  .curvas path:nth-child(4) { animation-delay: 0.24s; }
  .curvas path:nth-child(5) { animation-delay: 0.32s; }
  .curvas path:nth-child(6) { animation-delay: 0.4s; }
  .curvas path:nth-child(7) { animation-delay: 0.48s; }
  .curvas path:nth-child(8) { animation-delay: 0.56s; }
  .curvas path:nth-child(9) { animation-delay: 0.64s; }
  .curvas path:nth-child(10) { animation-delay: 0.72s; }
  .curvas path:nth-child(11) { animation-delay: 0.8s; }
  .curvas path:nth-child(12) { animation-delay: 0.88s; }

  .quieto .curvas {
    animation-play-state: paused;
  }

  @keyframes dibujar {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
  }

  @keyframes respirar {
    from { transform: scale(1) rotate(0deg); }
    to { transform: scale(1.04) rotate(2deg); }
  }

  /* La portada aparece al cargar, con el titular primero. */
  .hero h1 {
    animation: aparecer 1.2s var(--suave) both;
  }

  .hero-in > :not(h1, .pausa) {
    animation: aparecer 1s var(--suave) 0.3s both;
  }

  @keyframes aparecer {
    from { opacity: 0; transform: translateY(0.75rem); }
    to { opacity: 1; transform: none; }
  }

  /* Revelados al bajar: main.js pone .animar en <html> y .visto en cada bloque al entrar en pantalla. */
  .animar .revelar {
    transition: opacity 0.9s var(--suave), transform 0.9s var(--suave);
  }

  .animar .revelar:not(.visto) {
    opacity: 0;
    transform: translateY(1.25rem);
  }

  .animar .linea::before {
    transition: transform 0.9s cubic-bezier(0.6, 0, 0.2, 1) 0.25s;
  }

  .animar .linea:not(.visto)::before {
    transform: scaleX(0);
  }

  .animar .revelar:nth-child(2) { transition-delay: 0.08s; }
  .animar .revelar:nth-child(3) { transition-delay: 0.16s; }
}

/* El control de pausa aparece junto con el bucle: los dos dependen de .animar. */
@media (prefers-reduced-motion: no-preference) {
  .animar .pausa {
    display: inline-flex;
  }
}
