/**
 * Communes — Habari Theme
 * Chargé conditionnellement sur :
 *   - is_singular('communes')
 *   - is_post_type_archive('communes')
 *   - is_page_template('template-communes.php')
 */

/* ============================================================
   CARDS — Archive & liste
   ============================================================ */

.commune-archive-grid {
    display: grid;
    gap: 1.5rem;
}

.commune-archive-grid > div {
    display: flex;
}

.commune-archive-grid > div > article {
    flex: 1;
    min-width: 0;
}

.commune-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background-color: var(--habari-info-light);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-top: 0.75rem;
}

.commune-badge--cagnm  { background-color: #114929; }
.commune-badge--cadema { background-color: #FF9100; }
.commune-badge--3co    { background-color: #0268A5; }
.commune-badge--petite-terre { background-color: #f1c40f; color: #333; }
.commune-badge--ccsud  { background-color: #10A1BC; }

.commune-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.commune-card .uk-card-media-top img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    display: block;
}

.commune-card .uk-card-body {
    padding: 1.25rem;
}

.commune-card .uk-card-title a {
    color: var(--habari-secondary-navy);
    text-decoration: none;
    transition: color 0.2s ease;
}

.commune-card .uk-card-title a:hover {
    color: var(--habari-primary-brand);
    text-decoration: none;
}

.commune-card .commune-excerpt {
    color: var(--habari-dark-pale);
    min-height: 4.5rem;
    margin-bottom: 0;
}

/* ============================================================
   SINGLE — En-tête avant le hero (breadcrumb + titre)
   ============================================================ */


/* Mobile : sidebar (info-card) affichée avant le contenu principal */
.commune-single-sidebar { order: -1; }
@media (min-width: 960px) {
    .commune-single-sidebar { order: 0; }
}

.commune-single-title {
    font-family: var(--habari-font-heading);
    font-size: 2rem;
    line-height: 1.2;
    color: var(--habari-secondary-navy);
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* ============================================================
   SINGLE — Hero image
   ============================================================ */

.commune-hero {
    width: 100%;
    max-height: 380px;
    overflow: hidden;
}

.commune-hero img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    display: block;
}

/* ============================================================
   SINGLE — Onglets (override UIKit uk-tab)
   ============================================================ */

.commune-tabs-nav.uk-tab {
    display: flex;
    align-items: baseline;
    gap: 0;
    border-bottom: none;
    margin-left: 0;
    margin-bottom: 0.5rem;
    padding: 0;
    flex-wrap: nowrap;
}

.commune-tabs-nav.uk-tab::before {
    display: none; /* supprime la bordure UIKit */
}

.commune-tabs-nav.uk-tab > li {
    display: flex;
    align-items: center;
    padding: 0;
}

/* Séparateur pipe entre onglets */
.commune-tabs-nav.uk-tab > li + li::before {
    content: '|';
    color: var(--habari-dark-pale);
    font-size: 1.35rem;
    line-height: 1;
    padding: 0 0.75rem;
    pointer-events: none;
}

.commune-tabs-nav.uk-tab > li > a {
    font-family: var(--habari-font-heading);
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--habari-secondary-navy);
    text-transform: none;
    text-decoration: none;
    padding: 0;
    border: none;
    background: none;
    transition: color 0.2s ease;
    line-height: 1.2;
}

/* Retrait du soulignement actif UIKit */
.commune-tabs-nav.uk-tab > li > a::after,
.commune-tabs-nav.uk-tab > .uk-active > a::after {
    display: none;
}

.commune-tabs-nav.uk-tab > .uk-active > a {
    color: var(--habari-primary-brand);
    border: none;
    font-weight: 400;
}

.commune-tabs-nav.uk-tab > li > a:hover {
    color: var(--habari-primary-brand);
}

/* ============================================================
   SINGLE — Contenu des onglets
   ============================================================ */

/* Reset UIKit switcher qui ajoute un padding-left natif sur <ul> */
.commune-tabs-content {
    padding: 0 !important;
    margin: 0 !important;
    list-style: none;
}

.commune-tabs-content > li {
    padding: 0;
    margin: 0;
}

.commune-tab-panel-content {
    border: 1px solid var(--habari-dark-off);
    padding: 1.5rem;
    min-height: 200px;
}

/* ============================================================
   SINGLE — Galerie (dans onglet)
   ============================================================ */

.commune-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.commune-gallery-item {
    display: block;
    overflow: hidden;
    background: var(--habari-secondary-navy-off);
    aspect-ratio: 1 / 1;
}

.commune-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================
   SINGLE — Onglet Carte (Leaflet)
   ============================================================ */

.commune-map-tab-panel {
    border: 1px solid var(--habari-dark-off);
    overflow: hidden;
}

.commune-map-container {
    height: 400px;
    width: 100%;
    display: block;
}

/* ============================================================
   SINGLE — Carte infos officielles (sidebar)
   ============================================================ */

.commune-info-card-title {
    font-family: var(--habari-font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--habari-secondary-navy);
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--habari-primary-brand);
}

.commune-info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
    padding: 0;
}

.commune-info-list dt {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--habari-dark-pale);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    align-self: start;
    padding-top: 2px;
}

.commune-info-list dd {
    margin: 0;
    color: var(--habari-dark-shark);
    font-size: 0.9rem;
    font-weight: 500;
}

.commune-info-since {
    display: block;
    font-size: 0.75rem;
    color: var(--habari-dark-pale);
    font-weight: 400;
}

.commune-info-mayor-notes {
    display: block;
    font-size: 0.75rem;
    color: var(--habari-dark-pale);
    font-style: italic;
    margin-top: 0.2rem;
}

/* ============================================================
   SINGLE — Blason
   ============================================================ */

.commune-blason img {
    border-radius: 0;
    max-width: 120px;
    height: auto;
}

/* ============================================================
   SINGLE — Articles liés (section, hors onglets)
   ============================================================ */

.commune-related-section {
    background: var(--habari-secondary-navy-off);
    padding: 3rem 0;
}

.commune-related-title {
    font-family: var(--habari-font-heading);
    font-size: 1.5rem;
    color: var(--habari-dark-shark);
    margin-bottom: 1.75rem;
    margin-top: 0;
}

/* ============================================================
   SINGLE — Timeline historique des maires
   ============================================================ */

.commune-timeline {
    position: relative;
    padding-left: 1.25rem;
}

/* Ligne verticale */
.commune-timeline::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--habari-dark-off);
}

.commune-timeline-item {
    display: flex;
    gap: 1.25rem;
    position: relative;
    padding-bottom: 2rem;
}

.commune-timeline-item:last-child {
    padding-bottom: 0;
}

/* Point sur la ligne */
.commune-timeline-marker {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border: 2px solid var(--habari-secondary-navy);
    background: #fff;
    margin-top: 7px;
    position: relative;
    left: -1.34rem;
    margin-right: -10px;
}

.commune-timeline-body {
    flex: 1;
    padding-bottom: 0.25rem;
}

/* Période (début — fin) : texte coloré + tirets */
.commune-timeline-period {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--habari-font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--habari-secondary-navy);
    margin: 0 0 0.3rem;
    /* line-height: 1; */
}

/* Nom du maire */
.commune-timeline-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--habari-dark-shark);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.45rem;
}

/* Description libre */
.commune-timeline-notes {
    font-size: 0.875rem;
    color: var(--habari-dark-light);
    line-height: 1.6;
    margin: 0;
}

/* Maire actuel — item "en cours" en tête de timeline */
.commune-timeline-item--current .commune-timeline-marker {
    background: var(--habari-primary-brand);
    border-color: var(--habari-primary-brand);
}

.commune-timeline-item--current .commune-timeline-period {
    color: var(--habari-primary-brand);
}

.commune-badge--encours {
    display: inline-block;
    padding: 0.25em 0.50em;
    background: var(--habari-primary-brand);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* vertical-align: middle; */
}

