/* Additional glyphs use the same regular face as the existing CJK subset. */
@font-face {
    font-family: 'ZhongHuaXinHuo';
    src: url('./fonts/zhonghuaxinhuo-community.woff2?v=20261020-gallery') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+5267,U+5377,U+542B,U+548B,U+5566,U+5C1D,U+5EA7,U+5F69,U+6652,U+7CBE,U+80B2,U+9547,U+9662;
}

/* The community chapter inherits the existing homepage's colors and type. */
.community {
    min-height: 100svh;
    padding: calc(var(--nav-height) + 1.5rem) 0 1.5rem;
    display: flex;
    align-items: center;
}

.community .section-header {
    margin-bottom: clamp(1.5rem, 3vh, 2.5rem);
}

.community-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: center;
    gap: clamp(1.5rem, 4vw, 3rem);
}

.community-lead {
    margin-bottom: 1.25rem;
    color: var(--color-accent);
    font-size: clamp(1.2rem, 1.8vw, 1.5rem);
    font-weight: 400;
    line-height: 1.6;
    text-wrap: pretty;
}

.community-story > p {
    margin-bottom: 1rem;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1.9;
    text-wrap: pretty;
}

.community-story > p:last-child {
    margin-bottom: 0;
}

.community-work {
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-card-bg);
}

.community-gallery {
    min-width: 0;
    touch-action: pan-y pinch-zoom;
}

.community-work[hidden],
.community-gallery-controls[hidden] {
    display: none;
}

.community-work-link {
    display: block;
    background: var(--color-card-bg);
    aspect-ratio: 16 / 9;
}

.community-work img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.community-work figcaption {
    padding: 1.25rem;
    min-height: 13rem;
}

.community-gallery-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.community-gallery-controls button {
    display: inline-grid;
    place-items: center;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    font: inherit;
}

.community-gallery-controls button:hover {
    background: var(--color-card-bg);
}

.community-gallery-dots {
    display: flex;
    flex: 1;
    max-width: 176px;
    justify-content: center;
}

.community-gallery-dots button {
    flex: 1;
    min-width: 24px;
    max-width: 44px;
}

.community-gallery-dots button::after {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    background: var(--color-text-muted);
    opacity: 0.4;
}

.community-gallery-dots button[aria-pressed="true"]::after {
    width: 20px;
    opacity: 1;
    background: var(--color-accent);
}

.community-gallery-count {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.community-work-label {
    margin-bottom: 0.5rem;
    color: var(--color-accent);
    font-size: 0.82rem;
}

.community-work h3 {
    margin-bottom: 0.6rem;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.5;
}

.community-work figcaption > p:not(.community-work-label) {
    margin-bottom: 0.8rem;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    line-height: 1.7;
}

.community-work figcaption > a,
.community-replay-link {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 0.3em;
    text-decoration-color: var(--color-border);
}

.community-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    margin-top: 1.75rem;
}

.community-primary-link {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    background: var(--color-text);
    color: var(--color-bg);
    font-weight: 400;
}

.community a:hover {
    text-decoration: underline;
    text-underline-offset: 0.3em;
}

.community a:focus-visible,
.community button:focus-visible,
.community-stage:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

@media (max-width: 1024px) and (min-width: 769px) {
    .community-stage {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .community-stage {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.25rem;
    }

    .community-lead {
        font-size: 1.12rem;
        margin-bottom: 0.9rem;
    }

    .community-story > p {
        font-size: 0.94rem;
        line-height: 1.8;
    }

    .community-work figcaption {
        padding: 1rem;
    }

    .community-actions {
        gap: 0.5rem 1rem;
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    .community .section-header {
        margin-bottom: 0.8rem;
    }

    .community .section-title {
        font-size: clamp(1.25rem, 5.8vw, 1.65rem);
    }

    .community-stage {
        flex: 1 1 auto;
        min-height: 0;
        align-items: start;
        overflow-y: auto;
        padding: 0.25rem 0.25rem 0.75rem;
        scrollbar-width: thin;
        scrollbar-color: var(--color-border) transparent;
    }

    .community-actions {
        flex: 0 0 auto;
        margin-top: 0.75rem;
        font-size: 0.85rem;
    }

    .community-primary-link {
        min-height: 44px;
        padding: 0.65rem 1rem;
    }
}
