/* ============================================================
   Master League — Base / Reset
   ============================================================ */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Previene que el drawer móvil (translateX 100%) cause scroll horizontal */
    overflow-x: hidden;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    /* Previene que el drawer móvil cause scroll horizontal */
    overflow-x: hidden;
}

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

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

input, select, textarea {
    font: inherit;
    color: inherit;
}

/* Foco accesible y visible sobre tema oscuro */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--color-accent-hover); }

/* === Headings === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-text-strong);
    font-weight: var(--weight-bold);
    line-height: var(--leading-tight);
    margin: 0;
}
h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); font-weight: var(--weight-semibold); }
h5, h6 { font-size: var(--text-base); font-weight: var(--weight-semibold); }

p {
    margin: 0;
    line-height: var(--leading-relaxed);
}

/* === Selección y scrollbar === */
::selection {
    background: var(--color-accent);
    color: white;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-text-subtle); }

/* === Layout primitives === */
.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

.container-narrow {
    width: 100%;
    max-width: var(--container-narrow);
    margin-inline: auto;
    padding-inline: var(--space-4);
}

@media (min-width: 768px) {
    .container,
    .container-narrow { padding-inline: var(--space-6); }
}

/* === Bloque principal de página === */
main { flex: 1; padding-block: var(--space-6); }

@media (min-width: 768px) {
    main { padding-block: var(--space-8); }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}
