/* ============================================================================
   RENOVA RACK · Lotes de estantería industrial — Sistema de diseño global
   ----------------------------------------------------------------------------
   Arquitectura del archivo (orden intencional, de menor a mayor especificidad):
     01. Tokens de diseño (custom properties)
     02. Reset y base
     03. Tipografía
     04. Layout (contenedor, secciones, grids)
     05. Componentes: botones, badges, formularios, tarjetas
     06. Cabecera y navegación
     07. Hero
     08. Bloques de la home (beneficios, destacados, servicios, métricas, CTA)
     09. Listado de lotes (filtros + grid)
     10. Detalle de lote (galería + ficha)
     11. Pie de página
     12. Motion: estados iniciales de las animaciones GSAP
     13. Responsive y utilidades
   ----------------------------------------------------------------------------
   Nota de marca (Manual de Directrices de Marca, Renova · Danov Studio 2025):
     Primario    Negro Técnico   #101820  — fondos, encabezados, alto impacto
     Secundario  Cool Gray 11 C  #54565A  — cuerpos de texto y neutros
     Blanco                      #FFFFFF  — claridad y orden
     Complementario de la submarca RENOVA RACK: Rojo Industrial #e1251b
     (el Azul Técnico #1ecad3 pertenece a Renova Servis y NO se usa aquí)
   Se exponen como --brand-* y de ellos se derivan los roles semánticos.
   ========================================================================== */

/* ==========================================================================
   00. TIPOGRAFÍA CORPORATIVA — Linear Grotesk
   Autoalojada en /fonts (woff2). Se descartó Google Fonts a propósito: era la
   única petición a un tercero de todo el sitio y transfería la IP del
   visitante a Google, lo que obligaría a pedir consentimiento de cookies.
   Con la fuente en el propio dominio la web no hace ninguna llamada externa
   que trate datos personales.
   Jerarquía definida por el manual (pág. 26):
     Black 900 mayúsculas -> títulos principales
     Black 900            -> encabezados secundarios
     SemiBold 600 itálica -> énfasis dentro del texto (nunca subrayado)
     Regular 400          -> párrafos y contenido general
   ========================================================================== */
@font-face {
  font-family: "Linear Grotesk";
  src: url("fonts/LinearGrotesk-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Linear Grotesk";
  src: url("fonts/LinearGrotesk-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Linear Grotesk";
  src: url("fonts/LinearGrotesk-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Linear Grotesk";
  src: url("fonts/LinearGrotesk-SemiBoldItalic.woff2") format("woff2");
  font-weight: 600; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Linear Grotesk";
  src: url("fonts/LinearGrotesk-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Linear Grotesk";
  src: url("fonts/LinearGrotesk-Black.woff2") format("woff2");
  font-weight: 900; font-style: normal; font-display: swap;
}

/* ==========================================================================
   01. TOKENS DE DISEÑO
   Todo el sistema visual se controla desde aquí. Rebrandear la plataforma
   completa es cuestión de tocar el bloque --brand-* y nada más.
   ========================================================================== */
:root {
  /* --- Identidad RENOVA ---------------------------------------------------
     Valores tomados del kit vectorial oficial (Renova Brand), no aproximados
     de una imagen: son los hex exactos que usan los SVG del logotipo.      */
  --brand-navy: #101820;   /* Primario   · Black 6 C      */
  --brand-cyan: #1ecad3;   /* Complementario de Renova Servis: NO usar en Rack */
  --brand-red:  #e1251b;   /* Complementario RENOVA RACK  */
  --brand-gray: #54565A;   /* Secundario · Cool Gray 11 C */

  /* --- Roles semánticos exigidos por la especificación --------------------
     En la submarca RACK el acento es el Rojo Industrial. Da 4,7:1 de
     contraste sobre blanco, así que cumple AA también usado como texto.
     El cian queda declarado como referencia pero NO se usa: pertenece a
     Renova Servis y mezclarlo rompería la arquitectura de marca. */
  --primary:    var(--brand-navy);
  --secondary:  var(--brand-gray);
  --accent:     var(--brand-red);
  --background: #ffffff;
  --surface:    #f4f5f6;

  /* Alias del acento para texto e iconos. Existe para que cambiar el color de
     énfasis de toda la plataforma sea una sola línea. */
  --secondary-ink: var(--brand-red);

  /* --- Derivados de superficie -------------------------------------------- */
  --surface-2:  #eceeef;
  --surface-3:  #e0e3e5;
  --overlay:    rgba(16, 24, 32, .58);

  /* --- Texto --------------------------------------------------------------- */
  --text:        #101820;
  --text-soft:   #454a4f;
  --text-muted:  #6e7378;
  --text-invert: #ffffff;

  /* --- Bordes y separadores ------------------------------------------------ */
  --border:        #e2e5e7;
  --border-strong: #c8cccf;
  --ring:          rgba(225, 37, 27, .30);

  /* --- Estados ------------------------------------------------------------- */
  --success:    #1c9d6b;
  --success-bg: #e5f6ef;
  --warning:    #b8791a;
  --warning-bg: #fdf1de;
  --danger:     var(--brand-red);
  --danger-bg:  #fdeaea;
  --info:       #54565A;
  --info-bg:    #eceeef;

  /* --- Tipografía ---------------------------------------------------------- */
  --font-sans: "Linear Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;

  /* Escala fluida: cada paso interpola entre móvil (320px) y desktop (1440px) */
  --fs-xs:   clamp(.72rem, .70rem + .10vw, .78rem);
  --fs-sm:   clamp(.82rem, .79rem + .15vw, .90rem);
  --fs-base: clamp(.95rem, .91rem + .20vw, 1.05rem);
  --fs-md:   clamp(1.05rem, .99rem + .30vw, 1.20rem);
  --fs-lg:   clamp(1.25rem, 1.14rem + .55vw, 1.60rem);
  --fs-xl:   clamp(1.55rem, 1.32rem + 1.15vw, 2.30rem);
  --fs-2xl:  clamp(2.00rem, 1.55rem + 2.25vw, 3.40rem);
  --fs-3xl:  clamp(2.60rem, 1.75rem + 4.25vw, 5.20rem);

  --lh-tight: 1.08;
  --lh-snug:  1.28;
  --lh-base:  1.65;

  /* --- Espaciado (escala de 4px) ------------------------------------------- */
  --sp-1: .25rem;  --sp-2: .5rem;   --sp-3: .75rem;  --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4rem;
  --sp-9: 6rem;    --sp-10: 8rem;
  --section-y: clamp(4rem, 2.5rem + 7vw, 9rem);

  /* --- Formas -------------------------------------------------------------- */
  --r-xs: 6px;  --r-sm: 10px;  --r-md: 14px;
  --r-lg: 20px; --r-xl: 28px;  --r-full: 999px;

  /* --- Sombras (suaves, estilo Linear / Stripe) ---------------------------- */
  --sh-xs: 0 1px 2px rgba(15, 24, 33, .05);
  --sh-sm: 0 2px 6px rgba(15, 24, 33, .06), 0 1px 2px rgba(15, 24, 33, .04);
  --sh-md: 0 10px 26px rgba(15, 24, 33, .08), 0 2px 6px rgba(15, 24, 33, .04);
  --sh-lg: 0 24px 60px rgba(15, 24, 33, .12), 0 6px 16px rgba(15, 24, 33, .06);
  --sh-glow: 0 0 0 4px var(--ring);

  /* --- Movimiento ---------------------------------------------------------- */
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-io:  cubic-bezier(.65, 0, .35, 1);
  --t-fast: .18s var(--ease-out);
  --t-base: .32s var(--ease-out);
  --t-slow: .6s  var(--ease-out);

  /* --- Layout -------------------------------------------------------------- */
  --container: 1200px;
  --container-wide: 1400px;
  --header-h: 72px;

  /* --- Scroll Color Fade (efecto tipo Drink Cann) --------------------------
     GSAP escribe estas dos variables sobre :root durante el scroll.
     El valor declarado aquí es el fallback si GSAP no llega a cargar.      */
  --fade-bg:  var(--background);
  --fade-ink: var(--text);
}

/* --- Modo oscuro: por atributo (elección explícita del usuario) ------------ */
:root[data-theme="dark"] {
  --primary:    #2a353d;
  --secondary-ink: #ff6a61;
  --secondary:  #8a9096;
  --accent:     #ff5b52;
  --background: #0B1116;
  --surface:    #131A20;

  --surface-2: #1b232a;
  --surface-3: #26303a;
  --overlay:   rgba(3, 8, 12, .7);

  --text:       #E6EEF2;
  --text-soft:  #b9c0c6;
  --text-muted: #868e95;

  --border:        #242d35;
  --border-strong: #36424c;
  --ring:          rgba(255, 91, 82, .32);

  --success-bg: #102b22;
  --warning-bg: #2e2313;
  --danger-bg:  #2e1616;
  --info-bg:    #1b232a;

  --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --sh-sm: 0 2px 6px rgba(0, 0, 0, .45);
  --sh-md: 0 10px 26px rgba(0, 0, 0, .5);
  --sh-lg: 0 24px 60px rgba(0, 0, 0, .6);
}

/* --- Modo oscuro: por preferencia del sistema -----------------------------
   Solo aplica si el usuario NO ha elegido explícitamente el modo claro.   */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary:    #2a353d;
    --secondary-ink: #ff6a61;
    --secondary:  #8a9096;
    --accent:     #ff5b52;
    --background: #0B1116;
    --surface:    #131A20;
    --surface-2:  #1b232a;
    --surface-3:  #26303a;
    --overlay:    rgba(3, 8, 12, .7);
    --text:       #E6EEF2;
    --text-soft:  #b9c0c6;
    --text-muted: #868e95;
    --border:        #242d35;
    --border-strong: #36424c;
    --ring:          rgba(255, 91, 82, .32);
    --success-bg: #102b22;
    --warning-bg: #2e2313;
    --danger-bg:  #2e1616;
    --info-bg:    #1b232a;
    --sh-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --sh-sm: 0 2px 6px rgba(0, 0, 0, .45);
    --sh-md: 0 10px 26px rgba(0, 0, 0, .5);
    --sh-lg: 0 24px 60px rgba(0, 0, 0, .6);
  }
}

/* ==========================================================================
   02. RESET Y BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  /* Fondo y tinta se interpolan con GSAP durante el scroll.
     El doble fallback garantiza color aunque el JS no se ejecute. */
  background-color: var(--fade-bg, var(--background));
  color: var(--fade-ink, var(--text));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .25s linear;
}

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }

:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

::selection { background: var(--secondary); color: #06232a; }

/* Barra de scroll discreta (WebKit) */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); background-clip: content-box; }

/* Enlace de salto para navegación por teclado */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--primary); color: var(--text-invert);
  padding: var(--sp-3) var(--sp-5); border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; }

/* ==========================================================================
   03. TIPOGRAFÍA
   ========================================================================== */
h1, h2, h3, h4 {
  line-height: var(--lh-tight);
  font-weight: 800;
  letter-spacing: -.025em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); letter-spacing: -.015em; }
h4 { font-size: var(--fs-md); font-weight: 700; letter-spacing: -.01em; }

p { text-wrap: pretty; }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--secondary-ink);
}
.eyebrow::before {
  content: ""; width: 26px; height: 2px;
  background: currentColor; border-radius: var(--r-full);
}

.lead {
  font-size: var(--fs-md);
  color: var(--text-soft);
  max-width: 62ch;
}

/* En las secciones que atraviesa el Color Fade, el texto secundario se deriva
   de la tinta interpolada en lugar de un token estático. */
.fade-scope .lead,
.fade-scope .muted { color: color-mix(in srgb, var(--fade-ink) 68%, transparent); }

.muted { color: var(--text-muted); }
.mono  { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   04. LAYOUT
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, .5rem + 2.5vw, 2.5rem);
}
.container--wide   { max-width: var(--container-wide); }
.container--narrow { max-width: 780px; }

.section { padding-block: var(--section-y); position: relative; }
.section__head { max-width: 720px; margin-bottom: var(--sp-7); }
.section__head--center { margin-inline: auto; text-align: center; }
.section__head h2 { margin-block: var(--sp-3) var(--sp-4); }

.grid { display: grid; gap: var(--sp-5); }
.grid--2 { grid-template-columns: repeat(auto-fit,  minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }

.stack   { display: flex; flex-direction: column; gap: var(--sp-4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }

/* ==========================================================================
   05. COMPONENTES
   ========================================================================== */

/* --- Botones --------------------------------------------------------------- */
.btn {
  --btn-bg: var(--primary);
  --btn-fg: var(--text-invert);
  --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: .82rem 1.5rem;
  font-size: var(--fs-sm); font-weight: 600; letter-spacing: -.005em;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-full);
  cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              background-color var(--t-fast), border-color var(--t-fast),
              opacity var(--t-fast);
  will-change: transform;
}
.btn:hover:not(:disabled)  { transform: translateY(-2px); box-shadow: var(--sh-md); }
.btn:active:not(:disabled) { transform: translateY(0);    box-shadow: var(--sh-xs); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn--accent    { --btn-bg: var(--accent); }
.btn--secondary { --btn-bg: var(--secondary); --btn-fg: #052229; }
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--fade-ink, var(--text));
  --btn-bd: color-mix(in srgb, var(--fade-ink, var(--text)) 22%, transparent);
}
.btn--ghost:hover:not(:disabled) {
  --btn-bg: color-mix(in srgb, var(--fade-ink, var(--text)) 7%, transparent);
  box-shadow: none;
}
.btn--soft {
  --btn-bg: color-mix(in srgb, var(--secondary) 14%, transparent);
  --btn-fg: var(--secondary-ink);
}
.btn--sm    { padding: .55rem 1rem;  font-size: var(--fs-xs); }
.btn--lg    { padding: 1.05rem 2rem; font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn__icon  { width: 1.05em; height: 1.05em; flex: none; }

/* Micro-desplazamiento de la flecha en hover: detalle tipo Stripe */
.btn .arrow { transition: transform var(--t-fast); }
.btn:hover .arrow { transform: translateX(3px); }

/* --- Badges de estado ------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .72rem;
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em;
  border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-soft);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--disponible { background: var(--success-bg); color: var(--success); }
.badge--reservado  { background: var(--warning-bg); color: var(--warning); }
.badge--vendido    { background: var(--danger-bg);  color: var(--danger); }
.badge--eliminado  { background: var(--surface-3);  color: var(--text-muted); }

/* --- Formularios ----------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-soft); }
.field__hint  { font-size: var(--fs-xs); color: var(--text-muted); }
.field__error { font-size: var(--fs-xs); font-weight: 600; color: var(--danger); min-height: 1.1em; }

.input, .select, .textarea {
  width: 100%;
  padding: .74rem .95rem;
  font-size: var(--fs-sm);
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: var(--sh-glow);
}
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-bg);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
.select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c828e' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .8rem center;
  background-size: 1.05rem;
}

/* --- Tarjeta genérica ------------------------------------------------------ */
.card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
}

/* Variante translúcida para las secciones con Color Fade: sus colores derivan
   de la tinta interpolada, así la tarjeta funciona sobre fondo blanco, crema,
   azul y navy sin necesidad de clases adicionales por sección. */
.card--fade {
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 4%, transparent);
  border-color: color-mix(in srgb, var(--fade-ink, var(--text)) 12%, transparent);
  backdrop-filter: blur(8px);
}

/* ==========================================================================
   06. CABECERA Y NAVEGACIÓN
   ========================================================================== */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center;
  border-bottom: 1px solid transparent;
  transition: background-color var(--t-base), box-shadow var(--t-base),
              border-color var(--t-base), backdrop-filter var(--t-base);
}
/* Estado "scrolled": lo activa script.js al superar 24px de scroll */
.header.is-scrolled {
  background: color-mix(in srgb, var(--fade-bg, var(--background)) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: color-mix(in srgb, var(--fade-ink, var(--text)) 10%, transparent);
  box-shadow: var(--sh-sm);
}
.header__inner {
  width: 100%; max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: clamp(1rem, .5rem + 2.5vw, 2.5rem);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-5);
}

.brand { display: inline-flex; align-items: center; gap: var(--sp-3); flex: none; }
.brand__logo { height: 34px; width: auto; }
/* Se muestra una u otra variante del logotipo según el modo activo */
.brand__logo--dark { display: none; }
:root[data-theme="dark"] .brand__logo--light { display: none; }
:root[data-theme="dark"] .brand__logo--dark  { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand__logo--light { display: none; }
  :root:not([data-theme="light"]) .brand__logo--dark  { display: block; }
}

.nav { display: flex; align-items: center; gap: var(--sp-2); }
.nav__link {
  position: relative;
  padding: .5rem .9rem;
  font-size: var(--fs-sm); font-weight: 500;
  color: color-mix(in srgb, var(--fade-ink, var(--text)) 72%, transparent);
  border-radius: var(--r-full);
  transition: color var(--t-fast), background-color var(--t-fast);
}
.nav__link:hover {
  color: var(--fade-ink, var(--text));
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 7%, transparent);
}
.nav__link.is-active { color: var(--fade-ink, var(--text)); font-weight: 600; }
.nav__link.is-active::after {
  content: ""; position: absolute; left: 50%; bottom: .12rem;
  transform: translateX(-50%);
  width: 16px; height: 2px; border-radius: var(--r-full);
  background: var(--secondary);
}

.header__actions { display: flex; align-items: center; gap: var(--sp-2); }

/* Botón de tema claro / oscuro */
.theme-toggle {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  border: 1px solid color-mix(in srgb, var(--fade-ink, var(--text)) 16%, transparent);
  color: var(--fade-ink, var(--text));
  transition: background-color var(--t-fast), transform var(--t-fast);
}
.theme-toggle:hover {
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 8%, transparent);
  transform: rotate(-18deg);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun  { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* Menú hamburguesa (solo móvil) */
.nav-toggle { display: none; width: 38px; height: 38px; place-items: center; color: var(--fade-ink, var(--text)); }
.nav-toggle svg { width: 22px; height: 22px; }

/* ==========================================================================
   07. HERO CON VÍDEO DE FONDO
   --------------------------------------------------------------------------
   Tres capas apiladas dentro de .hero (position: relative):

     .hero__media    absolute inset:0   -> el <video> a sangre
     .hero__overlay  absolute inset:0   -> velo oscuro y degradados
     .hero__inner    position: relative -> el contenido, por encima

   Las animaciones de entrada son CSS puro, sin GSAP. Motivos:
     · El hero es lo primero que se ve: no puede depender de un CDN externo.
     · Se evita el parpadeo de tener que ocultarlo con JS y revelarlo después.
   GSAP sigue encargándose del resto de la página (Scroll Color Fade y reveals).
   ========================================================================== */
.hero {
  position: relative;
  min-height: min(100svh, 940px);
  display: grid;
  align-items: center;                 /* contenido centrado verticalmente */
  padding-block: calc(var(--header-h) + var(--sp-7)) var(--sp-9);
  overflow: hidden;
  isolation: isolate;                  /* contiene los z-index de las capas */
  background: var(--brand-navy);       /* color de espera antes del póster */
}

/* --- Capa 1: el vídeo -------------------------------------------------- */
.hero__media { position: absolute; inset: 0; z-index: 0; }

.hero__video {
  width: 100%; height: 100%;
  object-fit: cover;                   /* llena el marco sin deformarse */
  object-position: center 55%;         /* encuadre algo bajo: la estantería manda */
  display: block;
  /* Un punto de contraste y otro de saturación: el metraje de obra sale plano
     y así gana cuerpo sin necesidad de retocar el vídeo. */
  filter: saturate(1.08) contrast(1.06);
}

/* --- Capa 2: velo de legibilidad ---------------------------------------- */
.hero__overlay {
  position: absolute; inset: 0; z-index: 1;
  /* Velo base al 55 % (el máximo del rango pedido) más dos degradados:
     uno superior para que la cabecera se lea sobre cualquier fotograma y
     otro inferior que asienta el contenido y la señal de scroll. */
  background:
    linear-gradient(to bottom, rgba(16, 24, 32, .72) 0%, rgba(16, 24, 32, 0) 26%),
    linear-gradient(to top,    rgba(16, 24, 32, .78) 0%, rgba(16, 24, 32, 0) 42%),
    linear-gradient(105deg,    rgba(16, 24, 32, .55) 0%, rgba(16, 24, 32, .38) 60%, rgba(16, 24, 32, .5) 100%);
}

/* --- Capa 3: contenido --------------------------------------------------- */
.hero__inner {
  position: relative; z-index: 2;
  width: 100%;
  color: #fff;
}
.hero__inner > * { max-width: 24ch; }
.hero__inner > .hero__lead { max-width: 56ch; }
.hero__inner > .hero__actions,
.hero__inner > .hero__meta { max-width: none; }

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase;
  color: #fff;
}
.hero__eyebrow::before {
  content: ""; width: 30px; height: 2px;
  background: var(--brand-red); border-radius: var(--r-full);
}

.hero__title {
  font-size: clamp(2.3rem, 1.5rem + 3.9vw, 4.6rem);
  font-weight: 900;                    /* Linear Grotesk Black, según manual */
  line-height: 1.02;
  letter-spacing: -.03em;
  text-wrap: balance;
  /* Sombra muy suave: separa el texto del vídeo sin que se note el truco */
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}
.hero__title .word { display: inline-block; }
.hero__title .em { color: var(--brand-red); }

.hero__lead {
  margin-top: var(--sp-5);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: rgba(255, 255, 255, .88);
  text-shadow: 0 1px 14px rgba(0, 0, 0, .3);
}

.hero__actions {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  margin-top: var(--sp-6);
}

/* Microanimación pedida: leve zoom + sombra al pasar por encima */
.hero__btn {
  transition: transform var(--t-fast), box-shadow var(--t-fast),
              background-color var(--t-fast), border-color var(--t-fast);
}
.hero__btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.035);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
}
.hero__btn:active:not(:disabled) { transform: translateY(0) scale(.99); }

/* Botón traslúcido para el secundario: sobre vídeo, un ghost normal se pierde */
.btn--glass {
  --btn-bg: rgba(255, 255, 255, .12);
  --btn-fg: #fff;
  --btn-bd: rgba(255, 255, 255, .42);
  backdrop-filter: blur(8px);
}
.btn--glass:hover:not(:disabled) { --btn-bg: rgba(255, 255, 255, .2); }

/* --- Franja de datos ----------------------------------------------------- */
.hero__meta {
  display: flex; flex-wrap: wrap;
  gap: var(--sp-5) var(--sp-7);
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid rgba(255, 255, 255, .18);
}
.hero__meta-item strong {
  display: block;
  font-size: var(--fs-lg); font-weight: 800;
  letter-spacing: -.02em; line-height: 1.1;
  color: #fff;
}
.hero__meta-item span {
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, .68);
}

/* --- Control de pausa ---------------------------------------------------- */
.hero__pause {
  position: absolute; right: clamp(1rem, 2.5vw, 2.5rem); bottom: clamp(1rem, 2.5vw, 2.5rem);
  z-index: 3;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  color: #fff;
  background: rgba(16, 24, 32, .5);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: var(--r-full);
  backdrop-filter: blur(8px);
  transition: background-color var(--t-fast), transform var(--t-fast);
}
.hero__pause:hover { background: rgba(16, 24, 32, .78); transform: scale(1.08); }
.hero__pause svg { width: 16px; height: 16px; }
.hero__pause .icon-play { display: none; }
/* aria-pressed="true" = el usuario ha pausado: se ofrece «reanudar» */
.hero__pause[aria-pressed="true"] .icon-pause { display: none; }
.hero__pause[aria-pressed="true"] .icon-play  { display: block; }

/* --- Señal de scroll ----------------------------------------------------- */
.hero__scroll {
  position: absolute; left: 50%; bottom: var(--sp-5);
  transform: translateX(-50%);
  z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255, 255, 255, .6);
}
.hero__scroll-line {
  width: 1px; height: 42px;
  background: linear-gradient(to bottom, currentColor, transparent);
}

/* ==========================================================================
   07b. ENTRADA DEL HERO — fade-in + slide-up en CSS puro
   El escalonado se hace con :nth-child en lugar de una variable por elemento,
   porque el editor de textos regenera los <span class="word"> del titular y
   cualquier atributo inline se perdería.
   ========================================================================== */
@keyframes heroIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}
@keyframes heroWord {
  from { opacity: 0; transform: translateY(38px); }
  to   { opacity: 1; transform: none; }
}

.hero__eyebrow,
.hero__lead,
.hero__actions,
.hero__meta,
.hero__scroll,
.hero__pause {
  /* `both` (backwards + forwards) en lugar de `forwards` con opacity:0 aparte.
     Durante el retardo se aplica el fotograma inicial, así que el escalonado
     se ve igual; pero si por lo que sea las animaciones no llegaran a correr,
     el elemento se queda con su estilo normal (visible) en vez de invisible
     para siempre. En el hero, que es lo primero que se ve, esa diferencia
     importa. */
  animation: heroIn .85s var(--ease-out) both;
}
/* 120 ms de margen: da tiempo a que Content.apply() sustituya los textos
   editados antes de que arranque la animación, y así no se ve el cambio. */
.hero__eyebrow { animation-delay: .12s; }
.hero__lead    { animation-delay: .62s; }
.hero__actions { animation-delay: .74s; }
.hero__meta    { animation-delay: .86s; }
.hero__scroll  { animation-delay: 1.05s; }
.hero__pause   { animation-delay: 1.05s; }

.hero__title .word {
  animation: heroWord .95s var(--ease-out) both;
}
.hero__title .word:nth-child(1)  { animation-delay: .18s; }
.hero__title .word:nth-child(2)  { animation-delay: .25s; }
.hero__title .word:nth-child(3)  { animation-delay: .32s; }
.hero__title .word:nth-child(4)  { animation-delay: .39s; }
.hero__title .word:nth-child(5)  { animation-delay: .46s; }
.hero__title .word:nth-child(6)  { animation-delay: .53s; }
.hero__title .word:nth-child(7)  { animation-delay: .60s; }
.hero__title .word:nth-child(8)  { animation-delay: .67s; }
.hero__title .word:nth-child(9)  { animation-delay: .74s; }
.hero__title .word:nth-child(10) { animation-delay: .81s; }
.hero__title .word:nth-child(11) { animation-delay: .88s; }
.hero__title .word:nth-child(n+12) { animation-delay: .95s; }

/* Movimiento reducido: todo visible de inmediato, sin desplazamientos.
   El vídeo lo pausa script.js, que es lo que exige la WCAG. */
@media (prefers-reduced-motion: reduce) {
  .hero__eyebrow, .hero__lead, .hero__actions, .hero__meta,
  .hero__scroll, .hero__pause, .hero__title .word {
    opacity: 1;
    animation: none;
    transform: none;
  }
  .hero__scroll-line { display: none; }
}

/* ==========================================================================
   07c. RESPONSIVE DEL HERO
   ========================================================================== */
@media (max-width: 991px) {
  .hero { min-height: min(92svh, 780px); }
  .hero__inner > * { max-width: 100%; }
  .hero__meta { gap: var(--sp-4) var(--sp-6); margin-top: var(--sp-6); }
}

@media (max-width: 767px) {
  .hero {
    min-height: auto;
    padding-block: calc(var(--header-h) + var(--sp-8)) var(--sp-9);
  }
  /* En móvil el vídeo de fondo cuesta batería y datos, y el encuadre 16:9
     recortado a vertical apenas deja ver la estantería. Se mantiene, pero el
     velo sube para que el texto gane sin depender del fotograma. */
  .hero__overlay {
    background:
      linear-gradient(to bottom, rgba(16, 24, 32, .8) 0%, rgba(16, 24, 32, .58) 30%,
                                  rgba(16, 24, 32, .62) 70%, rgba(16, 24, 32, .85) 100%);
  }
  .hero__title { font-size: clamp(2rem, 1.2rem + 6vw, 2.9rem); }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { width: 100%; }
  .hero__meta { gap: var(--sp-4); }
  .hero__meta-item { flex: 1 1 42%; }
  .hero__scroll { display: none; }        /* estorba con el pulgar */
  .hero__pause { right: var(--sp-3); bottom: var(--sp-3); }
}

@media (max-width: 359px) {
  .hero__meta-item { flex: 1 1 100%; }
}

/* ==========================================================================
   08. BLOQUES DE LA HOME
   ========================================================================== */

/* --- Beneficios ------------------------------------------------------------ */
.benefit {
  padding: var(--sp-6);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 3.5%, transparent);
  border: 1px solid color-mix(in srgb, var(--fade-ink, var(--text)) 9%, transparent);
  transition: transform var(--t-base), box-shadow var(--t-base), background-color var(--t-base);
}
.benefit:hover { transform: translateY(-6px); box-shadow: var(--sh-md); }
.benefit__icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--secondary) 18%, transparent);
  color: var(--secondary-ink);
  margin-bottom: var(--sp-4);
}
.benefit__icon svg { width: 22px; height: 22px; }
.benefit h3 { margin-bottom: var(--sp-3); font-size: var(--fs-md); }
.benefit p  { font-size: var(--fs-sm); color: color-mix(in srgb, var(--fade-ink, var(--text)) 65%, transparent); }

/* --- Tarjeta de lote (reutilizada en home, listado y relacionados) --------- */
.lote-card {
  display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 4%, transparent);
  border: 1px solid color-mix(in srgb, var(--fade-ink, var(--text)) 11%, transparent);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
  will-change: transform;
}
.lote-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--sh-lg);
  border-color: color-mix(in srgb, var(--secondary) 45%, transparent);
}
.lote-card__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.lote-card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .7s var(--ease-out);
}
.lote-card:hover .lote-card__media img { transform: scale(1.07); }
.lote-card__badge { position: absolute; top: var(--sp-3); left: var(--sp-3); backdrop-filter: blur(6px); }
.lote-card__id {
  position: absolute; top: var(--sp-3); right: var(--sp-3);
  padding: .22rem .6rem;
  font-family: var(--font-mono); font-size: var(--fs-xs);
  background: rgba(15, 24, 33, .62); color: #fff;
  border-radius: var(--r-full);
  backdrop-filter: blur(6px);
}
.lote-card__body { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; }
.lote-card__title { font-size: var(--fs-md); font-weight: 700; letter-spacing: -.015em; }
.lote-card__loc {
  font-size: var(--fs-xs);
  color: color-mix(in srgb, var(--fade-ink, var(--text)) 55%, transparent);
  display: flex; align-items: center; gap: .35rem;
}
.lote-card__loc svg { width: 13px; height: 13px; flex: none; }
.lote-card__specs {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: color-mix(in srgb, var(--fade-ink, var(--text)) 62%, transparent);
}
.lote-card__specs span {
  padding: .2rem .55rem;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 7%, transparent);
}
.lote-card__foot {
  margin-top: auto; padding-top: var(--sp-4);
  border-top: 1px solid color-mix(in srgb, var(--fade-ink, var(--text)) 9%, transparent);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.lote-card__price {
  font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.lote-card__price small {
  display: block; font-size: var(--fs-xs); font-weight: 500;
  color: color-mix(in srgb, var(--fade-ink, var(--text)) 55%, transparent);
  letter-spacing: 0;
}
.lote-card__cta {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--secondary); color: #052229;
  transition: transform var(--t-fast);
}
.lote-card:hover .lote-card__cta { transform: translateX(3px) scale(1.06); }
.lote-card__cta svg { width: 17px; height: 17px; }

/* --- Métricas / estadísticas ---------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--sp-5); }
.stat { text-align: center; padding: var(--sp-5) var(--sp-4); }
.stat__value {
  font-size: clamp(2.2rem, 1.5rem + 3vw, 3.8rem);
  font-weight: 800; letter-spacing: -.045em; line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(160deg, var(--secondary), var(--primary));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
:root[data-theme="dark"] .stat__value { background: linear-gradient(160deg, #7fe3ee, var(--secondary)); -webkit-background-clip: text; background-clip: text; }
.stat__label {
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: color-mix(in srgb, var(--fade-ink, var(--text)) 62%, transparent);
}

/* --- CTA final (fondo navy del Color Fade) --------------------------------- */
.cta { text-align: center; }
.cta h2 { max-width: 18ch; margin-inline: auto; }
.cta .lead { margin-inline: auto; margin-top: var(--sp-4); }
.cta__actions { margin-top: var(--sp-6); justify-content: center; }
.cta__ring {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 50% at 50% 45%, color-mix(in srgb, var(--secondary) 16%, transparent), transparent 70%);
}

/* ==========================================================================
   09. LISTADO DE LOTES
   ========================================================================== */
.page-head {
  padding-top: calc(var(--header-h) + var(--sp-8));
  padding-bottom: var(--sp-6);
}
.breadcrumb {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); color: var(--text-muted);
  margin-bottom: var(--sp-4);
}
.breadcrumb a:hover { color: var(--secondary-ink); }
.breadcrumb span { opacity: .5; }

.filters {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 40;
  display: grid;
  grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(130px, 1fr)) auto;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  margin-bottom: var(--sp-6);
}
.filters__search { position: relative; }
.filters__search .input { padding-left: 2.5rem; }
.filters__search svg {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted); pointer-events: none;
}

.results-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.results-bar strong { color: var(--text); font-weight: 700; }

/* Estado vacío reutilizable (listado, detalle, tablas del panel) */
.empty {
  text-align: center;
  padding: var(--sp-9) var(--sp-5);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--text-muted);
}
.empty__icon {
  width: 56px; height: 56px; margin: 0 auto var(--sp-4);
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text-muted);
}
.empty__icon svg { width: 26px; height: 26px; }
.empty h3 { color: var(--text); margin-bottom: var(--sp-2); font-size: var(--fs-md); }

/* Skeletons de carga */
.skeleton {
  border-radius: var(--r-lg);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 50%, var(--surface-2) 70%);
  background-size: 220% 100%;
  animation: skeleton 1.3s var(--ease-io) infinite;
}
.skeleton--card { height: 380px; }
@keyframes skeleton { from { background-position: 180% 0; } to { background-position: -40% 0; } }

/* ==========================================================================
   10. DETALLE DE LOTE
   ========================================================================== */
.detalle { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(1.5rem, 1rem + 3vw, 3.5rem); align-items: start; }

.gallery__main {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--sh-md);
}
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__badge { position: absolute; top: var(--sp-4); left: var(--sp-4); }
.gallery__thumbs { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); flex-wrap: wrap; }
.gallery__thumb {
  width: 92px; aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid transparent;
  opacity: .62;
  transition: opacity var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.gallery__thumb:hover { opacity: 1; transform: translateY(-2px); }
.gallery__thumb.is-active { opacity: 1; border-color: var(--secondary); }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }

.ficha {
  position: sticky; top: calc(var(--header-h) + var(--sp-4));
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-sm);
}
.ficha__price {
  font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.04em; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.ficha__price small { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted); letter-spacing: 0; margin-top: var(--sp-1); }

.specs { display: grid; gap: 1px; background: var(--border); border-radius: var(--r-md); overflow: hidden; margin-block: var(--sp-5); }
.specs__row { display: flex; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--background); font-size: var(--fs-sm); }
.specs__row dt { color: var(--text-muted); }
.specs__row dd { font-weight: 600; text-align: right; }

.prose { color: var(--text-soft); font-size: var(--fs-sm); line-height: 1.75; }
.prose p + p { margin-top: var(--sp-3); }

/* ==========================================================================
   11. PIE DE PÁGINA
   ========================================================================== */
.footer {
  background: var(--primary);
  color: #cfdae1;
  padding-block: var(--sp-8) var(--sp-6);
  margin-top: var(--sp-8);
}
:root[data-theme="dark"] .footer { background: #070C10; }
.footer__grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: var(--sp-6); }
.footer__brand p { font-size: var(--fs-sm); max-width: 34ch; margin-top: var(--sp-4); color: #92a5b0; }
.footer h4 { color: #fff; font-size: var(--fs-sm); margin-bottom: var(--sp-4); letter-spacing: .04em; text-transform: uppercase; }
.footer li + li { margin-top: var(--sp-2); }
.footer a { font-size: var(--fs-sm); color: #a9bcc6; transition: color var(--t-fast); }
.footer a:hover { color: var(--secondary); }
.footer__legal {
  margin-top: var(--sp-7); padding-top: var(--sp-5);
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: flex; flex-wrap: wrap; gap: var(--sp-3); justify-content: space-between;
  font-size: var(--fs-xs); color: #7d919d;
}
.footer__logo { height: 32px; width: auto; }

/* ==========================================================================
   12. MOTION — estados iniciales de las animaciones GSAP
   ----------------------------------------------------------------------------
   IMPORTANTE: los estados ocultos SOLO se aplican cuando <html> lleva la clase
   .js-anim, que script.js añade únicamente si GSAP se ha cargado con éxito.
   Si el CDN falla, el contenido permanece visible: fallo seguro.
   ========================================================================== */
.js-anim .reveal        { opacity: 0; transform: translateY(38px); }
.js-anim .reveal-scale  { opacity: 0; transform: scale(.94); }
.js-anim .reveal-left   { opacity: 0; transform: translateX(-42px); }
.js-anim .reveal-right  { opacity: 0; transform: translateX(42px); }

/* Respeto por la preferencia de movimiento reducido del sistema operativo */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js-anim .reveal, .js-anim .reveal-scale,
  .js-anim .reveal-left, .js-anim .reveal-right { opacity: 1 !important; transform: none !important; }
}

/* ==========================================================================
   13. RESPONSIVE Y UTILIDADES
   ========================================================================== */

/* --- Desktop pequeño / tablet grande (< 1200px) --------------------------- */
@media (max-width: 1199px) {
  .footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Tablet (< 992px) ------------------------------------------------------ */
@media (max-width: 991px) {
  .detalle { grid-template-columns: 1fr; }
  .ficha { position: static; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters__search { grid-column: 1 / -1; }
}

/* --- Móvil (< 768px) ------------------------------------------------------- */
@media (max-width: 767px) {
  :root { --header-h: 62px; }

  /* La navegación pasa a panel desplegable a pantalla completa */
  .nav-toggle { display: grid; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch;
    gap: 0;
    padding: var(--sp-4);
    background: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--sh-lg);
    transform: translateY(-120%);
    /* Igual que en el panel: sin `visibility` el menú cerrado queda fuera de
       pantalla pero sus enlaces siguen siendo tabulables e invisibles. */
    visibility: hidden;
    transition: transform var(--t-base), visibility var(--t-base);
  }
  .nav.is-open { transform: translateY(0); visibility: visible; }
  .nav__link { padding: var(--sp-4); border-radius: var(--r-sm); color: var(--text); }
  .nav__link.is-active::after { display: none; }

  .hero { min-height: auto; }
  .hero__meta { gap: var(--sp-5); }
  .filters { position: static; grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr; gap: var(--sp-5); }
  .footer__legal { flex-direction: column; gap: var(--sp-2); }
  .gallery__thumb { width: 74px; }
  .section__head { margin-bottom: var(--sp-5); }
}

/* --- Móvil pequeño (320px) ------------------------------------------------ */
@media (max-width: 359px) {
  .btn { padding: .7rem 1.1rem; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { width: 100%; }
}

/* --- Utilidades ------------------------------------------------------------ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.text-center { text-align: center; }
.hidden      { display: none !important; }
.mt-0 { margin-top: 0; }  .mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.w-full { width: 100%; }

/* Impresión: se eliminan cromos, animaciones y elementos fijos */
@media print {
  .header, .footer, .hero__scroll, .filters, .theme-toggle, .nav-toggle { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card, .lote-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ==========================================================================
   14. COMPONENTES DE VENTA
   Bloque añadido para el catálogo de estantería: etiqueta de escasez,
   contador de unidades, botonera de contacto, historial de precio y las
   tarjetas de servicio con la iconografía oficial de Renova Rack.
   ========================================================================== */

/* --- Etiqueta de escasez ---------------------------------------------------
   El texto lo calcula LoteStore.etiqueta() a partir del stock real, nunca es
   un campo manual: así no puede quedar desfasada respecto a las existencias. */
.flag {
  display: inline-flex; align-items: center; gap: .34rem;
  padding: .28rem .68rem;
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  border-radius: var(--r-full);
  white-space: nowrap;
  background: var(--accent); color: #fff;
  box-shadow: var(--sh-sm);
}
.flag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.flag--unico   { background: var(--primary); color: #fff; }
.flag--ultimas { background: var(--accent);  color: #fff; }
.flag--agotado { background: var(--surface-3); color: var(--text-muted); box-shadow: none; }
:root[data-theme="dark"] .flag--unico { background: var(--surface-3); color: var(--text); }

/* --- Contador de unidades disponibles -------------------------------------- */
.stock { margin-block: var(--sp-4); }
.stock--sm { margin-block: var(--sp-2) 0; }
.stock__bar {
  height: 7px;
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 12%, transparent);
  border-radius: var(--r-full);
  overflow: hidden;
}
.stock__bar span {
  display: block; height: 100%;
  background: var(--primary);
  border-radius: var(--r-full);
  transition: width var(--t-slow);
}
.stock.is-low .stock__bar span { background: var(--accent); }
.stock__txt {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: color-mix(in srgb, var(--fade-ink, var(--text)) 62%, transparent);
}
.stock__txt strong { color: var(--fade-ink, var(--text)); font-weight: 700; }
.stock.is-low .stock__txt strong { color: var(--accent); }
.stock--sm .stock__bar { height: 5px; }

/* --- Familia / fabricante en la tarjeta ------------------------------------ */
.lote-card__cat {
  display: flex; align-items: center; gap: .38rem;
  font-size: var(--fs-xs); font-weight: 600;
  letter-spacing: .02em;
  color: var(--secondary-ink);
}
.lote-card__cat svg { width: 13px; height: 13px; flex: none; }

/* --- Encabezado de sección dentro de la ficha ------------------------------ */
.h-sec {
  font-size: var(--fs-lg);
  padding-bottom: var(--sp-3);
  border-bottom: 2px solid var(--border);
}

/* --- Ficha técnica en dos columnas ----------------------------------------- */
.specs--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.specs--grid .specs__row { flex-direction: column; align-items: flex-start; gap: .18rem; }
.specs--grid .specs__row dd { text-align: left; }

/* --- Panel de compra -------------------------------------------------------- */
.ficha__top { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.ficha__title { font-size: var(--fs-lg); margin-bottom: var(--sp-3); }
.ficha__actions { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-5); }
.ficha__actions .btn__icon { width: 1.2em; height: 1.2em; }
.ficha__notas {
  margin-top: var(--sp-5); padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.ficha__notas li { position: relative; padding-left: 1.1rem; }
.ficha__notas li + li { margin-top: var(--sp-2); }
.ficha__notas li::before {
  content: ""; position: absolute; left: 0; top: .5em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}

/* --- Historial de precio ---------------------------------------------------- */
.precio-hist {
  margin-top: var(--sp-7);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.precio-hist__head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.precio-hist__head h2 { font-size: var(--fs-md); }
.precio-hist p { font-size: var(--fs-xs); }
.precio-hist__body {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  gap: var(--sp-5); align-items: center;
  margin-top: var(--sp-4);
}
.precio-hist__spark { color: var(--accent); }
.spark { display: block; width: 100%; max-width: 260px; height: auto; }

.precio-hist__list { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.precio-hist__list li {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: var(--sp-3); align-items: baseline;
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--border);
}
.precio-hist__list li:last-child { border-bottom: 0; }
.precio-hist__list li.is-current .precio-hist__val { font-weight: 800; color: var(--text); }
.precio-hist__date { color: var(--text-muted); font-size: var(--fs-xs); }
.precio-hist__val { font-weight: 600; }
.precio-hist__dif { font-size: var(--fs-xs); font-weight: 700; text-align: right; min-width: 5ch; }
.precio-hist__dif.is-down { color: var(--success); }
.precio-hist__dif.is-up   { color: var(--accent); }

.delta {
  padding: .2rem .55rem;
  font-size: var(--fs-xs); font-weight: 700;
  border-radius: var(--r-full);
}
.delta--down { background: var(--success-bg); color: var(--success); }
.delta--up   { background: var(--danger-bg);  color: var(--danger); }

/* --- Servicios complementarios ---------------------------------------------
   Los iconos son los SVG oficiales de la iconografía de Renova Rack, servidos
   como <img>: así conservan intactos el grosor de línea y el Rojo Industrial
   que exige el manual (pág. 50), sin riesgo de recolorearlos por error. */
.servicio {
  display: flex; gap: var(--sp-4); align-items: flex-start;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--fade-ink, var(--text)) 3.5%, transparent);
  border: 1px solid color-mix(in srgb, var(--fade-ink, var(--text)) 9%, transparent);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.servicio:hover { transform: translateY(-4px); box-shadow: var(--sh-md); }
.servicio__icon {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--border);
}
.servicio__icon img { width: 30px; height: 30px; }
.servicio h3 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.servicio p {
  font-size: var(--fs-sm);
  color: color-mix(in srgb, var(--fade-ink, var(--text)) 65%, transparent);
}

/* Los iconos oficiales también sustituyen a los SVG genéricos de beneficios */
.benefit__icon { background: #fff; border: 1px solid var(--border); }
.benefit__icon img { width: 26px; height: 26px; }

/* --- Tagline ESPACIO -> EFICIENCIA ------------------------------------------
   SVG en línea: hereda `color` del contenedor, así el tagline acompaña
   automáticamente a la tinta interpolada del Scroll Color Fade y funciona
   igual en modo claro y oscuro sin duplicar el archivo. */
.tagline {
  display: block;
  width: min(430px, 80%); height: auto;
  margin-inline: auto;
  color: var(--fade-ink, var(--text));
}

/* ==========================================================================
   15. MODAL PÚBLICO — "Haz tu oferta"
   El panel tiene su propio modal en admin/style.css; este es el del sitio
   público, que no carga aquella hoja.
   ========================================================================== */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: var(--sp-4);
}
.modal.is-open { display: flex; }
.modal__backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(3px); }
.modal__dialog {
  position: relative;
  width: 100%; max-width: 480px; max-height: 92svh;
  display: flex; flex-direction: column;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  animation: modal-in .28s var(--ease-out);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.97); } }

.modal__head {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-5); border-bottom: 1px solid var(--border);
}
.modal__head h2 { font-size: var(--fs-md); }
.modal__head p { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 3px; }
.modal__close {
  margin-left: auto; width: 30px; height: 30px; flex: none;
  display: grid; place-items: center; border-radius: var(--r-sm); color: var(--text-muted);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__close svg { width: 17px; height: 17px; }
.modal__body {
  padding: var(--sp-5);
  /* El cuerpo del modal debe encogerse y hacer scroll, no desbordar.
     Ojo con la cadena flex: entre .modal__dialog y .modal__body hay un
     <form>, que por defecto es un bloque y corta la cadena. Sin las reglas
     de .modal__dialog > form el cuerpo mide su alto natural (1700 px en el
     formulario de lote), el diálogo lo recorta con overflow:hidden y los
     últimos campos quedan sencillamente inalcanzables.
     `min-height: 0` es imprescindible: el valor por defecto (`auto`) impide
     que un ítem flex encoja por debajo de su contenido. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;   /* el scroll no se contagia a la página */

  /* Barra siempre visible, para que se vea que hay más contenido */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;

  /* Sombras de scroll en CSS puro: aparecen solo si queda contenido por
     encima o por debajo. El truco es mezclar capas `local` (se mueven con
     el contenido) y `scroll` (fijas al marco). */
  background:
    linear-gradient(var(--background) 30%, rgba(0, 0, 0, 0)) top    / 100% 26px no-repeat local,
    linear-gradient(rgba(0, 0, 0, 0), var(--background) 70%) bottom / 100% 26px no-repeat local,
    radial-gradient(farthest-side at 50% 0,    rgba(16, 24, 32, .16), rgba(0, 0, 0, 0)) top    / 100% 11px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, rgba(16, 24, 32, .16), rgba(0, 0, 0, 0)) bottom / 100% 11px no-repeat scroll;
}

/* Restablece la cadena flex que rompe el <form> */
.modal__dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Barra de desplazamiento del modal, visible y con el gris corporativo */
.modal__body::-webkit-scrollbar { width: 10px; }
.modal__body::-webkit-scrollbar-track { background: var(--surface); border-radius: var(--r-full); }
.modal__body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid var(--surface);
  border-radius: var(--r-full);
}
.modal__body::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Cabecera y pie no se encogen: siempre a la vista mientras se hace scroll */
.modal__head, .modal__foot { flex: none; }
.modal__foot {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* Resumen del lote dentro del modal de oferta */
.oferta__ref {
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
}
.oferta__ref strong { display: block; font-size: var(--fs-sm); color: var(--text); margin-bottom: 2px; }
.oferta__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.oferta__grid .field--full { grid-column: 1 / -1; }
.oferta__nota { font-size: var(--fs-xs); color: var(--text-muted); text-align: center; }

/* ==========================================================================
   16. RESPONSIVE DE LOS BLOQUES NUEVOS
   ========================================================================== */
@media (max-width: 767px) {
  .precio-hist__body { grid-template-columns: 1fr; }
  .precio-hist__spark { order: 2; }
  .specs--grid { grid-template-columns: 1fr; }
  .servicio { flex-direction: column; gap: var(--sp-3); }
  .oferta__grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   17. PÁGINAS LEGALES
   Aviso legal, política de privacidad y política de cookies. Documentos
   largos de lectura continua: medida de línea corta, jerarquía marcada y
   tablas que se pueden desplazar en móvil.
   ========================================================================== */
.legal { max-width: 74ch; }
.legal > * + * { margin-top: var(--sp-4); }

.legal h2 {
  margin-top: var(--sp-8);
  padding-bottom: var(--sp-3);
  font-size: var(--fs-lg);
  border-bottom: 2px solid var(--border);
}
.legal h3 { margin-top: var(--sp-6); font-size: var(--fs-md); }
.legal p, .legal li { font-size: var(--fs-sm); line-height: 1.75; color: var(--text-soft); }
.legal strong { color: var(--text); font-weight: 600; }
.legal a { color: var(--secondary-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.legal ul, .legal ol { padding-left: 1.3rem; }
.legal ul li { list-style: disc; }
.legal ol li { list-style: decimal; }
.legal li + li { margin-top: var(--sp-2); }

/* Ficha de datos del titular */
.legal-card {
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
}
.legal-card dl { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); }
.legal-card dt { color: var(--text-muted); }
.legal-card dd { color: var(--text); font-weight: 500; }

/* Tabla de cookies / tratamientos */
.legal-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.legal-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.legal-table th, .legal-table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.legal-table thead th {
  font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); background: var(--surface); white-space: nowrap;
}
.legal-table tbody tr:last-child td { border-bottom: 0; }
.legal-table code { font-family: var(--font-mono); color: var(--text); }

.legal-updated {
  margin-top: var(--sp-8); padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-muted);
}

@media (max-width: 560px) {
  .legal-card dl { grid-template-columns: 1fr; gap: 0; }
  .legal-card dd { margin-bottom: var(--sp-3); }
}
