/* ==========================================================================
   Consorcio de Harinas · base.css
   Identidad visual compartida: fuentes, variables, base y piezas comunes.
   Es el único CSS del tema con colores, familias y tamaños de texto literales;
   los bloques, la cabecera, el pie y WooCommerce solo usan var(--…).

   Origen: la web de Elementor (kit 12, plantillas 111 y 228 y las páginas),
   medida con getComputedStyle a 1440 y 390 px (PROYECTO-WP.md).

   Fuentes
   - HWT Aetna Extra Condensed 400 ... --f-titulo: títulos, menú, acordeón,
     botón del formulario. Archivo del cliente (woff).
   - Manrope 400 · 500 · 700 ......... --f-texto: cuerpo, botones, precios.
     Fuente variable, subconjunto latino (assets/fonts/LICENCIAS.txt).
   Se precargan las dos (primera pantalla).

   Contrato de color para los bloques, la cabecera y el pie
   Solo estas variables de contexto; las redefinen .seccion--claro,
   .seccion--blanco y .seccion--rojo:
     --fondo          fondo de la sección
     --texto          títulos y texto principal
     --texto-fuerte   texto de la primera pantalla y de los enlaces de menú
     --texto-2        párrafos
     --acento         enlace activo, iconos
     --linea          reglas finas (acordeón, columnas, pie)
     --boton          color del texto y del borde del botón píldora
     --campo-fondo    fondo de los campos de formulario
     --campo-texto    texto de los campos
     --error          mensajes y campos con error
   Fuera de base.css no puede haber colores, familias ni tamaños de texto
   literales. tests/test-assets.php (harinas_literales_css) los busca.
   ========================================================================== */

@font-face {
  font-family: "HWT Aetna";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/hwt-aetna-extracond.woff") format("woff");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-variable.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   1 · Variables (única fuente de verdad)
   ========================================================================== */
:root {
  /* Paleta del kit de Elementor */
  --beige: #e6e2d3;        /* fondo de la página («Fondo pagina») */
  --rosado: #f1dccc;       /* campos de formulario («Beige») */
  --rojo: #c40b32;         /* acento («Énfasis») */
  --naranja: #eea37a;      /* enlace activo del menú del móvil */
  --tinta: #333333;        /* títulos (color por defecto de Elementor) */
  --gris: #525252;         /* párrafos («Secundario») */
  --negro: #000000;        /* menú, botones, precios («Texto») */
  --blanco: #ffffff;
  --rojo-error: #8a0620;   /* error legible sobre beige y blanco */
  --error-claro: #ffd6de;  /* error legible sobre rojo */
  --negro-15: rgb(0 0 0 / .15);
  --negro-45: rgb(0 0 0 / .45);   /* velo del vídeo de fondo */
  --negro-60: rgb(0 0 0 / .6);    /* fondo del visor de la galería */
  --blanco-90: rgb(255 255 255 / .9);

  /* Tipografía */
  --f-titulo: "HWT Aetna", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-texto: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-cuerpo: 16px;          /* cuerpo 16/24 */
  --t-pequeno: 14px;         /* pie y datos de contacto */
  --t-campo: 16px;           /* campos (15 en Elementor; 16 evita el zoom de iOS) */
  --t-boton: 20px;           /* botón píldora (18 en móvil) */
  --t-menu: 18px;            /* menú principal */
  --t-menu-movil: 26px;      /* menú del panel lateral */
  --t-contacto: 18px;        /* datos de contacto de la primera pantalla */
  --t-acordeon-texto: 18px;  /* texto del acordeón */
  --t-precio: 20px;          /* precio en la tienda y la ficha */
  --t-tarjeta: 34px;         /* nombre del producto en la tienda */
  --t-columna: 28px;         /* título de cada columna (36 en móvil) */
  --t-aviso: 30px;           /* aviso de Finalizar compra */
  --t-insignia: 10px;        /* contador del carrito */
  --t-h2-tienda: 32px;       /* títulos de los bloques de WooCommerce (carrito vacío) */
  /* Títulos: tamaño de Elementor en escritorio / tableta (768–1024) / móvil */
  --t-xl: 6.5vw;             /* primera pantalla y titulares (móvil 54) */
  --t-l: 6.5vw;              /* primera pantalla de las páginas interiores (móvil 46) */
  --t-m: 4.7vw;              /* título de sección (móvil 42) */
  --t-s: 4.7vw;              /* título de sección de las páginas interiores (móvil 34) */
  --t-acordeon: 3vw;         /* títulos del acordeón (móvil 30) */
  --lh-acordeon: 24px;       /* interlineado del acordeón (el de Elementor, menor que la letra) */

  /* Espacio (porcentajes de Elementor, relativos al ancho) */
  --lado: 3%;                /* margen lateral */
  --bloque: 7%;              /* espacio vertical de sección */
  --hueco: 64px;             /* entre columnas */
  --hueco-texto: 24px;       /* entre título, texto y botón */
  --col-texto: 40%;
  --col-foto: 50%;

  /* Movimiento */
  --entrada: 1.25s;          /* fundido lateral (Elementor «lento») */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  /* Colores de contexto: por defecto, los del fondo beige */
  --fondo: var(--beige);
  --texto: var(--tinta);
  --texto-fuerte: var(--negro);
  --texto-2: var(--gris);
  --acento: var(--rojo);
  --linea: var(--tinta);
  --boton: var(--negro);
  --campo-fondo: var(--rosado);
  --campo-texto: var(--negro);
  --error: var(--rojo-error);
}
@media (max-width: 1024px) {
  :root { --t-xl: 7vw; --t-l: 7vw; --t-m: 5vw; --t-s: 5vw; --t-acordeon: 4vw; --lado: 24px; --bloque: 50px; }
}
@media (max-width: 767px) {
  :root {
    --t-xl: 54px; --t-l: 46px; --t-m: 42px; --t-s: 34px; --t-acordeon: 30px;
    --t-boton: 18px; --t-columna: 36px; --t-tarjeta: 30px;
    --lado: 20px; --bloque: 40px; --hueco: 40px;
  }
}

/* ==========================================================================
   2 · Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--beige);
  color: var(--tinta);
  font: 400 var(--t-cuerpo)/1.5 var(--f-texto);
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
h1, h2, h3, h4 { font-family: var(--f-titulo); font-weight: 400; }
ul, ol { padding: 0; list-style: none; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; }
.seccion--rojo :focus-visible { outline-color: var(--blanco); }

.visually-hidden,
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 1000; padding: .6rem 1rem; background: var(--negro); color: var(--blanco); }
.skip:focus { top: 1rem; }

/* ==========================================================================
   3 · Secciones: fondo beige, blanco o rojo (redefinen los colores de contexto)
   ========================================================================== */
.seccion {
  padding: var(--bloque) var(--lado);
  background: var(--fondo);
  color: var(--texto);
}
.seccion--claro {
  --fondo: var(--beige);
  --texto: var(--tinta);
  --texto-fuerte: var(--negro);
  --texto-2: var(--gris);
  --acento: var(--rojo);
  --linea: var(--tinta);
  --boton: var(--negro);
  --error: var(--rojo-error);
}
.seccion--blanco {
  --fondo: var(--blanco);
  --texto: var(--tinta);
  --texto-fuerte: var(--negro);
  --texto-2: var(--gris);
  --acento: var(--rojo);
  --linea: var(--tinta);
  --boton: var(--negro);
  --error: var(--rojo-error);
}
.seccion--rojo {
  --fondo: var(--rojo);
  --texto: var(--blanco);
  --texto-fuerte: var(--blanco);
  --texto-2: var(--blanco);
  --acento: var(--blanco);
  --linea: var(--blanco);
  --boton: var(--blanco);
  --error: var(--error-claro);
}

/* ==========================================================================
   4 · Piezas comunes
   ========================================================================== */
/* Títulos: HWT Aetna con interlineado 1; el tamaño lo da la clase (campo «Tamaño del título»). */
.titulo { font-family: var(--f-titulo); font-weight: 400; line-height: 1; color: var(--texto); overflow-wrap: break-word; }
.titulo--xl { font-size: var(--t-xl); }
.titulo--l { font-size: var(--t-l); }
.titulo--m { font-size: var(--t-m); }
.titulo--s { font-size: var(--t-s); }
.h3 { font-family: var(--f-titulo); font-weight: 400; font-size: var(--t-columna); line-height: 1.2; color: var(--texto); }

/* Texto con formato (WYSIWYG): párrafos seguidos, sin hueco (Elementor «espaciado 0»). */
.texto { color: var(--texto-2); }
.texto a { color: inherit; }
.texto strong { font-weight: 700; }
.texto ul { list-style: disc; padding-left: 1.4em; }
.texto ol { list-style: decimal; padding-left: 1.4em; }
/* Variante de lectura larga: un hueco de 20 px entre párrafos y listas. */
.texto--largo p, .texto--largo ul, .texto--largo ol, .texto--largo table { margin-bottom: 20px; }
.texto--largo > :last-child { margin-bottom: 0; }

/* Botón píldora: borde de 1 px del color del texto; se rellena de negro al pasar. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 20px 40px;
  border: 1px solid var(--boton); border-radius: 300px;
  background: transparent; color: var(--boton);
  font: 400 var(--t-boton)/1 var(--f-texto); letter-spacing: 1.2px; text-decoration: none; text-align: center;
  cursor: pointer;
  transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease;
}
.btn:hover, .btn:focus-visible { background: var(--negro); border-color: var(--negro); color: var(--blanco); }
/* Botón rectangular negro (añadir al carrito); al pasar, rojo. */
.btn-solido {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 10px 16px;
  border: 1px solid var(--negro); border-radius: 0;
  background: var(--negro); color: var(--blanco);
  font: 700 var(--t-cuerpo)/1.25 var(--f-texto); letter-spacing: 1px; text-decoration: none;
  cursor: pointer;
  transition: background-color 300ms ease, border-color 300ms ease;
}
.btn-solido:hover, .btn-solido:focus-visible { background: var(--rojo); border-color: var(--rojo); }
@media (max-width: 767px) {
  .btn--movil-ancho { width: 100%; }
}

/* Foto con fundido lateral al entrar en pantalla (Elementor fadeInLeft/fadeInRight).
   Solo con JS y sin «reducir movimiento»; si el script no llega, la foto aparece a los 4 s. */
@media (prefers-reduced-motion: no-preference) {
  html.js .aparece { opacity: 0; animation: aparece-seguro 0s 4s forwards; }
  html.js .aparece--der { translate: 60px 0; }
  html.js .aparece--izq { translate: -60px 0; }
  html.js .aparece--arriba { translate: 0 60px; }
  html.js .aparece.is-visible { animation: aparece var(--entrada) var(--ease-out) forwards; }
}
@keyframes aparece { to { opacity: 1; translate: 0 0; } }
@keyframes aparece-seguro { to { opacity: 1; translate: 0 0; } }

/* Lista de datos de contacto con icono */
.datos { display: grid; gap: 25px; }
.datos li { display: flex; align-items: flex-start; gap: 10px; color: var(--texto-fuerte); font-size: var(--t-contacto); line-height: 1.4; }
.datos svg { flex: none; width: 24px; height: 24px; margin-top: 2px; fill: var(--acento); }
.datos a { text-decoration: none; }
.datos a:hover { text-decoration: underline; }

/* ==========================================================================
   5 · Formularios (campos sobre fondo rosado, sin borde, como el formulario de Elementor)
   ========================================================================== */
.campo { display: grid; gap: 6px; }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 40px; padding: 8px 16px;
  border: 0; border-radius: 0;
  background: var(--campo-fondo); color: var(--campo-texto);
  font: 400 var(--t-campo)/1.4 var(--f-texto);
  -webkit-appearance: none; appearance: none;
}
.campo textarea { resize: vertical; height: 94px; min-height: 60px; }
.campo input::placeholder, .campo textarea::placeholder { color: var(--gris); opacity: 1; }
.campo input:focus-visible, .campo textarea:focus-visible { outline: 2px solid var(--negro); outline-offset: 0; }
.campo [aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--error); }
.campo__error { color: var(--error); font-size: var(--t-pequeno); font-weight: 600; }
.campo__error:empty { display: none; }

/* ==========================================================================
   6 · Movimiento reducido
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
