/* ==========================================================
   Browse pages (movies / tv-shows). Used with theme.css + browse.js
   ========================================================== */
.container {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* ---------- Header with moving poster wall ---------- */
.b-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 150px 0 72px;
    min-height: 560px;
    display: flex;
    align-items: flex-end;
}

.b-wall {
    position: absolute;
    inset: -30% -20%;
    z-index: -2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    transform: rotate(-8deg);
    opacity: 0;
    transition: opacity 1.2s ease;
}

.b-wall.ready {
    opacity: 0.55;
}

.b-wall-row {
    display: flex;
    gap: 16px;
    width: max-content;
    animation: marquee 90s linear infinite;
}

.b-wall-row:nth-child(2) {
    animation-direction: reverse;
    animation-duration: 110s;
}

.b-wall-row:nth-child(3) {
    animation-duration: 130s;
}

.b-wall-row img {
    width: 150px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 12px;
    background: var(--surface-2);
}

.b-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(5, 5, 5, 0.92) 0%, rgba(5, 5, 5, 0.7) 40%, rgba(5, 5, 5, 0.3) 100%),
        linear-gradient(0deg, var(--bg) 0%, transparent 45%),
        linear-gradient(180deg, rgba(5, 5, 5, 0.7) 0%, transparent 30%);
}

.b-hero-content>* {
    animation: rise 0.9s var(--ease) both;
}

.b-hero-content>*:nth-child(2) {
    animation-delay: 0.08s;
}

.b-hero-content>*:nth-child(3) {
    animation-delay: 0.16s;
}

.b-hero-content>*:nth-child(4) {
    animation-delay: 0.24s;
}

.b-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3.4rem, 10vw, 8.5rem);
    line-height: 0.88;
    letter-spacing: -0.045em;
    margin: 0.4rem 0 1.1rem;
}

.b-title .outline {
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.85);
}

.b-sub {
    max-width: 560px;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.b-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 620px;
    height: 62px;
    padding: 0 0.5rem 0 1.4rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: border-color 0.3s ease, background 0.3s ease;
}

.b-search:focus-within {
    border-color: #fff;
    background: rgba(10, 10, 12, 0.9);
}

.b-search svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.b-search input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font: 700 1.05rem var(--font-body);
}

.b-search input::placeholder {
    color: rgba(255, 255, 255, 0.85);
}

.b-search .btn {
    height: 48px;
    padding: 0 1.4rem;
}

/* ---------- Sticky toolbar ---------- */
.b-bar {
    position: sticky;
    top: 64px;
    z-index: 50;
    background: rgba(5, 5, 5, 0.86);
    -webkit-backdrop-filter: saturate(160%) blur(18px);
    backdrop-filter: saturate(160%) blur(18px);
    border-bottom: 1px solid var(--line);
}

.b-bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.85rem;
}

.seg {
    position: relative;
    display: flex;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
    min-width: 0;
}

.seg::-webkit-scrollbar {
    display: none;
}

.seg-pill {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 0;
    border-radius: 999px;
    background: #fff;
    transition: transform 0.45s var(--ease), width 0.45s var(--ease);
}

.seg-btn {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    height: 38px;
    padding: 0 1.15rem;
    border: none;
    background: none;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.88rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.seg-btn.active {
    color: #000;
}

.view-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    flex-shrink: 0;
}

.view-btn {
    width: 38px;
    height: 34px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 10px;
    background: none;
    cursor: pointer;
    transition: background 0.2s ease;
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

.view-btn.active {
    background: rgba(255, 255, 255, 0.16);
}

.genres {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0.75rem 0 0.85rem;
}

.genres::-webkit-scrollbar {
    display: none;
}

.genre-chip {
    flex-shrink: 0;
    height: 34px;
    padding: 0 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: transparent;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.genre-chip:hover {
    border-color: rgba(255, 255, 255, 0.45);
}

.genre-chip.active {
    background: var(--accent);
    border-color: var(--accent);
}

/* ---------- Results ---------- */
.b-results-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding: 2.25rem 0 1.5rem;
}

.b-results-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    letter-spacing: -0.015em;
    line-height: 1.15;
}

.b-results-title .muted {
    color: var(--accent-hot);
}

.b-count {
    font-weight: 800;
    font-size: 0.88rem;
}

.b-clear {
    height: 36px;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.06);
    font-weight: 800;
    font-size: 0.82rem;
    cursor: pointer;
}

.b-clear[hidden] {
    display: none;
}

.b-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 2rem 1.1rem;
}

.b-grid .card {
    width: auto;
    animation-delay: calc(var(--i, 0) * 30ms);
}

.b-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 540px), 1fr));
    gap: 1rem;
}

.lcard {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: center;
    padding: 0.75rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--line);
    text-decoration: none;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.4s var(--ease);
    animation: cardIn 0.6s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 30ms);
}

.lcard:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--line-strong);
    transform: translateY(-3px);
}

.lcard-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
}

.lcard-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s var(--ease);
}

.lcard:hover .lcard-thumb img {
    transform: scale(1.06);
}

.lcard-rank {
    position: absolute;
    left: 8px;
    bottom: 4px;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.8rem;
    line-height: 1;
    letter-spacing: -0.04em;
    z-index: 1;
}

.lcard-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.6), transparent 55%);
}

.lcard-title {
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lcard-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0.6rem;
    margin: 0.2rem 0 0.45rem;
    font-size: 0.8rem;
    font-weight: 800;
}

.lcard-meta .star {
    color: var(--gold);
}

.lcard-meta .sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
}

.lcard-overview {
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.85);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.skel-card .card-media,
.skel-card .lcard-thumb {
    background: linear-gradient(100deg, #111114 30%, #1c1c22 50%, #111114 70%);
    background-size: 300% 100%;
    animation: shimmer 1.6s linear infinite;
}

.skel-line {
    height: 10px;
    border-radius: 6px;
    margin-top: 0.75rem;
    width: 80%;
}

.skel-line.short {
    width: 45%;
    margin-top: 0.5rem;
}

.b-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 0 1rem;
    font-weight: 700;
}

.b-more[hidden] {
    display: none;
}

.dots {
    display: flex;
    gap: 6px;
}

.dots i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1s ease-in-out infinite;
}

.dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.dots i:nth-child(3) {
    animation-delay: 0.3s;
}

.b-empty {
    padding: 4rem 1rem;
    text-align: center;
}

.b-empty h3 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.b-empty p {
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 60;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    cursor: pointer;
    transform: translateY(90px);
    transition: transform 0.45s var(--ease), background 0.25s ease;
}

.to-top.show {
    transform: none;
}

.to-top:hover {
    background: var(--accent-hot);
}

.to-top svg {
    width: 22px;
    height: 22px;
}

/* ---------- Top IMDB: podium hero ---------- */
.b-hero.top {
    align-items: center;
}

.b-hero.top::before {
    background:
        radial-gradient(40% 70% at 75% 0%, rgba(245, 197, 24, 0.16), transparent 70%),
        radial-gradient(30% 50% at 60% 10%, rgba(229, 9, 20, 0.1), transparent 70%),
        linear-gradient(0deg, var(--bg) 0%, transparent 40%);
}

.top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 560px);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: end;
}

.podium {
    display: grid;
    grid-template-columns: 1fr 1.18fr 1fr;
    align-items: end;
    gap: 0.9rem;
    min-height: 300px;
}

.pod {
    --medal: #f5c518;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    min-width: 0;
    animation: rise 0.9s var(--ease) both;
}

.pod-1 {
    animation-delay: 0.1s;
}

.pod-2 {
    --medal: #d3d8e0;
    animation-delay: 0.25s;
}

.pod-3 {
    --medal: #d08a4a;
    animation-delay: 0.4s;
}

.pod-poster {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-2);
    border: 2px solid var(--medal);
    transition: transform 0.5s var(--ease);
}

.pod:hover .pod-poster {
    transform: translateY(-8px) rotate(-1deg);
}

.pod-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pod-medal {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--medal);
    color: #000;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.05rem;
}

.pod-title {
    margin-top: 0.7rem;
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pod-meta {
    font-size: 0.78rem;
    font-weight: 800;
    margin-bottom: 0.6rem;
}

.pod-meta .star {
    color: var(--gold);
}

.pod-step {
    display: grid;
    place-items: center;
    border-radius: 12px 12px 0 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
    border-top: 3px solid var(--medal);
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.3rem;
    color: var(--medal);
}

.pod-1 .pod-step {
    height: 96px;
}

.pod-2 .pod-step {
    height: 66px;
}

.pod-3 .pod-step {
    height: 44px;
}

.rank-badge {
    background: var(--gold) !important;
    color: #000;
    border-color: transparent !important;
    font-family: var(--font-display);
    font-size: 0.78rem !important;
}

@media (max-width: 1024px) {
    .top-grid {
        grid-template-columns: 1fr;
    }

    .podium {
        max-width: 560px;
        min-height: 0;
    }
}

@media (max-width: 520px) {
    .podium {
        gap: 0.5rem;
    }

    .pod-title {
        font-size: 0.8rem;
    }

    .pod-medal {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }

    .pod-1 .pod-step {
        height: 64px;
    }

    .pod-2 .pod-step {
        height: 44px;
    }

    .pod-3 .pod-step {
        height: 30px;
        font-size: 1rem;
    }
}

@keyframes marquee {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .b-hero {
        padding: 120px 0 48px;
        min-height: 460px;
    }

    .b-wall-row img {
        width: 110px;
    }

    .b-hero::before {
        background:
            linear-gradient(0deg, var(--bg) 0%, rgba(5, 5, 5, 0.75) 45%, rgba(5, 5, 5, 0.55) 100%);
    }

    .b-search {
        height: 54px;
        padding-left: 1.1rem;
    }

    .b-search .btn {
        display: none;
    }

    .b-bar-top {
        gap: 0.5rem;
    }

    .seg-btn {
        padding: 0 0.9rem;
        font-size: 0.82rem;
    }

    .b-grid {
        grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
        gap: 1.4rem 0.75rem;
    }

    .lcard {
        grid-template-columns: 132px minmax(0, 1fr);
        gap: 0.9rem;
        padding: 0.55rem;
    }

    .lcard-title {
        font-size: 0.95rem;
    }

    .lcard-overview {
        -webkit-line-clamp: 2;
        font-size: 0.8rem;
    }

    .to-top {
        right: 16px;
        bottom: 16px;
    }
}

@media (max-width: 420px) {
    .view-toggle {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .b-wall-row {
        animation: none;
    }
}
