/* Le pagine interne conservano i contenuti editoriali e una misura di lettura contenuta. */
body:not(:has(.smc-home)) #page {
    max-width: 1040px;
}

body.single-post #page {
    max-width: var(--smc-width);
}

body:not(:has(.smc-home)) .inside-article {
    padding: clamp(24px, 5vw, 64px);
    border: 1px solid var(--smc-border);
}

body:not(:has(.smc-home)) .entry-header,
body:not(:has(.smc-home)) .entry-content {
    max-width: 72ch;
    margin-inline: auto;
}

body:not(:has(.smc-home)) .entry-content {
    margin-top: 32px;
}

/* Gli articoli conservano una colonna di lettura stabile anche con allegati. */
.single-post .entry-meta {
    color: var(--smc-muted);
    font-size: 14px;
    line-height: 1.5;
    margin-top: 16px;
}

.single-post .entry-content > * {
    max-width: 100%;
}

/* Il PDF del foglietto usa il riquadro ampio senza allargare i paragrafi. */
.single-post .entry-content:has(.pdfemb-viewer) {
    max-width: none;
}

.single-post .entry-content:has(.pdfemb-viewer) > :not(.pdfemb-viewer):not(:has(.pdfemb-viewer)) {
    max-width: 72ch;
    margin-inline: auto;
}

.single-post .entry-content img,
.single-post .entry-content iframe,
.single-post .entry-content embed,
.single-post .entry-content object {
    max-width: 100%;
}

.single-post .entry-content :is(pre, table) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/* La home è la fonte editoriale; il footer usa lo stesso gruppo di recapiti. */
.smc-inner-footer {
    padding-block: clamp(40px, 5vw, 72px);
    border-top: 1px solid var(--smc-border);
    background: var(--smc-bg);
}

.smc-inner-footer .smc-bottom {
    width: min(var(--smc-width), calc(100% - 64px));
    margin-inline: auto;
    padding-block: 0;
}

.smc-inner-footer .smc-bottom > .wp-block-group__inner-container {
    display: contents;
}

.smc-inner-footer h2 {
    color: var(--smc-blue);
    font-size: clamp(30px, 3vw, 42px);
    line-height: 1.15;
    margin-bottom: 30px;
}

/* La proposta conserva sezioni e blocchi editoriali della homepage. */
.smc-home.wp-block-group {
    padding: 0;
}

.smc-home {
    overflow-x: clip;
}

.smc-home .wp-block-group__inner-container {
    display: contents;
}

body:has(.smc-home) #fullscreen-image {
    display: none;
}

body:has(.smc-home) .site-main {
    margin-top: 0;
    margin-bottom: 0;
}

body:has(.smc-home) .site {
    max-width: none;
}

body:has(.smc-home) .site-content {
    padding: 0;
}

body:has(.smc-home) .content-area {
    width: 100%;
}

body:has(.smc-home) .inside-article {
    padding: 0;
    background: transparent;
}

body:has(.smc-home) .entry-content {
    margin: 0;
}

.smc-shell {
    width: min(var(--smc-width), calc(100% - 64px));
    margin-inline: auto;
}

.smc-section {
    padding-block: 88px;
}

/* Fotografia e testo hanno superfici distinte per mantenere il contrasto. */
.smc-hero {
    position: relative;
    min-height: 620px;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    overflow: hidden;
    background: var(--smc-bg);
}

.smc-hero-image {
    position: absolute;
    inset: 24px 49% 48px 24px;
    margin: 0;
    overflow: hidden;
    border-radius: 12px 140px 12px 12px;
}

.smc-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 18% center;
}

.smc-hero-copy {
    position: relative;
    grid-column: 2;
    padding: 48px clamp(28px, 5vw, 88px) 72px 48px;
    max-width: 720px;
}

.smc-hero-copy::before {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    margin-bottom: 28px;
    background: var(--smc-accent);
    border-radius: 2px;
}

.smc-hero h1 {
    font-size: clamp(56px, 5.8vw, 88px);
    line-height: .98;
    letter-spacing: -.035em;
    color: var(--smc-blue);
    margin-bottom: 22px;
}

.smc-hero .smc-subtitle {
    color: var(--smc-muted);
    font: 18px/1.5 Inter, system-ui, sans-serif;
    margin-bottom: 32px;
}

.smc-hero-copy > p:not(.smc-eyebrow):not(.smc-subtitle) {
    font-size: 18px;
    margin-bottom: 28px;
}

.smc-mass {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1.2fr 1fr 1.4fr 1fr;
    gap: 28px;
    margin-top: -24px;
    padding: 32px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--smc-border);
    box-shadow: var(--smc-shadow);
}

.smc-mass h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.smc-mass > div {
    padding-left: 24px;
    border-left: 1px solid var(--smc-border);
}

.smc-mass h3 {
    font-family: Inter, system-ui, sans-serif;
    font-size: 17px;
    color: var(--smc-accent);
    font-weight: 650;
    margin-bottom: 12px;
}

.smc-mass p {
    font-size: 17px;
    margin-bottom: 0;
}

.smc-pastoral-band {
    background: #f0ece3;
    border-block: 1px solid var(--smc-border);
}

/* Le due fasce di notizie estendono lo sfondo oltre la colonna dei blocchi. */
.smc-home .smc-section:has(#avvisi),
.smc-home .smc-section:has(#vita-parrocchia) {
    position: relative;
    isolation: isolate;
}

.smc-home .smc-section:has(#avvisi)::before,
.smc-home .smc-section:has(#vita-parrocchia)::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background-repeat: no-repeat;
}

.smc-home .smc-section:has(#avvisi) {
    min-height: 360px;
}

/* Fondi uniformi danno priorità a notizie e fotografie degli articoli. */
.smc-home .smc-section:has(#avvisi)::before {
    background: var(--smc-bg);
}

.smc-home .smc-section:has(#vita-parrocchia)::before {
    background: #eaf0ed;
    border-block: 1px solid #d9e3dc;
}

.smc-home #vita-parrocchia {
    text-align: left;
}

.smc-home .smc-section > h2::after,
.smc-home .smc-section > .wp-block-group__inner-container > h2::after {
    content: "";
    display: block;
    width: 44px;
    height: 3px;
    margin-top: 20px;
    background: var(--smc-accent);
}

.smc-pastoral-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
}

.smc-bottom {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 32px;
}

.smc-history, .smc-location, .smc-contact {
    padding: 36px;
    border-radius: 12px;
    border: 1px solid var(--smc-border);
    background: #fff;
}

.smc-contact {
    color: var(--smc-text);
}

.smc-contact a {
    color: var(--smc-accent);
    overflow-wrap: anywhere;
}

.smc-contact-details {
    margin: 0;
}

/* Prevale sullo stile nativo della Tabella anche quando viene caricato dopo. */
.wp-block-table.smc-contact-details table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    font-size: 16px;
    line-height: 1.4;
}

.wp-block-table.smc-contact-details td {
    padding: 6px 0;
    border: 0;
    vertical-align: top;
    text-align: left;
}

.wp-block-table.smc-contact-details td:first-child {
    width: 102px;
    padding-right: 12px;
}

/* Fotografie decorative in celle autonome: nessun testo si sovrappone alle immagini. */
.smc-home .smc-section:has(#avvisi),
.smc-home .smc-section:has(#vita-parrocchia),
.smc-home .smc-pastoral-band .smc-section {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 36px;
    align-items: center;
}

.smc-home .smc-section:has(#avvisi) > h2,
.smc-home .smc-section:has(#vita-parrocchia) > h2,
.smc-home .smc-pastoral-band .smc-section h2 {
    grid-column: 1;
    grid-row: 1;
    margin-bottom: 0;
}

.smc-home .smc-section:has(#avvisi)::after,
.smc-home .smc-section:has(#vita-parrocchia)::after,
.smc-home .smc-pastoral-band .smc-section::after {
    content: "";
    display: block;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

.smc-home .smc-section:has(#avvisi)::after {
    background-image: url("../img/home-featured.jpg");
    aspect-ratio: 4 / 3;
    background-position: center top;
}

.smc-home .smc-section:has(#vita-parrocchia)::after {
    background-image: url("../img/home-parish-life.jpg");
    background-position: center;
}

.smc-home .smc-pastoral-band .smc-section::after {
    background-image: url("../img/home-reality.jpg");
}

.smc-home .smc-section > .smc-news,
.smc-home .smc-section > .wp-block-group__inner-container > .smc-news,
.smc-home .smc-pastoral-grid {
    grid-column: 1 / -1;
    grid-row: 2;
}

/* In evidenza affianca la fotografia alle notizie, sotto il titolo comune. */
@media (min-width: 768px) {
    .smc-home .smc-section:has(#avvisi) > h2,
    .smc-home .smc-section:has(#avvisi) > .wp-block-group__inner-container > h2 {
        grid-column: 1 / -1;
    }

    .smc-home .smc-section:has(#avvisi)::after {
        grid-column: 2;
        grid-row: 2;
    }

    .smc-home .smc-section:has(#avvisi) .smc-news {
        grid-column: 1;
        grid-row: 2;
        align-self: start;
    }

    .smc-home .smc-section:has(#avvisi) .wp-block-post-template {
        grid-template-columns: minmax(0, 1fr);
    }

    .smc-home .smc-section:has(#avvisi) .wp-block-post:only-child {
        grid-column: 1;
    }
}
