/* =========================================================
   COMMUNITY — PAGE-SPECIFIC COMPOSITION

   COMPACT   < 610
   WIDE      610–779
   EDITORIAL 780–1199
   MAX       1200+
   ========================================================= */

.community-page {
    width: 100%;
    background: var(--surface-page);
}


/* ---------- INTRO ---------- */

.community-intro {
    padding-top: var(--content-space-top);
    padding-bottom: 56px;
}

.community-copy-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.community-heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.community-kicker {
    order: 1;

    margin: 0 0 10px;

    font-family: var(--secondary-font);
    font-size: 17px;
    font-weight: var(--weight-regular);
    line-height: 1.4;

    color: var(--secondary-color);
}

.community-title {
    order: 2;

    margin: 0;

    font-family: var(--main-font);
    font-size: 28px;
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    letter-spacing: -0.025em;

    color: var(--primary-color);
    text-transform: none;
}

.community-heading-rule {
    order: 3;

    width: 100%;
    margin: 24px 0 32px;

    border: 0;
    border-top: 1px solid #00000020;
}

.community-body {
    min-width: 0;
}

.community-body p {
    margin: 0;

    font-family: var(--main-font);
    font-size: 18px;
    font-weight: var(--weight-regular);
    line-height: 1.5;

    color: var(--primary-color);
}


/* ---------- INSTAGRAM FEED ---------- */

.community-feed {
    padding-bottom: 96px;
}

/*
   The Instagram feed gets its own container.

   COMPACT / WIDE / EDITORIAL:
   it follows the same horizontal gutters as .page-container.

   MAX:
   only this visual grid is allowed to become wider than the
   editorial text column.
*/
.community-grid-container {
    width: calc(100% - (var(--page-gutter) * 2));
    margin-inline: auto;
}

/*
   The official embeds carry an inline min-width of 326px.
   We neutralize it so a post can shrink safely inside the
   Casa Rocca responsive container on narrow screens.
*/
.instagram-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(min(100%, 326px), 1fr));

    gap: 32px;
    align-items: start;
}

.instagram-post {
    width: 100%;
    min-width: 0;
}

.instagram-post .instagram-media {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}


/* ---------- COMMUNITY LEGAL ---------- */

.community-legal {
    width: 100%;

    font-family: var(--secondary-font);
    color: var(--secondary-color);
}

.community-legal-title {
    margin: 0 0 28px;

    font-family: var(--secondary-font);
    font-size: var(--font-size-XS);
    font-weight: var(--weight-semibold);
    line-height: 1.35;

    color: var(--secondary-color);
}

.community-legal-copy {
    margin: 0;

    font-family: var(--secondary-font);
    font-size: 12px;
    font-weight: var(--weight-regular);
    line-height: 1.5;

    color: var(--secondary-color);
    
    text-align: justify;

    -webkit-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

.community-legal-copy a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.12em;
}

.community-legal-copy a:hover {
    color: var(--primary-color);
}


/* =========================================================
   WIDE
   ========================================================= */

@media (min-width: 610px) {

    .community-intro {
        padding-bottom: 72px;
    }

    .community-kicker {
        margin-bottom: 0;
    }

    .community-heading-rule {
        order: 2;
        margin: 12px 0 16px;
    }

    .community-title {
        order: 3;

        font-size: 38px;
        line-height: 1.2;
    }

    .community-body {
        margin-top: 32px;
    }

    .community-feed {
        padding-bottom: 110px;
    }

    .community-legal-copy {
        font-size: var(--font-size-XS);
    }
}


/* =========================================================
   EDITORIAL
   ========================================================= */

@media (min-width: 780px) {

    .community-intro {
        padding-top: 78px;
        padding-bottom: 72px;
    }

    /*
       Shared two-column editorial pattern:
       kicker + rule span the full width;
       title and body begin below the rule.
    */
    .community-copy-layout {
        grid-template-columns: minmax(0, 0.58fr) minmax(0, 1fr);
        column-gap: 40px;
        align-items: start;
    }

    .community-heading {
        display: contents;
    }

    .community-kicker {
        grid-column: 1 / -1;
        grid-row: 1;

        margin: 0 0 12px;
    }

    .community-heading-rule {
        grid-column: 1 / -1;
        grid-row: 2;

        margin: 0 0 32px;
    }

    .community-title {
        grid-column: 1;
        grid-row: 3;

        font-size: 38px;
    }

    .community-body {
        grid-column: 2;
        grid-row: 3;

        margin-top: 0;
    }

    .community-feed {
        padding-bottom: 120px;
    }
}


/* =========================================================
   MAX
   ========================================================= */

@media (min-width: 1200px) {

    .community-intro {
        padding-top: var(--content-space-top);
    }

    /*
       Keep heading + body on the standard editorial max width.
       Only the Instagram grid expands beyond --page-max-width.
    */
    .community-grid-container {
        width: min(
            1100px,
            calc(100% - 80px)
        );
    }

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