/* Master communities. Dark band running a bento grid: one tall feature card on the left and
   three staggered cards on the right, so the empty cell reads as composition rather than a gap. */

.communities {
    padding-block: var(--space-8);
}

.communities__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: var(--space-6) var(--space-8);
    align-items: start;
    margin-bottom: var(--space-7);
}

.communities__title {
    font-size: clamp(2.25rem, 4.5vw, 3.25rem);
    letter-spacing: -0.035em;
}

.communities__intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-5);
    padding-top: var(--space-2);
}

.communities__lede {
    font-size: var(--text-sm);
    line-height: 1.7;
    color: var(--fg-dim);
    text-align: justify;
}

.communities__more {
    display: flex;
    justify-content: center;
    margin-top: var(--space-7);
}

.communities__grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--space-6) var(--space-5);
    list-style: none;
    padding: 0;
}

.community__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.community__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-md);
    transition: transform var(--dur-slow) var(--ease-out);
}

.community__link:hover .community__image {
    transform: scale(1.02);
}

.community__name {
    margin-top: var(--space-3);
    font-size: var(--text-md);
    font-weight: var(--fw-semibold);
}

.community__pitch {
    margin-top: 2px;
    font-size: var(--text-sm);
    color: var(--accent);
}

.community__note {
    max-width: 46ch;
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    line-height: 1.7;
    color: var(--fg-dim);
}

.community--feature {
    grid-column: 1 / 7;
    grid-row: 1 / 3;
}

.community--feature .community__link {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.community--feature .community__image {
    flex: 1;
    min-height: 0;
    aspect-ratio: auto;
}

.community--feature .community__name {
    font-size: var(--text-lg);
}

.communities__grid .community:nth-child(2) {
    grid-column: 7 / 10;
    grid-row: 1;
}

.communities__grid .community:nth-child(3) {
    grid-column: 10 / 13;
    grid-row: 1;
}

.communities__grid .community:nth-child(4) {
    grid-column: 7 / 10;
    grid-row: 2;
}

.communities__grid .community:nth-child(5) {
    grid-column: 10 / 13;
    grid-row: 2;
}

@media (max-width: 1080px) {
    .communities__head {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--space-4);
    }

    .communities__lede {
        max-width: 62ch;
        text-align: left;
    }

    .communities__more {
    display: flex;
    justify-content: center;
    margin-top: var(--space-7);
}

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

    .community--feature,
    .communities__grid .community:nth-child(2),
    .communities__grid .community:nth-child(3),
    .communities__grid .community:nth-child(4),
    .communities__grid .community:nth-child(5) {
        grid-column: auto;
        grid-row: auto;
    }

    .community--feature .community__image {
        aspect-ratio: 16 / 9;
    }

    .community--feature {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .communities__more {
    display: flex;
    justify-content: center;
    margin-top: var(--space-7);
}

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

@media (prefers-reduced-motion: no-preference) {
    .communities .community__image {
        clip-path: inset(0 100% 0 0);
    }

    .communities .community__name,
    .communities .community__pitch,
    .communities .community__note {
        opacity: 0;
    }

    .communities.is-visible .community__image {
        clip-path: inset(0 0 0 0);
        transition: clip-path 1000ms var(--ease-out);
        transition-delay: var(--delay, 0ms);
    }

    .communities.is-visible .community__name,
    .communities.is-visible .community__pitch,
    .communities.is-visible .community__note {
        opacity: 1;
        transition: opacity 600ms var(--ease-out);
        transition-delay: calc(var(--delay, 0ms) + 300ms);
    }
}
