/* =========================================================
   ZIHKON · ESTILOS GLOBALES
   Sistema de diseño (variables) + componentes comunes:
   botones, cabecera, pie, WhatsApp flotante, aviso de cookies.
   Los estilos propios de cada sección están en css/secciones.css.

   Inspiración: el casco antiguo de Estepona. Paredes encaladas
   (fondo blanco frío), macetas azules (color principal), buganvilla
   (botones) y sol (detalles sobre fondos oscuros). El verde se
   reserva para lo que es WhatsApp.
   ========================================================= */

/* =========================================================
   FUENTES (alojadas en /fonts, subconjunto latino de Google Fonts).
   Atkinson Hyperlegible Next es variable: un archivo para 400–700.
   ========================================================= */
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/atkinson-hyperlegible-next.woff2") format("woff2"); }
@font-face { font-family: "Young Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/young-serif.woff2") format("woff2"); }

/* =========================================================
   VARIABLES GLOBALES (colores, tipografía, espaciado, radios, sombras)
   Cambia aquí un valor y se aplica en toda la web.
   Los temas de css/temas/ sobrescriben los colores: no cambies
   los NOMBRES de las variables o los temas dejarán de funcionar.
   ========================================================= */
:root {
  color-scheme: light;

  /* --- Colores de marca --- */
  --color-primario: #2346c0;        /* azul maceta: enlaces, iconos, acentos */
  --color-primario-oscuro: #0f1c45; /* tinta marino: bandas oscuras, plan destacado */
  --color-acento: #ffc94a;          /* sol: destacados sobre fondos oscuros */
  --color-detalle: #c21a63;         /* buganvilla: marcas pequeñas */

  /* --- Texto --- */
  --color-texto: #141b33;
  --color-texto-suave: #4e5873;     /* texto secundario (contraste AA en todos los fondos claros) */
  --color-texto-invertido: #f8f9fc;        /* texto sobre fondos oscuros */
  --color-texto-invertido-suave: #c3cbe2;  /* texto secundario sobre fondos oscuros */

  /* --- Fondos y superficies --- */
  --color-fondo: #f6f7f9;           /* cal: fondo general de la página */
  --color-fondo-alterno: #eaeef7;   /* bandas alternas (productos, quién está detrás) */
  --color-superficie: #ffffff;      /* tarjetas, formulario, franjas y pie */
  --color-fondo-icono: #e3e9fa;     /* fondo de etiquetas y marcas pequeñas */

  /* --- Bordes --- */
  --color-borde: #dce1ec;
  --color-borde-fuerte: #c3cadb;
  --color-borde-campo: #7d869c;     /* borde de campos del formulario (contraste 3:1) */
  --color-foco: var(--color-primario);

  /* --- Estados (mensajes del formulario) --- */
  --color-exito: #13723f;
  --color-exito-fondo: #e3f4e9;
  --color-error: #b0283a;
  --color-error-fondo: #fbe9ec;
  --color-aviso: #7a4f00;
  --color-aviso-fondo: #fff3d6;

  /* --- Botones --- */
  --color-boton: #c21a63;           /* buganvilla */
  --color-boton-hover: #a3134f;
  --color-boton-activo: #85103f;
  --color-boton-texto: #ffffff;
  --color-boton-secundario-borde: var(--color-borde-fuerte); /* botón claro (.button--light) */
  --color-boton-destacado: var(--color-acento);              /* botón amarillo sobre fondo oscuro (.button--lime) */
  --color-boton-destacado-hover: #ffd772;
  --color-boton-destacado-activo: #f0b62a;
  --color-boton-destacado-texto: var(--color-primario-oscuro);

  /* --- WhatsApp (solo para lo que abre WhatsApp) --- */
  --color-whatsapp: #138251;
  --color-whatsapp-hover: #0f6b42;
  --color-chat-fondo: #efeae2;      /* fondo de las conversaciones de ejemplo */
  --color-chat-enviado: #d9fdd3;    /* burbuja de lo que escribe el cliente y comandos */
  --color-chat-recibido: #ffffff;

  /* --- Tipografías (cargadas desde Google Fonts en el <head> de index.html) ---
     Títulos: Young Serif (cercana, con carácter). Solo tiene un grosor: no la pongas en negrita.
     Texto: Atkinson Hyperlegible Next (diseñada para leerse con facilidad). */
  --fuente-titulos: "Young Serif", Georgia, serif;
  --fuente-principal: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;

  /* --- Escala tipográfica (base 17px, proporción ~1,25) --- */
  --texto-xs: 0.8125rem;   /* 13px: notas */
  --texto-sm: 0.9375rem;   /* 15px: textos secundarios, botones */
  --texto-base: 1.0625rem; /* 17px: texto general */
  --texto-md: 1.1875rem;   /* 19px: entradillas */
  --texto-lg: 1.5rem;      /* 24px: títulos de bloque */
  --texto-xl: 2rem;        /* 32px: títulos destacados */
  --titulo-seccion: clamp(2rem, 1.45rem + 2vw, 3rem);       /* 32px → 48px */
  --titulo-hero: clamp(2.5rem, 1.55rem + 3.7vw, 4.375rem);  /* 40px → 70px */
  --interlineado-titulo: 1.08;
  --interlineado-texto: 1.6;
  --tracking-titulo: -0.012em;

  /* --- Espaciado (escala de 4px) --- */
  --espacio-1: 4px;
  --espacio-2: 8px;
  --espacio-3: 12px;
  --espacio-4: 16px;
  --espacio-5: 24px;
  --espacio-6: 32px;
  --espacio-7: 48px;
  --espacio-8: 64px;
  --espacio-9: 96px;
  --espacio-seccion: clamp(4.5rem, 2.8rem + 5vw, 7.5rem); /* 72px → 120px entre secciones */

  /* --- Radios: más redondo cuanto más "conversación" es el elemento --- */
  --radio-boton: 12px;
  --radio-campo: 10px;
  --radio-etiqueta: 6px;
  --radio-tarjeta: 20px;
  --radio-burbuja: 16px;

  /* --- Sombras (teñidas de azul marino) --- */
  --sombra-sm: 0 1px 2px #0f1c4512, 0 2px 6px #0f1c450d;
  --sombra-md: 0 12px 30px -12px #0f1c4538;
  --sombra-lg: 0 30px 60px -24px #0f1c4552;

  /* --- Movimiento --- */
  --transicion: 180ms cubic-bezier(.22, 1, .36, 1);

  /* --- Medidas --- */
  --ancho-maximo: 1160px;
  --alto-cabecera: 76px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--alto-cabecera) + var(--espacio-4)); }
body { margin: 0; background: var(--color-fondo); color: var(--color-texto); font: var(--texto-base)/var(--interlineado-texto) var(--fuente-principal); font-kerning: normal; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
h1, h2, h3, h4 { text-wrap: balance; }
h1, h2, h3 { font-family: var(--fuente-titulos); font-weight: 400; letter-spacing: var(--tracking-titulo); }
p { text-wrap: pretty; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--color-foco); outline-offset: 3px; }
:where(.final-cta, .price-card--featured) :focus-visible { outline-color: var(--color-acento); }
.skip-link { position: absolute; z-index: 30; top: var(--espacio-2); left: var(--espacio-2); padding: var(--espacio-3) var(--espacio-4); border-radius: var(--radio-boton); background: var(--color-primario-oscuro); color: var(--color-texto-invertido); font-size: var(--texto-sm); font-weight: 700; transform: translateY(-150%); transition: transform var(--transicion); }
.skip-link:focus-visible { transform: translateY(0); outline-color: var(--color-acento); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* ---------- Utilidades y títulos de sección ---------- */
.wrap { width: min(var(--ancho-maximo), calc(100% - var(--espacio-7))); margin-inline: auto; }
.section-title { max-width: 22ch; margin: 0 0 var(--espacio-4); font-size: var(--titulo-seccion); line-height: var(--interlineado-titulo); }
.section-lede { max-width: 56ch; margin: 0; color: var(--color-texto-suave); font-size: var(--texto-md); line-height: 1.55; }

/* Comando de WhatsApp (WEB, CARTA, PUBLICAR, LISTO, SÍ): con la forma de una burbuja enviada,
   para que se reconozca lo que hay que escribir */
.cmd { display: inline-block; padding: .05em .45em; border-radius: 7px 7px 2px 7px; background: var(--color-chat-enviado); color: #0b3a1e; font-weight: 700; letter-spacing: .02em; line-height: 1.35; white-space: nowrap; }

/* ---------- Botones (.button, .button--light, .button--lime, .button--ghost, .button--whatsapp) ----------
   Estados: hover, focus (anillo global), active, disabled. */
.button { display: inline-flex; min-height: 52px; align-items: center; justify-content: center; gap: 10px; padding: 0 var(--espacio-5); border: 1px solid transparent; border-radius: var(--radio-boton); background: var(--color-boton); color: var(--color-boton-texto); font-size: var(--texto-sm); font-weight: 700; line-height: 1.2; text-align: center; cursor: pointer; transition: background-color var(--transicion), border-color var(--transicion), color var(--transicion), transform var(--transicion); }
.button:hover { background: var(--color-boton-hover); }
.button:active { background: var(--color-boton-activo); transform: translateY(1px); }
.button:disabled { opacity: .6; cursor: progress; transform: none; }
.button svg { width: 18px; height: 18px; flex: 0 0 auto; }
.button--light { border-color: var(--color-boton-secundario-borde); background: var(--color-superficie); color: var(--color-texto); }
.button--light:hover { border-color: var(--color-primario); background: var(--color-superficie); color: var(--color-primario); }
.button--light:active { background: var(--color-fondo-icono); }
.button--lime { background: var(--color-boton-destacado); color: var(--color-boton-destacado-texto); }
.button--lime:hover { background: var(--color-boton-destacado-hover); }
.button--lime:active { background: var(--color-boton-destacado-activo); }
.button--ghost { border-color: #ffffff66; background: transparent; color: var(--color-texto-invertido); }
.button--ghost:hover { border-color: var(--color-texto-invertido); background: #ffffff14; }
.button--ghost:active { background: #ffffff24; }
.button--wa svg { width: 20px; height: 20px; color: var(--color-whatsapp); }
.button--whatsapp { background: var(--color-whatsapp); color: #fff; }
.button--whatsapp:hover, .button--whatsapp:active { background: var(--color-whatsapp-hover); }

/* ---------- Cabecera y navegación ---------- */
.topbar { position: sticky; z-index: 20; top: 0; border-bottom: 1px solid var(--color-borde); background: color-mix(in srgb, var(--color-fondo) 92%, transparent); backdrop-filter: blur(10px); }
.nav { display: flex; min-height: var(--alto-cabecera); align-items: center; justify-content: space-between; gap: var(--espacio-5); }
.brand { display: inline-flex; align-items: center; gap: 10px; font: var(--texto-lg) var(--fuente-titulos); }
.brand img { width: auto; height: 46px; object-fit: contain; }
.nav-links { display: flex; align-items: center; gap: var(--espacio-6); color: var(--color-texto-suave); font-size: var(--texto-sm); font-weight: 500; }
.nav-links a { position: relative; padding-block: 10px; transition: color var(--transicion); }
.nav-links a:hover { color: var(--color-texto); }
.nav-links a[aria-current="true"] { color: var(--color-primario); }
.nav-links a[aria-current="true"]::after { position: absolute; right: 0; bottom: 2px; left: 0; height: 2px; border-radius: 2px; background: currentColor; content: ""; }
.nav .button { min-height: 44px; padding-inline: 18px; }
.menu-toggle { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border: 1px solid var(--color-borde-fuerte); border-radius: var(--radio-boton); background: var(--color-superficie); color: var(--color-texto); cursor: pointer; }
.menu-toggle svg { width: 20px; height: 20px; }

/* ---------- Secciones (comportamiento común) ---------- */
section { scroll-margin-top: calc(var(--alto-cabecera) + var(--espacio-3)); }

/* ---------- Pie de página ---------- */
.footer { padding: var(--espacio-7) 0 var(--espacio-6); background: var(--color-primario-oscuro); color: var(--color-texto-invertido); }
.footer-inner { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--espacio-4) var(--espacio-6); }
.footer .brand { min-height: 44px; font-size: var(--texto-md); }
.footer .brand img { width: auto; height: 28px; padding: 3px 6px; border-radius: 6px; background: #fff; box-sizing: content-box; }
.footer p, .footer-links, .social-label { margin: 0; color: var(--color-texto-invertido-suave); font-size: var(--texto-sm); }
.footer-inner > p { grid-column: 1 / -1; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: end; gap: var(--espacio-2) var(--espacio-5); }
.footer-links a:hover, .footer-legal a:hover { color: var(--color-texto-invertido); text-decoration: underline; text-underline-offset: 3px; }
.footer-nap a { color: var(--color-texto-invertido); text-underline-offset: 3px; }
.footer-bottom { display: flex; align-items: center; justify-content: space-between; gap: var(--espacio-5); margin-top: var(--espacio-5); padding-top: var(--espacio-5); border-top: 1px solid #ffffff24; }
.footer-legal { display: flex; flex-wrap: wrap; gap: var(--espacio-2) var(--espacio-5); }
.footer-legal a { color: var(--color-texto-invertido-suave); font-size: var(--texto-xs); }
.footer-copy { margin: var(--espacio-5) 0 0; color: var(--color-texto-invertido-suave); font-size: var(--texto-xs); }
.footer :focus-visible { outline-color: var(--color-acento); }
.social-area { display: flex; align-items: center; gap: var(--espacio-3); }
.social-label { font-size: var(--texto-xs); }
.social-buttons { display: flex; gap: var(--espacio-2); }
.social-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid #ffffff33; border-radius: 50%; background: transparent; color: var(--color-texto-invertido-suave); transition: border-color var(--transicion), color var(--transicion); }
.social-button:hover { border-color: var(--color-acento); color: var(--color-texto-invertido); }
.social-button svg { width: 17px; height: 17px; }

/* ---------- Botón flotante de WhatsApp ---------- */
.whatsapp-float { position: fixed; z-index: 25; right: 22px; bottom: 28px; display: inline-flex; min-width: 54px; height: 54px; align-items: center; justify-content: center; gap: 9px; padding: 0 20px; border-radius: 999px; background: var(--color-whatsapp); box-shadow: var(--sombra-md); color: #fff; font-size: var(--texto-sm); font-weight: 700; transition: background-color var(--transicion); }
.whatsapp-float:hover { background: var(--color-whatsapp-hover); }
.whatsapp-float svg { width: 22px; height: 22px; }

/* ---------- Aviso de cookies ---------- */
.cookie-banner { position: fixed; z-index: 24; bottom: 22px; left: 22px; display: flex; max-width: min(500px, calc(100vw - 44px)); align-items: center; gap: var(--espacio-5); padding: var(--espacio-4) var(--espacio-5); border: 1px solid var(--color-borde); border-radius: var(--radio-tarjeta); background: var(--color-superficie); box-shadow: var(--sombra-lg); }
.cookie-banner[hidden] { display: none; }
.cookie-banner strong { display: block; font: var(--texto-base) var(--fuente-titulos); }
.cookie-banner p { margin: var(--espacio-1) 0 0; color: var(--color-texto-suave); font-size: var(--texto-xs); line-height: 1.5; }
.cookie-banner p a { color: var(--color-primario); text-decoration: underline; text-underline-offset: 2px; }
.cookie-banner .button { min-height: 44px; flex: 0 0 auto; padding-inline: 18px; }

/* ---------- Movimiento reducido: todo aparece ya en su estado final ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive (componentes globales) ---------- */
@media (pointer: coarse) {
  .footer-links a, .footer-legal a { display: inline-block; padding-block: 12px; }
  .footer-links, .footer-legal { row-gap: 0; }
}
@media (max-width: 900px) {
  .nav-links { gap: var(--espacio-5); }
  .nav-links a:nth-child(4), .nav-links a:nth-child(5) { display: none; }
}
@media (max-width: 680px) {
  :root { --alto-cabecera: 64px; }
  .wrap { width: min(var(--ancho-maximo), calc(100% - 40px)); }
  .brand img { height: 38px; }
  .menu-toggle { display: inline-flex; }
  .nav > .button { display: none; }
  .nav-links { position: absolute; top: calc(var(--alto-cabecera) - 1px); right: 0; left: 0; display: none; align-items: stretch; gap: 0; padding: var(--espacio-2) 20px var(--espacio-4); border-bottom: 1px solid var(--color-borde); background: var(--color-fondo); box-shadow: var(--sombra-md); color: var(--color-texto); font-size: var(--texto-base); }
  .nav-links.is-open { display: flex; flex-direction: column; }
  .nav-links a, .nav-links a:nth-child(4), .nav-links a:nth-child(5) { display: block; padding: 14px 0; border-bottom: 1px solid var(--color-borde); }
  .nav-links a::after { display: none; }
  .nav-links a:last-child { border: 0; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .footer-bottom { align-items: flex-start; flex-direction: column; }
  .social-area { align-items: flex-start; flex-direction: column; }
  .whatsapp-float { right: 14px; bottom: 20px; width: 54px; min-width: 54px; padding: 0; }
  .whatsapp-float span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .cookie-banner { right: 12px; bottom: 88px; left: 12px; max-width: none; align-items: stretch; flex-direction: column; gap: var(--espacio-3); padding: var(--espacio-4); }
}
