/**
 * RUTA: /assets/css/base.css
 * ============================================================
 *  Estilos base — funciona con modo claro y oscuro.
 *  Usa variables de variables.css.
 * ============================================================
 */

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

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

body {
    font-family:       var(--font-sans);
    font-size:         var(--text-base);
    font-weight:       var(--fw-normal);
    line-height:       1.6;
    color:             var(--text-primary);
    background-color:  var(--bg-base);
    min-height:        100vh;
    -webkit-font-smoothing:  antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Tipografía ──────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 {
    font-weight: var(--fw-bold);
    line-height: 1.25;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

p { color: var(--text-secondary); }
a { color: var(--accent); text-decoration: none; transition: opacity var(--t-fast); }
a:hover { opacity: 0.8; }
code, pre {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--bg-border);
    border-radius: var(--radius-sm);
}
code { padding: 0.1em 0.4em; }
pre { padding: var(--sp-4); overflow-x: auto; }

/* ── Fondo decorativo ────────────────────────────────────────── */
.bg-mesh {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Modo oscuro: orbes de color suave */
[data-theme="dark"] .bg-mesh::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle,
        color-mix(in srgb, var(--accent) 6%, transparent) 0%,
        transparent 70%
    );
    top: -200px; left: -150px;
}
[data-theme="dark"] .bg-mesh::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(59,130,246,0.04) 0%,
        transparent 70%
    );
    bottom: -100px; right: -100px;
}

/* Modo claro: sin orbes, fondo limpio */
[data-theme="light"] .bg-mesh::before,
[data-theme="light"] .bg-mesh::after {
    display: none;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--bg-border-hover);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); opacity: 0.5; }

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

/* ── Animaciones ─────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

.animate-in    { animation: fadeInUp 0.3s ease both; }
.animate-fade  { animation: fadeIn 0.25s ease both; }
.animate-scale { animation: scaleIn 0.2s var(--t-spring) both; }

/* Stagger para listas de elementos */
.stagger > *:nth-child(1)  { animation-delay:  0ms; }
.stagger > *:nth-child(2)  { animation-delay: 50ms; }
.stagger > *:nth-child(3)  { animation-delay: 100ms; }
.stagger > *:nth-child(4)  { animation-delay: 150ms; }
.stagger > *:nth-child(5)  { animation-delay: 200ms; }
.stagger > *:nth-child(6)  { animation-delay: 250ms; }

/* Spinner de carga */
.spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ── Utilidades ──────────────────────────────────────────────── */
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only       { position:absolute;width:1px;height:1px;padding:0;margin:-1px;
                 overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0; }
.no-theme-transition,
.no-theme-transition * { transition: none !important; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }

@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Helpers de color de texto ───────────────────────────────── */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger)  !important; }
.text-info    { color: var(--info)    !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-accent  { color: var(--accent)  !important; }