/*
 * base.css — Estilos de elementos base
 *
 * Estilos para HTML desnudo. Sin clases utilitarias.
 * Usa tokens de tokens.css.
 *
 * La tipografía responsive usa clamp() en los elementos directamente,
 * reemplazando las ~150 líneas de .h1-xl, .h2-xl, .h1-sm... del original.
 */

/* ══════════════════════════════════════════════════════════════
   BODY
   ══════════════════════════════════════════════════════════════ */

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  align-content: space-between;
}

/* ══════════════════════════════════════════════════════════════
   ESTRUCTURA
   ══════════════════════════════════════════════════════════════ */

header, footer {
  flex-basis: 100%;
  max-width: 100%;
  width: 100%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════════════
   TIPOGRAFÍA — fluida con clamp()
   ══════════════════════════════════════════════════════════════ */

h1 {
  font-size: clamp(2rem, 4vw + 0.5rem, 3.5rem);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 3vw + 0.25rem, 2.5rem);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 2vw + 0.25rem, 1.875rem);
  line-height: var(--leading-tight);
  font-weight: var(--weight-semi);
}

h4 {
  font-size: var(--text-xl);
  line-height: var(--leading-tight);
  font-weight: var(--weight-semi);
}

h5 {
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  font-weight: var(--weight-semi);
}

h6 {
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: var(--weight-semi);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

p:last-child {
  margin-block-end: 0;
}

/* ══════════════════════════════════════════════════════════════
   ENLACES
   ══════════════════════════════════════════════════════════════ */

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════════════════════════════
   LISTAS
   ══════════════════════════════════════════════════════════════ */

ul, ol {
  padding-inline-start: var(--space-6);
  margin-block-end: var(--space-4);
}

li {
  margin-block-end: var(--space-1);
}

/* ══════════════════════════════════════════════════════════════
   IMÁGENES Y MEDIA
   ══════════════════════════════════════════════════════════════ */

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

figure {
  margin: 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-block-start: var(--space-2);
}

/* ══════════════════════════════════════════════════════════════
   FORMULARIOS Y BOTONES
   ══════════════════════════════════════════════════════════════ */

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

input, select, textarea {
  font: inherit;
  color: inherit;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}

/* ══════════════════════════════════════════════════════════════
   SEPARADORES Y BLOQUES
   ══════════════════════════════════════════════════════════════ */

hr {
  border: none;
  border-block-start: 1px solid var(--color-border);
  margin-block: var(--space-8);
}

blockquote {
  border-inline-start: 4px solid var(--color-accent);
  padding-inline-start: var(--space-4);
  color: var(--color-text-muted);
  font-style: italic;
  margin-inline: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--color-surface);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background-color: var(--color-surface);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

/* ══════════════════════════════════════════════════════════════
   TABLAS
   ══════════════════════════════════════════════════════════════ */

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: var(--space-2) var(--space-3);
  border-block-end: 1px solid var(--color-border);
  text-align: left;
}

th {
  font-weight: var(--weight-semi);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ══════════════════════════════════════════════════════════════
   SKIP LINK (accesibilidad)
   ══════════════════════════════════════════════════════════════ */

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background: var(--color-accent);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semi);
  text-decoration: none;
  z-index: var(--z-toast);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}
