/* ==========================================================================
   Winapsis — Sistema de diseño (tema claro)
   Se carga ANTES que styles.css / actividades.css / pulso.css en todas las
   páginas (ver php/brand.php → winapsis_head()). Es la única fuente de los
   tokens de color, tipografía, radios y sombras.

   Paleta oficial (Tablero de identidad visual):
     Azul oscuro  #0B2D6B  texto de marca, encabezados, fondos oscuros
     Azul         #1565FF  botones y acentos principales
     Cian         #22D3EE  hover y detalles secundarios (sólo decorativo:
                           no alcanza contraste AA como texto sobre blanco)
     Amarillo     #FDCB2E  llamadas a la acción, destacados, alertas
   ========================================================================== */

/* Nunito (SIL OFL 1.1, fonts/OFL.txt) — variable 400–900, servida localmente
   para funcionar sin CDN. Sólo subconjuntos latino y latino extendido. */
@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url("../fonts/nunito-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url("../fonts/nunito-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: light;

    /* ── Marca ─────────────────────────────────────────────────────────── */
    --wn-navy: #0B2D6B;
    --wn-navy-900: #071F4D;
    --wn-blue: #1565FF;
    --wn-blue-700: #0E4FD6;
    --wn-cyan: #22D3EE;
    --wn-cyan-700: #0E7490;      /* cian legible para texto */
    --wn-yellow: #FDCB2E;
    --wn-yellow-700: #8A6500;    /* amarillo legible para texto */

    --wn-blue-50: #EEF4FF;
    --wn-blue-100: #DCE8FF;
    --wn-cyan-50: #E8FBFE;
    --wn-yellow-50: #FFF8DD;
    --wn-navy-50: #F1F4FA;

    --wn-gradient-brand: linear-gradient(135deg, var(--wn-cyan) 0%, var(--wn-blue) 55%, var(--wn-navy) 100%);

    /* ── Superficies ───────────────────────────────────────────────────── */
    --bg-page: #F4F8FE;
    --bg-dark: var(--bg-page);          /* nombre heredado del tema oscuro */
    --bg-card: #FFFFFF;
    --bg-card-hover: #F5F8FF;
    --bg-subtle: #EEF3FB;
    --border-color: rgba(11, 45, 107, 0.12);
    --border-strong: rgba(11, 45, 107, 0.22);
    --border-glow: rgba(21, 101, 255, 0.2);

    /* ── Texto (contraste AA sobre blanco y sobre --bg-page) ───────────── */
    --text-primary: #0E1F45;     /* 16:1 */
    --text-secondary: #3F5175;   /* 7.9:1 */
    --text-muted: #5E6E8C;       /* 5.1:1 */
    --text-on-accent: #FFFFFF;

    /* ── Estados ───────────────────────────────────────────────────────── */
    --accent: var(--wn-blue);
    --accent-hover: var(--wn-blue-700);
    --accent-glow: rgba(21, 101, 255, 0.28);
    --accent-gradient: linear-gradient(135deg, #1565FF 0%, #0E4FD6 100%);
    --highlight: var(--wn-yellow);
    --success: #047857;
    --success-gradient: linear-gradient(135deg, #047857 0%, #059669 100%);
    --danger: #DC2626;
    --danger-gradient: linear-gradient(135deg, #B91C1C 0%, #DC2626 100%);
    --warning: #B45309;

    /* ── Tipografía ────────────────────────────────────────────────────── */
    --font-main: "Nunito", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-brand: "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

    /* ── Forma y profundidad ───────────────────────────────────────────── */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(11, 45, 107, 0.06), 0 1px 3px rgba(11, 45, 107, 0.08);
    --shadow-md: 0 10px 28px -12px rgba(11, 45, 107, 0.22), 0 2px 6px rgba(11, 45, 107, 0.06);
    --shadow-lg: 0 28px 56px -20px rgba(11, 45, 107, 0.3), 0 4px 12px rgba(11, 45, 107, 0.06);
    --focus-ring: 0 0 0 3px rgba(21, 101, 255, 0.35);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
html {
    background-color: var(--bg-page);
}

body {
    background-color: var(--bg-page);
    /* Fondo de marca liviano (sin imágenes): halos cian/azul + trama de nodos */
    background-image:
        radial-gradient(circle at 8% 0%, rgba(34, 211, 238, 0.16) 0, transparent 38%),
        radial-gradient(circle at 100% 100%, rgba(21, 101, 255, 0.12) 0, transparent 42%),
        radial-gradient(circle at 92% 6%, rgba(253, 203, 46, 0.12) 0, transparent 22%),
        radial-gradient(rgba(11, 45, 107, 0.07) 1px, transparent 1.2px);
    background-size: auto, auto, auto, 24px 24px;
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(34, 211, 238, 0.35);
    color: var(--wn-navy-900);
}

a {
    color: var(--wn-blue);
}

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

:focus-visible {
    outline: 3px solid rgba(21, 101, 255, 0.55);
    outline-offset: 2px;
}

/* Barras de desplazamiento claras */
* {
    scrollbar-color: rgba(11, 45, 107, 0.28) transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(11, 45, 107, 0.22);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(11, 45, 107, 0.38);
}

/* ── Logotipo ───────────────────────────────────────────────────────────── */
.wn-logo {
    display: inline-block;
    line-height: 0;
}

.wn-logo img {
    display: block;
    height: auto;
    max-width: 100%;
}

/*
 * Logos de texto heredados (topbars, tarjetas de login, cabeceras de
 * estadísticas y superadmin): se reemplazan por la imagen del logotipo sin
 * tocar su HTML. El texto "Winapsis" sigue en el DOM para lectores de
 * pantalla; el tamaño de fuente de cada contexto define la altura del logo.
 */
.logo-text,
.study-brand,
.topbar-logo,
.logo-area > h1,
.auth-logo .logo-text,
.email-logo,
.super-header-brand .logo {
    display: inline-block;
    height: 1.1em;
    aspect-ratio: 640 / 201;
    width: auto;
    min-width: calc(1.1em * 3.18);
    background: url("../images/brand/logo-winapsis.webp") left center / contain no-repeat !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    -webkit-text-stroke: 0 !important;
    text-shadow: none !important;
    filter: none !important;
    overflow: hidden;
    white-space: nowrap;
    font-size: inherit;
    line-height: 1.1;
    vertical-align: middle;
    user-select: none;
}

.logo-text *,
.topbar-logo * {
    visibility: hidden;
}

/* Barra de las páginas de actividades: "✏️ Crucigrama  [logo]" (sólo <em class="act-brand-logo">) */
.act-brand em.act-brand-logo {
    display: inline-block;
    height: 1.35em;
    width: calc(1.35em * 3.18);
    background: url("../images/brand/logo-winapsis.webp") left center / contain no-repeat;
    color: transparent !important;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: middle;
    text-indent: 110%;
}

/* ── Slogan "JUEGA • APRENDE • AVANZA" ──────────────────────────────────── */
.wn-slogan {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4em 1em;
    margin: 0;
    font-family: var(--font-brand);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.wn-slogan span {
    margin-right: -0.32em;   /* compensa el letter-spacing final */
}

.wn-dot {
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    background: var(--wn-cyan);
    font-style: normal;
}

.wn-dot--yellow {
    background: var(--wn-yellow);
}

.wn-slogan--on-dark {
    color: rgba(255, 255, 255, 0.86);
}

/* ── Iconografía de categorías (6 secciones de la identidad) ───────────── */
.wn-categories {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wn-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.wn-category img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.wn-category:hover img {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 10px 22px -10px rgba(21, 101, 255, 0.55);
}

.wn-category span {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    line-height: 1.35;
    text-transform: uppercase;
    color: var(--wn-navy);
}

@media (min-width: 1100px) {
    .wn-categories--wide {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

/* ── Pie de marca reutilizable ──────────────────────────────────────────── */
.wn-brand-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Pie de página común (SALTMINE Development) ───────────────────────── */
.wn-credit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 10px;
    flex: 0 0 100%;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 18px 16px 20px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted, #5E6E8C);
    text-align: center;
}
.wn-credit__by {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.wn-credit__logo {
    display: block;
    height: 44px;
    width: auto;
}
.wn-credit__mail {
    display: inline-flex;
    align-items: center;
    color: var(--wn-blue-700, #0E4FD6);
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.15s;
}
.wn-credit__mail:hover,
.wn-credit__mail:focus-visible { opacity: 1; transform: translateY(-1px); }
.wn-credit__mail svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
