/* v247 final safe fixes
   Scope: sidebar overlap, prediction card polish, sitemap-safe pages.
   This file intentionally does not target or redesign the homepage/category hero sections. */
:root {
    --kisure-sticky-top: 84px;
    --kisure-sidebar-final: clamp(250px, 18vw, 300px);
    --kisure-layout-final-gap: clamp(1rem, 1.45vw, 1.65rem);
}

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

.site-main,
.site-shell,
.site-shell--wide,
.content-grid,
.home-news-layout,
.category-news-layout,
.tag-news-layout,
.article-shell,
.football-layout,
.football-prediction-layout {
    max-width: 100%;
}

.site-header,
.site-header__bar,
header.site-header {
    z-index: 1200 !important;
}

@media (min-width: 992px) {
    .content-grid,
    .home-news-layout,
    .category-news-layout,
    .tag-news-layout,
    .article-shell {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) var(--kisure-sidebar-final) !important;
        gap: var(--kisure-layout-final-gap) !important;
        align-items: start !important;
        overflow: visible !important;
    }

    .football-layout,
    .football-layout--wide-main,
    .football-layout--match-page,
    .football-prediction-layout {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) clamp(255px, 18vw, 310px) !important;
        gap: var(--kisure-layout-final-gap) !important;
        align-items: start !important;
        overflow: visible !important;
    }

    .content-grid > section,
    .content-grid > main,
    .content-grid > div,
    .article-shell > article,
    .article-shell > section,
    .football-layout > section,
    .football-layout > main,
    .football-layout > div,
    .football-prediction-main,
    .football-match-main-column {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .content-grid > aside,
    .article-shell > aside,
    .football-layout > aside,
    .sidebar-stack,
    .article-rail,
    .football-sidebar-stack,
    .football-match-sidebar-stack,
    .football-side-panel {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .sticky-sidebar,
    aside.sticky-sidebar,
    .sidebar-stack.sticky-sidebar,
    .article-rail.sticky-sidebar,
    .football-sidebar-stack.sticky-sidebar,
    .football-match-sidebar-stack.sticky-sidebar,
    .football-side-panel.sticky-sidebar,
    [data-kisure-sticky-sidebar] {
        position: sticky !important;
        top: var(--kisure-sticky-top) !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        z-index: 5 !important;
        transform: none !important;
        will-change: auto !important;
    }

    .sidebar-stack.sticky-sidebar,
    .article-rail.sticky-sidebar,
    .football-sidebar-stack.sticky-sidebar,
    .football-match-sidebar-stack.sticky-sidebar {
        display: grid !important;
        gap: clamp(.85rem, 1vw, 1.05rem) !important;
        align-content: start !important;
    }

    .site-panel--tight,
    .sidebar-stack > *,
    .article-rail > *,
    .football-sidebar-stack > *,
    .football-match-sidebar-stack > * {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    .content-grid .news-grid,
    .content-grid .news-grid--cards,
    .category-news-layout .news-grid,
    .tag-news-layout .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .football-news-page .content-grid .news-grid,
    .site-shell--wide > .content-grid .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (min-width: 1500px) {
    .content-grid .news-grid,
    .content-grid .news-grid--cards {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 1180px) and (min-width: 992px) {
    :root {
        --kisure-sidebar-final: 260px;
        --kisure-sticky-top: 80px;
    }

    .content-grid .news-grid,
    .content-grid .news-grid--cards,
    .category-news-layout .news-grid,
    .tag-news-layout .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 991.98px) {
    .content-grid,
    .home-news-layout,
    .category-news-layout,
    .tag-news-layout,
    .article-shell,
    .football-layout,
    .football-layout--wide-main,
    .football-layout--match-page,
    .football-prediction-layout {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .sticky-sidebar,
    aside.sticky-sidebar,
    .sidebar-stack.sticky-sidebar,
    .article-rail.sticky-sidebar,
    .football-sidebar-stack.sticky-sidebar,
    .football-match-sidebar-stack.sticky-sidebar,
    [data-kisure-sticky-sidebar] {
        position: static !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }
}

.sidebar-item,
.sidebar-item > div,
.headline-title,
.sidebar-muted,
.football-side-panel,
.football-link-list,
.football-link-list span {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-wrap: anywhere;
    word-break: normal;
}

.headline-title,
.football-side-panel h3,
.football-side-panel p {
    white-space: normal !important;
}

/* Match page and prediction detail spacing only. */
.football-match-main-column,
.football-prediction-main {
    display: grid !important;
    gap: clamp(1.25rem, 2vw, 2rem) !important;
    align-content: start !important;
}

.football-match-main-column > .football-section,
.football-prediction-main > .football-section,
.football-prediction-main > .football-prediction-day,
.football-prediction-main > .football-prediction-surebets,
.football-prediction-detail-page .football-prediction-result-card {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.football-section--match-lineups,
.football-section--match-stories,
.football-match-main-column > .football-section + .football-section {
    margin-top: 0 !important;
}

/* Keep homepage/category/gallery hero unchanged, but make gallery rail titles sit below thumbnails. */
.home-gallery-rail__item,
.media-section .home-gallery-rail__item {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: .75rem !important;
    align-content: start !important;
}
.home-gallery-rail__media,
.media-section .home-gallery-rail__media {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
}
.home-gallery-rail__body,
.media-section .home-gallery-rail__body {
    padding: 0 .1rem .15rem !important;
}
.home-gallery-rail__body h3,
.media-section .home-gallery-rail__body h3 {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
}

/* Prediction cards: horizontal match-card style on desktop and mobile. */
.football-prediction-league-list,
.football-prediction-surebet-list {
    display: grid;
    gap: clamp(1rem, 1.5vw, 1.35rem);
}
.football-prediction-league-group,
.football-prediction-surebets {
    background: linear-gradient(135deg, rgba(14,165,164,.07), rgba(255,255,255,.86));
    border: 1px solid rgba(14,165,164,.18);
    border-radius: 26px;
    display: grid;
    gap: 1rem;
    padding: clamp(.9rem, 1.4vw, 1.15rem);
}
.football-prediction-league-group__head,
.football-prediction-surebets__head {
    align-items: center;
    display: flex;
    gap: .8rem;
    justify-content: space-between;
    min-width: 0;
}
.football-prediction-league-group__title,
.football-prediction-surebets__title {
    align-items: center;
    display: flex;
    gap: .75rem;
    min-width: 0;
}
.football-prediction-league-group__logo,
.football-prediction-surebets__icon {
    align-items: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: inline-flex;
    flex: 0 0 48px;
    height: 48px;
    justify-content: center;
    width: 48px;
}
.football-prediction-league-group__logo img {
    height: 34px;
    object-fit: contain;
    width: 34px;
}
.football-prediction-league-group__head h3,
.football-prediction-surebets__head h2 {
    color: var(--bg-contrast);
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 1.8vw, 1.45rem);
    line-height: 1.08;
    margin: 0;
}
.football-prediction-league-group__head p,
.football-prediction-surebets__head p {
    color: var(--text-soft);
    font-weight: 800;
    margin: .15rem 0 0;
}
.football-prediction-grid--league,
.football-prediction-surebet-grid {
    display: grid;
    gap: .9rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
}
.football-prediction-match-card {
    background: rgba(255,255,255,.84);
    border: 1px solid rgba(14,165,164,.22);
    border-radius: 22px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .06);
    color: var(--bg-contrast);
    display: grid;
    gap: .85rem;
    padding: 1rem;
}
.football-prediction-match-card__top,
.football-prediction-match-card__meta,
.football-prediction-match-card__actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    justify-content: space-between;
}
.football-prediction-match-card__league {
    align-items: center;
    color: var(--primary-strong);
    display: inline-flex;
    font-family: var(--font-display);
    font-weight: 800;
    gap: .55rem;
    min-width: 0;
    text-transform: uppercase;
}
.football-prediction-match-card__league img {
    height: 30px;
    object-fit: contain;
    width: 30px;
}
.football-prediction-match-card__time {
    background: rgba(14,165,164,.11);
    border-radius: 999px;
    color: var(--primary-strong);
    font-family: var(--font-display);
    font-weight: 800;
    padding: .55rem .75rem;
    white-space: nowrap;
}
.football-prediction-match-card__teams {
    align-items: center;
    display: grid;
    gap: .7rem;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    min-width: 0;
}
.football-prediction-match-card__team {
    align-items: center;
    display: flex;
    gap: .7rem;
    min-width: 0;
}
.football-prediction-match-card__team:last-child {
    flex-direction: row-reverse;
    text-align: right;
}
.football-prediction-match-card__team img,
.football-prediction-match-card__team b {
    align-items: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: inline-flex;
    flex: 0 0 48px;
    font-family: var(--font-display);
    height: 48px;
    justify-content: center;
    object-fit: contain;
    width: 48px;
}
.football-prediction-match-card__team strong {
    color: var(--bg-contrast);
    font-family: var(--font-display);
    font-size: clamp(1rem, 1.5vw, 1.35rem);
    line-height: 1.08;
    min-width: 0;
    overflow-wrap: anywhere;
}
.football-prediction-match-card__versus {
    align-items: center;
    background: var(--bg-contrast);
    border-radius: 16px;
    color: #fff;
    display: inline-flex;
    font-family: var(--font-display);
    font-weight: 800;
    justify-content: center;
    min-height: 44px;
    min-width: 58px;
    padding: .55rem .75rem;
}
.football-prediction-match-card__meta {
    border-top: 1px solid var(--border);
    justify-content: flex-start;
    padding-top: .75rem;
}
.football-prediction-match-card__meta span {
    color: var(--text-soft);
    font-family: var(--font-display);
    font-size: .9rem;
    font-weight: 800;
    text-transform: uppercase;
}
.football-prediction-match-card__actions {
    border-top: 1px solid var(--border);
    justify-content: flex-start;
    padding-top: .75rem;
}
.football-prediction-mini-pill {
    background: rgba(14,165,164,.10);
    border: 1px solid rgba(14,165,164,.22);
    border-radius: 999px;
    color: var(--primary-strong);
    display: inline-flex;
    font-family: var(--font-display);
    font-weight: 800;
    gap: .45rem;
    padding: .55rem .8rem;
    white-space: nowrap;
}
.football-prediction-match-card__stats {
    display: grid;
    gap: .55rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.football-prediction-match-card__stats span {
    background: rgba(15,23,42,.035);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: grid;
    gap: .15rem;
    padding: .55rem;
    text-align: center;
}
.football-prediction-match-card__stats strong {
    color: var(--bg-contrast);
    font-family: var(--font-display);
}
.football-prediction-match-card__stats small {
    color: var(--text-soft);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}
.football-prediction-detail-card {
    margin-bottom: clamp(1rem, 1.6vw, 1.35rem);
}
.football-prediction-detail-page .football-prediction-match-hero {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
}
.football-prediction-detail-page .football-prediction-result-card {
    padding: clamp(1.15rem, 2vw, 1.75rem) !important;
}
.football-prediction-scoreline {
    border-radius: 24px !important;
}

@media (max-width: 575.98px) {
    .football-prediction-match-card {
        gap: .75rem;
        padding: .85rem;
    }
    .football-prediction-match-card__teams {
        gap: .45rem;
        grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
    }
    .football-prediction-match-card__team {
        gap: .45rem;
    }
    .football-prediction-match-card__team img,
    .football-prediction-match-card__team b {
        border-radius: 13px;
        flex-basis: 38px;
        height: 38px;
        width: 38px;
    }
    .football-prediction-match-card__team strong {
        font-size: .95rem;
    }
    .football-prediction-match-card__versus {
        border-radius: 13px;
        min-height: 38px;
        min-width: 46px;
        padding: .4rem .5rem;
    }
    .football-prediction-match-card__stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

html[data-theme="dark"] .football-prediction-league-group,
html[data-theme="dark"] .football-prediction-surebets,
html[data-theme="dark"] .football-prediction-match-card {
    background: linear-gradient(135deg, rgba(15,23,42,.92), rgba(15,23,42,.76));
}
html[data-theme="dark"] .football-prediction-match-card__team img,
html[data-theme="dark"] .football-prediction-match-card__team b,
html[data-theme="dark"] .football-prediction-league-group__logo,
html[data-theme="dark"] .football-prediction-surebets__icon {
    background: rgba(255,255,255,.08);
}
