/* ============================================================
   AIDES AUX FAMILLES
   Hero : classes moving-leaving-* (moving-leaving.css)
   Structure et cartes : modèle Construire et transformer
============================================================ */

#familles-content {
    --familles-accent: var(--enfold-alternate-color-primary);
    --familles-heading: var(--component-color-dark);
    --familles-text: var(--component-color-text);
    --familles-muted: color-mix(in srgb, var(--component-color-text) 84%, var(--component-color-bg2));
    --familles-border: var(--component-color-border);
    --familles-surface: var(--component-color-bg2);
    --familles-background: var(--component-color-bg);
}

#familles-content,
#familles-content * {
    box-sizing: border-box;
}

/* Même largeur que la page « S’installer ou quitter la commune » */
#familles-content>.container {
    width: calc(100% - 48px);
    max-width: 1180px;
    padding-right: 0;
    padding-left: 0;
}

.familles-intro p,
.familles-section-intro p,
.familles-note p {
    margin: 0;
}

.familles-section-intro p+p {
    margin-top: 10px;
}

/* Structure : colonnes Avia sœurs affichées en grille 2/3 – 1/3 */

#familles-content {
    background-color: var(--familles-background);
}

#familles-content .template-page.content {
    padding-top: 48px;
    padding-bottom: 42px;
}

#familles-content .entry-content-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(270px, 0.8fr);
    align-items: start;
    gap: 52px;
}

#familles-content .entry-content-wrapper::before,
#familles-content .entry-content-wrapper::after {
    display: none;
    content: none;
}

#familles-content .entry-content-wrapper>.flex_column {
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
}

.familles-section-heading,
.familles-related-title {
    padding: 0;
}

#top #familles-content .familles-section-heading {
    margin: 0 0 12px;
}

.familles-section-heading .av-special-heading-tag {
    line-height: 1.2;
    font-weight: 400;
}

#top #familles-content .familles-section-separated {
    margin-top: 44px;
    padding-top: 38px;
    border-top: 1px solid var(--familles-border);
}

.familles-section-intro {
    max-width: 720px;
    color: var(--familles-text);
}

.familles-section-intro a,
.familles-note a {
    color: var(--familles-accent);
    font-weight: 700;
    text-decoration: none;
}

.familles-section-intro a:hover,
.familles-section-intro a:focus-visible,
.familles-note a:hover,
.familles-note a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.familles-note {
    margin-top: 16px;
    color: var(--familles-muted);
}

/* Rangées libellé / valeur (modèle Construire et transformer) */

.familles-facts {
    margin-top: 20px;
    padding: 8px 24px;
    border: 1px solid var(--familles-border);
    border-radius: var(--component-radius);
    background: var(--familles-surface);
}

.familles-facts dl {
    margin: 0;
}

.familles-facts-row {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 0;
    border-bottom: 1px solid var(--familles-border);
    line-height: 1.35;
}

.familles-facts-row:last-child {
    border-bottom: 0;
}

#top .familles-facts dt {
    flex: none;
    margin: 0;
    color: var(--familles-muted);
    font-weight: 400;
}

#top .familles-facts dd {
    margin: 0;
    color: var(--familles-heading);
    font-weight: 700;
    text-align: right;
}

.familles-facts a {
    color: var(--familles-accent);
    text-decoration: none;
}

.familles-facts a:hover,
.familles-facts a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Interlocuteurs : liste d’icônes Avia en cartes */

.familles-contacts {
    margin-top: 22px;
}

.familles-contacts .avia-icon-list {
    opacity: 1 !important;
    animation: none !important;
}

#top .familles-contacts .avia-icon-list>li {
    padding: 24px 24px 24px 84px;
    margin: 0 0 16px;
    background: var(--familles-surface);
    border: 1px solid var(--familles-border);
    border-radius: var(--component-radius-lg);
    opacity: 1 !important;
    transform: none !important;
}

#top #familles-content .familles-contacts .iconlist_icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin: 0 0 0 -60px;
    color: var(--component-color-text-invert) !important;
    background: var(--familles-accent) !important;
    border: 0;
    border-radius: 50%;
    opacity: 1 !important;
    animation: none !important;
    transform: none !important;
}

.familles-contacts .iconlist-timeline {
    display: none;
}

#top .familles-contacts .iconlist_content_wrap {
    margin-left: 0;
}

#top .familles-contacts .av_iconlist_title {
    color: var(--familles-heading);
    font-weight: 700;
}

#top .familles-contacts .iconlist_content {
    color: var(--familles-text);
}

.familles-contacts .iconlist_content p {
    margin: 0;
}

.familles-contacts .iconlist_content p+p {
    margin-top: 10px;
}

.familles-contacts .iconlist_content a {
    color: var(--familles-accent);
    font-weight: 700;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.familles-contacts .iconlist_content a:hover,
.familles-contacts .iconlist_content a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Nom de la personne, sous le titre de la carte */
#top #familles-content .familles-person {
    color: var(--familles-heading);
    font-weight: 700;
}

/* Lignes de coordonnées dans une carte */
.familles-contact-meta {
    display: grid;
    gap: 4px;
    margin-top: 12px !important;
    padding-top: 12px;
    border-top: 1px solid var(--familles-border);
}

.familles-contact-meta span {
    display: block;
}

/* Liens externes en boutons pleine largeur */

#top #familles-content .familles-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

/* WordPress peut envelopper les liens d’un paragraphe */
#top #familles-content .familles-links>p {
    display: contents;
}

.familles-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--familles-border);
    border-radius: var(--component-radius);
    background: var(--familles-background);
    color: var(--familles-heading);
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}

.familles-links a:hover,
.familles-links a:focus-visible {
    border-color: var(--familles-accent);
    color: var(--familles-accent);
}

/* Documents PDF : même bloc que les pages Règlements communaux et Construire */

#top #familles-content .familles-documents {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.familles-documents::before,
.familles-documents::after {
    display: none;
    content: none;
}

.familles-document {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--familles-border);
    border-radius: var(--component-radius);
    background: var(--familles-surface);
}

#top #familles-content .familles-document-title {
    margin: 0 0 14px;
    color: var(--familles-heading);
    font-weight: 700;
    line-height: 1.35;
}

/* Paragraphe ajouté par WordPress autour des liens PDF */
#top #familles-content .familles-document>p:not(.familles-document-title) {
    margin: 0;
}

.familles-document a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--familles-border);
    border-radius: var(--component-radius);
    background: var(--familles-background);
    color: var(--familles-heading);
    font-weight: 700;
    text-decoration: none;
}

.familles-document a+a {
    margin-top: 10px;
}

.familles-document a:hover,
.familles-document a:focus-visible {
    border-color: var(--familles-accent);
    color: var(--familles-accent);
}

.familles-file-type {
    flex: none;
    padding: 2px 8px;
    border-radius: var(--component-radius);
    background: var(--familles-accent);
    color: var(--component-color-text-invert);
    line-height: 1.4;
}

/* Colonne latérale : carte de contact (modèle Déchets et recyclage) */

#top #familles-content .familles-contact-card {
    padding: 24px 24px 28px;
    border: 1px solid var(--familles-border);
    border-radius: var(--component-radius-lg);
    background: var(--familles-surface);
}

#top #familles-content .familles-contact-card h2 {
    margin: 0 0 22px;
    color: var(--familles-heading);
}

#top #familles-content .familles-contact-card h3 {
    margin: 12px 0 0;
}

#top #familles-content .familles-contact-card p {
    margin: 0;
    color: var(--familles-text);
    line-height: 1.5;
}

#top #familles-content .familles-contact-card p+p {
    margin-top: 8px;
}

#top #familles-content .familles-contact-card hr {
    margin: 22px 0;
    border: 0;
    border-top: 1px solid var(--familles-border);
}

#top #familles-content .familles-contact-card strong {
    color: var(--familles-heading);
}

/* Les adresses e-mail longues doivent revenir à la ligne dans la carte */
#top #familles-content .familles-contact-card a[href^="mailto:"] {
    color: var(--familles-heading);
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#top #familles-content .familles-contact-phone {
    color: var(--familles-accent);
    font-weight: 700;
    text-decoration: none;
}

#top #familles-content .familles-contact-hours {
    color: var(--familles-heading);
}

#top #familles-content .familles-call-button {
    display: block;
    min-height: 44px;
    margin-top: 24px;
    padding: 11px 8px;
    border: 1px solid var(--familles-accent);
    border-radius: var(--component-radius);
    color: var(--familles-accent);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
}

#top #familles-content .familles-call-button:hover,
#top #familles-content .familles-call-button:focus-visible {
    background: var(--familles-accent);
    color: var(--component-color-text-invert);
}

.familles-related-title {
    margin: 28px 0 12px;
}

.familles-related-links {
    border-top: 1px solid var(--familles-border);
}

.familles-related-links ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.familles-related-links li {
    margin: 0;
    border-bottom: 1px solid var(--familles-border);
}

.familles-related-links li::before {
    display: none;
    content: none;
}

.familles-related-links a {
    display: block;
    padding: 14px 0;
    color: var(--familles-text);
    line-height: 1.35;
    text-decoration: none;
}

.familles-related-links a:hover,
.familles-related-links a:focus-visible {
    color: var(--familles-accent);
}

/* Responsive */

@media only screen and (max-width: 989px) {
    #familles-content .entry-content-wrapper {
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
    }

    /* Carte de contact et liens côte à côte sur tablette */
    .familles-sidebar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto 1fr;
        align-items: start;
        gap: 0 24px;
    }

    /* La classe Avia d’un bloc texte est posée sur l’élément intérieur :
       carte à gauche, titre et liens à droite */
    .familles-sidebar>.av_textblock_section:first-child {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .familles-sidebar>.familles-related-title {
        grid-column: 2;
        grid-row: 1;
        margin-top: 0;
    }

    .familles-sidebar>.av_textblock_section:last-child {
        grid-column: 2;
        grid-row: 2;
    }

    #top #familles-content .familles-links {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media only screen and (max-width: 767px) {
    #familles-content>.container {
        width: calc(100% - 36px);
        max-width: calc(100% - 36px);
    }

    #familles-content .template-page.content {
        padding-top: 36px;
        padding-bottom: 32px;
    }

    #familles-content .entry-content-wrapper {
        gap: 36px;
    }

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

    .familles-sidebar>* {
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .familles-sidebar .familles-related-title {
        margin-top: 28px;
    }

    .familles-document {
        padding: 20px;
    }

    /* Le badge PDF passe sous le libellé si la place manque */
    .familles-document a {
        align-items: flex-start;
    }

    .familles-facts-row {
        flex-direction: column;
        gap: 6px;
    }

    #top .familles-facts dd {
        text-align: left;
    }

    #top .familles-contacts .avia-icon-list>li {
        padding: 22px 20px;
    }

    #top #familles-content .familles-contacts .iconlist_icon {
        position: static;
        margin: 0 0 16px;
    }
}
