/**
 * Home "Trending now" rail — panel colors follow body[data-home-sections-preset] via home-sections-presets.css.
 */

.trending-section-v2 {
    margin-bottom: 2.5rem;
}

.trending-panel {
    position: relative;
    border-radius: 20px;
    padding: clamp(1.25rem, 3vw, 1.75rem);
    border: 1px solid var(--home-section-border);
    background: var(--home-section-surface);
    box-shadow: var(--home-section-box-shadow);
    overflow: hidden;
}

.trending-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: var(--home-section-panel-radials);
}

.trending-hero-head {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
}

.trending-hero-head__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem 0.75rem;
    min-width: 0;
}

.trending-hero-head__lead {
    flex: 1 1 auto;
    min-width: 0;
    max-width: min(36rem, 100%);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.trending-hero-head__accent {
    flex-shrink: 0;
    width: 3px;
    height: 1.65rem;
    border-radius: 2px;
    background: var(--home-section-trend-accent-bg);
    box-shadow: var(--home-section-trend-accent-shadow);
}

.trending-hero-head__emoji {
    flex-shrink: 0;
    font-size: 1.35rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    font-style: normal;
}

.trending-hero-head__title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-sans);
    font-size: clamp(1.22rem, 3.5vw, 1.55rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #f8fafc;
    -webkit-font-smoothing: antialiased;
}

.trending-hero-head__actions {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.trending-hero-head__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.25);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}

.trending-hero-head__cta-label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 6.5rem;
}

.trending-hero-head__cta:hover {
    color: #fff;
    border-color: rgba(248, 250, 252, 0.35);
    background: rgba(30, 41, 59, 0.75);
}

[data-theme="light"] .trending-hero-head__cta {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .trending-hero-head__cta:hover {
    background: #fff;
    border-color: rgba(37, 99, 235, 0.35);
}

[data-theme="light"] .trending-hero-head__title {
    color: #0f172a;
}

@media (min-width: 768px) {
    .trending-hero-head__cta {
        padding: 0.4rem 0.85rem;
        font-size: 0.8rem;
    }

    .trending-hero-head__cta-label {
        max-width: none;
    }
}

.trending-scroll-wrap {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
}

/* Overlay on thumbnail rail — mobile + desktop */
.trending-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 8;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(71, 85, 105, 0.55);
    background: rgba(15, 15, 18, 0.82);
    color: #cbd5e1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.08) inset,
        0 8px 24px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
}

.trending-scroll-btn--prev {
    left: max(10px, env(safe-area-inset-left, 0px));
}

.trending-scroll-btn--next {
    right: max(10px, env(safe-area-inset-right, 0px));
}

.trending-scroll-btn:hover {
    color: #f1f5f9;
    border-color: rgba(148, 163, 184, 0.5);
    background: rgba(30, 30, 34, 0.92);
}

.trending-scroll-btn:active {
    transform: translateY(-50%) scale(0.94);
}

[data-theme="light"] .trending-scroll-btn {
    border-color: rgba(15, 23, 42, 0.12);
    color: #475569;
    background: rgba(255, 255, 255, 0.94);
}

[data-theme="light"] .trending-scroll-btn:hover {
    color: #0f172a;
    border-color: rgba(37, 99, 235, 0.35);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .trending-scroll-btn {
        background: rgba(18, 18, 22, 0.94);
    }
}

@media (min-width: 768px) {
    .trending-scroll-btn {
        width: 40px;
        height: 40px;
        font-size: 0.82rem;
    }

    .trending-scroll-btn--prev {
        left: 14px;
    }

    .trending-scroll-btn--next {
        right: 14px;
    }
}

.trending-scroll-v2 {
    position: relative;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.2rem 0 1rem;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--home-section-trend-scrollbar-pair);
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
}

.trending-scroll-v2::-webkit-scrollbar {
    height: 6px;
}

.trending-scroll-v2::-webkit-scrollbar-thumb {
    background: var(--home-section-trend-scrollbar-thumb);
    border-radius: 999px;
}

.trending-item-v2 {
    position: relative;
    min-width: 16.75rem;
    width: 16.75rem;
    flex: 0 0 auto;
    scroll-snap-align: start;
}

@media (min-width: 768px) {
    .trending-item-v2 {
        min-width: 17.75rem;
        width: 17.75rem;
    }

    .trending-item-v2--top {
        min-width: 18.5rem;
        width: 18.5rem;
    }
}

@media (min-width: 900px) {
    .trending-item-v2--top {
        min-width: 20rem;
        width: 20rem;
    }
}

@media (max-width: 767px) {
    .trending-scroll-v2 {
        scroll-snap-type: x mandatory;
        gap: 0.75rem;
    }

    .trending-item-v2,
    .trending-item-v2--top {
        flex: 0 0 100%;
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        scroll-snap-align: start;
        scroll-snap-stop: always;
    }
}

.trending-item-v2--top .trending-card-v2 {
    box-shadow: var(--home-section-trend-top-card-shadow);
}

.trending-top-ribbon {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    padding: 0.2rem 0.65rem;
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--home-section-trend-ribbon-color);
    background: var(--home-section-trend-ribbon-bg);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.trending-card-v2 {
    display: block;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--home-section-trend-card-border);
    box-shadow: var(--home-section-trend-card-shadow);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.32s ease, border-color 0.25s ease;
}

.trending-card-v2:hover {
    transform: translateY(-5px);
    border-color: var(--home-section-trend-card-border-hover);
    box-shadow: var(--home-section-trend-card-shadow-hover);
}

.trending-card-v2 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.trending-card-v2:hover img {
    transform: scale(1.05);
}

.trending-card-v2__shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(5, 6, 8, 0.12) 0%, transparent 40%, rgba(5, 6, 8, 0.65) 100%);
}

.trending-card-v2__rank {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 3;
    min-width: 1.65rem;
    height: 1.65rem;
    padding: 0 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    color: var(--home-section-trend-rank-color);
    background: var(--home-section-trend-rank-bg);
    border: 1px solid var(--home-section-trend-rank-border);
    backdrop-filter: blur(8px);
}

.trending-card-v2__dur {
    position: absolute;
    top: 0.5rem;
    left: 2.35rem;
    z-index: 3;
    padding: 0.22rem 0.45rem;
    border-radius: 7px;
    font-size: 0.62rem;
    font-weight: 700;
    color: #f8fafc;
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.trending-card-v2__platform {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 3;
    max-width: min(52%, calc(100% - 5rem));
    padding: 0.26rem 0.55rem;
    border-radius: 7px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.15;
    color: #fff;
    background: linear-gradient(125deg, var(--platform-g1, #b91c1c), var(--platform-g2, #f59e0b));
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trending-card-v2 .trending-overlay-v2 {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--home-section-trend-overlay-gradient);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.85rem 0.95rem;
    pointer-events: none;
}

.trending-title-v2 {
    color: var(--home-section-trend-title-color);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 0.4rem;
    line-height: 1.32;
    text-shadow: 0 1px 16px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trending-meta-v2 {
    font-size: 0.68rem;
    color: var(--home-section-trend-meta-color);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem 0.65rem;
}

.trending-meta-v2__pill {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--home-section-trend-pill-color);
    background: var(--home-section-trend-pill-bg);
    border: 1px solid var(--home-section-trend-pill-border);
}

.trending-meta-v2__views {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--home-section-trend-views-color);
}

.trending-meta-v2__views i {
    font-size: 0.62rem;
    opacity: 0.85;
}

.trending-meta-v2__time {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.trending-meta-v2__time i {
    opacity: 0.75;
    font-size: 0.65rem;
}

@media (prefers-reduced-motion: reduce) {
    .trending-card-v2,
    .trending-card-v2 img,
    .trending-hero-head__cta {
        transition: none !important;
    }

    .trending-card-v2:hover {
        transform: none;
    }

    .trending-card-v2:hover img {
        transform: none;
    }

}
