/* WEEGY v10: home blocks, pagination, and mobile header/search. */

/* Homepage block system */
.wc-home-columns {
    display: grid !important;
    grid-template-columns: minmax(0, 2.2fr) minmax(250px, .95fr) !important;
    gap: 15px !important;
    align-items: start !important;
    direction: ltr !important;
    width: 100% !important;
    margin: 0 0 22px !important;
}
.wc-home-columns > .wc-home-panel { direction: rtl !important; min-width: 0 !important; width: 100% !important; }
.wc-home-columns--reverse {
    grid-template-columns: minmax(250px, .95fr) minmax(0, 2.2fr) !important;
}
.wc-home-columns.has-one-panel { grid-template-columns: minmax(0, 1fr) !important; }
.wc-home-panel--wide, .wc-home-panel--compact { min-width: 0 !important; max-width: 100% !important; }
.wc-home-panel-grid {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 17px 11px !important;
    width: 100% !important;
    direction: rtl !important;
}
.wc-home-panel-grid > .GridItem {
    display: block !important;
    float: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
}
.wc-home-panel-grid .BG--GridItem { aspect-ratio: 2 / 3 !important; width: 100% !important; }
.wc-home-panel-grid .Thumb--GridItem { min-width: 0 !important; width: 100% !important; }
.wc-home-panel-grid .Thumb--GridItem > a > strong {
    display: -webkit-box !important;
    min-height: 36px !important;
    margin-top: 7px !important;
    overflow: hidden !important;
    font-size: 11px !important;
    line-height: 1.5 !important;
    text-overflow: ellipsis !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}
.wc-home-panel .wc-anime-list { direction: rtl !important; }
.wc-home-panel .wc-anime-item { width: 100% !important; min-width: 0 !important; }
.wc-home-all-latest,
.wc-home-extra-grid { width: 100% !important; max-width: 100% !important; }
.wc-home-all-latest { margin: 22px 0 !important; }
.wc-section-heading-centered {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 2px auto 18px !important;
    text-align: center !important;
}
.wc-section-heading-centered h2 {
    margin: 0 !important;
    color: #fff !important;
    font-size: clamp(18px, 2vw, 24px) !important;
    font-weight: 900 !important;
    line-height: 1.4 !important;
    text-align: center !important;
}
.wc-section-heading-centered > a { margin-inline-start: 12px; }
.wc-home-all-latest .wc-section-heading-centered > a { display: none !important; }
.wc-home-all-latest .wc-post-grid,
.wc-home-extra-grid .wc-home-panel-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
.wc-home-pagination { display: flex !important; justify-content: center !important; margin: 25px auto 5px !important; }
.wc-home-pagination ul { display: flex !important; flex-wrap: wrap !important; justify-content: center !important; gap: 7px !important; margin: 0 !important; padding: 0 !important; }
.wc-home-pagination li { list-style: none !important; }
.wc-home-pagination a, .wc-home-pagination span { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 7px 11px; border-radius: 9px; }

/* The fixed latest section uses a centered title, with no block URL control. */
.wc-home-all-latest .wc-section-heading { justify-content: center !important; text-align: center !important; }
.wc-home-all-latest .wc-section-heading > div { width: 100%; text-align: center !important; }

/* Mobile header: hamburger on the right, centered brand, icon-only search on the left. */
.wc-search-toggle { display: none !important; }
@media (max-width: 1140px) {
    rootinside { padding-top: 72px !important; }
    header.wc-site-header {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        z-index: 10050 !important;
        height: 72px !important;
        min-height: 72px !important;
        padding: 0 12px !important;
        overflow: visible !important;
    }
    .wc-header-shell {
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        direction: rtl !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 72px !important;
        height: 72px !important;
        gap: 0 !important;
        margin: 0 auto !important;
    }
    .wc-menu-toggle {
        position: relative !important;
        z-index: 2 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        order: 1 !important;
        flex: 0 0 46px !important;
        width: 46px !important;
        height: 46px !important;
        margin: 0 !important;
        padding: 11px !important;
        border-radius: 13px !important;
        background: rgba(255,255,255,.06) !important;
        border: 1px solid rgba(255,255,255,.12) !important;
    }
    .wc-menu-toggle span { width: 21px !important; height: 2px !important; margin: 2px 0 !important; background: #fff !important; border-radius: 5px !important; }
    .wc-brand-wrap {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        z-index: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        max-width: min(54vw, 260px) !important;
        margin: 0 !important;
        transform: translate(-50%, -50%) !important;
        text-align: center !important;
        order: 2 !important;
    }
    .wc-brand { display: flex !important; align-items: center !important; justify-content: center !important; gap: 0 !important; max-width: 100% !important; }
    .wc-brand-mark { display: none !important; }
    header.wc-site-header .HeaderLogo {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        max-width: 100% !important;
        color: #fff !important;
        font-size: clamp(20px, 4.8vw, 27px) !important;
        font-weight: 900 !important;
        line-height: 1.05 !important;
        text-align: center !important;
        white-space: nowrap !important;
    }
    header.wc-site-header .HeaderLogo .wc-brand-name::first-letter { color: var(--theme-primary) !important; }
    header.wc-site-header .HeaderLogo logotext {
        display: block !important;
        margin-top: 4px !important;
        color: #d7dbe3 !important;
        font-size: 9px !important;
        line-height: 1.2 !important;
        text-align: center !important;
        white-space: nowrap !important;
    }
    header.wc-site-header middle--header {
        position: absolute !important;
        top: calc(100% + 8px) !important;
        right: 8px !important;
        left: auto !important;
        z-index: 10070 !important;
        display: none !important;
        width: min(86vw, 360px) !important;
        max-width: calc(100vw - 16px) !important;
        max-height: calc(100dvh - 92px) !important;
        margin: 0 !important;
        padding: 13px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        direction: rtl !important;
        text-align: right !important;
        background: #10151f !important;
        border: 1px solid rgba(255,255,255,.12) !important;
        border-radius: 17px !important;
        box-shadow: 0 22px 48px rgba(0,0,0,.52) !important;
        transform-origin: top right !important;
    }
    header.wc-site-header.wc-menu-open middle--header { display: block !important; }
    header.wc-site-header .NavigationMenu {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 5px !important;
        direction: rtl !important;
        text-align: right !important;
    }
    header.wc-site-header .NavigationMenu > li {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: right !important;
    }
    header.wc-site-header .NavigationMenu > li > a {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        min-height: 46px !important;
        padding: 10px 13px !important;
        color: #f3f5f8 !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        text-align: right !important;
        border-radius: 10px !important;
        background: rgba(255,255,255,.035) !important;
    }
    header.wc-site-header .NavigationMenu > li > a:after { margin-right: auto !important; margin-left: 0 !important; }
    header.wc-site-header .NavigationMenu > li > ul,
    header.wc-site-header .NavigationMenu > li > .sub-menu {
        position: static !important;
        display: none !important;
        width: calc(100% - 12px) !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: none !important;
        margin: 5px 12px 8px 0 !important;
        padding: 7px !important;
        overflow: visible !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        direction: rtl !important;
        text-align: right !important;
        background: rgba(255,255,255,.045) !important;
        border: 1px solid rgba(255,255,255,.08) !important;
        border-radius: 11px !important;
        box-shadow: none !important;
    }
    header.wc-site-header .NavigationMenu > li.open > ul,
    header.wc-site-header .NavigationMenu > li.open > .sub-menu,
    header.wc-site-header .NavigationMenu > li:focus-within > ul,
    header.wc-site-header .NavigationMenu > li:focus-within > .sub-menu { display: block !important; }
    header.wc-site-header .NavigationMenu > li > ul li,
    header.wc-site-header .NavigationMenu > li > .sub-menu li { width: 100% !important; text-align: right !important; }
    header.wc-site-header .NavigationMenu > li > ul a,
    header.wc-site-header .NavigationMenu > li > .sub-menu a {
        display: flex !important;
        align-items: center !important;
        min-height: 39px !important;
        padding: 8px 11px !important;
        color: #dfe4ed !important;
        font-size: 12px !important;
        text-align: right !important;
        border-radius: 8px !important;
    }
    .wc-header-social { display: none !important; }
    .wc-search-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        order: 3 !important;
        flex: 0 0 46px !important;
        width: 46px !important;
        height: 46px !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #fff !important;
        background: var(--theme-primary) !important;
        border: 0 !important;
        border-radius: 50% !important;
        font-size: 17px !important;
        cursor: pointer !important;
    }
    .wc-header-search {
        position: absolute !important;
        top: calc(100% + 9px) !important;
        right: auto !important;
        left: 8px !important;
        z-index: 10080 !important;
        display: none !important;
        width: min(340px, calc(100vw - 16px)) !important;
        max-width: calc(100vw - 16px) !important;
        height: 54px !important;
        margin: 0 !important;
        padding: 6px !important;
        background: #111722 !important;
        border: 1px solid rgba(255,255,255,.13) !important;
        border-radius: 14px !important;
        box-shadow: 0 18px 40px rgba(0,0,0,.5) !important;
    }
    header.wc-site-header.wc-search-open .wc-header-search { display: flex !important; }
    .wc-header-search input {
        display: block !important;
        flex: 1 1 auto !important;
        width: 1px !important;
        min-width: 0 !important;
        height: 40px !important;
        padding: 0 12px !important;
        color: #fff !important;
        background: rgba(255,255,255,.06) !important;
        border: 1px solid rgba(255,255,255,.08) !important;
        border-radius: 9px !important;
        font-size: 13px !important;
        text-align: right !important;
    }
    .wc-header-search button {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 40px !important;
        width: 40px !important;
        height: 40px !important;
        margin-right: 6px !important;
        color: #fff !important;
        background: var(--theme-primary) !important;
        border: 0 !important;
        border-radius: 9px !important;
    }
}

@media (max-width: 560px) {
    rootinside { padding-top: 66px !important; }
    header.wc-site-header, .wc-header-shell { height: 66px !important; min-height: 66px !important; }
    header.wc-site-header { padding: 0 10px !important; }
    .wc-menu-toggle, .wc-search-toggle { width: 41px !important; height: 41px !important; flex-basis: 41px !important; }
    .wc-brand-wrap { max-width: 56vw !important; }
    header.wc-site-header .HeaderLogo { font-size: clamp(19px, 5vw, 23px) !important; }
    header.wc-site-header .HeaderLogo logotext { font-size: 8px !important; }
    .wc-main { padding-right: 9px !important; padding-left: 9px !important; }
    .wc-home-columns, .wc-home-columns--reverse { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; }
    .wc-home-panel-grid, .wc-home-all-latest .wc-post-grid, .wc-home-extra-grid .wc-home-panel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 14px 8px !important; }
    .wc-home-panel-grid .Thumb--GridItem > a > strong { font-size: 10px !important; }
    .wc-home-all-latest { margin: 15px 0 !important; }
    .wc-section-heading-centered { margin-bottom: 13px !important; }
    .wc-section-heading-centered h2 { font-size: 18px !important; }
}
@media (max-width: 380px) {
    rootinside { padding-top: 62px !important; }
    header.wc-site-header, .wc-header-shell { height: 62px !important; min-height: 62px !important; }
    .wc-menu-toggle, .wc-search-toggle { width: 37px !important; height: 37px !important; flex-basis: 37px !important; }
    .wc-brand-wrap { max-width: 52vw !important; }
    header.wc-site-header .HeaderLogo { font-size: 18px !important; }
    header.wc-site-header .HeaderLogo logotext { font-size: 7px !important; }
    .wc-home-panel-grid, .wc-home-all-latest .wc-post-grid, .wc-home-extra-grid .wc-home-panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* The TopCinema T stays tied to the theme's configurable primary accent. */
header.wc-site-header .HeaderLogo .wc-brand-name::first-letter { color: var(--theme-primary) !important; }
@media (max-width: 1140px) {
    .wc-menu-toggle { flex-direction: column !important; gap: 0 !important; }
}

/* Similar posts: centered heading and 10 results in a five-column, two-row grid. */
singlerelated.wc-similar-posts > .titleArea { text-align: center !important; }
singlerelated.wc-similar-posts > .titleArea > span { display: block !important; width: 100% !important; text-align: center !important; }
singlerelated.wc-similar-posts .Grid--WecimaPosts { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
@media (max-width: 720px) { singlerelated.wc-similar-posts .Grid--WecimaPosts { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
