/* ================================================
   BINGU — Cabecera y pie de la web (diseño 2026)
   Marcado: includes/header.php, includes/footer.php. JS: includes/header-js.php.
   Usa los tokens --b-* y los componentes .b-* de brand.css (se cargan los dos desde includes/web-fonts.php).
   Clases con prefijo sh- (cabecera) y sf- (pie) para no chocar con los estilos viejos de global.css.
   Boceto de referencia: mockups/cabecera-pie-rediseno-2026.html
   ================================================ */

:root {
    /* Alto de la cabecera fija: franja 4px + barra + borde 1px.
       Lo usan los paneles «sticky» de las páginas (top: calc(var(--site-header-h) + Npx)). */
    --site-header-h: 81px;
}
@media (max-width: 1023px) {
    :root { --site-header-h: 75px; }
}
html { scroll-padding-top: calc(var(--site-header-h) + 12px); }
body.sh-menu-open { overflow: hidden; }

.sh, .sf {
    font-family: var(--b-font);
    font-weight: 500;
    line-height: 1.5;
    color: var(--b-text);
    letter-spacing: 0;
}
.sh [hidden], .sf [hidden] { display: none !important; }
.sh :focus-visible, .sf :focus-visible { outline: 4px solid var(--b-focus); outline-offset: 3px; }
.sh ul, .sf ul { list-style: none; margin: 0; padding: 0; }
.sh-wrap, .sf-wrap { width: var(--b-max); margin: 0 auto; }

/* ================================================
   CABECERA
   ================================================ */
.sh-skip {
    position: absolute;
    left: 16px;
    top: -100px;
    z-index: 100;
    background: var(--b-text);
    color: #fff;
    padding: 10px 18px;
    border-radius: var(--b-radius-sm);
    font-family: var(--b-font);
    font-weight: 700;
    text-decoration: none;
}
.sh-skip:focus-visible { top: 12px; outline: 4px solid var(--b-blue); }

.sh {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--b-surface);
    border-bottom: 1px solid var(--b-line);
    margin-bottom: 28px;   /* el mismo hueco que dejaba la cabecera vieja: las páginas cuentan con él */
    transition: box-shadow 0.2s ease;
}
/* Franja de marca: la única nota de degradado de la cabecera */
.sh::before {
    content: "";
    display: block;
    height: 4px;
    background: var(--b-gradient);
}
.sh.is-scrolled { box-shadow: 0 6px 20px rgba(26, 26, 46, 0.08); }

.sh-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 76px;
}
.sh-logo { flex-shrink: 0; display: block; border-radius: 12px; }
.sh-logo img { display: block; height: 48px; width: auto; }

/* Navegación */
.sh-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.sh-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 46px;
    padding: 6px 16px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--b-text);
    text-decoration: none;
    font-family: var(--b-font);
    font-weight: 600;
    font-size: 18px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sh-link:hover { background: var(--b-surface-2); color: var(--b-text); }
.sh-link[aria-current="page"],
.sh-link.is-current {
    background: var(--b-blue-soft);
    color: var(--b-blue-ink);
    font-weight: 700;
}
.sh-chev { width: 14px; height: 14px; flex-shrink: 0; transition: transform 0.15s ease; }
.sh-link[aria-expanded="true"] { background: var(--b-surface-2); }
[aria-expanded="true"] > .sh-chev { transform: rotate(180deg); }

/* «Probar demo» / «Jugar partida»: el único botón rosa (acción principal), a la derecha del todo */
.sh-actions .sh-play { gap: 8px; padding: 6px 16px 6px 8px; }
.sh-play[aria-expanded="true"] { background: var(--b-pink-dark); border-color: var(--b-pink-dark); }
.sh-play-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    color: var(--b-pink);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.b-btn .sh-play-dot svg { width: 13px; height: 13px; fill: currentColor; margin-left: 2px; }
.b-btn .sh-chev { width: 14px; height: 14px; fill: none; }

/* Acciones de la derecha */
.sh-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 0;
}
.sh-actions .b-btn { min-height: 50px; padding: 6px 20px; white-space: nowrap; }
.sh-yt {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--b-text);
    transition: background-color 0.15s ease, color 0.15s ease;
}
.sh-yt:hover { background: var(--b-surface-2); color: #e00; }
.sh-yt svg { width: 26px; height: 26px; }
.sh-yt .yt-play, .sf-yt .yt-play { fill: #fff; }

/* Botón de usuario */
.sh-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    max-width: 220px;
    padding: 4px 14px 4px 4px;
    border-radius: 999px;
    border: 3px solid var(--b-line);
    background: var(--b-surface);
    color: var(--b-text);
    font-family: var(--b-font);
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
.sh-user:hover { border-color: var(--b-line-strong); }
.sh-user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--b-blue);
    color: var(--b-text);
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    overflow: hidden;
}
.sh-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Con plan: aro verde (se entiende sin leer) */
.sh-user.has-plan { padding-left: 7px; }
.sh-user.has-plan .sh-avatar { box-shadow: 0 0 0 3px var(--b-surface), 0 0 0 6px var(--b-green); }

/* Desplegables */
.sh-dd { position: relative; }
.sh-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 280px;
    padding: 10px;
    background: var(--b-surface);
    border: 1px solid var(--b-line);
    border-radius: 24px;
    box-shadow: 0 4px 8px rgba(26, 26, 46, 0.06), 0 20px 48px rgba(26, 26, 46, 0.16);
    z-index: 60;
}
.sh-panel--right { left: auto; right: 0; }
.sh-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 8px 12px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    line-height: 1.2;
    color: var(--b-text);
}
.sh-item:hover { background: var(--b-surface-2); color: var(--b-text); }
.sh-ico {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--b-surface-2);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.sh-ico svg { width: 20px; height: 20px; }
.sh-item--pink, .sh-item--pink:hover { color: var(--b-pink-ink); }
.sh-item--pink .sh-ico { background: var(--b-pink-soft); }
.sh-item--muted, .sh-item--muted:hover { color: var(--b-muted); }
.sh-sep { height: 1px; background: var(--b-line); margin: 8px 6px; }

/* Desplegable «Jugar»: dos tarjetas (números / imágenes) + enlaces */
.sh-panel--play { width: 440px; }
.sh-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.sh-tile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 3px solid var(--b-line);
    border-radius: 20px;
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.2;
    color: var(--b-text);
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.12s ease;
}
.sh-tile:hover { border-color: var(--b-blue); background: var(--b-blue-soft); color: var(--b-text); }
.sh-tile:active { transform: scale(0.98); }
.sh-art {
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    display: grid;
    place-items: center;
    overflow: hidden;
}
.sh-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sh-art--numbers { background: var(--b-bg); }
.sh-art--images { background: var(--b-blue-soft); }
.sh-art-card, .sh-art-ball {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.25s ease;
}
.sh-tile:hover .sh-art-card { transform: translateY(-2px) rotate(2deg); }
.sh-tile:hover .sh-art-ball { transform: translate(-3px, -3px) rotate(-25deg); }

/* Cabecera del menú de usuario */
.sh-user-head { padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.sh-user-fullname { font-weight: 800; font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.sh-user-head .b-badge, .sh-account .b-badge { align-self: flex-start; font-size: 15px; padding: 2px 12px; }
.sh-badge-grey { background: var(--b-surface-2); color: var(--b-muted); }
.sh-noplan-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 16px;
    background: var(--b-pink);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
}
.sh-noplan-cta:hover { background: var(--b-pink-dark); color: #fff; }

/* Hamburguesa */
.sh-burger {
    display: none;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    border: 3px solid var(--b-line);
    background: var(--b-surface);
    color: var(--b-text);
    place-items: center;
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
}
.sh-burger svg { width: 24px; height: 24px; }
.sh-burger .i-close { display: none; }
.sh-burger[aria-expanded="true"] .i-open { display: none; }
.sh-burger[aria-expanded="true"] .i-close { display: block; }

/* Menú móvil: ocupa la pantalla bajo la cabecera, una sola zona con scroll
   y «Generar cartones» siempre visible abajo. Filas planas, sin cajas. */
.sh-mmenu {
    position: fixed;
    top: var(--site-header-h);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    background: var(--b-surface);
    border-top: 1px solid var(--b-line);
}
.sh-mscroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 0 calc(24px + env(safe-area-inset-bottom)); }

.sh-mplay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.sh-mplay a {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border: 3px solid var(--b-line);
    border-radius: 20px;
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    line-height: 1.15;
    color: var(--b-text);
}
.sh-mplay a:active { border-color: var(--b-blue); background: var(--b-blue-soft); }
.sh-mplay .sh-art { border-radius: 10px; }

.sh-mlabel {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--b-muted);
    margin: 20px 2px 2px;
}
.sh-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 54px;
    padding: 0 2px;
    border-bottom: 1px solid var(--b-line);
    text-decoration: none;
    font-weight: 600;
    font-size: 19px;
    line-height: 1.2;
    color: var(--b-text);
}
.sh-rows li:last-child .sh-row { border-bottom: 0; }
.sh-row::after {
    content: "";
    width: 9px;
    height: 9px;
    border-right: 2.5px solid var(--b-line-strong);
    border-top: 2.5px solid var(--b-line-strong);
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-right: 6px;
}
.sh-row--pink { color: var(--b-pink-ink); font-weight: 700; }

.sh-account { display: flex; align-items: center; gap: 12px; padding: 8px 2px 10px; border-bottom: 1px solid var(--b-line); }
.sh-account .sh-avatar { width: 42px; height: 42px; }
.sh-account-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.sh-account .sh-user-fullname { font-size: 19px; }
.sh-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.sh-auth .b-btn { min-height: 54px; padding: 6px 12px; }
.sh-btn-dark { background: var(--b-text); border-color: var(--b-text); color: #fff; }
.sh-btn-dark:hover { background: #2c2c48; border-color: #2c2c48; color: #fff; }
.sh-logout {
    display: inline-block;
    margin-top: 14px;
    padding: 6px 2px;
    color: var(--b-muted);
    font-weight: 600;
    font-size: 17px;
    text-decoration: underline;
    text-underline-offset: 4px;
}

@media (max-width: 1180px) {
    .sh-bar { gap: 14px; }
    .sh-link { padding: 6px 12px; }
}
@media (max-width: 1023px) {
    .sh-nav, .sh-actions .sh-dd--user, .sh-actions .sh-login, .sh-actions .sh-yt { display: none; }
    .sh-burger { display: grid; }
    .sh-bar { height: 70px; }
    .sh-logo img { height: 42px; }
    /* El botón Jugar sigue visible; su panel se abre a todo el ancho bajo la cabecera */
    .sh-panel--play {
        position: fixed;
        top: var(--site-header-h);
        left: 0;
        right: 0;
        width: auto;
        min-width: 0;
        padding: 16px calc((100vw - var(--b-max)) / 2) 20px;
        border-width: 1px 0;
        border-radius: 0 0 24px 24px;
    }
}
@media (min-width: 1024px) {
    .sh-mmenu { display: none !important; }
}
/* Móviles pequeños: el texto del botón puede partirse en dos líneas (fr «Lancer une partie», tl «Subukan ang demo») */
@media (max-width: 420px) {
    .sh-bar { gap: 10px; }
    .sh-actions { gap: 8px; }
    .sh-logo img { height: 36px; }
    .sh-actions .sh-play {
        max-width: 170px;
        padding: 4px 12px;
        font-size: 16px;
        line-height: 1.1;
        white-space: normal;
        text-align: left;
    }
    .sh-play-dot { display: none; }
}

/* ================================================
   PIE
   ================================================ */
.sf {
    background: var(--b-surface);
    border-top: 1px solid var(--b-line);
    padding-top: 48px;
    font-size: 18px;
}
.sf-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.8fr 0.8fr 1.3fr;
    gap: 40px;
}
.sf-logo { display: block; height: 52px; width: auto; }
.sf-tagline { color: var(--b-muted); font-size: 17px; margin: 14px 0 18px; max-width: 40ch; }
.sf-heading {
    font-family: var(--b-font);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--b-muted);
    margin: 0 0 10px;
}
.sf-links { display: flex; flex-direction: column; gap: 2px; }
.sf-links a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    line-height: 1.25;
    color: var(--b-text);
}
.sf-links a:hover { color: var(--b-blue-ink); text-decoration: underline; text-underline-offset: 4px; }

/* Selector de idioma */
.sf-lang { position: relative; display: inline-block; }
.sf-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    padding: 6px 16px 6px 10px;
    border-radius: 999px;
    border: 3px solid var(--b-line);
    background: var(--b-surface);
    color: var(--b-text);
    font-family: var(--b-font);
    font-weight: 700;
    font-size: 17px;
    cursor: pointer;
}
.sf-lang-btn:hover { border-color: var(--b-line-strong); }
.sf-globe { width: 20px; height: 20px; color: var(--b-muted); }
.sf-flag { width: 26px; height: 18px; object-fit: cover; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); flex-shrink: 0; }
.sf-lang-panel {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 340px;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    background: var(--b-surface);
    border: 1px solid var(--b-line);
    border-radius: 24px;
    box-shadow: 0 4px 8px rgba(26, 26, 46, 0.06), 0 20px 48px rgba(26, 26, 46, 0.16);
    z-index: 30;
}
.sf-lang-panel button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 6px 10px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--b-text);
    font-family: var(--b-font);
    font-weight: 600;
    font-size: 17px;
    text-align: left;
    cursor: pointer;
}
.sf-lang-panel button:hover { background: var(--b-surface-2); }
.sf-lang-panel button[aria-current="true"] { background: var(--b-blue-soft); color: var(--b-blue-ink); font-weight: 700; }

/* Tarjeta «Uso recreativo» */
.sf-safe { background: var(--b-green-soft); border-radius: var(--b-radius-lg); padding: 22px 24px; }
.sf-safe-head { display: flex; gap: 14px; align-items: flex-start; }
.sf-safe-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--b-green);
    color: #fff;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.sf-safe-icon svg { width: 26px; height: 26px; }
.sf-safe-title { font-family: var(--b-font); font-size: 20px; font-weight: 800; line-height: 1.2; color: var(--b-green-ink); margin: 0; }
.sf-safe-desc { font-size: 17px; font-weight: 600; color: var(--b-text); margin: 2px 0 0; }
.sf-safe-notice {
    margin: 14px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(17, 114, 58, 0.18);
    font-size: 15px;
    color: var(--b-muted);
    line-height: 1.45;
}

.sf-bottom {
    margin-top: 44px;
    border-top: 1px solid var(--b-line);
    padding: 18px 0 22px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 15px;
    color: var(--b-muted);
}
.sf-bottom p { margin: 0; }
.sf-yt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--b-text);
    text-decoration: none;
}
.sf-yt svg { width: 24px; height: 24px; color: #e00; }
.sf-yt:hover { color: var(--b-text); text-decoration: underline; text-underline-offset: 4px; }
.sf-band { height: 6px; background: var(--b-gradient); }

@media (max-width: 1100px) {
    .sf-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 560px) {
    .sf-grid { gap: 28px 16px; }
    .sf-brand, .sf-safe { grid-column: 1 / -1; }
    .sf-lang-panel { width: min(340px, calc(100vw - 32px)); }
    .sf-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .sh, .sh-link, .sh-tile, .sh-chev, .sh-user, .sh-yt, .sh-play, .sh-art-card, .sh-art-ball { transition: none; }
}
