/* =========================================================
 * base.css — Horizon Extranjería
 * Reset moderno, tipografía, accesibilidad, utilidades.
 * Carga DESPUÉS de tokens.css.
 * ========================================================= */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-base);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-strong);
  line-height: 1.25;
  margin: 0 0 var(--space-4);
}

p { margin: 0 0 var(--space-4); }

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--color-dorado); }

img, picture, svg, video {
  max-width: 100%;
  height: auto;
  display: block;
}

button { font: inherit; cursor: pointer; }

/* Accesibilidad: respetar reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Foco accesible visible */
:focus-visible {
  outline: 3px solid var(--color-dorado);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Utilidades ---------- */
.container {
  width: min(90%, var(--container));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Skip-link accesibilidad (oculto hasta foco) */
.skip-to-content {
  position: absolute;
  top: -40px; left: 0;
  background: var(--color-dorado);
  color: var(--color-verde);
  padding: var(--space-2) var(--space-4);
  z-index: var(--z-modal);
  font-weight: 700;
  transition: top var(--dur-fast) var(--ease);
}
.skip-to-content:focus { top: 0; }

/* ---------- Botones reutilizables ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(135deg, var(--color-dorado), var(--color-dorado-oscuro));
  color: var(--color-verde);
  box-shadow: var(--shadow-md);
}
.btn-primary:hover { box-shadow: var(--shadow-lg); color: var(--color-verde); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--color-verde);
  border-color: var(--color-verde);
}
.btn-secondary:hover { background: var(--color-verde); color: #fff; }

.btn-whatsapp {
  background: var(--color-whatsapp);
  color: #fff;
}
.btn-whatsapp:hover { color: #fff; box-shadow: var(--shadow-md); }

/* ---------- Card ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease),
              box-shadow var(--dur-base) var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

/* =========================================================
 * Header / nav (componente compartido)
 * ========================================================= */
header {
  background: var(--bg-header);
  padding: 12px 0;
  border-bottom: 2px solid var(--color-dorado);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  box-shadow: 0 2px 15px rgba(0,0,0,.08);
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.logo-container {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: var(--space-3);
}
.logo-container h1 {
  font-size: 1.4em;
  color: var(--color-verde);
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.logo-img {
  max-height: 55px;
  transition: transform var(--dur-base) var(--ease);
}
.logo-img:hover { transform: scale(1.05); }

nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-4);
}
nav li { position: relative; }
nav a {
  text-decoration: none;
  color: var(--color-verde);
  font-weight: 600;
  font-size: 1em;
  padding: 8px 5px;
  transition: all var(--dur-base) var(--ease);
}
nav a:hover { color: var(--color-dorado); transform: translateY(-1px); }

/* Hamburguesa móvil */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: var(--color-verde);
  border-radius: 3px;
  transition: all var(--dur-base) var(--ease);
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  nav ul {
    position: fixed;
    top: 70px;
    left: -100%;
    flex-direction: column;
    background: var(--bg-header);
    width: 100%;
    height: calc(100vh - 70px);
    transition: left var(--dur-base) var(--ease);
    padding-top: var(--space-8);
    box-shadow: 0 5px 15px rgba(0,0,0,.1);
    z-index: 999;
    gap: 0;
  }
  nav ul.active { left: 0; }
  nav li { width: 100%; }
  nav a {
    display: block;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-soft);
    font-size: 1.1em;
  }
  /* En móvil ya hay pelota WhatsApp flotante (de mejoras.js),
     así que ocultamos el botón WhatsApp del menú para no duplicar */
  nav ul li a.cta-button[href*="wa.me"],
  nav ul li a.btn[href*="wa.me"] {
    display: none !important;
  }
}

/* =========================================================
 * Footer (componente compartido)
 * ========================================================= */
footer {
  background: var(--bg-footer);
  color: #cfcfcf;
  padding: var(--space-12) 0 var(--space-6);
  margin-top: var(--space-16);
}
footer h4 {
  color: var(--color-dorado);
  margin: 0 0 var(--space-3);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
footer p { color: #b8b8b8; font-size: .92rem; }
footer ul { list-style: none; padding: 0; margin: 0; }
footer ul li { margin-bottom: var(--space-2); }
footer a {
  color: #cfcfcf;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
footer a:hover { color: var(--color-dorado); }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.footer-bottom {
  border-top: 1px solid #2a2a2a;
  padding-top: var(--space-4);
  text-align: center;
  font-size: .85rem;
  color: #888;
}

@media (max-width: 768px) {
  footer { padding: var(--space-8) var(--space-3) var(--space-4); }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  footer h4 { font-size: .95rem; }
  footer p, footer ul li { font-size: .88rem; }
}

/* =========================================================
 * Tipografía responsive global
 * ========================================================= */
@media (max-width: 768px) {
  body { font-size: .95rem; }
  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }
  .btn { padding: var(--space-3) var(--space-4); font-size: .95rem; }
}

/* Evitar scroll horizontal accidental en móvil por elementos que se salgan */
html, body { overflow-x: hidden; max-width: 100vw; }
img, picture, video, iframe { max-width: 100%; height: auto; }
