.home-topic-chip.active,
.home-topic-chip[aria-current="page"] {
    pointer-events: none;
    cursor: default;
}


.page-width.home-page {
    --home-column-gap: 18px;
    --home-row-gap: 38px;
    --home-card-radius: 12px;

    position: relative;
    width: min(1760px, calc(100% - 48px));
    margin-inline: auto;
    padding-block: 0 72px;
    font-family: Tahoma, Arial, sans-serif;
}

.home-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Topic chips */

.home-topic-navigation {
    position: sticky;
    top: var(--topbar-height);
    z-index: 900;
    min-width: 0;
    min-height: 58px;
    margin-block-end: 24px;
    padding-block: 10px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 1px 0 var(--border-color);
    backdrop-filter: blur(12px);
}

.home-topic-viewport {
    min-width: 0;
    overflow: hidden;
}

.home-topic-scroller {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-behavior: smooth;
    scrollbar-width: none;
    touch-action: pan-x;
}

.home-topic-scroller::-webkit-scrollbar {
    display: none;
}

.home-topic-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 14px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--soft-surface);
    color: var(--primary-text);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    transition:
        background-color 140ms ease,
        color 140ms ease;
}

.home-topic-chip:hover {
    background: var(--hover-color);
}

.home-topic-chip.active,
.home-topic-chip[aria-current="page"] {
    background: var(--primary-text);
    color: #ffffff;
}

.home-topic-scroll-button {
    position: absolute;
    top: 50%;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--surface-color);
    color: var(--primary-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transform: translateY(-50%);
}

.home-topic-scroll-right {
    inset-inline-start: 0;
}

.home-topic-scroll-left {
    inset-inline-end: 0;
}

.home-topic-scroll-button:hover {
    background: var(--soft-surface);
}

.home-topic-scroll-button:disabled {
    pointer-events: none;
    opacity: 0.32;
}

.home-topic-scroll-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Heading: hidden on the normal feed, visible on search pages */

.home-feed-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-block: 28px 24px;
}

.home-feed-header.compact {
    display: none;
}

.home-feed-heading-group {
    min-width: 0;
}

.home-feed-eyebrow {
    margin: 0 0 5px;
    color: var(--brand-color);
    font-size: 0.8rem;
    font-weight: 700;
}

.home-feed-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.4vw, 1.8rem);
    line-height: 1.5;
}

.home-feed-summary {
    margin: 6px 0 0;
    color: var(--secondary-text);
    font-size: 0.84rem;
}

.home-clear-search,
.home-empty-action {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 7px 16px;
    border: 1px solid var(--border-color);
    border-radius: 21px;
    background: var(--surface-color);
    color: var(--brand-color);
    font-size: 0.84rem;
    font-weight: 700;
}

.home-clear-search:hover,
.home-empty-action:hover {
    background: rgba(37, 99, 235, 0.07);
}

.home-feed-status {
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: 9px;
    color: var(--secondary-text);
    font-size: 0.82rem;
    text-align: center;
}

.home-feed-status[data-state="error"] {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

/* Video grid */

.home-feed-section {
    scroll-margin-block-start:
        calc(var(--topbar-height) + 70px);
}

.home-video-grid,
.home-loading-grid {
    display: grid;
    grid-template-columns:
        repeat(5, minmax(0, 1fr));
    align-items: start;
    gap:
        var(--home-row-gap)
        var(--home-column-gap);
}

.home-video-card {
    position: relative;
    min-width: 0;
}

/* Thumbnail */

.home-video-thumbnail-shell {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--home-card-radius);
    background: #e5e7eb;
}

.home-video-thumbnail-link {
    position: absolute;
    inset: 0;
    display: block;
}

.home-video-thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1);
    transition: transform 180ms ease;
}

.home-video-card:hover .home-video-thumbnail {
    transform: scale(1.018);
}

.home-thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    background: linear-gradient(145deg, #e5e7eb, #f3f4f6);
    color: var(--secondary-text);
    font-size: 0.8rem;
    text-align: center;
}

.home-video-duration {
    position: absolute;
    inset-inline-end: 7px;
    inset-block-end: 7px;
    min-width: 36px;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(15, 15, 15, 0.9);
    color: #ffffff;
    direction: ltr;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

/* Information under each thumbnail */

.home-video-card-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding-block-start: 11px;
    direction: rtl;
}

.home-video-avatar {
    position: static;
    display: inline-flex;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    overflow: hidden;
    border-radius: 50%;
    background: var(--brand-color);
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 700;
}

.home-video-avatar-image,
.home-video-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-video-information {
    min-width: 0;
    flex: 1 1 auto;
    text-align: start;
}

.home-video-title {
    display: -webkit-box;
    min-height: 2.9em;
    margin: 0;
    overflow: hidden;
    color: var(--primary-text);
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.45;
    text-align: start;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.home-video-title a {
    color: inherit;
}

.home-video-title a:hover {
    color: var(--brand-color);
}

.home-video-author {
    margin: 6px 0 0;
    overflow: hidden;
    color: var(--secondary-text);
    font-size: 0.77rem;
    line-height: 1.5;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.home-video-metadata {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin: 2px 0 0;
    color: var(--secondary-text);
    font-size: 0.73rem;
    line-height: 1.5;
}

.home-video-metadata span,
.home-video-metadata time {
    white-space: nowrap;
}

/* Three-dot menu */

.home-video-menu {
    position: relative;
    z-index: 10;
    flex: 0 0 32px;
    align-self: flex-start;
    margin: -4px 0 0;
}

.home-video-menu[open] {
    z-index: 50;
}

.home-video-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--primary-text);
    font-size: 1.2rem;
    line-height: 1;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.home-video-menu-button::-webkit-details-marker {
    display: none;
}

.home-video-menu-button::marker {
    content: "";
}

.home-video-menu-button:hover,
.home-video-menu[open] .home-video-menu-button {
    background: var(--soft-surface);
}

.home-video-menu-panel {
    position: absolute;
    inset-block-start: calc(100% + 4px);
    inset-inline-end: 0;
    z-index: 60;
    width: max-content;
    min-width: 205px;
    max-width: min(280px, 80vw);
    padding: 7px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.home-video-menu-panel a {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    border-radius: 8px;
    color: var(--primary-text);
    font-size: 0.82rem;
    text-align: start;
    white-space: nowrap;
}

.home-video-menu-panel a:hover {
    background: var(--soft-surface);
}

/* Empty and loading states */

.home-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    margin-block-start: 12px;
    padding: 38px 24px;
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    background: #fafafa;
    text-align: center;
}

.home-empty-state h2 {
    margin: 0;
    font-size: 1.16rem;
}

.home-empty-state p {
    max-width: 540px;
    margin: 10px 0 0;
    color: var(--secondary-text);
    font-size: 0.86rem;
    line-height: 1.8;
}

.home-empty-action {
    margin-block-start: 18px;
}

.home-loading-grid {
    margin-block-start: var(--home-row-gap);
}

.home-skeleton-card {
    min-width: 0;
}

.home-skeleton-thumbnail,
.home-skeleton-avatar,
.home-skeleton-lines > span {
    position: relative;
    display: block;
    overflow: hidden;
    background: #e8e8e8;
}

.home-skeleton-thumbnail::after,
.home-skeleton-avatar::after,
.home-skeleton-lines > span::after {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            100deg,
            transparent 20%,
            rgba(255, 255, 255, 0.72) 50%,
            transparent 80%
        );
    background-size: 220% 100%;
    content: "";
    animation: home-skeleton-shimmer 1.35s infinite;
}

.home-skeleton-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--home-card-radius);
}

.home-skeleton-information {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
    padding-block-start: 11px;
}

.home-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.home-skeleton-lines {
    display: block;
    min-width: 0;
    padding-block-start: 2px;
}

.home-skeleton-lines > span {
    width: 100%;
    height: 11px;
    margin-block-end: 8px;
    border-radius: 6px;
}

.home-skeleton-lines > span:nth-child(2) {
    width: 72%;
}

.home-skeleton-lines > span:nth-child(3) {
    width: 44%;
}

@keyframes home-skeleton-shimmer {
    from {
        background-position: 120% 0;
    }

    to {
        background-position: -120% 0;
    }
}

/* Pagination */

.home-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-block-start: 34px;
}

.home-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    min-height: 42px;
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    background: var(--surface-color);
    color: var(--primary-text);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
}

.home-load-more:hover {
    background: rgba(37, 99, 235, 0.07);
}

.home-load-more[aria-busy="true"] {
    pointer-events: none;
    opacity: 0.65;
}

.home-feed-sentinel {
    width: 100%;
    height: 1px;
}

/* Responsive grid */

@media (max-width: 1650px) {
    .home-video-grid,
    .home-loading-grid {
        grid-template-columns:
            repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1250px) {
    .home-video-grid,
    .home-loading-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .page-width.home-page {
        width: min(100% - 28px, 1760px);
    }

    .home-video-grid,
    .home-loading-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .home-feed-header {
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .page-width.home-page {
        --home-row-gap: 30px;
        --home-card-radius: 9px;

        padding-block-end: 52px;
    }

    .home-topic-navigation {
        min-height: 54px;
        margin-block-end: 18px;
        padding-block: 8px;
    }

    .home-topic-chip {
        min-height: 34px;
        padding: 6px 12px;
        font-size: 0.79rem;
    }

    .home-topic-scroll-button {
        display: none;
    }

    .home-feed-header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        margin-block: 22px 20px;
    }

    .home-clear-search {
        align-self: flex-start;
    }

    .home-video-grid,
    .home-loading-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-video-avatar {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .home-video-title {
        font-size: 0.93rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-topic-scroller {
        scroll-behavior: auto;
    }

    .home-topic-chip,
    .home-video-thumbnail {
        transition: none;
    }

    .home-skeleton-thumbnail::after,
    .home-skeleton-avatar::after,
    .home-skeleton-lines > span::after {
        animation: none;
    }
}