/* Capa de refinamiento sobre la versión 13. Se carga después de las demás hojas.
   No cambia contenido ni estructura: quitar su <link> devuelve el sitio al estado anterior. */

/* Archivo variable, auto-alojada (SIL OFL 1.1, ver fonts/ARCHIVO-OFL.txt). No se pide nada a servidores externos. */
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/archivo-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
                 U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/archivo-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
                 U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Arial ajustada a las proporciones de Archivo: mientras carga la fuente el texto casi no se mueve. */
@font-face {
  font-family: "Archivo Fallback"; src: local("Arial");
  size-adjust: 102.3%; ascent-override: 85.8%; descent-override: 20.5%; line-gap-override: 0%;
}

:root {
  --link: #00719a;                 /* medio tono más oscuro: cumple AA también sobre los fondos teñidos */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radius-control: 8px;
  --radius-card: 12px;
  accent-color: var(--action);
}

/* ---------- Superficies del navegador ---------- */
html { -webkit-text-size-adjust: 100%; scrollbar-color: #a3bec8 #f1f7f8; scrollbar-gutter: stable; }
html:has(dialog[open]) { overflow: hidden; }
::selection { background: rgba(0, 136, 188, 0.22); color: var(--ink); }
.hero ::selection, .topbar ::selection, footer ::selection { background: rgba(164, 217, 134, 0.38); color: #fff; }
a { text-decoration-thickness: 0.08em; }
a:focus-visible, button:focus-visible, summary:focus-visible, video:focus-visible { outline-offset: 3px; border-radius: 4px; }
.hero :focus-visible, .topbar :focus-visible, footer :focus-visible { outline-color: #9ed2e1; }

/* ---------- Tipografía ---------- */
body { font-family: "Archivo", "Archivo Fallback", system-ui, -apple-system, "Segoe UI", sans-serif; text-rendering: optimizeLegibility; font-kerning: normal; }
h2 { letter-spacing: -0.025em; }
.hero h1 { letter-spacing: -0.03em; line-height: 1.1; }
.gateways h2, .video-copy h3, .service h3 { letter-spacing: -0.015em; }
.intro p { max-width: 65ch; margin-inline: auto; }
.corporate-copy p, .section-heading > p, .contact > div:first-child p { max-width: 65ch; }

/* Piso de tamaño para texto de apoyo: nada con información por debajo de 11,5 px. */
.eyebrow { font-size: 12px; letter-spacing: 0.14em; font-weight: 700; }
.topbar { font-size: 12px; }
nav a { font-size: 13px; }
.gateway-number, .service b, .coverage-label, .gallery-grid figcaption span { font-size: 11.5px; }
.hero-caption span, .hero-counter { font-size: 12px; }
.trust { font-size: 13px; }
.corporate-image figcaption, .coverage-map figcaption, .client-logo figcaption,
.video-meta, .project-note, .footer-bottom { font-size: 12px; }
.gallery-grid figcaption { font-size: 13px; }
.footer-grid > div > a:not(.footer-brand) { font-size: 13px; }
.territory-statbar strong, .hero-counter, .gateway-number, .service b, .papers small, .video-meta {
  font-variant-numeric: tabular-nums;
}

/* ---------- Radios y elevación: una sola escala ---------- */
.button, nav .nav-cta, .mobile-menu summary, .dialog-header button, .map-close { border-radius: var(--radius-control); }
.service, .video-card, .client-logo, .contact > div:last-child, .corporate-image img, .gallery-grid a {
  border-radius: var(--radius-card);
}
.gallery-dialog, .map-dialog { border-radius: 16px; }
.coverage-map { box-shadow: none; }

/* La ficha del director deja la franja lateral y pasa a ser una tarjeta completa. */
.director { border: 1px solid var(--line); border-radius: var(--radius-card); }

/* ---------- Controles: respuesta al toque ---------- */
.button, nav .nav-cta, .floating, .hero-controls button, .dialog-header button, .map-close, .map-enlarge,
.mobile-menu summary, .measurement-actions button {
  touch-action: manipulation;
  transition: background-color 0.18s var(--ease-out), border-color 0.18s var(--ease-out),
              color 0.18s var(--ease-out), transform 0.16s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.floating { transition: background-color 0.18s var(--ease-out), transform 0.16s var(--ease-out), box-shadow 0.2s var(--ease-out), opacity 0.2s var(--ease-out), visibility 0.2s; }
.button:active, nav .nav-cta:active, .floating:active, .hero-controls button:active,
.dialog-header button:active, .map-close:active, .mobile-menu summary:active { transform: scale(0.97); }
.dialog-header button, .map-close { min-height: 44px; }

.service { transition: border-color 0.2s var(--ease-out), background-color 0.2s var(--ease-out), transform 0.2s var(--ease-out); }
.gateways > a, .papers > a, .faq summary, .footer-grid a, nav a { transition: background-color 0.2s var(--ease-out), color 0.15s var(--ease-out); }
.gallery-grid img { transition: transform 0.5s var(--ease-out); }
.gallery-open, .map-open { cursor: zoom-in; }

@media (hover: hover) and (pointer: fine) {
  .service:hover { background: #fff; border-color: #9cc3d0; transform: translateY(-2px); }
  .gallery-grid a:hover img { transform: scale(1.035); }
  .faq summary:hover { color: var(--link); }
  .footer-grid > div > a:not(.footer-brand):hover, .footer-bottom a:hover { color: #fff; }
  .floating:hover { background: #356224; transform: translateY(-1px); box-shadow: 0 10px 26px rgba(42, 84, 28, 0.34); }
}
/* En pantallas táctiles el hover se queda pegado tras el toque: se neutraliza donde más se nota. */
@media (hover: none) {
  .gateways > a:hover { background: transparent; }
  .gallery-grid a:hover img { transform: none; }
  .service:hover { border-color: var(--line); }
}

nav a[aria-current] { color: var(--link); }
nav .nav-cta[aria-current] { color: #fff; }

.floating {
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  box-shadow: 0 6px 20px rgba(42, 84, 28, 0.28);
}
/* Mientras el botón flotante taparía los controles del carrusel, se retira (lo decide refine.js). */
.floating.is-tucked { opacity: 0; visibility: hidden; pointer-events: none; }

/* ---------- Portada ---------- */
.hero { touch-action: pan-y; }
/* El titular tiene 2 o 3 líneas según la imagen: anclado abajo, los botones no saltan al cambiar. */
.hero-inner { align-items: flex-end; padding-top: 56px; }
.hero-slide { transform: scale(1.06); transition: opacity 1s ease, transform 0s linear 1s; }
.hero-slide.is-active { transform: scale(1); transition: opacity 1s ease, transform 7s cubic-bezier(0.2, 0.6, 0.3, 1); }

.hero-controls { -webkit-user-select: none; user-select: none; }
.hero-controls button { position: relative; }
.hero-controls button::after { content: ""; position: absolute; inset: -6px; }   /* área táctil de 46 px */
.hero-controls .hero-dot::after { inset: -7px 0; }

/* Iconos dibujados en lugar de glifos de texto; el nombre accesible sigue en aria-label. */
.hero-controls .hero-prev, .hero-controls .hero-next, .hero-controls .hero-pause { font-size: 0; }
.hero-prev::before, .hero-next::before {
  content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 0 1.75px 1.75px;
  transform: translateX(1.5px) rotate(45deg);
}
.hero-next::before { transform: translateX(-1.5px) rotate(-135deg); }
.hero-pause::before { content: ""; width: 9px; height: 11px; border-inline: 2.5px solid currentColor; }
.hero-pause[aria-label^="Reanudar"]::before {
  width: 0; height: 0; border-block: 6px solid transparent; border-inline: 0 solid transparent;
  border-left: 10px solid currentColor; transform: translateX(1.5px);
}
.hero-dot::before { margin: auto; transition: width 0.3s var(--ease-out), background-color 0.2s var(--ease-out); }
.hero-dot[aria-pressed="true"]::before { width: 18px; border-radius: 4px; }

/* ---------- Preguntas frecuentes ---------- */
.faq summary::before, .faq summary::after {
  content: ""; position: absolute; right: 6px; top: 0.62em; width: 14px; height: 2px;
  border-radius: 1px; background: var(--link); font-size: 0;
  transition: transform 0.28s var(--ease-out), opacity 0.2s var(--ease-out);
}
.faq summary::before { transform: rotate(90deg); }
.faq details[open] summary::before { transform: rotate(0deg); opacity: 0; }
.faq details[open] summary::after { content: ""; }

@supports (interpolate-size: allow-keywords) {
  .faq details { interpolate-size: allow-keywords; }
  .faq details::details-content {
    block-size: 0; overflow: clip; opacity: 0;
    transition: block-size 0.28s var(--ease-out), opacity 0.22s var(--ease-out), content-visibility 0.28s allow-discrete;
  }
  .faq details[open]::details-content { block-size: auto; opacity: 1; }
}

/* ---------- Diálogos de galería y mapa ---------- */
.gallery-dialog, .map-dialog, .map-dialog-scroll { overscroll-behavior: contain; }
.gallery-dialog, .map-dialog {
  opacity: 0; transform: translateY(8px) scale(0.97);
  transition: opacity 0.2s var(--ease-out), transform 0.24s var(--ease-out),
              overlay 0.24s allow-discrete, display 0.24s allow-discrete;
}
.gallery-dialog[open], .map-dialog[open] { opacity: 1; transform: none; }
.gallery-dialog::backdrop, .map-dialog::backdrop {
  opacity: 0; transition: opacity 0.24s ease, overlay 0.24s allow-discrete, display 0.24s allow-discrete;
}
.gallery-dialog[open]::backdrop, .map-dialog[open]::backdrop { opacity: 1; }
@starting-style {
  .gallery-dialog[open], .map-dialog[open] { opacity: 0; transform: translateY(8px) scale(0.97); }
  .gallery-dialog[open]::backdrop, .map-dialog[open]::backdrop { opacity: 0; }
}

/* ---------- Menú móvil ---------- */
@media (max-width: 950px) {
  .mobile-menu nav { overscroll-behavior: contain; transform-origin: top right; border-radius: 0 0 var(--radius-card) var(--radius-card); }
  .mobile-menu[open] nav { animation: menu-in 0.22s var(--ease-out); }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }

/* ---------- Movimiento ligado al scroll (solo donde el navegador lo soporta) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    header { animation: header-lift linear both; animation-timeline: scroll(root); animation-range: 0 140px; }
    .gallery-grid figure, .video-card, .corporate-image, .coverage-map {
      animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%;
    }
  }
}
@keyframes header-lift { to { box-shadow: 0 8px 26px rgba(16, 51, 65, 0.09); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

@media (prefers-reduced-motion: reduce) {
  .hero-slide, .hero-slide.is-active { transform: none; transition: none; }
  .gallery-dialog, .map-dialog, .gallery-dialog::backdrop, .map-dialog::backdrop { transition: none; }
  .mobile-menu[open] nav { animation: none; }
  .button:active, nav .nav-cta:active, .floating:active, .hero-controls button:active { transform: none; }
}

@media (max-width: 700px) {
  .eyebrow { font-size: 11.5px; }
  .trust { font-size: 12px; }
  .gallery-grid figcaption { font-size: 12px; }
}

/* En pantallas angostas la primera imagen tiene el texto más largo: se reserva su alto
   para que la página no se mueva al rotar el carrusel. */
.hero, .hero-inner { min-height: 664px; }
@media (max-width: 392px) { .hero, .hero-inner { min-height: 704px; } }
@media (max-width: 339px) { .hero, .hero-inner { min-height: 812px; } }

/* Clientes como franja de confianza justo debajo de la portada. */
.clients { padding-top: 56px; padding-bottom: 56px; border-bottom: 1px solid var(--line); }
.clients .intro { margin-bottom: 28px; }
@media (min-width: 951px) {
  .client-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
  .client-logo { padding: 16px 12px; }
  .client-logo > div { height: 72px; }
  .client-logo img { max-height: 64px; }
  .client-logo figcaption { margin-top: 10px; }
}
@media (max-width: 700px) {
  .clients { padding-top: 44px; padding-bottom: 44px; }
  .client-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .client-logo { padding: 12px 8px; }
  .client-logo > div { height: 52px; }
  .client-logo img { max-height: 48px; }
  .client-logo figcaption { margin-top: 8px; }
}

/* Retrato del director junto a su ficha. */
.director { display: grid; grid-template-columns: 128px minmax(0, 1fr); column-gap: 24px; align-items: start; }
.director-photo { grid-row: 1 / span 3; width: 128px; height: 128px; border-radius: var(--radius-card); object-fit: cover; object-position: 50% 18%; }
.director > .director-id, .director > p { grid-column: 2; }
.director-id p { margin-top: 4px; }
.director > p:last-child { margin-bottom: 0; }
@media (max-width: 1180px) {
  .director { grid-template-columns: 104px minmax(0, 1fr); column-gap: 20px; }
  .director-photo { grid-row: 1; width: 104px; height: 104px; }
  .director-id { align-self: center; }
  .director > p { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .director { grid-template-columns: 84px minmax(0, 1fr); column-gap: 16px; padding: 20px; }
  .director-photo { width: 84px; height: 84px; }
}

/* Solicitud de cotización: arma el mensaje y lo abre en WhatsApp o en el correo. */
.contact { align-items: start; }
.quote { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 24px; max-width: 640px; }
.quote label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.quote-wide, .quote-actions, .contact .quote-note { grid-column: 1 / -1; }
.quote input, .quote select, .quote textarea {
  width: 100%; min-height: 46px; padding: 11px 12px;
  font: inherit; font-size: 16px; font-weight: 400; color: var(--ink);
  background: #fff; border: 1px solid #b9cdd4; border-radius: var(--radius-control);
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.quote textarea { min-height: 92px; resize: vertical; }
.quote input::placeholder { color: #7d949d; }
.quote :is(input, select, textarea):focus-visible { outline: none; border-color: var(--link); box-shadow: 0 0 0 3px rgba(0, 113, 154, 0.22); }
.quote-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.quote-actions .button { margin: 0; }
.contact .quote-note { margin: 0; font-size: 12.5px; }
@media (max-width: 560px) {
  .quote { grid-template-columns: 1fr; }
  .quote-actions .button { flex: 1 1 100%; }
}

/* Casos de estudio con figura, problema, trabajo y resultado. */
.cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.case { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-card); }
.case-figure { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: #fff; border-bottom: 1px solid var(--line); cursor: zoom-in; }
.case-figure img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform 0.5s var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .case-figure:hover img { transform: scale(1.03); } }
.case-body { padding: 24px 26px 28px; }
.case-featured { scroll-margin-top: 110px; }
.case-featured .case-figure {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  aspect-ratio: auto;
  padding: clamp(14px, 2vw, 28px);
  background: var(--wash);
}
.case-featured .case-figure img {
  height: auto;
  border-radius: 8px;
}
.case-featured .case-body { min-width: 0; }
.case-featured h3 { font-size: clamp(22px, 2vw, 30px); }
@media (min-width: 851px) {
  .case-featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }
  .case-featured .case-figure { border-bottom: 0; border-right: 1px solid var(--line); }
  .case-featured .case-body { padding: clamp(24px, 2.5vw, 38px); }
}
.case-place { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--link); }
.case h3 { margin: 8px 0 18px; font-size: 21px; line-height: 1.25; letter-spacing: -0.015em; text-wrap: balance; }
.case dl { display: grid; gap: 14px; margin: 0; }
.case dt { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }
.case dd { margin: 3px 0 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.case-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 0; padding: 0; list-style: none; }
.case-tools li { padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--wash); border-radius: 999px; }
@media (max-width: 850px) {
  .cases { grid-template-columns: 1fr; gap: 20px; }
  .case-body { padding: 20px 20px 24px; }
}

/* Tarjetas de clientes: acceso a sus sitios oficiales. */
.client-link { display: block; position: relative; color: inherit; text-decoration: none; border-radius: var(--radius-card); touch-action: manipulation; }
.client-link .client-logo { height: 100%; background: #fff; transition: transform .2s var(--ease-out), border-color .2s, background-color .2s, box-shadow .2s; }
.client-link img { transition: transform .2s var(--ease-out); }
.client-external { position: absolute; top: 10px; right: 12px; color: var(--link); font-size: 16px; line-height: 1; opacity: .55; transition: opacity .2s; }
.client-link:focus-visible { outline: 3px solid var(--link); outline-offset: 4px; }
.client-link:focus-visible .client-logo { border-color: var(--link); background: var(--wash); }
.client-link:focus-visible .client-external { opacity: 1; }
@media (hover: hover) {
  .client-link:hover .client-logo { transform: translateY(-4px); border-color: var(--link); background: var(--wash); box-shadow: 0 10px 24px rgba(18, 54, 68, .09); }
  .client-link:hover img { transform: scale(1.04); }
  .client-link:hover .client-external { opacity: 1; }
}
.client-link:active .client-logo { border-color: var(--link); background: var(--wash); }
@media (prefers-reduced-motion: reduce) {
  .client-link .client-logo, .client-link img, .client-external { transition: none; }
  .client-link:hover .client-logo, .client-link:hover img { transform: none; }
}
