/* ============================================================
   LAYOUT.CSS
   Agencement global de la page — conteneurs, grilles, rythme
   vertical et responsive général.
   ============================================================ */

/* ──────────────────────────────────────────────
   1. CONTENEURS
   ────────────────────────────────────────────── */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* En-tête public partagé */
.public-header {
    position: sticky;
    top: 0;
    z-index: 1050;
    background: linear-gradient(90deg, rgba(10, 14, 26, .98), rgba(15, 23, 42, .96));
    border-bottom: 1px solid rgba(255, 255, 255, .09);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.public-header__bar { min-height: 76px; display: flex; align-items: center; gap: 1.5rem; }
.public-brand { display: inline-flex; align-items: center; gap: .7rem; margin-right: auto; color: var(--text); text-decoration: none; }
.public-brand:hover { color: var(--text); }
.public-brand__emblem { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(0, 200, 83, .4); border-radius: 13px; background: linear-gradient(145deg, rgba(0, 200, 83, .2), rgba(0, 200, 83, .04)); color: var(--primary); font-size: 1.35rem; box-shadow: inset 0 0 18px rgba(0, 200, 83, .08); }
.public-brand .brand-text { display: block; color: #fff; font-size: 1.15rem; line-height: 1; }
.public-brand small { display: block; margin-top: .3rem; color: var(--text-muted); font-size: .61rem; letter-spacing: .08em; text-transform: uppercase; }
.public-nav { position: relative; }
.public-nav__toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.public-nav__trigger { display: none; align-items: center; gap: .45rem; padding: .55rem .8rem; border: 1px solid var(--border-strong); border-radius: 9px; color: var(--text); cursor: pointer; }
.public-nav__toggle:focus-visible + .public-nav__trigger { outline: 2px solid var(--primary); outline-offset: 3px; }
.public-nav__dropdown summary::-webkit-details-marker { display: none; }
.public-nav__panel { display: flex !important; align-items: center; gap: .15rem; }
.public-nav__link { display: inline-flex; align-items: center; gap: .4rem; padding: .58rem .68rem; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-size: .81rem; font-weight: 600; white-space: nowrap; cursor: pointer; transition: color .2s, background .2s; }
.public-nav__link:hover, .public-nav__link.active { color: #fff; background: rgba(255, 255, 255, .07); }
.public-nav__link.active { color: var(--primary-light); }
.public-nav__dropdown { position: relative; }
.public-nav__chevron { margin-left: .1rem; font-size: .65rem; transition: transform .2s; }
.public-nav__dropdown[open] .public-nav__chevron { transform: rotate(180deg); }
.public-nav__dropdown-menu { position: absolute; top: calc(100% + .7rem); right: 0; width: 310px; padding: .55rem; border: 1px solid var(--border-strong); border-radius: 13px; background: #111827; box-shadow: 0 18px 45px rgba(0, 0, 0, .42); }
.public-nav__dropdown-menu::before { content: ''; position: absolute; top: -.7rem; left: 0; right: 0; height: .7rem; }
.public-nav__dropdown-menu a { display: flex; align-items: center; gap: .8rem; padding: .72rem; border-radius: 9px; color: var(--text); text-decoration: none; }
.public-nav__dropdown-menu a:hover { background: rgba(0, 200, 83, .1); }
.public-nav__dropdown-menu i, .public-nav__flag { display: grid; place-items: center; width: 28px; color: var(--primary); font-size: 1rem; flex: none; }
.public-nav__dropdown-menu strong, .public-nav__dropdown-menu small { display: block; }
.public-nav__dropdown-menu strong { font-size: .8rem; }
.public-nav__dropdown-menu small { margin-top: .12rem; color: var(--text-muted); font-size: .68rem; }
.public-nav__soon { display: inline-flex; align-items: center; gap: .35rem; margin-left: .25rem; padding: .48rem .62rem; border: 1px dashed rgba(255, 193, 7, .32); border-radius: 8px; color: var(--text-muted); font-size: .75rem; white-space: nowrap; }
.public-nav__soon i, .public-nav__soon small { color: var(--warning); }
.public-nav__soon small { font-size: .6rem; text-transform: uppercase; }

/* Pied de page public partagé */
.public-footer { margin-top: 4rem; border-top: 1px solid rgba(255, 255, 255, .09); background: linear-gradient(145deg, #0b101d, #101827 55%, #0c1520); color: var(--text-muted); }
.public-footer__grid { display: grid; grid-template-columns: minmax(240px, 1.5fr) repeat(2, minmax(140px, .7fr)) minmax(245px, 1fr); gap: 3rem; padding-top: 3.75rem; padding-bottom: 3rem; }
.public-footer__about p { max-width: 390px; margin: 1.25rem 0 0; font-size: .85rem; line-height: 1.75; }
.public-footer__brand { display: inline-flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; }
.public-footer__emblem { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(0, 200, 83, .35); border-radius: 13px; background: rgba(0, 200, 83, .1); color: var(--primary); font-size: 1.3rem; }
.public-footer__brand .brand-text { display: block; font-size: 1.15rem; line-height: 1; }
.public-footer__brand small { display: block; margin-top: .35rem; color: var(--text-muted); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; }
.public-footer__nav { display: flex; flex-direction: column; align-items: flex-start; gap: .7rem; }
.public-footer h2 { margin: 0 0 .45rem; color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.public-footer__nav a { color: var(--text-muted); font-size: .82rem; text-decoration: none; transition: color .2s, transform .2s; }
.public-footer__nav a:hover { color: var(--primary-light); transform: translateX(3px); }
.public-footer__highlight { display: flex; gap: .85rem; padding: 1.1rem; align-self: start; border: 1px solid rgba(0, 200, 83, .22); border-radius: 14px; background: linear-gradient(135deg, rgba(0, 200, 83, .11), rgba(255, 255, 255, .025)); }
.public-footer__highlight-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: rgba(0, 200, 83, .13); color: var(--primary-light); }
.public-footer__highlight p { margin: .4rem 0 .7rem; font-size: .75rem; line-height: 1.55; }
.public-footer__highlight a { color: var(--primary-light); font-size: .78rem; font-weight: 700; text-decoration: none; }
.public-footer__bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.15rem; padding-bottom: 1.15rem; border-top: 1px solid rgba(255, 255, 255, .07); font-size: .7rem; }
.public-footer__bottom strong { color: var(--primary-light); font-weight: 700; }
.public-footer__bottom a { color: var(--text-muted); text-decoration: none; }
.public-footer__bottom a:hover { color: var(--primary-light); }
.mobile-nav { display: none; }

@media (max-width: 1199px) {
    .public-brand small { display: none; }
    .public-nav__link { padding-inline: .5rem; }
    .public-nav__link > i { display: none; }
}

@media (max-width: 991px) {
    .public-header__bar { min-height: 66px; }
    .public-nav__trigger { display: inline-flex; }
    .public-nav__toggle:not(:checked) ~ .public-nav__panel { display: none !important; }
    .public-nav__panel { position: absolute; top: calc(100% + .65rem); right: 0; width: min(340px, calc(100vw - 2rem)); max-height: calc(100vh - 90px); padding: .7rem; flex-direction: column; align-items: stretch; overflow-y: auto; border: 1px solid var(--border-strong); border-radius: 14px; background: #111827; box-shadow: 0 20px 45px rgba(0, 0, 0, .48); }
    .public-nav__link { width: 100%; padding: .72rem; }
    .public-nav__link > i { display: inline-block; }
    .public-nav__dropdown-menu { position: static; width: 100%; margin: .25rem 0 .5rem; box-shadow: none; background: rgba(10, 14, 26, .6); }
    .public-nav__soon { margin: .25rem 0 0; justify-content: center; }
    .public-footer__grid { grid-template-columns: 1.35fr 1fr 1fr; gap: 2rem; }
    .public-footer__highlight { grid-column: 1 / -1; }
}

@media (max-width: 767px) {
    body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
    .public-footer { margin-top: 2.5rem; }
    .public-footer__grid { grid-template-columns: 1fr 1fr; padding-top: 2.75rem; }
    .public-footer__about, .public-footer__highlight { grid-column: 1 / -1; }
    .public-footer__bottom { flex-direction: column; align-items: flex-start; }
    .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 1100; display: grid; grid-template-columns: repeat(4, 1fr); min-height: 64px; padding: .35rem max(.4rem, env(safe-area-inset-right)) calc(.35rem + env(safe-area-inset-bottom)) max(.4rem, env(safe-area-inset-left)); border-top: 1px solid rgba(255, 255, 255, .12); background: rgba(10, 14, 26, .96); box-shadow: 0 -10px 30px rgba(0, 0, 0, .35); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
    .mobile-nav a { display: flex; min-width: 0; min-height: 52px; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; border-radius: 10px; color: var(--text-muted); font-size: .61rem; font-weight: 600; text-decoration: none; }
    .mobile-nav a i { font-size: 1.08rem; }
    .mobile-nav a.active { color: var(--primary-light); background: rgba(0, 200, 83, .1); }
}

@media (max-width: 420px) {
    .public-brand__emblem { width: 38px; height: 38px; }
    .public-brand .brand-text { font-size: 1rem; }
    .public-nav__trigger span { display: none; }
}

main,
.page-content {
    flex: 1;
}

/* Container légèrement plus large sur grands écrans */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* Container full-width pour certaines sections */
.container-fluid-padded {
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: 100%;
}

/* ──────────────────────────────────────────────
   2. RYTHME VERTICAL (espacement entre blocs)
   ────────────────────────────────────────────── */
.block+.block {
    margin-top: 0;
    /* les blocs gèrent leur propre padding */
}

/* Zone composite : live + sidebar */
.block--live-zone {
    padding: var(--space-block) 0;
}

.block--live-zone .block--live,
.block--live-zone .block--standings,
.block--live-zone .block--scorers {
    margin-bottom: 0;
}

/* Rythme vertical global sur mobile */
@media (max-width: 768px) {
    :root {
        --space-block: 2.5rem;
        --space-block-sm: 1.75rem;
    }
}

/* ──────────────────────────────────────────────
   3. GRILLES PERSONNALISÉES
   ────────────────────────────────────────────── */

/* Grille live : 2 colonnes sur tablette+ */
.grid-live {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid-live {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Grille articles */
.grid-articles {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 576px) {
    .grid-articles {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .grid-articles {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Grille vidéos */
.grid-videos {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 576px) {
    .grid-videos {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .grid-videos {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Grille compétitions */
.grid-competitions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .grid-competitions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 992px) {
    .grid-competitions {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ──────────────────────────────────────────────
   4. STRUCTURE LIVE + SIDEBAR
   ────────────────────────────────────────────── */
.live-sidebar-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .live-sidebar-layout {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }

    /* Sticky sidebar sur grands écrans */
    .live-sidebar-layout>aside {
        position: sticky;
        top: 90px;
    }
}

/* ──────────────────────────────────────────────
   5. STICKY ÉLÉMENTS
   ────────────────────────────────────────────── */
.sticky-top-offset {
    top: 76px;
    /* hauteur navbar */
    position: sticky;
    z-index: 100;
}

/* ──────────────────────────────────────────────
   6. SECTION ALTERNÉE (fond légèrement différent)
   ────────────────────────────────────────────── */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
    border: none;
}

/* ──────────────────────────────────────────────
   7. ASPECTS RATIOS UTILITAIRES
   ────────────────────────────────────────────── */
.ratio-16-9 {
    aspect-ratio: 16 / 9;
}

.ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.ratio-1-1 {
    aspect-ratio: 1 / 1;
}

/* ──────────────────────────────────────────────
   8. OFFSET POUR ANCRES (compense navbar sticky)
   ────────────────────────────────────────────── */
[id^="block-"] {
    scroll-margin-top: 90px;
}

/* ──────────────────────────────────────────────
   9. Z-INDEX HIÉRARCHIE
   ────────────────────────────────────────────── */
:root {
    --z-navbar: 1030;
    --z-sticky: 1020;
    --z-modal: 1050;
    --z-backtop: 999;
    --z-overlay: 1040;
}

#mainNav {
    z-index: var(--z-navbar);
}

#backTop {
    z-index: var(--z-backtop);
}

/* ──────────────────────────────────────────────
   10. RESPONSIVE GLOBAL
   ────────────────────────────────────────────── */

/* Tablette */
@media (max-width: 991px) {
    .block--hero .display-4 {
        font-size: 2.1rem;
    }

    .block--live-zone .block--standings {
        margin-top: 1.5rem;
    }
}

/* Mobile */
@media (max-width: 767px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .block {
        padding: var(--space-block) 0;
    }

    .block__title {
        font-size: 1.3rem;
    }

    .block__title::before {
        height: 22px;
        width: 4px;
    }

    .block__header {
        margin-bottom: 1.25rem;
        gap: .75rem;
    }

    .block__select {
        max-width: 140px;
        font-size: .75rem;
    }

    /* Live cards en pleine largeur */
    .match-card .score {
        font-size: 1.6rem;
    }

    /* Hero */
    .block--hero {
        padding-top: 1.5rem;
        padding-bottom: 2rem;
    }

    .featured-score {
        font-size: 2.2rem;
        letter-spacing: 2px;
    }

    .team-logo {
        width: 52px;
        height: 52px;
        font-size: 1.1rem;
    }
}

/* Petit mobile */
@media (max-width: 480px) {
    .block__title {
        font-size: 1.1rem;
        gap: .5rem;
    }

    .block__title::before {
        height: 18px;
        width: 3px;
    }

    .featured-teams {
        gap: .5rem;
    }

    .featured-score {
        font-size: 1.8rem;
    }

    .team-name {
        font-size: .75rem;
    }

    .article-title {
        font-size: .95rem;
    }

    .video-title {
        font-size: .85rem;
    }
}

/* ──────────────────────────────────────────────
   11. IMPRESSION
   ────────────────────────────────────────────── */
@media print {

    #mainNav,
    #backTop,
    .block--ticker,
    .block--newsletter,
    .block--filters {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .block {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
}

/* ──────────────────────────────────────────────
   12. ACCESSIBILITÉ
   ────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ticker {
        animation: none;
    }

    .live-dot {
        animation: none;
    }

    .block--featured-match::before {
        display: none;
    }

    * {
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour navigation clavier */
a:focus-visible,
button:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ──────────────────────────────────────────────
   13. SCROLLBAR STYLISÉE (WebKit)
   ────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-3);
    border-radius: 5px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: #2a3550;
}
