:root {
    --color-primary: #1769aa;
    --color-primary-dark: #12558c;
    --color-text: #202b36;
    --color-muted: #667085;
    --color-background: #f5f8fc;
    --color-surface: #ffffff;
    --color-border: #e8edf4;
    --radius-card: 16px;
    --content-width: 1320px;
}

.community-wall,
.community-wall * {
    box-sizing: border-box;
}

.community-wall {
    width: min(100% - 48px, var(--content-width));
    margin: 0 auto;
    padding: 24px 0;
    color: var(--color-text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.65;
}

.instagram-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
}

.post-card {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: 0 3px 12px rgb(31 51 73 / 4%);
    transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.post-card:hover {
    transform: translateY(-5px);
    border-color: #d6e5f5;
    box-shadow: 0 12px 30px rgb(31 51 73 / 10%);
}

.post-card:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(23 105 170 / 12%);
}

.post-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.post-link:focus-visible,
.follow-button:focus-visible {
    outline: 3px solid #12558c;
    outline-offset: 4px;
}

.post-media {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #e9eef5;
}

.post-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 350ms ease;
}

.image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px;
    color: var(--color-muted);
    background: #e9eef5;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.post-card:hover .post-media img {
    transform: scale(1.035);
}

.post-type {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 5px 11px;
    color: #fff;
    background: rgb(25 35 48 / 72%);
    border: 1px solid rgb(255 255 255 / 20%);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2px;
    backdrop-filter: blur(8px);
}

.post-content {
    padding: 18px;
}

.post-caption {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 14px;
    color: #263648;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.75;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.post-date {
    display: inline-block;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .15px;
}

.feed-message {
    grid-column: 1 / -1;
    padding: 40px 20px;
    color: var(--color-muted);
    text-align: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
}

.wall-footer {
    margin-top: 36px;
    text-align: center;
}

.follow-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 11px 25px;
    color: #fff !important;
    background: linear-gradient(135deg, #1976bd, #125b9c);
    border: 0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgb(23 105 170 / 20%);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none !important;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.follow-button:hover {
    color: #fff !important;
    background: linear-gradient(135deg, #1769aa, #104d85);
    transform: translateY(-2px);
    box-shadow: 0 7px 16px rgb(23 105 170 / 28%);
}

.instagram-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .instagram-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .community-wall {
        width: min(100% - 28px, var(--content-width));
        padding: 18px 0;
    }

    .instagram-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .post-content {
        padding: 13px;
    }

    .post-caption {
        font-size: 13px;
        line-height: 1.65;
    }

    .post-type {
        top: 8px;
        right: 8px;
        padding: 4px 9px;
        font-size: 10px;
    }

    .wall-footer {
        margin-top: 28px;
    }
}

@media (max-width: 360px) {
    .instagram-grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .community-wall *,
    .community-wall *::before,
    .community-wall *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
