/* ============================================================
   core/base.css
   Estilos base del documento (usa tokens)
   Capa mínima y predecible (la estética vive en typography/layout/components)
   ============================================================ */

/* ------------------------------
   DOCUMENTO
------------------------------ */
html {
  font-family: var(--font-family-base);
  color: var(--color-text);
  background: var(--color-bg);
}

/* ------------------------------
   BODY
------------------------------ */
body {
  padding-top: var(--header-height, 70px);
  min-height: 100dvh;
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  overflow-x: hidden;
}

/* ------------------------------
   IMÁGENES Y MEDIOS
------------------------------ */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ------------------------------
   TIPOGRAFÍA BASE (defaults seguros)
   typography.css controla el ritmo real dentro de main.
------------------------------ */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-heading);
}

p {
  margin: 0;
  line-height: var(--line-height-relaxed);
  /* ⚠️ NO definimos color aquí — typography.css lo controla en main */
}

/* ------------------------------
   ENLACES (globales)
------------------------------ */
a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition-normal);
}

a:hover {
  color: var(--link-hover-color);
}

/* ------------------------------
   TABLAS
------------------------------ */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: var(--space-3);
  border: 1px solid var(--color-border-subtle);
  text-align: left;
}

th {
  background: var(--gray-100);
  font-weight: 600;
}

/* ------------------------------
   FORMULARIOS (BASE)
------------------------------ */
input, select, textarea, button {
  font: inherit;
  color: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--color-white);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

textarea {
  resize: vertical;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-lighter);
}

button {
  cursor: pointer;
}

/* ------------------------------
   FOCUS ACCESIBLE GLOBAL
------------------------------ */
:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* ------------------------------
   SELECCIÓN DE TEXTO
------------------------------ */
::selection {
  background: var(--color-brand-dark);
  color: #fff;
}

/* ------------------------------
   CONTENEDOR GENÉRICO
------------------------------ */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding-inline: var(--space-4);
}