/* ===========================================================================
   IMD Industrial · base
   Normalización, tipografía base y primitivas reutilizables: contenedor,
   botones, campos de formulario, enlaces, utilidades de accesibilidad y la
   animación de entrada al desplazar. Nada específico de una página.
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--hdr-h);   /* anclas: debajo del encabezado fijo */
  scrollbar-color: #9AA6BD var(--grey);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}

img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: .2em; text-decoration-thickness: 1.5px; }
input, select, textarea, button { font: inherit; color: inherit; }
input, textarea { caret-color: var(--blue); }
/* Al llegar por un ancla (#empresa, #productos…) el título queda a 32 px del
   encabezado, sin el relleno superior de la sección. Un solo desfase: no
   sumar otro scroll-margin aquí (se acumula con scroll-padding-top). */
.sec[id] { scroll-margin-top: calc(32px - var(--section)); }

::selection { background: var(--celeste); color: var(--navy); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--grey); }
::-webkit-scrollbar-thumb { background: #9AA6BD; border-radius: 8px; border: 3px solid var(--grey); }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
.on-dark :focus-visible, .on-dark:focus-visible { outline-color: var(--celeste); }

/* ------------------------------------------------------------- Titulares */
.display { font-size: var(--t-display); font-weight: 800; letter-spacing: -.025em; line-height: 1.04; }
.h2 { font-size: var(--t-h2); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.h3 { font-size: var(--t-h3); font-weight: 700; line-height: 1.15; }
.lead { font-size: var(--t-lead); line-height: 1.5; }

/* ------------------------------------------------------------ Estructura */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.sec { padding-block: var(--section); }
.sec--grey { background: var(--grey); }
.sec--navy { background: var(--navy); color: var(--white); }

.sec-head { max-width: 62ch; margin-bottom: clamp(32px, 4vw, 56px); }
.sec-head--row { max-width: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.sec-head--row > div { max-width: 62ch; }
.sec-head p { color: var(--ink-soft); font-size: var(--t-lead); margin-top: 16px; max-width: 62ch; }
.sec--navy .sec-head p { color: var(--on-navy-soft); }

.eyebrow {
  display: inline-block; font-size: .8125rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--blue); margin-bottom: 14px;
}
.eyebrow--dark { color: var(--celeste); }

/* --------------------------------------------------------------- Botones */
.btn {
  --bg: var(--blue); --fg: var(--white);
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 52px; padding: 0 1.4em; border: 0; border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg); font-weight: 700; font-size: 1.0625rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 180ms ease, box-shadow 180ms ease;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.btn--celeste { --bg: var(--celeste); --fg: var(--navy); }
.btn--navy { --bg: var(--navy); --fg: var(--white); }
.btn--white { --bg: var(--white); --fg: var(--navy); }
.btn--wa { --bg: var(--wa); --fg: var(--wa-ink); }
.btn--line { --bg: transparent; --fg: var(--navy); box-shadow: inset 0 0 0 1.5px var(--grey-3); }
.btn--ghost { --bg: transparent; --fg: currentColor; box-shadow: inset 0 0 0 1.5px currentColor; }
.btn--sm { min-height: 42px; font-size: .9375rem; padding: 0 1.1em; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { --bg: var(--blue-hover); }
  .btn--celeste:hover { --bg: var(--celeste-hover); }
  .btn--navy:hover { --bg: var(--navy-2); }
  .btn--white:hover { --bg: var(--blue-soft); }
  .btn--wa:hover { --bg: #3BE07B; }
  .btn--line:hover { --bg: var(--grey); box-shadow: inset 0 0 0 1.5px var(--navy); }
  .btn--ghost:hover { --bg: rgba(255, 255, 255, .12); }
}

.link-go { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--blue); text-decoration: none; }
.link-go svg { width: 18px; height: 18px; transition: transform 220ms var(--ease-out); }
.link-go:hover svg { transform: translateX(4px); }

/* Enlace de salto para teclado y lector de pantalla */
.skip {
  position: absolute; left: 16px; top: -64px; z-index: 100;
  background: var(--blue); color: var(--white); padding: 12px 16px;
  border-radius: var(--radius-sm); font-weight: 700; text-decoration: none;
  transition: top 160ms var(--ease-out);
}
.skip:focus { top: 12px; }

.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;
}

/* ---------------------------------------------------- Campos de formulario */
.field { display: grid; gap: 6px; }
.field label { font-size: var(--t-small); font-weight: 600; color: var(--ink-soft); }
.input {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--grey-2); background: var(--white);
  /* Color propio: dentro de secciones oscuras (.phead) heredaba el blanco del
     contenedor y el texto escrito no se veía sobre el fondo blanco. */
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.input::placeholder { color: #6B7A8F; opacity: 1; }
.input:-webkit-autofill { -webkit-text-fill-color: var(--ink); }
.input:hover { border-color: #B8C2D4; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 115, 230, .2); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.error { color: var(--danger); font-size: var(--t-small); }

/* -------------------------------------------- Entrada al desplazar (JS on) */
.reveal-on [data-reveal] { opacity: 0; transform: translateY(24px); }
.reveal-on [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .reveal-on [data-reveal] { opacity: 1; transform: none; }
}
