/* ---------- Variables y base ---------- */
:root {
  --sky-blue: #4FA8D8;
  --sky-blue-dark: #3A8DBB;
  --white: #FFFFFF;
  --accent-yellow: #F2C230;
  --accent-coral: #E06A5A;
  --ink: #2E3A45;
  --ink-soft: #5B6B76;
  --bg-soft: #F7FBFD;
  --border-soft: #E1EEF4;

  --font-heading: 'Quicksand', sans-serif;
  --font-body: 'Nunito', sans-serif;

  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-soft: 0 10px 30px rgba(79, 168, 216, 0.15);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* Cinturón de seguridad: ningún elemento (ej. el dropdown de países del
   teléfono) debe poder empujar la página a scrollear horizontalmente. */
html, body { overflow-x: hidden; }

body {
  margin: 0;
  width: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
}

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

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.5em;
}

p { margin: 0 0 1em; color: var(--ink-soft); }

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

section { padding: 64px 0; }

.section-sub {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 40px;
}

/* ---------- Botones ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 32px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.btn-primary {
  background: var(--accent-coral);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(224, 106, 90, 0.35);
}

.btn-primary:hover {
  background: #cf5c4d;
  transform: translateY(-2px);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--sky-blue-dark);
}

.brand-icon { flex-shrink: 0; }

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--sky-blue-dark);
  border-radius: 3px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.main-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 0 solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.main-nav.open {
  max-height: 320px;
  padding: 12px 0 20px;
  border-bottom-width: 1px;
}

.main-nav a {
  padding: 10px 20px;
  font-weight: 600;
  color: var(--ink);
  border-radius: 999px;
}

.main-nav a:hover { color: var(--sky-blue-dark); }

.lang-toggle {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 999px;
}

.lang-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.lang-btn.active {
  background: var(--sky-blue);
  color: var(--white);
}

/* ---------- Hero ----------
   Mobile-first: la foto y el texto van APILADOS (imagen arriba, texto abajo,
   sobre fondo claro). Superponer el texto en blanco sobre la imagen (como en
   desktop) solo funciona cuando hay espacio de sobra; en celulares angostos
   el bloque de texto es más alto que la imagen (aspect-ratio 3/2 la deja
   bajita) y el texto se salía por arriba, quedando tapado por el header
   (sticky, z-index alto). A partir de tablet (768px) sí hay espacio y se
   activa el estilo de foto de fondo + texto blanco superpuesto. */
.hero {
  position: relative;
  padding: 0;
}

.hero-media {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--ink);
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(46, 58, 69, 0.15) 0%, rgba(46, 58, 69, 0.75) 100%);
  display: none;
}

.hero-content {
  padding: 28px 0 36px;
  background: var(--bg-soft);
}

.hero h1 {
  color: var(--ink);
  font-size: 1.7rem;
  margin-bottom: 0.3em;
}

.hero-tagline {
  color: var(--sky-blue-dark);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5em;
}

.hero-sub {
  max-width: 480px;
  margin-bottom: 1.5em;
}

/* ---------- Servicios ---------- */
.services { background: var(--bg-soft); }

.services h2, .contact h2, .about h2 { text-align: center; }

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.service-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease;
}

.service-card:hover { transform: translateY(-4px); }

.service-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
}

.service-card h3 { font-size: 1.15rem; }
.service-card p { margin-bottom: 0; font-size: 0.95rem; }

/* ---------- Sobre nosotros ---------- */
.about-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.about-media img {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.about-content h2 { text-align: left; }

/* ---------- Contacto ---------- */
.contact-form {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.form-row .iti {
  display: block;
  width: 100%;
  max-width: 100%;
}

/* El input real de teléfono (dentro de .iti) a veces no queda tan ancho como
   sus hermanos (nombre/correo/mensaje) — Safari/iOS en particular le mete su
   propio estilo por default a los inputs. Se lo forzamos explícito, con
   !important porque la librería le pone estilos en línea (padding-left para
   la banderita) y así nos aseguramos de ganarle siempre, sin importar qué
   más le ponga en línea. */
.form-row .iti__tel-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Bug real de la librería: el ancho del panel del dropdown de banderitas se
   calcula al cargar la página y NO se recalcula si la ventana cambia de
   tamaño después (ej. rotar el teléfono, o achicar la ventana) — se queda
   con el ancho viejo y se desborda. Un tope en unidades de viewport (vw, no
   %) lo arregla sin pelear con la librería: vw siempre se mide contra la
   pantalla real, sin importar el ancho que JS le haya puesto en línea ni
   el contenedor donde esté posicionado. */
.form-row .iti__country-selector {
  max-width: calc(100vw - 40px);
}

/* Bug clásico de flexbox: un hijo de flex con texto largo no se encoge por
   default (min-width:auto), así que un nombre de país largo podía empujar
   la fila (y la página entera) más ancha que la pantalla. Con min-width:0
   el texto se envuelve dentro de su propia fila en vez de desbordar. */
.iti__country-name {
  min-width: 0;
  overflow-wrap: break-word;
}

/* El buscador de países dentro del dropdown de banderitas necesita su propio
   padding para el ícono de lupa (si no, el texto/cursor le pasa por encima). */
.form-row .iti__search-input {
  padding-left: calc(var(--iti-spacer-horizontal) + var(--iti-globe-icon-size) + var(--iti-spacer-horizontal));
  padding-right: calc(var(--iti-spacer-horizontal) + var(--iti-clear-icon-size) + var(--iti-spacer-horizontal));
  max-width: 100%;
  box-sizing: border-box;
}

.form-row input,
.form-row textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 16px;
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--sky-blue);
  background: var(--white);
}

.field-error {
  color: var(--accent-coral);
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 1em;
}

.form-row.has-error input {
  border-color: var(--accent-coral);
  background: #FFF8F7;
}

.form-row.has-error input:focus {
  border-color: var(--accent-coral);
}

.contact-form .btn { align-self: flex-start; }

.contact-form .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.form-confirm {
  align-self: center;
  margin-top: 4px;
  padding: 10px 26px;
  border-radius: 999px;
  background: var(--sky-blue-dark);
  color: var(--white);
  font-weight: 700;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.form-confirm.visible { opacity: 1; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.85);
  padding-top: 48px;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-bottom: 32px;
}

.footer-col h3 {
  color: var(--white);
  font-size: 1rem;
  margin-bottom: 0.6em;
}

.footer-col p { color: rgba(255, 255, 255, 0.75); margin-bottom: 0.4em; }

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-weight: 600;
  margin-bottom: 16px;
}

.icon-inline { width: 20px; height: 20px; color: var(--accent-yellow); }

.social-links { display: flex; gap: 12px; }

.social-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--white);
  transition: background 0.2s ease;
}

.social-icon:hover { background: var(--sky-blue); }
.social-icon svg { width: 18px; height: 18px; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 18px 0;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ---------- Tablet / Desktop ---------- */
@media (min-width: 768px) {
  section { padding: 88px 0; }

  .nav-toggle { display: none; }

  .main-nav {
    position: static;
    flex-direction: row;
    max-height: none;
    overflow: visible;
    border-bottom: none;
    padding: 0;
    gap: 8px;
  }

  .lang-toggle { margin-top: 0; margin-left: 8px; }

  /* Hay espacio de sobra: la foto vuelve a ser el fondo del hero y el texto
     se superpone en blanco, pegado abajo. */
  .hero-media::after { display: block; }

  .hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0 0 72px;
    background: none;
  }

  .hero h1 { color: var(--white); font-size: 3rem; }
  .hero-tagline { color: var(--white); font-size: 1.3rem; }
  .hero-sub { color: rgba(255, 255, 255, 0.9); }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }

  .about-inner {
    flex-direction: row;
    align-items: center;
    gap: 56px;
  }

  .about-media, .about-content { flex: 1; }

  .footer-inner { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .services-grid { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 3.4rem; }
}
