/* ============================================================
   IIAP Design System — tokens/index.css
   Punto de entrada único para todos los design tokens
   Instituto de Investigaciones Ambientales del Pacífico
   ============================================================ */

@import './colors.css';
@import './typography.css';

/* ─── Google Fonts (CDN — para desarrollo rápido) ─── */
/* Para producción: usar @fontsource (ver skills/astro-integration.md) */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Source+Sans+3:ital,wght@0,400;0,500;0,600;1,400&family=Playfair+Display:wght@400;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Reset moderno ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Tipografía base ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-primary-900);
  text-wrap: balance;
}

h1 { font-size: clamp(var(--text-3xl), 5vw, var(--text-4xl)); }
h2 { font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl)); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p {
  line-height: var(--leading-relaxed);
  text-wrap: pretty;
}

/* ─── Links ─── */
a {
  color: var(--color-primary-600);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-primary-700);
}

/* ─── Media ─── */
img,
video,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ─── Listas ─── */
ul, ol {
  padding-left: var(--space-6);
}

li {
  line-height: var(--leading-relaxed);
  margin-block: var(--space-1);
}

/* ─── Código ─── */
code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background-color: var(--color-primary-50);
  color: var(--color-primary-800);
  padding: var(--space-0-5) var(--space-1-5);
  border-radius: var(--radius-sm);
}

pre {
  background-color: var(--color-primary-900);
  color: var(--color-primary-100);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

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

/* ─── HR ─── */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-8);
}

/* ─── Tablas ─── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

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

th {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-semibold);
  background-color: var(--color-primary-50);
  color: var(--color-primary-800);
  letter-spacing: var(--tracking-wide);
  font-size: var(--text-xs);
  text-transform: uppercase;
}

tbody tr:hover {
  background-color: var(--color-primary-50);
}

/* ─── Focus visible (accesibilidad) ─── */
:focus-visible {
  outline: 3px solid var(--color-primary-500);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ─── Selección de texto ─── */
::selection {
  background-color: var(--color-primary-200);
  color: var(--color-primary-900);
}

/* ─── Scrollbar (opcional, WebKit) ─── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-neutral-100);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary-400);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-600);
}
