/* ==========================================================================
   PRECOLL S.A.S. — DESIGN SYSTEM
   Hoja de estilos base. Todo el sitio se construye sobre este archivo.
   Convención de nombres: BEM (Block__Element--Modifier)
   ========================================================================== */

/* ==========================================================================
   1. FUENTES — autoalojadas en assets/fonts/
   Antes se pedían a fonts.googleapis.com. Esa hoja externa bloqueaba el pintado
   y encadenaba dos conexiones a terceros (googleapis -> gstatic): el navegador
   no dibujaba nada durante ~2,2 s. Los archivos son los mismos que servía
   Google (Lexend v26 y Source Sans 3 v19, subconjuntos latin y latin-ext), así
   que la apariencia no cambia. Autorizado por el cliente el 2026-09-01.

   Ambas son fuentes VARIABLES: un único archivo por subconjunto cubre todo el
   rango de pesos, por eso se declara `font-weight` como rango y no una regla
   por peso. Los pesos en uso son 400/500/600/700/800 en Lexend y
   400/500/600/700 en Source Sans 3, exactamente los que se pedían antes.

   `font-display: swap` mantiene el texto visible desde el primer instante con
   la tipografía de respaldo. El <head> de cada página precarga únicamente los
   dos subconjuntos `latin`, que son los que necesita el español.
   ========================================================================== */

@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/lexend-latin.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;
}
@font-face {
  font-family: 'Lexend';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/lexend-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/source-sans-3-latin.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;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/source-sans-3-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ==========================================================================
   2. VARIABLES CSS (DESIGN TOKENS)
   ========================================================================== */
:root {
  /* --- Color: paleta corporativa (verificada, no modificar) --- */
  --color-primary: #E8051F;
  --color-primary-dark: #B8041A;
  --color-ink: #1A1A1A;
  --color-surface-dark: #171717;
  --color-muted: #5A5A5A;
  --color-border: #E2E2E2;
  --color-surface: #F7F7F7;
  --color-white: #FFFFFF;

  /* Variantes de uso semántico (derivadas, no nuevos colores) */
  --color-text: var(--color-ink);
  --color-text-muted: var(--color-muted);
  --color-bg: var(--color-white);
  --color-bg-alt: var(--color-surface);
  --color-bg-dark: var(--color-surface-dark);
  --color-link: var(--color-primary);
  --color-link-hover: var(--color-primary-dark);
  --color-focus-ring: #1A73E8; /* azul accesible para :focus-visible, nunca usar el rojo de marca como indicador de foco (falla contraste en algunos fondos) */

  /* --- Tipografía --- */
  --font-heading: 'Lexend', sans-serif;
  --font-body: 'Source Sans 3', sans-serif;
  --font-accent: 'Verdana', Geneva, sans-serif; /* uso exclusivo: etiqueta grande de acento en hero interior (ver .hero-label__accent) — decisión deliberada del cliente, no usar en ningún otro contexto */

  /* Escala tipográfica (consolidada — reemplaza los valores dispersos 12–30px de los bocetos) */
  --text-xs: 0.75rem;    /* 12px — etiquetas, monospace técnico */
  --text-sm: 0.875rem;   /* 14px — texto secundario, nav */
  --text-base: 1rem;     /* 16px — cuerpo estándar */
  --text-md: 1.125rem;   /* 18px — cuerpo destacado */
  --text-lg: 1.25rem;    /* 20px — subtítulos de tarjeta */
  --text-xl: 1.5rem;     /* 24px — H3 */
  --text-2xl: 1.875rem;  /* 30px — H2 */
  --text-3xl: 2.25rem;   /* 36px — H1 en móvil */
  --text-4xl: 3rem;      /* 48px — H1 en tablet */
  --text-5xl: 3.75rem;   /* 60px — H1 en desktop / hero */

  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-black: 800;

  /* --- Espaciado (escala base 4px — reemplaza los valores dispersos de los bocetos) --- */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-7: 3rem;     /* 48px */
  --space-8: 4rem;     /* 64px */
  --space-9: 6rem;     /* 96px */

  /* --- Radios de borde (consolidado — reemplaza el rango disperso 4–44px) --- */
  --radius-sm: 6px;    /* inputs, badges pequeños */
  --radius-md: 10px;   /* tarjetas, botones */
  --radius-lg: 16px;   /* contenedores grandes, imágenes destacadas */
  --radius-pill: 999px; /* botones tipo píldora, chips */

  /* --- Sombras (formalizadas a partir de las 2 variantes reales encontradas en los bocetos) --- */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 20px 50px -27px rgba(0, 0, 0, 0.45);

  /* --- Transiciones (no existían en los bocetos — definidas ahora de forma deliberada) --- */
  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;
  --transition-slow: 400ms ease;

  /* --- Bordes --- */
  --border-width: 1px;
  --border-width-accent: 3px; /* borde izquierdo rojo de tarjetas técnicas */

  /* --- Z-index (escala de apilamiento) --- */
  --z-nav: 100;
  --z-dropdown: 200;
  --z-modal: 300;
  --z-toast: 400;

  /* --- Contenedor --- */
  --container-max: 1280px;
  --container-padding: var(--space-4);
}

/* ==========================================================================
   3. BREAKPOINTS RESPONSIVE (documentados como referencia — mobile-first)
   ========================================================================== */
/*
  --bp-sm:  600px   (tablet vertical)
  --bp-md:  960px   (tablet horizontal / desktop pequeño)
  --bp-lg:  1280px  (desktop)
  --bp-xl:  1600px  (pantallas anchas / 4K)

  CSS custom properties no funcionan dentro de @media queries — estos valores
  se repiten como números literales en cada media query. Mantener esta lista
  como referencia única de verdad para los breakpoints usados en todo el sitio.

  Uso: mobile-first — estilos base para 320px, luego min-width hacia arriba.
  @media (min-width: 600px)  { ... }
  @media (min-width: 960px)  { ... }
  @media (min-width: 1280px) { ... }
  @media (min-width: 1600px) { ... }
*/

/* ==========================================================================
   4. RESET Y BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: var(--weight-regular);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; height: auto; display: block; }

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-link-hover); }

/* Accesibilidad: anillo de foco visible, nunca eliminar sin reemplazar */
:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-ink);
  margin: 0 0 var(--space-4);
}
h1 { font-size: var(--text-3xl); font-weight: var(--weight-black); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }

p { margin: 0 0 var(--space-4); }

@media (min-width: 600px) {
  h1 { font-size: var(--text-4xl); }
}
@media (min-width: 960px) {
  h1 { font-size: var(--text-5xl); }
}

/* ==========================================================================
   5. LAYOUT / CONTENEDOR
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.section {
  padding-block: var(--space-8);
}
.section--dark {
  background: var(--color-bg-dark);
  color: var(--color-white);
}
.section--alt {
  background: var(--color-bg-alt);
}

/* Etiqueta de sección — ESTILO ACTUALIZADO tras revisión del cliente.
   Reemplaza el patrón anterior de etiqueta pequeña monospace numerada
   ("01/ Historia"). Confirmado como patrón sistemático en las 4 secciones
   del Home FINAL (Catálogo, Por qué Precoll SAS, Certificaciones, Ubicación):
   palabra grande, roja, en negrita, sin numeración — seguida de una línea
   horizontal que ocupa el espacio restante. */
.section-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.section-label__text {
  font-family: var(--font-heading);
  font-size: 1.875rem; /* 30px — confirmado en el boceto, no forma parte de la escala general */
  font-weight: var(--weight-black);
  color: var(--color-primary);
  white-space: nowrap;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Uso: <div class="section-label"><span class="section-label__text">CATÁLOGO</span></div> */

/* Etiqueta de hero interior (Nosotros, Productos, Contacto): breadcrumb pequeño
   + palabra de acento grande en Verdana — decisión deliberada del cliente,
   ver DESIGN_SYSTEM.md sección 3 para el razonamiento. No usar Verdana en
   ningún otro componente del sitio. */
.hero-label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--space-5);
}
.hero-label--on-light {
  color: var(--color-muted);
}
.hero-label__accent {
  font-family: var(--font-accent);
  font-size: 2.5rem; /* 40px — token dedicado a este componente, fuera de la escala tipográfica general a propósito */
  font-weight: var(--weight-semibold);
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   6. BOTONES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  border: var(--border-width) solid transparent;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--color-primary);
  color: var(--color-white);
}
.btn--primary:hover { background: var(--color-primary-dark); color: var(--color-white); }

.btn--secondary {
  background: transparent;
  color: var(--color-ink);
  border-color: var(--color-border);
}
.btn--secondary:hover { border-color: var(--color-ink); }

.btn--dark {
  background: var(--color-ink);
  color: var(--color-white);
}
.btn--dark:hover { background: #000; color: var(--color-white); }

.btn--on-dark {
  background: transparent;
  color: var(--color-white);
  border-color: rgba(255,255,255,0.35);
}
.btn--on-dark:hover { border-color: var(--color-white); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   7. TARJETAS
   ========================================================================== */
.card {
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* Tarjeta técnica con borde izquierdo rojo — patrón usado en certificaciones,
   segmentos de producto, y datos destacados en todo el sitio */
.card--accent {
  border-left: var(--border-width-accent) solid var(--color-primary);
  background: var(--color-bg-alt);
  box-shadow: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.card--elevated {
  box-shadow: var(--shadow-lg);
}

.card__title {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}
.card__body {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ==========================================================================
   8. BADGES (certificaciones, etiquetas)
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge--cert {
  background: rgba(232, 5, 31, 0.08);
  /* Sobre su propio fondo rosado el rojo de marca da 4,09:1 y WCAG AA pide
     4,5:1 para texto pequeño. --color-primary-dark sube a 5,95:1. El fondo y
     el borde no cambian, así que el distintivo se ve igual. */
  color: var(--color-primary-dark);
  border: 1px solid rgba(232, 5, 31, 0.25);
}

/* ==========================================================================
   9. TABLAS TÉCNICAS
   ========================================================================== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.table th {
  font-family: ui-monospace, monospace;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-width) solid var(--color-border);
}
.table td {
  padding: var(--space-4);
  border-bottom: var(--border-width) solid var(--color-border);
  vertical-align: middle;
}
.table tbody tr {
  transition: background-color var(--transition-fast);
}
.table tbody tr:hover {
  background: var(--color-bg-alt);
}

/* Versión móvil: la tabla colapsa a tarjetas apiladas (ver sección 12) */

/* ==========================================================================
   10. FORMULARIOS
   ========================================================================== */
.form-group {
  margin-bottom: var(--space-5);
}
.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-muted);
  margin-bottom: var(--space-2);
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg-alt);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  outline: none;
}
.form-textarea {
  min-height: 120px;
  resize: vertical;
}
.form-input.is-error,
.form-select.is-error,
.form-textarea.is-error {
  border-color: var(--color-primary);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--color-primary);
  margin-top: var(--space-1);
}

/* ==========================================================================
   11. NAVEGACIÓN Y FOOTER
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--color-white);
  border-bottom: var(--border-width) solid var(--color-border);
}
.nav__inner {
  display: flex;
  align-items: center;
  /* CRÍTICO — confirmado en el boceto FINAL, NO usar 'center': logo queda a la
     izquierda, nav + botón Cotizar quedan empujados a la derecha. Este valor
     ya estaba correcto en versiones anteriores de este archivo, pero fue
     ignorado al construir — verificar que el HTML final realmente cargue y
     use este CSS en vez de declarar estilos inline propios. */
  justify-content: space-between;
  padding-block: var(--space-3);
}
.nav__links {
  display: none; /* oculto en móvil, ver sección 12 */
  gap: var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.nav__link {
  color: var(--color-muted);
  padding-bottom: var(--space-1);
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.nav__link:hover,
.nav__link--active {
  color: var(--color-ink);
  border-bottom-color: var(--color-primary);
}

.footer {
  background: var(--color-bg-dark);
  color: var(--color-white);
  padding-block: var(--space-7) var(--space-5);
}
.footer a { color: rgba(255,255,255,0.8); }
.footer a:hover { color: var(--color-white); }

/* ==========================================================================
   12. RESPONSIVE — BREAKPOINTS Y COMPORTAMIENTO
   ========================================================================== */
@media (min-width: 600px) {
  .nav__links { display: flex; }
  .nav__toggle { display: none; }
}

@media (max-width: 599.98px) {
  /* Tabla técnica colapsa a tarjetas apiladas en móvil */
  .table--responsive thead { display: none; }
  .table--responsive tr {
    display: block;
    margin-bottom: var(--space-4);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
  }
  .table--responsive td {
    display: flex;
    justify-content: space-between;
    border: none;
    padding: var(--space-2) 0;
  }
  .table--responsive td::before {
    content: attr(data-label);
    font-weight: var(--weight-semibold);
    color: var(--color-muted);
  }
}

/* ==========================================================================
   13. UTILIDADES
   ========================================================================== */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Respeto a preferencias de accesibilidad: reduce animaciones si el usuario lo pide */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
