/* =====================================================================
   communes-environs.css
   Styles pour les pages "Communes et lieux-dits des environs"
   À intégrer dans le fichier de styles principal du thème gommecourt
   ou via @import dans le SCSS du thème.
   ===================================================================== */

/* ----- Wrapper blanc qui matérialise la zone de contenu ----- */
.communes-wrapper {
    max-width: 1100px;
    margin: 1.5rem auto 3rem;
    padding: 2.5rem 3rem;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

@media (max-width: 720px) {
    .communes-wrapper {
        margin: 1rem 0.75rem 2rem;
        padding: 1.5rem 1.25rem;
    }
}

/* ----- En-tête de page ----- */
.communes-header,
.communes-index-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #d6cfc1;
}

.communes-header h1,
.communes-index-header h1 {
    margin-bottom: 0.5rem;
    font-family: Georgia, "Times New Roman", serif;
    color: #2a3b54;
}

.communes-header .chapeau,
.communes-index-header .chapeau {
    font-size: 1.05rem;
    font-style: italic;
    color: #555;
    line-height: 1.55;
}

/* =====================================================================
   PAGE INDEX (parent)
   ===================================================================== */

.communes-index__intro {
    margin: 2rem 0;
    line-height: 1.65;
}

.communes-index__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0;
}

.communes-index__tab {
    display: block;
    padding: 1.25rem 1.5rem;
    background: #faf7f1;
    border: 1px solid #d6cfc1;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease,
                border-color 0.15s ease;
}

.communes-index__tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(42, 59, 84, 0.12);
    border-color: #2a3b54;
}

.communes-index__tab-letters {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 2rem;
    font-weight: bold;
    color: #2a3b54;
    letter-spacing: 0.05em;
}

.communes-index__tab-count {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.communes-index__tab-preview {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.92rem;
    color: #444;
    line-height: 1.45;
}

.communes-index__tab-preview li {
    padding: 0.15rem 0;
}

.communes-index__tab-more {
    color: #888;
    font-style: italic;
}

.communes-index__total {
    margin-top: 2rem;
    text-align: center;
    font-size: 1rem;
    color: #555;
}

/* =====================================================================
   SOUS-PAGE (un onglet)
   ===================================================================== */

/* ----- Barre de navigation alphabétique ----- */
.communes-nav {
    margin: 1.5rem -1rem 2.5rem;
    padding: 1rem 1.25rem;
    background: #f4ede0;
    border-radius: 6px;
    position: sticky;
    top: 1rem;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.communes-nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
    justify-content: center;
}

.communes-nav__item a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: #fff;
    border: 1px solid #d6cfc1;
    border-radius: 4px;
    text-decoration: none;
    color: #2a3b54;
    font-family: Georgia, serif;
    font-size: 0.95rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.communes-nav__item a:hover {
    background: #2a3b54;
    color: #fff;
    border-color: #2a3b54;
}

.communes-nav__item.is-current a {
    background: #2a3b54;
    color: #fff;
    border-color: #2a3b54;
    font-weight: bold;
}

.communes-nav__count {
    display: inline-block;
    min-width: 1.5em;
    padding: 0 0.35em;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 0.78rem;
    text-align: center;
}

.communes-nav__item.is-current .communes-nav__count {
    background: rgba(255, 255, 255, 0.25);
}

.communes-nav__back {
    margin: 0;
    text-align: center;
    font-size: 0.88rem;
}

.communes-nav__back a {
    color: #666;
    text-decoration: none;
}

.communes-nav__back a:hover {
    color: #2a3b54;
    text-decoration: underline;
}

/* ----- Sommaire de la page ----- */
.communes-toc {
    margin: 0 0 2.5rem;
    padding: 1.25rem 1.5rem;
    background: #faf7f1;
    border-left: 4px solid #2a3b54;
    border-radius: 0 4px 4px 0;
}

.communes-toc__title {
    margin: 0 0 0.75rem;
    font-family: Georgia, serif;
    font-size: 1.1rem;
    color: #2a3b54;
}

.communes-toc__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem 1.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.communes-toc__list a {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #2a3b54;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.2rem 0;
    transition: color 0.15s;
}

.communes-toc__list a:hover {
    color: #1a2a3e;
}

.communes-toc__list a:hover .communes-toc__name {
    text-decoration: underline;
}

.communes-toc__blason {
    flex-shrink: 0;
    width: 18px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.communes-toc__blason img,
.communes-toc__blason svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.communes-toc__name {
    line-height: 1.3;
}

.communes-toc__type {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

.communes-intro {
    margin: 2rem 0;
    line-height: 1.65;
}

/* ----- Notice individuelle ----- */
.communes-list {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.commune-notice {
    scroll-margin-top: 6rem;  /* compense la nav sticky */
    padding-bottom: 2rem;
    border-bottom: 1px solid #e6e0d2;
}

.commune-notice:last-child {
    border-bottom: none;
}

.commune-notice__header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1rem;
}

.commune-notice__blason {
    width: 70px;
    flex-shrink: 0;
}

.commune-notice__blason img,
.commune-notice__blason-placeholder {
    width: 100%;
    height: auto;
    max-height: 80px;
    display: block;
}

.commune-notice__blason img {
    /* Petite ombre douce pour les blasons couleur */
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.commune-notice__title-wrap {
    align-self: center;
}

.commune-notice__nom {
    font-family: Georgia, serif;
    font-size: 1.75rem;
    color: #2a3b54;
    margin: 0;
    line-height: 1.2;
}

.commune-notice__blason-desc {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    color: #777;
    line-height: 1.4;
}

@media (max-width: 720px) {
    .commune-notice__header {
        grid-template-columns: auto 1fr;
        gap: 0.85rem;
    }
    .commune-notice__blason {
        width: 55px;
    }
    .commune-notice__nom {
        font-size: 1.4rem;
    }
    .commune-notice__anchor {
        grid-column: 2;
        justify-self: end;
    }
}

.commune-notice__type {
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: #e6e0d2;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #555;
    vertical-align: middle;
}

.commune-notice__anchor {
    color: #b5ad9a;
    text-decoration: none;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.commune-notice:hover .commune-notice__anchor {
    opacity: 1;
}

.commune-notice__anchor:hover {
    color: #2a3b54;
}

.commune-notice__body {
    display: grid;
    grid-template-columns: minmax(220px, 35%) 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 720px) {
    .commune-notice__body {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

.commune-notice__media {
    margin: 0;
}

.commune-notice__media img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

.commune-notice__media figcaption {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.commune-notice__credit {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: #999;
}

.commune-notice__credit a {
    color: #999;
}

.commune-notice__identite {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1rem;
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    background: #faf7f1;
    border-radius: 4px;
    font-size: 0.92rem;
}

.commune-notice__identite dt {
    font-weight: bold;
    color: #555;
}

.commune-notice__identite dd {
    margin: 0;
    color: #333;
}

.commune-notice__texte {
    line-height: 1.65;
    color: #2a2a2a;
}

.commune-notice__texte p:first-child {
    margin-top: 0;
}

.commune-notice__texte p:last-child {
    margin-bottom: 0;
}

.commune-notice__liens {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed #d6cfc1;
}

.commune-notice__liens h3 {
    margin: 0 0 0.5rem;
    font-family: Georgia, serif;
    font-size: 1rem;
    color: #2a3b54;
}

.commune-notice__liens ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.commune-notice__liens li {
    padding: 0.2rem 0;
}

.commune-notice__liens a {
    color: #2a3b54;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.commune-notice__mention {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

.commune-notice__back-to-top {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #888;
    text-decoration: none;
}

.commune-notice__back-to-top:hover {
    color: #2a3b54;
    text-decoration: underline;
}

/* ----- Pied de page : navigation entre onglets ----- */
.communes-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #d6cfc1;
}

.communes-footer__nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.communes-footer__nav a {
    padding: 0.6rem 1rem;
    background: #faf7f1;
    border: 1px solid #d6cfc1;
    border-radius: 4px;
    color: #2a3b54;
    text-decoration: none;
    font-family: Georgia, serif;
    transition: background 0.15s, color 0.15s;
}

.communes-footer__nav a:hover {
    background: #2a3b54;
    color: #fff;
    border-color: #2a3b54;
}

.communes-footer__index {
    font-style: italic;
}

.communes-empty {
    margin: 3rem 0;
    text-align: center;
    color: #888;
}
