/**
 * ProfeJuegos — Estilos globales
 *
 * Este archivo se carga SOLO cuando hay un shortcode [profejuego]
 * en la página. No se carga en páginas sin juegos.
 *
 * Contiene estilos base compartidos por todos los módulos.
 * Cada módulo añade sus propios estilos vía enqueue_assets().
 *
 * @package ProfeJuegos
 * @since   1.0.0
 */

/* Contenedor base de todos los juegos */
.pj-game-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    font-family: 'Nunito', system-ui, sans-serif;
    box-sizing: border-box;
}

.pj-game-container * {
    box-sizing: border-box;
}

body:has([data-game]) .site.grid-container,
body:has([data-game]) .site-content,
body:has([data-game]) .content-area,
body:has([data-game]) .site-main,
body:has([data-game]) .inside-article,
body:has([data-game]) .entry-content {
    width: 100% !important;
    max-width: 100% !important;
}

body:has([data-game]) .site-main {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

body:has([data-game]) .inside-article {
    padding: 0 !important;
}

body:has([data-game]) #right-sidebar,
body:has([data-game]) #left-sidebar,
body:has([data-game]) .widget-area.sidebar {
    display: none !important;
}

body:has([data-game]) .entry-header,
body:has([data-game]) .featured-image,
body:has([data-game]) .page-header-image,
body:has([data-game]) .featured-image.page-header-image,
body:has([data-game]) .featured-image.page-header-image.grid-container {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* ==========================================================
   ProfeJuegos - Páginas manuales de juego (.pjgame)
   Layout definitivo: hero oscuro + caja SEO + juego
   ========================================================== */

.pjgame {
    width: 100%;
    margin: 0;
    padding: 0;
    color: #172033;
    background: #f5f8fc;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

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

.pjgame a {
    text-decoration: none;
}

.pjgame-wrap {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
}

.pjgame-hero {
    position: relative;
    display: block !important;
    padding: 34px 0 38px;
    color: #ffffff;
    background: #172033;
}

.pjgame-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 6px;
    background: linear-gradient(90deg, #e63946, #f9c74f, #16a34a, #0ea5e9, #2563eb);
}

.pjgame-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 28px;
    align-items: center;
}

.pjgame-head > div:first-child {
    max-width: 820px;
}

.pjgame-kicker {
    display: block !important;
    margin: 0 0 10px !important;
    color: #f9c74f !important;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.pjgame-title,
.pjgame h1.pjgame-title {
    display: block !important;
    margin: 0 !important;
    color: #ffffff !important;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.pjgame-text {
    display: block !important;
    max-width: 780px;
    margin: 12px 0 0 !important;
    color: rgba(255, 255, 255, .92) !important;
    font-size: 1rem;
    line-height: 1.55;
    font-weight: 600;
}

.pjgame-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.pjgame-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 900;
}

.pjgame-btn-secondary {
    color: #ffffff !important;
    border: 2px solid rgba(255, 255, 255, .55);
    background: rgba(255, 255, 255, .1);
}

.pjgame-btn-secondary:hover,
.pjgame-btn-secondary:focus {
    color: #ffffff !important;
    background: rgba(255, 255, 255, .18);
}

.pjgame-band {
    padding: 34px 0 42px;
    background: #f5f8fc;
}

.pjgame-seo-box {
    width: min(980px, 100%);
    margin: 0 auto;
    padding: 34px;
    border: 1px solid #dfe7f3;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(23, 32, 51, .10);
}

.pjgame-seo-kicker {
    margin: 0 0 8px !important;
    color: #e63946 !important;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.pjgame-seo-title {
    margin: 0 !important;
    color: #172033 !important;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.08;
    font-weight: 900;
}

.pjgame-seo-intro {
    max-width: 760px;
    margin: 14px 0 0 !important;
    color: #334155 !important;
    font-size: 1.02rem;
    line-height: 1.65;
}

.pjgame-seo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.pjgame-card {
    min-height: 210px;
    padding: 20px;
    border: 1px solid #dfe7f3;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(23, 32, 51, .06);
}

.pjgame-card h2,
.pjgame-card h3 {
    margin: 0 0 10px !important;
    color: #172033 !important;
    font-size: 1.05rem;
    line-height: 1.25;
    font-weight: 900;
}

.pjgame-card p {
    margin: 0 !important;
    color: #334155 !important;
    font-size: .98rem;
    line-height: 1.55;
    font-weight: 650;
}

.pjgame-pill {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 10px;
    padding: 5px 9px;
    border-radius: 8px;
    color: #ffffff;
    background: #e63946;
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.pjgame-start {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.pjgame-start-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    min-width: min(430px, 100%);
    padding: 14px 42px;
    border-radius: 8px;
    color: #ffffff !important;
    background: #16a34a;
    font-size: 1.2rem;
    font-weight: 900;
    text-decoration: none !important;
    box-shadow: 0 18px 34px rgba(22, 163, 74, .24);
}

.pjgame-start-button:hover,
.pjgame-start-button:focus {
    color: #ffffff !important;
    background: #107238;
}

.pjgame-play {
    display: none;
    padding: 28px 0 56px;
    background: #f5f8fc;
}

.pjgame-play:target {
    display: block;
    scroll-margin-top: 24px;
}

.pjgame:has(.pjgame-play:target) .pjgame-hero,
.pjgame:has(.pjgame-play:target) .pjgame-band {
    display: none !important;
}

.pjgame:has(.pjgame-play:target) .pjgame-play {
    padding-top: 28px;
}

.pjgame-play-wrap {
    width: min(1320px, calc(100% - 20px));
    margin: 0 auto;
}

body:has(.pjgame) .entry-header,
body:has(.pjgame) .featured-image,
body:has(.pjgame) .page-header-image,
body:has(.pjgame) .featured-image.page-header-image,
body:has(.pjgame) .featured-image.page-header-image.grid-container {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

@media (max-width: 1050px) {
    .pjgame-head {
        grid-template-columns: 1fr;
    }

    .pjgame-actions {
        justify-content: flex-start;
    }

    .pjgame-seo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .pjgame-wrap {
        width: min(100% - 28px, 1180px);
    }

    .pjgame-hero {
        padding: 28px 0 34px;
    }

    .pjgame-title,
    .pjgame h1.pjgame-title {
        font-size: clamp(1.8rem, 9vw, 2.6rem);
    }

    .pjgame-seo-box {
        padding: 24px;
    }

    .pjgame-seo-grid {
        grid-template-columns: 1fr;
    }

    .pjgame-card {
        min-height: auto;
    }

    .pjgame-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .pjgame-btn,
    .pjgame-start-button {
        width: 100%;
    }

    .pjgame-play {
        padding: 22px 0 44px;
    }

    .pjgame-play:target {
        display: block;
    }

    .pjgame:has(.pjgame-play:target) .pjgame-hero,
    .pjgame:has(.pjgame-play:target) .pjgame-band {
        display: none !important;
    }
}

/* Mensaje de error en producción */
.pj-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 12px 16px;
    color: #b91c1c;
    font-size: .9rem;
}

.pj-game-start-hidden {
    max-height: 0 !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-top-width: 0 !important;
    border-bottom-width: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.pj-game-seo.pj-game-seo--started {
    max-height: 0 !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.pj-game-seo .pj-game-start-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: min(100%, 430px) !important;
    min-height: 68px !important;
    margin: 30px auto 0 !important;
    padding: 18px 34px !important;
    border-radius: 8px !important;
    font-size: clamp(1.25rem, 2vw, 1.55rem) !important;
    line-height: 1.1 !important;
    text-align: center !important;
    box-shadow: 0 18px 34px rgba(22, 163, 74, .24) !important;
}

.pj-game-seo .pj-game-start-button:hover,
.pj-game-seo .pj-game-start-button:focus {
    transform: translateY(-2px);
    box-shadow: 0 22px 38px rgba(37, 99, 235, .22) !important;
}

.pjui-creator-screen {
    display: grid;
    gap: 18px;
}

.pjui-hero {
    --pjui-hero-gradient: linear-gradient(135deg, #2563eb, #0ea5e9);
    padding: 22px 16px;
    border-radius: 16px;
    text-align: center;
    color: #fff;
    background: var(--pjui-hero-gradient);
    box-shadow: 0 10px 28px rgba(37, 99, 235, .18);
}

.pjui-hero-title-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.pjui-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    line-height: 1;
}

.pjui-hero-title {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.05;
    font-weight: 900;
    color: #fff;
}

.pjui-hero-subtitle {
    margin: 0;
    font-size: 1.28rem;
    line-height: 1.2;
    font-weight: 800;
    color: rgba(255, 255, 255, .96);
}

.pjui-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.pjui-choice-grid.is-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pjui-choice-card {
    width: 100%;
    min-height: 180px;
    padding: 22px;
    border: 1px solid #dbe4f0;
    border-radius: 16px;
    background: #fff;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(23, 32, 51, .06);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease, color .18s ease;
}

.pjui-choice-card:hover,
.pjui-choice-card:focus,
.pjui-choice-card:focus-visible {
    color: #1e293b;
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 10px 26px rgba(37, 99, 235, .16);
    outline: none;
    transform: translateY(-1px);
}

.pjui-choice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    margin-bottom: 14px;
}

.pjui-choice-icon img {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: contain;
}

.pjui-choice-tag {
    display: block;
    margin-bottom: 8px;
    color: #1d4ed8;
    font-size: .86rem;
    font-weight: 900;
    text-transform: uppercase;
}

.pjui-choice-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.35rem;
    color: #1d4ed8;
}

.pjui-choice-card small {
    display: block;
    color: #475569;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.45;
}

@media (max-width: 900px) {
    .pjui-choice-grid {
        grid-template-columns: 1fr;
    }
}
