.community-preview {
    position: relative;
    background: var(--mtw-white);
    overflow: hidden;
}

.community-preview-container {
    width: min(1480px, calc(100% - 64px));
    margin: 0 auto;
}

/* Header */

.community-preview-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 44px;
    padding-bottom: 34px;
    border-bottom: 1px solid var(--mtw-border);
}

.community-preview-heading {
    max-width: 820px;
}

.community-preview-header h2 {
    margin-bottom: 18px;
}

.community-preview-header p:not(.kicker) {
    color: var(--mtw-muted);
    font-size: 1.05rem;
    line-height: 1.75;
}

.community-preview-top-link {
    flex-shrink: 0;
}

/* Shared metadata */

.community-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.community-preview-date,
.community-preview-category {
    display: inline-flex;
    align-items: center;
    min-height: 29px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    line-height: 1;
    font-weight: 800;
}

.community-preview-date {
    background: var(--mtw-red-soft);
    color: var(--mtw-red-dark);
}

.community-preview-category {
    background: var(--mtw-off-white);
    border: 1px solid var(--mtw-border);
    color: var(--mtw-muted);
}

/* Featured notice */

.community-featured-card {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
    min-height: 570px;
    margin-bottom: 28px;
    background: var(--mtw-black);
    border: 1px solid var(--mtw-black);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.community-featured-image {
    display: block;
    min-height: 570px;
    background: var(--mtw-light-grey);
    overflow: hidden;
}

.community-featured-image img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 570px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.community-featured-card:hover .community-featured-image img {
    transform: scale(1.025);
}

.community-featured-content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 54px;
}

.community-featured-content::before {
    content: "";
    position: absolute;
    top: 54px;
    left: 0;
    width: 4px;
    height: 74px;
    background: var(--mtw-red);
}

.community-featured-content .community-preview-category {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.76);
}

.community-featured-content h3 {
    max-width: 620px;
    margin-bottom: 22px;
    font-size: clamp(2rem, 3.25vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.055em;
}

.community-featured-content h3 a {
    color: var(--mtw-white);
    text-decoration: none;
}

.community-featured-content h3 a:hover {
    color: rgba(255, 255, 255, 0.82);
}

.community-featured-description {
    max-width: 620px;
    margin-bottom: 34px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    line-height: 1.78;
}

.community-preview-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: auto;
}

.community-preview-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 17px;
    border: 1px solid var(--mtw-border);
    border-radius: 8px;
    background: var(--mtw-white);
    color: var(--mtw-muted);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background 0.2s ease;
}

.community-preview-file:hover {
    border-color: var(--mtw-red);
    color: var(--mtw-red);
}

.community-preview-file-dark {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.24);
    color: var(--mtw-white);
}

.community-preview-file-dark:hover {
    background: var(--mtw-white);
    border-color: var(--mtw-white);
    color: var(--mtw-black);
}

/* Three smaller notices */

.community-preview-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.community-small-card {
    display: grid;
    grid-template-rows: 220px 1fr;
    min-width: 0;
    background: var(--mtw-white);
    border: 1px solid var(--mtw-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

.community-small-card:hover {
    border-color: var(--mtw-red);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.community-small-image {
    display: block;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--mtw-light-grey);
}

.community-small-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.25s ease;
}

.community-small-card:hover .community-small-image img {
    transform: scale(1.03);
}

.community-small-content {
    display: flex;
    flex-direction: column;
    padding: 28px;
}

.community-small-content .community-preview-meta {
    margin-bottom: 18px;
}

.community-small-content h3 {
    margin-bottom: 14px;
    font-size: clamp(1.25rem, 1.55vw, 1.65rem);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

.community-small-content h3 a {
    color: var(--mtw-black);
    text-decoration: none;
}

.community-small-content h3 a:hover {
    color: var(--mtw-red);
}

.community-small-content p {
    margin-bottom: 24px;
    color: var(--mtw-muted);
    font-size: 0.93rem;
    line-height: 1.65;
}

.community-small-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    width: fit-content;
    margin-top: auto;
    color: var(--mtw-red);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
}

.community-small-link span {
    transition: transform 0.2s ease;
}

.community-small-link:hover span {
    transform: translateX(3px);
}

/* Empty state */

.community-preview-empty {
    display: grid;
    grid-template-columns: 5px 1fr;
    gap: 26px;
    align-items: center;
    max-width: 820px;
    padding: 32px;
    background: var(--mtw-off-white);
    border: 1px solid var(--mtw-border);
    border-radius: var(--radius-md);
}

.community-preview-empty-line {
    width: 5px;
    height: 100%;
    min-height: 88px;
    background: var(--mtw-red);
    border-radius: var(--radius-xs);
}

.community-preview-empty h3 {
    margin-bottom: 10px;
    font-size: clamp(1.35rem, 1.7vw, 1.75rem);
}

.community-preview-empty p {
    max-width: 620px;
    color: var(--mtw-muted);
}

.community-preview-bottom-link {
    display: none;
    margin-top: 32px;
}

/* Responsive */

@media (max-width: 1180px) {
    .community-featured-card {
        grid-template-columns: 1fr 1fr;
    }

    .community-featured-content {
        padding: 42px;
    }

    .community-featured-content::before {
        top: 42px;
    }

    .community-preview-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .community-small-card:last-child {
        grid-column: 1 / -1;
        grid-template-columns: 320px minmax(0, 1fr);
        grid-template-rows: auto;
    }

    .community-small-card:last-child .community-small-image {
        height: 100%;
        min-height: 260px;
    }
}

@media (max-width: 980px) {
    .community-preview-container {
        width: min(100% - 32px, 1480px);
    }

    .community-preview-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .community-preview-top-link {
        display: none;
    }

    .community-preview-bottom-link {
        display: block;
    }

    .community-featured-card {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .community-featured-image,
    .community-featured-image img {
        min-height: 0;
    }

    .community-featured-image {
        aspect-ratio: 16 / 9;
    }

    .community-featured-content {
        min-height: 430px;
    }
}

@media (max-width: 760px) {
    .community-preview-list {
        grid-template-columns: 1fr;
    }

    .community-small-card,
    .community-small-card:last-child {
        grid-column: auto;
        grid-template-columns: 1fr;
        grid-template-rows: 220px 1fr;
    }

    .community-small-card:last-child .community-small-image {
        height: 220px;
        min-height: 220px;
    }
}

@media (max-width: 620px) {
    .community-preview-header {
        margin-bottom: 32px;
        padding-bottom: 28px;
    }

    .community-featured-content {
        min-height: 0;
        padding: 32px 26px;
    }

    .community-featured-content::before {
        top: 32px;
        width: 4px;
        height: 54px;
    }

    .community-featured-content h3 {
        font-size: 2rem;
    }

    .community-preview-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .community-preview-actions .btn,
    .community-preview-file {
        width: 100%;
    }

    .community-small-image,
    .community-small-card:last-child .community-small-image {
        height: 190px;
        min-height: 190px;
    }

    .community-small-card,
    .community-small-card:last-child {
        grid-template-rows: 190px 1fr;
    }

    .community-small-content {
        padding: 24px;
    }

    .community-preview-empty {
        grid-template-columns: 1fr;
        gap: 18px;
        padding: 26px;
    }

    .community-preview-empty-line {
        width: 58px;
        height: 4px;
        min-height: 4px;
    }

    .community-preview-bottom-link .btn {
        width: 100%;
    }
}