/* El Legado · base: reinicio, tipografía, utilidades, botones y formularios. Valores de tokens.css. */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  /* Inter con tamaños ópticos: a 30px o más usa su corte de titular (más cerrado). */
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Una familia y dos pesos: la jerarquía sale del tamaño y del gris, no de la negrita. */
h1, h2, h3, h4 { margin: 0; font-weight: 500; line-height: var(--leading-snug); }
b, strong { font-weight: 600; }
p { margin: 0; }
a { color: inherit; }
.muted { color: var(--text-2); font-weight: 400; }
.small { font-size: var(--text-xs); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
/* Etiqueta en mayúsculas: siempre con aire entre letras. */
.eyebrow, .modal-section h3, .modal-callout h3, .type-tag, .priority {
  text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: 600; font-size: var(--text-xs);
}

/* ---------- Íconos ({% icono %}, static/img/iconos.svg) ---------- */
/* De trazo y del color del texto; las marcas, en relleno y con su color. El tamaño lo pone quien lo usa. */
.icon {
  flex: none; width: var(--icon-sm); height: var(--icon-sm);
  fill: none; stroke: currentColor; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round;
}
.icon-xs { width: var(--icon-xs); height: var(--icon-xs); }
.icon-md { width: var(--icon-md); height: var(--icon-md); }
.icon-lg { width: var(--icon-lg); height: var(--icon-lg); }
.marca-meta { color: var(--marca-meta); }
.marca-facebook { color: var(--marca-facebook); }
.marca-instagram { color: var(--marca-instagram); }
.marca-whatsapp { color: var(--marca-whatsapp); }
.marca-messenger { color: var(--marca-messenger); }
.marca-kommo { color: var(--marca-kommo); }
.marca-n8n { color: var(--marca-n8n); }
/* Ícono + texto en una línea: el texto conserva la línea base del párrafo y el ícono se centra con él. */
.with-icon { display: inline-flex; align-items: baseline; gap: var(--space-2); }
.with-icon > .icon { align-self: center; }
/* Sobre tinta el color de marca no contrasta: el logotipo toma el del texto (cada componente de tinta lo indica). */
.btn-primary .marca { color: inherit; }

/* ---------- Botones y formularios ---------- */
/* Secundario: píldora con contorno. Las acciones terciarias van como enlace. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
  font: 500 var(--text-sm) / 1.5 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}
.btn:hover { border-color: var(--line-hover); background: var(--surface-2); }
/* Al presionar se hunde un poco. */
.btn:active { transform: translateY(1px); }
/* Primario (uno por sección): tinta elevada, con el borde de arriba iluminado. */
.btn-primary {
  background: var(--ink); color: var(--on-ink); border-color: var(--ink);
  box-shadow: var(--shadow-ink);
}
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-primary:active { box-shadow: none; }
.btn-small { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); gap: var(--space-1); }
.btn-small .icon { width: var(--icon-xs); height: var(--icon-xs); }
.link-button { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.text-link { font-weight: 500; text-decoration: underline; text-decoration-color: var(--line-hover); text-underline-offset: 3px; }
.text-link:hover { text-decoration-color: currentColor; }

/* Botón de ícono: círculo en relleno gris con el ícono de trazo a 20px. */
.icon-button {
  flex: none; display: inline-grid; place-items: center;
  width: var(--icon-button); height: var(--icon-button); padding: 0;
  border: 0; border-radius: 50%; background: var(--fill); color: var(--text);
  font: inherit; cursor: pointer; transition: background-color var(--duration-fast) var(--ease);
}
.icon-button:hover { background: var(--fill-hover); }
.icon-button .icon { width: var(--icon-md); height: var(--icon-md); }

input, select, textarea {
  font: 400 var(--text-sm) / 1.5 var(--font-body);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  padding: var(--space-2) var(--space-3);
  /* Campo hundido: sombra interior arriba. */
  box-shadow: var(--inset-field);
  transition: border-color var(--duration-fast) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: var(--line-hover); }
::placeholder { color: var(--text-3); }
/* Selector con chevron propio: igual en todos los navegadores. */
select {
  appearance: none;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px;
  padding-right: calc(var(--space-3) * 3);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- Formularios (el acceso tiene su hoja: acceso.css) ---------- */
.field { display: grid; gap: var(--space-2); }
.field label { font-weight: 500; }
.form-error { margin-top: var(--space-4); color: var(--bad-800); background: var(--bad-50); border-left: 4px solid var(--bad-500); padding: var(--space-2) var(--space-3); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
