/* =========================================================
 * modern.css — Horizon Extranjería
 * Capa de modernización visual aplicada a TODO el sitio.
 *
 * Orden de carga:
 *   - Páginas legacy (index, blog, nosotros…): se enlaza justo antes de
 *     </head>, DESPUÉS de su <style> inline. Así gana los empates de
 *     especificidad sin reescribir las 1.300 líneas de CSS de index.html.
 *   - Páginas con componentes (blog/*, reservas…): se enlaza dentro de
 *     head-common, después del critical CSS pero ANTES del <style> propio
 *     de la página. Es deliberado: el diseño específico de un artículo
 *     (.article-hero, .cta-box…) debe poder mandar sobre la capa global,
 *     y de hecho lo hace por especificidad de clase en cualquier orden.
 *
 * Regla de oro al editar este archivo:
 *   - Nada de !important salvo para vencer a un style="" inline.
 *   - Todo color sale de tokens.css. Cero hex sueltos.
 * ========================================================= */

/* ---------------------------------------------------------
 * 1. Tokens de la capa moderna
 * ------------------------------------------------------- */
:root {
  /* Tipografía display */
  --font-display-modern: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont,
                         "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Escala tipográfica fluida (min 360px → max 1200px) */
  --fs-xs:   clamp(0.76rem, 0.74rem + 0.10vw, 0.82rem);
  --fs-sm:   clamp(0.87rem, 0.84rem + 0.15vw, 0.95rem);
  --fs-base: clamp(1.00rem, 0.97rem + 0.17vw, 1.09rem);
  --fs-lg:   clamp(1.13rem, 1.07rem + 0.28vw, 1.28rem);
  --fs-xl:   clamp(1.35rem, 1.24rem + 0.50vw, 1.65rem);
  --fs-2xl:  clamp(1.65rem, 1.44rem + 0.95vw, 2.25rem);
  --fs-3xl:  clamp(2.00rem, 1.62rem + 1.70vw, 3.05rem);
  --fs-4xl:  clamp(2.35rem, 1.75rem + 2.65vw, 3.85rem);

  /* Sombras en capas — más realistas que una sola sombra plana */
  --sh-xs: 0 1px 2px rgba(16, 24, 32, .05);
  --sh-sm: 0 1px 2px rgba(16, 24, 32, .05), 0 2px 6px rgba(16, 24, 32, .04);
  --sh-md: 0 2px 4px rgba(16, 24, 32, .05), 0 8px 20px rgba(16, 24, 32, .07);
  --sh-lg: 0 4px 8px rgba(16, 24, 32, .05), 0 16px 40px rgba(16, 24, 32, .10);
  --sh-xl: 0 8px 16px rgba(16, 24, 32, .06), 0 28px 64px rgba(16, 24, 32, .14);

  /* Sombra tintada de marca, para elementos verdes/dorados */
  --sh-brand: 0 6px 20px rgba(52, 78, 65, .22);
  --sh-gold:  0 6px 20px rgba(218, 183, 73, .32);

  /* Radios */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  /* Superficies derivadas */
  --surface-tint:   #f6f8f6;
  --surface-sunken: #eef2ef;
  --hairline:       rgba(52, 78, 65, .10);

  /* Gradientes de marca */
  --grad-brand: linear-gradient(135deg, #3d5c4c 0%, #2a3d34 100%);
  --grad-gold:  linear-gradient(135deg, #e3c766 0%, #c8a845 100%);

  /* Curva de animación */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

/* ---------------------------------------------------------
 * 2. Tipografía global
 * ------------------------------------------------------- */
body {
  font-size: var(--fs-base);
  line-height: 1.68;
  letter-spacing: -0.003em;
  text-wrap: pretty;
}

h1, h2, h3, h4, h5, h6,
.card-titulo, .hero-enhanced h1 {
  font-family: var(--font-display-modern);
  letter-spacing: -0.022em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); font-weight: 800; line-height: 1.12; }
h2 { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.20; }
h3 { font-size: var(--fs-xl);  font-weight: 700; line-height: 1.28; }
h4 { font-size: var(--fs-lg);  font-weight: 700; line-height: 1.35; }

/* El logo del header NO es un encabezado semántico: es marca.
   Se mantiene el tamaño visual anterior pese a la escala nueva. */
.logo-container .logo-text,
.logo-container h1 {
  font-size: clamp(1.05rem, .92rem + .55vw, 1.42rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0;
  color: var(--color-verde, #344e41);
}

/* ---------------------------------------------------------
 * 3. Header — sticky con desenfoque
 * ------------------------------------------------------- */
header {
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--hairline);
  box-shadow: var(--sh-xs);
  transition: box-shadow .25s var(--ease-out), background .25s var(--ease-out);
}

/* mejoras.js añade .hz-scrolled al bajar; si no existe, no pasa nada */
header.hz-scrolled {
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--sh-md);
}

@supports not (backdrop-filter: blur(1px)) {
  header { background: #fff; }
}

nav a {
  position: relative;
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: -0.01em;
}

/* Subrayado animado en la navegación (solo escritorio) */
@media (min-width: 769px) {
  nav ul li > a:not(.cta-button):not(.btn)::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: var(--color-dorado, #dab749);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .28s var(--ease-out);
  }
  nav ul li > a:not(.cta-button):not(.btn):hover::after,
  nav ul li > a[aria-current="page"]::after { transform: scaleX(1); }
}

/* ---------------------------------------------------------
 * 4. Botones
 * ------------------------------------------------------- */
.btn,
.cta-button,
.btn-blog-all,
button.hz-btn {
  font-family: var(--font-display-modern);
  font-weight: 700;
  letter-spacing: -0.01em;
  border-radius: var(--r-md);
  transition: transform .22s var(--ease-out),
              box-shadow .22s var(--ease-out),
              background .22s var(--ease-out);
  will-change: transform;
}

.btn-primary,
.cta-button {
  background: var(--grad-gold);
  color: var(--color-verde, #344e41);
  box-shadow: var(--sh-gold);
  border: none;
}

.btn-primary:hover,
.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(218, 183, 73, .42);
  color: var(--color-verde, #344e41);
}

.btn-primary:active,
.cta-button:active { transform: translateY(0); }

.btn-whatsapp {
  background: linear-gradient(135deg, #2ee071, #21b757);
  box-shadow: 0 6px 20px rgba(37, 211, 102, .34);
  border: none;
}
.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 211, 102, .45);
}

.btn-blog-all:hover { background: var(--color-verde-oscuro, #2a3d34); }

/* ---------------------------------------------------------
 * 5. Tarjetas
 * ------------------------------------------------------- */
.articulo-card,
.service-card,
.guide-card,
.testimonial-card,
.blog-card-link,
.hz-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  transition: transform .3s var(--ease-out),
              box-shadow .3s var(--ease-out),
              border-color .3s var(--ease-out);
}

.articulo-card:hover,
.service-card:hover,
.guide-card:hover,
.blog-card-link:hover,
.hz-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--sh-lg);
  border-color: rgba(218, 183, 73, .45);
}

/* La imagen de cabecera de la tarjeta hace un zoom sutil */
.articulo-card .card-imagen,
.blog-card-link > div:first-child {
  position: relative;
  overflow: hidden;
}

.articulo-card .card-imagen::after,
.blog-card-link > div:first-child::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 50% 0%,
              rgba(255, 255, 255, .16) 0%, transparent 60%);
  pointer-events: none;
}

.articulo-card .card-imagen-icon {
  transition: transform .35s var(--ease-out);
}
.articulo-card:hover .card-imagen-icon {
  transform: scale(1.12) rotate(-4deg);
}

.card-titulo {
  font-size: var(--fs-lg);
  font-weight: 800;
  line-height: 1.32;
}

.card-categoria {
  border-radius: var(--r-xl);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: .02em;
}

.card-enlace {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.card-enlace i { transition: transform .25s var(--ease-out); }
.card-enlace:hover i { transform: translateX(4px); }

/* ---------------------------------------------------------
 * 6. Secciones y ritmo vertical
 * ------------------------------------------------------- */
section { position: relative; }

section > .container > h2,
section > .container > h3 {
  letter-spacing: -0.028em;
}

/* Filete dorado bajo los títulos de sección centrados */
.services h3::after,
.guides h3::after,
.testimonials h3::after,
.contact h3::after {
  content: "";
  display: block;
  width: 62px;
  height: 4px;
  border-radius: 4px;
  margin: 18px auto 0;
  background: var(--grad-gold);
}

/* Fondo alterno más suave que el #f9f9f9 plano */
.hz-section-tint { background: var(--surface-tint); }

/* ---------------------------------------------------------
 * 7. Hero
 * ------------------------------------------------------- */
.hero-enhanced,
.hz-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* Malla de color sutil detrás del hero */
.hero-enhanced::before,
.hz-hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 140%;
  z-index: -1;
  background:
    radial-gradient(48% 46% at 82% 14%, rgba(218, 183, 73, .20) 0%, transparent 70%),
    radial-gradient(46% 44% at 12% 82%, rgba(74, 158, 106, .16) 0%, transparent 70%);
  pointer-events: none;
}

.hero-enhanced h1,
.hz-hero h1 {
  font-size: var(--fs-4xl);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.032em;
}

/* ---------------------------------------------------------
 * 8. Píldoras de confianza
 * ------------------------------------------------------- */
.trust-badges {
  background: var(--surface-tint);
  border-block: 1px solid var(--hairline);
}

.hz-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .42rem .95rem;
  border-radius: var(--r-xl);
  background: rgba(52, 78, 65, .07);
  border: 1px solid var(--hairline);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--color-verde, #344e41);
  letter-spacing: -.005em;
}

.hz-pill-gold {
  background: rgba(218, 183, 73, .16);
  border-color: rgba(218, 183, 73, .35);
}

/* ---------------------------------------------------------
 * 9. Franja de estadísticas
 * ------------------------------------------------------- */
.hz-stats-strip {
  border-radius: var(--r-lg);
  border: 1px solid var(--hairline);
  box-shadow: var(--sh-md);
  overflow: hidden;
  background: var(--bg-card, #fff);
}

.hz-stat-num {
  font-family: var(--font-display-modern);
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--color-verde, #344e41);
}

/* El degradado sobre el texto solo donde background-clip:text funciona.
   Sin este guardia, un WebView antiguo de Android aplicaria el
   color:transparent sin recortar el fondo y los numeros (5.000+, 8 anos,
   95%, 4,9) se verian INVISIBLES. Parte del publico de este sitio navega
   desde moviles antiguos, asi que el degradado va como mejora opcional. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .hz-stat-num {
    background: var(--grad-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.hz-stat-lbl {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text-muted, #6b7280);
}

/* ---------------------------------------------------------
 * 10. Formularios
 * ------------------------------------------------------- */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
  font-family: inherit;
  font-size: var(--fs-base);
  padding: .85rem 1rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border-soft, #e5e7eb);
  background: var(--bg-card, #fff);
  color: var(--text-base, #333);
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-verde, #344e41);
  box-shadow: 0 0 0 4px rgba(52, 78, 65, .12);
}

input::placeholder,
textarea::placeholder { color: #9aa3ad; }

/* ---------------------------------------------------------
 * 11. Cuerpo de artículo (prosa legible)
 * ------------------------------------------------------- */
.articulo-contenido,
.hz-prose {
  font-size: clamp(1.04rem, 1rem + .22vw, 1.15rem);
  line-height: 1.78;
  color: #2f3742;
}

.articulo-contenido > p,
.hz-prose > p { margin-bottom: 1.35em; }

.articulo-contenido h2,
.hz-prose h2 {
  margin-top: 2.4em;
  margin-bottom: .7em;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hairline);
}

.articulo-contenido h3,
.hz-prose h3 { margin-top: 1.9em; margin-bottom: .55em; }

.articulo-contenido ul,
.articulo-contenido ol,
.hz-prose ul,
.hz-prose ol { margin: 0 0 1.35em; padding-left: 1.3em; }

.articulo-contenido li,
.hz-prose li { margin-bottom: .55em; }

/* Enlaces dentro del texto: visibles sin ser ruidosos */
.articulo-contenido a:not(.btn):not(.cta-button),
.hz-prose a:not(.btn):not(.cta-button) {
  color: var(--color-verde, #344e41);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(218, 183, 73, .65);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: text-decoration-color .2s, color .2s;
}
.articulo-contenido a:not(.btn):not(.cta-button):hover,
.hz-prose a:not(.btn):not(.cta-button):hover {
  color: var(--color-verde-oscuro, #2a3d34);
  text-decoration-color: var(--color-dorado, #dab749);
}

/* Cita destacada */
.hz-callout {
  margin: 2rem 0;
  padding: 1.35rem 1.5rem;
  border-radius: var(--r-md);
  border-left: 4px solid var(--color-dorado, #dab749);
  background: var(--surface-tint);
  box-shadow: var(--sh-xs);
}
.hz-callout > :last-child { margin-bottom: 0; }

.hz-callout-alerta {
  border-left-color: var(--color-urgente, #dc3545);
  background: #fff5f5;
}

.hz-callout-clave {
  border-left-color: var(--color-verde-claro, #4a9e6a);
  background: #f2f9f5;
}

/* Tablas: legibles y con scroll propio en móvil */
.hz-tabla-wrap {
  overflow-x: auto;
  margin: 1.8rem 0;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  box-shadow: var(--sh-xs);
  -webkit-overflow-scrolling: touch;
}

.hz-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  background: var(--bg-card, #fff);
}

.hz-tabla th {
  background: var(--grad-brand);
  color: #fff;
  font-family: var(--font-display-modern);
  font-weight: 700;
  text-align: left;
  padding: .85rem 1rem;
  white-space: nowrap;
}

.hz-tabla td {
  padding: .8rem 1rem;
  border-top: 1px solid var(--border-soft, #e5e7eb);
  vertical-align: top;
}

.hz-tabla tbody tr:nth-child(even) { background: var(--surface-tint); }

/* ---------------------------------------------------------
 * 12. Footer
 * ------------------------------------------------------- */
footer {
  background:
    radial-gradient(80% 120% at 50% 0%, #23292b 0%, #16191a 100%);
  border-top: 3px solid transparent;
  border-image: var(--grad-gold) 1;
}

footer h4 {
  font-family: var(--font-display-modern);
  font-size: var(--fs-sm);
  letter-spacing: .08em;
}

footer a { transition: color .2s var(--ease-out), transform .2s var(--ease-out); }
footer ul li a:hover { color: var(--color-dorado, #dab749); }

/* ---------------------------------------------------------
 * 13. Imágenes y multimedia
 * ------------------------------------------------------- */
.hz-media {
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-md);
}

/* ---------------------------------------------------------
 * 14. Accesibilidad y detalles finos
 * ------------------------------------------------------- */
::selection {
  background: rgba(218, 183, 73, .35);
  color: var(--color-verde-oscuro, #2a3d34);
}

:focus-visible {
  outline: 3px solid var(--color-dorado, #dab749);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-to-content {
  position: absolute;
  left: -9999px;
  z-index: 9999;
  padding: .8rem 1.2rem;
  background: var(--color-verde, #344e41);
  color: #fff;
  border-radius: 0 0 var(--r-md) 0;
  font-weight: 700;
}
.skip-to-content:focus {
  left: 0;
  top: 0;
  color: #fff;
}

/* Scrollbar discreta (navegadores que la soportan) */
@supports (scrollbar-width: thin) {
  html { scrollbar-width: thin; scrollbar-color: #c9d2cb transparent; }
}

/* Respetar la preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .articulo-card:hover,
  .service-card:hover,
  .guide-card:hover,
  .blog-card-link:hover,
  .hz-card:hover,
  .btn:hover,
  .cta-button:hover { transform: none; }
}

/* ---------------------------------------------------------
 * 15. Ajustes móviles
 * ------------------------------------------------------- */
@media (max-width: 768px) {
  nav ul {
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
  }

  nav ul li a {
    font-weight: 600;
    border-bottom: 1px solid var(--hairline);
  }

  .articulo-card:hover,
  .blog-card-link:hover { transform: none; }

  .hz-callout { padding: 1.1rem 1.15rem; }
}

/* ---------------------------------------------------------
 * 16. Correcciones móviles
 * ------------------------------------------------------- */

/* El header es sticky (70px). Sin esto, al pulsar un enlace del índice
   el título de destino queda oculto detrás de la cabecera. */
html { scroll-padding-top: 84px; }

@media (max-width: 768px) {
  /* El menú desplegable usaba height:calc(100vh - 70px) y ningún overflow.
     Con 11 enlaces, los últimos ("Reservar cita" y "Llamar") caían fuera
     de la pantalla en móviles pequeños y no había forma de alcanzarlos.
     Además 100vh en iOS Safari incluye la barra de direcciones, así que el
     alto calculado era mayor que el visible.

     Anclando bottom:0 el navegador calcula el alto con el viewport real, y
     overflow-y permite desplazarse cuando el menú no cabe. */
  nav ul {
    bottom: 0;
    height: auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
  }

  /* Objetivo táctil mínimo cómodo en los enlaces del menú. */
  nav ul li a { min-height: 44px; display: flex; align-items: center; }
}
