/* WEEGY Cinema responsive refinement v2.1
 * Layout corrections for the two legacy sidebars, mobile navigation and nested menus.
 * This file is intentionally loaded after cinema-redesign.css.
 */

/* Keep the two legacy sidebars outside the content column on wide screens. */
@media (min-width: 1300px) {
    .wc-main {
        margin-right: 304px !important;
        margin-left: 300px !important;
        width: auto;
        min-width: 0;
    }
    footer.wc-site-footer {
        margin-right: 304px !important;
        margin-left: 300px !important;
    }
    .LeftUI {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        padding: 94px 18px 24px;
        overflow-x: hidden;
        overflow-y: auto;
        color: var(--wc-text);
        background: #0e131c;
        border-right: 1px solid var(--wc-line);
        box-shadow: -12px 0 40px rgba(0,0,0,.12);
        z-index: 10010;
    }
    .RightUI {
        width: 280px;
        padding: 94px 18px 24px;
        overflow-x: hidden;
        overflow-y: auto;
    }
    /* Single-post pages already have their own details column inside the post layout. */
    body.single-post .LeftUI { display: none !important; }
    body.single-post .wc-main,
    body.single-post footer.wc-site-footer { margin-left: 0 !important; }
}

/* At laptop/tablet widths, both sidebars leave the page flow and the right
   filter panel becomes an off-canvas drawer controlled by the theme button. */
@media (max-width: 1299px) {
    .wc-main {
        width: auto;
        max-width: 100%;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    footer.wc-site-footer {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    .LeftUI {
        display: none !important;
    }
    .RightUI {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: min(88vw, 340px) !important;
        max-width: calc(100vw - 28px) !important;
        height: 100vh !important;
        height: 100dvh !important;
        padding: 88px 16px 24px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        background: #0e131c !important;
        border-left: 1px solid var(--wc-line) !important;
        box-shadow: -20px 0 55px rgba(0,0,0,.45) !important;
        z-index: 10050 !important;
        transform: translateX(110%);
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        transition: transform .24s ease, opacity .24s ease, visibility .24s ease;
        overscroll-behavior: contain;
    }
    .RightUI.opened {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
    .Wecima--overlay {
        position: fixed !important;
        inset: 0 !important;
        z-index: 10040 !important;
        background: rgba(2,5,12,.62) !important;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }
    .wc-brand-wrap {
        position: relative;
        min-width: 0;
    }
    .RightSideFlex--Openmenu {
        position: static !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        flex: 0 0 38px;
        width: 38px;
        height: 38px;
        margin: 0 0 0 8px !important;
        color: #fff;
        background: rgba(120,87,255,.16);
        border: 1px solid rgba(120,87,255,.38);
        border-radius: 11px;
        cursor: pointer;
        z-index: 10060;
    }
    .RightSideFlex--Openmenu i { font-size: 16px; }
    .LeftUI { pointer-events: none; }
    .LeftUI.opened { pointer-events: auto; }
}

/* Header navigation: anchor every submenu to its own menu item instead of
   allowing multiple dropdowns to stack over the hero from a shared origin. */
header.wc-site-header .NavigationMenu > li {
    position: relative;
}
header.wc-site-header .NavigationMenu > li > ul,
header.wc-site-header .NavigationMenu > li > .sub-menu {
    position: absolute !important;
    top: calc(100% + 6px) !important;
    right: 0 !important;
    left: auto !important;
    display: block;
    min-width: 220px;
    width: max-content;
    max-width: min(88vw, 360px);
    max-height: min(68vh, 520px);
    margin: 0 !important;
    padding: 8px !important;
    overflow-x: hidden;
    overflow-y: auto;
    background: #111722 !important;
    border: 1px solid var(--wc-line) !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 42px rgba(0,0,0,.48) !important;
    transform: translateY(8px) !important;
    transform-origin: top right !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    z-index: 10070;
}
header.wc-site-header .NavigationMenu > li:hover > ul,
header.wc-site-header .NavigationMenu > li:focus-within > ul,
header.wc-site-header .NavigationMenu > li.open > ul {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) !important;
}
header.wc-site-header .NavigationMenu > li > ul li { position: relative; }
header.wc-site-header .NavigationMenu > li > ul li a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 11px;
    color: #c5cedd;
    border-radius: 9px;
    white-space: normal;
    line-height: 1.5;
}
header.wc-site-header .NavigationMenu > li > ul li a:hover,
header.wc-site-header .NavigationMenu > li > ul li a:focus-visible {
    color: #fff;
    background: rgba(120,87,255,.16);
}

/* Main content should never exceed its available column. */
.wc-main,
.wc-home,
.wc-home-latest,
.MasterArchiveSection,
wecima,
singlecontainer,
singlecontainerright,
singlecontainerleft {
    min-width: 0;
    max-width: 100%;
}
.wc-home { width: 100%; }
.wc-hero-content,
.wc-hero-copy { min-width: 0; }
.wc-hero-copy p { overflow-wrap: anywhere; }
.Grid--WecimaPosts,
.wc-post-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 154px), 1fr)); }

/* Movie details: reflow the metadata sidebar instead of dropping it on tablets. */
@media (max-width: 1024px) {
    singlecontainer {
        display: flex;
        flex-wrap: wrap;
        gap: 14px;
    }
    singlecontainerright {
        order: 1;
        flex: 1 1 100%;
        width: 100% !important;
        max-width: 100%;
    }
    singlecontainer > singlecontainerleft,
    singlecontainerleft {
        display: block !important;
        order: 2;
        flex: 1 1 100%;
        float: none !important;
        width: 100% !important;
        max-width: 100%;
        margin: 14px 0 0;
    }
    .Single-begin { width: 100%; }
    .WatchServersEmbed { min-width: 0; }
    .WatchServersEmbed .Inner--WatchServersEmbed {
        position: relative;
        width: 100%;
        aspect-ratio: 16 / 9;
    }
}

/* Switch to the compact, touch-friendly navigation before the old header
   starts running out of horizontal room. */
@media (max-width: 1140px) {
    rootinside { padding-top: 78px; }
    header.wc-site-header { min-height: 68px; }
    .wc-header-shell { min-height: 68px; gap: 9px; }
    .wc-menu-toggle {
        display: block !important;
        order: 0;
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
    }
    .wc-brand-wrap { order: 1; }
    .wc-header-search { order: 2; flex: 1 1 180px; min-width: 0; }
    .wc-account-wrap { order: 3; }
    header.wc-site-header middle--header {
        position: absolute !important;
        top: calc(100% + 7px) !important;
        right: 10px !important;
        left: 10px !important;
        display: none;
        max-height: calc(100dvh - 92px);
        padding: 12px !important;
        overflow-x: hidden;
        overflow-y: auto;
        background: #101722 !important;
        border: 1px solid var(--wc-line) !important;
        border-radius: 16px !important;
        box-shadow: 0 18px 40px rgba(0,0,0,.46) !important;
        z-index: 10080 !important;
    }
    header.wc-site-header.wc-menu-open middle--header { display: block !important; }
    header.wc-site-header .NavigationMenu,
    header.wc-site-header .Button--Menubar--UX > .NavigationMenu {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
        max-height: none;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible;
    }
    header.wc-site-header .Button--Menubar--UX > span { display: none !important; }
    header.wc-site-header .Button--Menubar--UX { display: block !important; width: 100%; }
    header.wc-site-header .NavigationMenu > li { width: 100%; }
    header.wc-site-header .NavigationMenu > li > a {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        min-height: 43px;
        padding: 9px 12px;
    }
    header.wc-site-header .NavigationMenu > li > ul,
    header.wc-site-header .NavigationMenu > li > .sub-menu {
        position: static !important;
        display: none !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: none !important;
        margin: 4px 10px 8px !important;
        padding: 6px !important;
        overflow: visible !important;
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        box-shadow: none !important;
        background: rgba(255,255,255,.035) !important;
        border: 1px solid var(--wc-line) !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 a { min-height: 38px; }
}

@media (max-width: 720px) {
    rootinside { padding-top: 66px; }
    header.wc-site-header { min-height: 64px; padding: 0 8px; }
    .wc-header-shell { min-height: 64px; gap: 7px; }
    .wc-menu-toggle { width: 36px; height: 36px; flex-basis: 36px; padding: 7px; }
    .wc-brand { gap: 6px; }
    .wc-brand-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 10px; }
    header.wc-site-header .HeaderLogo { font-size: 17px; }
    header.wc-site-header .HeaderLogo logotext { font-size: 9px; }
    .wc-header-search { height: 37px; min-width: 0; flex: 1 1 0; padding: 0 8px; }
    .wc-header-search input { min-width: 0; height: 35px; padding: 0 5px; font-size: 11px; }
    .wc-header-search button { display: none; }
    .wc-account-wrap { display: none !important; }
    .wc-main { padding: 14px 10px 26px !important; }
    .wc-hero { min-height: 0; margin-bottom: 16px; border-radius: 17px; }
    .wc-hero-content {
        display: grid;
        grid-template-columns: minmax(0, 1fr) clamp(86px, 22vw, 116px);
        align-items: center;
        gap: 12px;
        min-height: 0;
        padding: 20px 12px 78px;
    }
    .wc-hero-copy { width: 100%; max-width: none; }
    .wc-hero-poster {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        max-width: 116px;
        margin: 0;
        align-self: center;
        transform: none;
        border-radius: 10px;
    }
    .wc-hero-copy { grid-column: 1; grid-row: 1; }
    .wc-hero h2 { font-size: clamp(19px, 5.6vw, 26px); line-height: 1.28; }
    .wc-hero-copy p { font-size: 11px; line-height: 1.75; }
    .wc-eyebrow { padding: 5px 8px; margin-bottom: 9px; font-size: 9px; }
    .wc-hero-meta { gap: 5px; margin-bottom: 12px; }
    .wc-hero-meta span { padding: 3px 6px; font-size: 9px; }
    .wc-hero-actions { gap: 6px; }
    .wc-button { min-height: 36px; padding: 7px 9px; font-size: 10px; }
    .wc-hero-rail { right: 10px; left: 10px; bottom: 10px; max-width: calc(100% - 20px); }
    .wc-hero-rail a { max-width: 135px; padding: 7px 9px; font-size: 10px; }
    .wc-home-tabs { margin-bottom: 18px; padding: 6px; gap: 5px; }
    .wc-home-tabs a { padding: 8px 10px; font-size: 10px; }
    .wc-section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
    .wc-section-heading h2 { font-size: 19px; }
    .wc-section-heading p { max-width: 100%; font-size: 11px; }
    .Grid--WecimaPosts, .wc-post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 16px 8px; }
    .wc-movie-card .Thumb--GridItem > a > strong { font-size: 11px; }
    .singlecontainerleft { padding: 14px !important; }
    .wc-footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
    rootinside { padding-top: 62px; }
    header.wc-site-header { min-height: 60px; padding: 0 6px; }
    .wc-header-shell { min-height: 60px; gap: 5px; }
    .wc-menu-toggle { width: 34px; height: 34px; flex-basis: 34px; }
    .wc-brand-mark { display: none; }
    header.wc-site-header .HeaderLogo { font-size: 15px; }
    header.wc-site-header .HeaderLogo logotext { display: none; }
    .wc-brand-wrap { max-width: 110px; }
    .RightSideFlex--Openmenu { flex-basis: 32px; width: 32px; height: 34px; margin-left: 4px !important; }
    .wc-header-search { flex: 1 1 0; height: 35px; padding: 0 6px; }
    .wc-header-search input { font-size: 10px; }
    .wc-main { padding-right: 8px !important; padding-left: 8px !important; }
    .wc-hero-content { grid-template-columns: minmax(0, 1fr) 82px; gap: 9px; padding: 17px 10px 74px; }
    .wc-hero-poster { max-width: 82px; }
    .wc-hero-copy p { font-size: 10px; }
    .wc-hero-meta span { font-size: 8px; }
    .wc-button { padding: 6px 7px; font-size: 9px; }
    .Grid--WecimaPosts, .wc-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 15px 9px; }
    .wc-footer-inner { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
    .wc-brand-wrap { max-width: 95px; }
    header.wc-site-header .HeaderLogo { font-size: 13px; }
    .RightSideFlex--Openmenu { flex-basis: 30px; width: 30px; height: 32px; }
    .wc-hero-content { grid-template-columns: minmax(0, 1fr) 72px; }
    .wc-hero-poster { max-width: 72px; }
    .wc-hero h2 { font-size: 18px; }
    .wc-hero-actions { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
    .RightUI,
    header.wc-site-header .NavigationMenu > li > ul { transition: none !important; }
}
