/* =========================================================================
   site.css — Estilos base + header + footer, SIN depender de Tailwind.
   Pensado para funcionar directo con Live Server (sin build).
   ========================================================================= */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700&display=swap");

:root {
  --primary: #2e7d32;
  --primary-dark: #005005;
  --logo-green: #02994d;        /* verde exacto del logo */
  --logo-green-dark: #027a3e;   /* versión oscura para hover */
  --primary-light: #60ad5e;
  --accent: #f9a825;
  --cream: #f7f5f0;
  --ink: #1f2937;
  --header-h: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--header-h);   /* deja sitio al header fijo */
}
/* La home tiene hero a pantalla completa: el header translúcido va encima */
body.hero-home { padding-top: 0; }

h1, h2, h3, h4 { font-family: "Poppins", "Inter", system-ui, sans-serif; margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* El `display: block` de arriba le gana al `[hidden] { display: none }` del
   navegador (que es de menor especificidad), así que las imágenes marcadas con
   el atributo `hidden` seguían visibles. Se veía en productos: al mostrar un
   carrusel, la foto del producto anterior quedaba encima y comprimía al nuevo.
   Debe ir DESPUÉS de la regla de img para ganarle. */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- HEADER */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.site-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 clamp(1rem, 4vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: flex; align-items: center; }
.brand img { height: 40px; width: auto; }

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
  list-style: none;
  margin: 0;
  padding: 0;
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-links a { color: #374151; transition: color 0.18s ease; }
.nav-links a:hover { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.btn-contact {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.1rem;
  border-radius: 0.55rem;
  background: var(--logo-green, #02994d);   /* verde exacto del logo */
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.18s ease;
}
.btn-contact:hover { background: var(--logo-green-dark, #027a3e); }

/* Botón de idioma ES/EN */
.btn-lang {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.4rem; padding: 0.42rem 0.6rem;
  border: 1px solid #d7e3d9; border-radius: 0.55rem;
  background: transparent; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.8rem; letter-spacing: .04em;
  color: var(--logo-green, #02994d);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.btn-lang:hover { background: var(--logo-green, #02994d); color: #fff; border-color: var(--logo-green, #02994d); }

.nav-toggle {
  display: none;
  border: 0;
  background: transparent;
  padding: 0.4rem;
  cursor: pointer;
  color: var(--ink);
}
.nav-toggle svg { width: 26px; height: 26px; }

/* Menú móvil desplegable */
.nav-mobile {
  background: #fff;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}
.nav-mobile ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem clamp(1rem, 4vw, 2rem) 1rem;
}
.nav-mobile a {
  display: block;
  padding: 0.7rem 0;
  font-weight: 500;
  border-bottom: 1px solid #f1f1f1;
}
.nav-mobile a:hover { color: var(--primary); }
.hidden { display: none !important; }

/* Responsive: nav horizontal solo en escritorio */
@media (max-width: 820px) {
  .nav-links { display: none; }
  .btn-contact { display: none; }
  .nav-toggle { display: inline-flex; }
}
@media (min-width: 821px) {
  .nav-mobile { display: none !important; }
}

/* ---------- Cinta ondulada entre secciones (reutilizable en todas las páginas)
   Banda de color con olas arriba y abajo, para separar secciones blancas.
   El color se controla con --band-color. */
.wave-band {
  --band-color: #0b3d2e;                 /* tono verde oscuro (ajustable) */
  position: relative; background: var(--band-color);
  height: clamp(80px, 10vw, 130px); overflow: hidden;
}
.wave-band__edge { position: absolute; left: 0; width: 100%; height: 54px; display: block; }
.wave-band__edge path { fill: #fff; }     /* "muerde" la banda con el color de las secciones */
.wave-band__top { top: -1px; }
.wave-band__bot { bottom: -1px; }

/* ---------------------------------------------------------------- FOOTER */
.site-footer { background: #eceee9; color: #111; border-top: 1px solid rgba(0, 0, 0, 0.08); }
.site-footer__grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3.5rem clamp(1rem, 4vw, 2rem);
  display: grid;
  gap: 2.5rem;
  grid-template-columns: repeat(4, 1fr);
}
.site-footer__grid h4 {
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #111;
  margin-bottom: 0.85rem;
}
.footer-logo { display: inline-block; }
.footer-logo img { height: 44px; width: auto; display: block; }
.footer-brand p { color: rgba(0, 0, 0, 0.6); font-size: 0.9rem; max-width: 24ch; margin: 1rem 0 0; }

/* Redes sociales */
.footer-social { display: flex; gap: 0.6rem; margin-top: 1.3rem; }
.footer-social a {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.06); color: #111;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.footer-social a:hover { background: var(--primary, #2e7d32); color: #fff; transform: translateY(-2px); }
.footer-social svg { width: 20px; height: 20px; }

/* Powered by Codefy */
.powered-by { display: inline-flex; align-items: center; gap: 0.5rem; color: rgba(0, 0, 0, 0.55); }
.powered-by span { font-size: 0.78rem; }
/* 44px y no 20: el logo actual es cuadrado (2000x2000), no el logotipo
   alargado de antes; a 20px quedaba un sello ilegible. */
.powered-by img { height: 44px; width: auto; opacity: 1; transition: opacity 0.2s ease; }
.powered-by:hover { color: #111; }
.powered-by:hover img { opacity: 1; }
.site-footer__grid ul { list-style: none; margin: 0; padding: 0; }
.site-footer__grid li { margin-bottom: 0.5rem; }
.site-footer__grid ul a,
.site-footer__grid li { color: rgba(0, 0, 0, 0.65); font-size: 0.9rem; }
.site-footer__grid ul a { display: inline-flex; align-items: center; gap: 0.35rem; transition: color 0.2s ease, transform 0.2s ease; }
.site-footer__grid ul a::before { content: "\203A"; color: var(--primary, #2e7d32); font-weight: 700; }
.site-footer__grid ul a:hover { color: var(--primary, #2e7d32); transform: translateX(2px); }

.site-footer__bottom {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.site-footer__bottom > div {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: rgba(0, 0, 0, 0.55);
}

@media (max-width: 820px) {
  .site-footer__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .site-footer__grid { grid-template-columns: 1fr; }
  /* En una sola columna el texto ya no compite por ancho */
  .footer-brand p { max-width: none; }
}

/* =========================================================================
   BASE RESPONSIVE GLOBAL
   Escalones usados en todo el sitio (mantenerlos consistentes):
     ≤480   móvil pequeño      481–767   móvil grande
     768–1024  tablet          1025–1440 laptop        ≥1441 desktop
   ========================================================================= */

/* Nada debe provocar scroll horizontal.
   - `clip` y no `hidden`: `hidden` crea un contenedor de scroll que rompe los
     `position: sticky` (el selector lateral de productos depende de ello).
   - Va solo en `html`, no en `body`: el overflow del elemento raíz se propaga
     al viewport, así que el recorte ocurre ahí arriba y no afecta al header
     `position: fixed`. Ponerlo también en `body` sí podría recortarlo. */
html { overflow-x: clip; }

/* Los títulos largos (o una URL pegada) no deben desbordar en pantallas
   estrechas: se parten en vez de empujar el layout. */
h1, h2, h3, h4, p, li, a, dd, dt { overflow-wrap: break-word; }

/* Medios sin desbordes. Las reglas por clase siguen ganando en especificidad,
   así que las imágenes con alto fijo (logo, tarjetas) no se ven afectadas. */
img, svg, video, iframe { max-width: 100%; }

/* -------------------------------------------------- TABLET (768–1024) */
@media (min-width: 768px) and (max-width: 1024px) {
  /* El footer a 4 columnas queda apretado en tablet; 2 respira mejor. */
  .site-footer__grid { grid-template-columns: repeat(2, 1fr); gap: 2rem; }
}

/* -------------------------------------------------- MÓVIL (≤820) */
@media (max-width: 820px) {
  /* Objetivos táctiles: mínimo 44px recomendado por las guías de iOS/Android. */
  .nav-toggle { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .btn-lang { min-height: 40px; }
  .nav-mobile a { padding: 0.85rem 0; }        /* ~48px de alto real */
  /* Los enlaces del footer medían 23px de alto: demasiado finos para el dedo.
     Se les da cuerpo y se compensa reduciendo el margen entre elementos. */
  .site-footer__grid li { margin-bottom: 0.15rem; }
  .site-footer__grid ul a { min-height: 44px; padding: 0.2rem 0; }
  .footer-social a { width: 44px; height: 44px; }
  .brand { min-height: 44px; align-items: center; }
  .powered-by { min-height: 40px; }

  /* Si el menú desplegado no cabe (móvil apaisado), que haga scroll él mismo
     en lugar de quedar cortado por debajo del viewport. */
  .nav-mobile ul {
    max-height: calc(100svh - var(--header-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .site-footer__grid { padding-top: 2.5rem; padding-bottom: 2.5rem; }
  .site-footer__bottom > div { justify-content: center; text-align: center; }
}

/* -------------------------------------------------- MÓVIL PEQUEÑO (≤380) */
@media (max-width: 380px) {
  :root { --header-h: 58px; }
  .brand img { height: 32px; }
  .btn-lang { min-width: 2.1rem; padding: 0.38rem 0.45rem; font-size: 0.74rem; }
  .header-actions { gap: 0.4rem; }
  .site-header__inner { padding: 0 0.9rem; }
}

/* -------------------------------------------------- MÓVIL APAISADO
   Pantalla muy baja: se recupera altura encogiendo el header. */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --header-h: 52px; }
  .brand img { height: 30px; }
}

/* -------------------------------------------------- DESKTOP GRANDE (≥1441)
   En monitores anchos el contenido se queda estrecho y con mucho aire muerto
   a los lados; se ensancha el contenedor y sube ligeramente la escala. */
@media (min-width: 1441px) {
  .site-header__inner,
  .site-footer__grid,
  .site-footer__bottom > div { max-width: 1360px; }
}
