/* ==========================================================================
   ACCUEIL — Commune de Nguidilé
   ========================================================================== */
.mt { margin-top: 36px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }

/* ---------- Couverture ---------- */
.cover {
    position: relative; overflow: hidden; color: #fff;
    background: var(--night);
    height: 100vh; height: 100svh; min-height: 700px; max-height: 960px;
    padding-top: var(--header-h);
    display: flex; flex-direction: column;
}
.hs-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .9s var(--ease), visibility 0s .9s; }
.hs-slide.is-active { opacity: 1; visibility: visible; transition: opacity .9s var(--ease), visibility 0s; z-index: 1; }

.photo { position: absolute; top: 0; bottom: 0; right: 0; width: 62%; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, var(--night) 0%, rgba(15,18,21,.78) 22%, rgba(15,18,21,.2) 60%, rgba(15,18,21,.05) 100%),
                linear-gradient(0deg, rgba(15,18,21,.88) 0%, transparent 40%);
}
.photo.full { width: 100%; }
.photo.full::after { background: linear-gradient(90deg, rgba(15,18,21,.96) 0%, rgba(15,18,21,.85) 40%, rgba(15,18,21,.55) 100%); }
.hs-slide.is-active .photo img { animation: kenburns 16s ease-out both; }
@keyframes kenburns { from { transform: scale(1.1); } to { transform: scale(1); } }

.cover-in {
    position: relative; z-index: 2; height: 100%;
    display: flex; flex-direction: column; justify-content: center;
    padding-top: calc(var(--header-h) + 30px); padding-bottom: 250px;
}
.cover-in > * { max-width: 720px; }
.hs-slide.is-active .cover-in > * { animation: rise .9s var(--ease) both; }
.hs-slide.is-active .cover-in > *:nth-child(2) { animation-delay: .1s; }
.hs-slide.is-active .cover-in > *:nth-child(3) { animation-delay: .2s; }
.hs-slide.is-active .cover-in > *:nth-child(4) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

.mega {
    margin-top: 0 !important;
    font: 900 italic clamp(40px, 5.6vw, 76px)/.98 var(--f-disp);
    text-transform: uppercase; letter-spacing: -.03em; color: #fff; margin-top: 20px;
}
.mega .hl { color: var(--yellow); }
.cover-t {
    font: 800 clamp(26px, 3vw, 40px)/1.15 var(--f-disp); letter-spacing: -.02em; color: #fff; margin-top: 0;
    display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cover .lede { margin-top: 18px; max-width: 600px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cover-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }

.cover-kpi {
    position: absolute; z-index: 3; left: 0; right: 0; bottom: 92px;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.cover-nav {
    position: absolute; z-index: 3; left: 0; right: 0; bottom: 30px;
    display: flex; align-items: center; gap: 18px; color: #B4BCC4;
}
.hs-count { font: 800 16px var(--f-disp); white-space: nowrap; }
.hs-count b { color: var(--yellow); }
.hs-dots { display: flex; gap: 4px; flex: 1; max-width: 360px; }
.hs-dots button { flex: 1; height: 20px; padding: 8px 0; border: 0; background: none; cursor: pointer; }
.hs-dots button span { display: block; height: 4px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; position: relative; }
.hs-dots button span::after { content: ''; position: absolute; inset: 0; background: var(--yellow); transform: scaleX(0); transform-origin: left; }
.hs-dots button.is-active.run span::after { animation: prog var(--hs-delay, 7000ms) linear forwards; }
@keyframes prog { to { transform: scaleX(1); } }
.cover-nav button.hs-prev, .cover-nav button.hs-next {
    width: 42px; height: 42px; border-radius: 6px; border: 1px solid rgba(255,255,255,.22);
    background: rgba(15,18,21,.6); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background .2s, color .2s;
}
.cover-nav button.hs-prev:hover, .cover-nav button.hs-next:hover { background: var(--yellow); color: var(--navy); border-color: var(--yellow); }

/* ---------- Cartes à photo (comme « Trois parties ») ---------- */
.pcard {
    display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: inherit;
    background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.pcard:hover { transform: translateY(-4px); box-shadow: 0 2px 0 rgba(22,26,30,.03), 0 26px 46px -26px rgba(22,26,30,.5); }
.pcard-img { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--sky); }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.pcard:hover .pcard-img img { transform: scale(1.04); }
.pcard-img .tag { position: absolute; left: 16px; top: 16px; }
.pcard-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard-body h3 { font: 700 17.5px/1.35 var(--f-disp); color: var(--navy); letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-body p { color: var(--mut); font-size: 15px; line-height: 1.6; flex: 1; }
.pcard-body .link { margin-top: 6px; }
.pcard:hover h3 { color: var(--blue); }

/* ---------- Mot du maire ---------- */
.mayor { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.mayor-photo { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 4 / 5; background: var(--sky); }
.mayor-photo img { width: 100%; height: 100%; object-fit: cover; }
.mayor-photo figcaption {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 22px;
    background: linear-gradient(0deg, rgba(15,18,21,.92), rgba(15,18,21,.0)); color: #fff;
}
.mayor-photo figcaption b { display: block; font: 800 19px var(--f-disp); }
.mayor-photo figcaption span { font-size: 13.5px; color: #D9DEE3; }
.mayor-text { margin-top: 22px; color: var(--mut); font-size: 16px; line-height: 1.75; }
.mayor-text p + p { margin-top: 12px; }

/* ---------- Thèmes (cartes à icône + filigrane) ---------- */
.tcard { text-align: left; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 4px; transition: border-color .2s, transform .3s var(--ease); }
.tcard:hover { border-color: var(--blue); transform: translateY(-3px); }
.tcard .ib { margin-bottom: 14px; }
.tcard p { flex: 1; }
.tcard .link { margin-top: 14px; }

/* Fenêtres modales */
.modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(8,10,12,.7); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s .2s; }
.modal.on { opacity: 1; visibility: visible; transition: opacity .2s, visibility 0s; }
.modal-box { width: 100%; max-width: 620px; max-height: 86vh; overflow: auto; background: #fff; border-radius: 10px; border-top: 6px solid var(--blue); padding: 26px 28px; transform: translateY(14px); transition: transform .3s var(--ease); }
.modal.on .modal-box { transform: none; }
.modal-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.modal-head h3 { font: 800 20px var(--f-disp); color: var(--navy); flex: 1; }
.modal-x { width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--navy); }
.modal-list { list-style: none; }
.modal-list li { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid #EEF0F2; }
.modal-list li .i { color: var(--green); margin-top: 2px; }
.modal-list b { display: block; color: var(--navy); font-weight: 600; }
.modal-list span { color: var(--mut); font-size: 14.5px; }
.modal-foot { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 20px; }

/* ---------- Domaines (section sombre sur photo) ---------- */
.domains { overflow: hidden; }
.domains .photo.full img { filter: saturate(.85); }
.dcard .ib { margin-bottom: 16px; }
.dcard h3 { font-size: 19px; }
.dcard p { font-size: 14.5px; }

/* ---------- Médiathèque ---------- */
.gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 240px 240px; gap: 16px; }
.g-item { position: relative; overflow: hidden; border-radius: 10px; background: var(--sky); text-decoration: none; }
.g-item:first-child { grid-row: span 2; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.g-item:hover img { transform: scale(1.04); }
.g-cap { position: absolute; inset: auto 0 0 0; padding: 40px 18px 16px; color: #fff; background: linear-gradient(0deg, rgba(15,18,21,.92), transparent); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.g-cap .chip { background: rgba(255,255,255,.16); color: #fff; height: 28px; font-size: 12.5px; }
.g-cap b { font: 700 15.5px/1.35 var(--f-disp); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.g-item:first-child .g-cap b { font-size: 21px; }

/* ---------- Agenda + contact ---------- */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 64px); }
.agenda { display: grid; gap: 12px; }
.ag { display: flex; gap: 18px; align-items: center; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: inherit; transition: border-color .2s; }
.ag:hover { border-color: var(--blue); }
.ag-d { width: 72px; height: 72px; flex: none; border-radius: 8px; background: var(--navy); color: #B4BCC4; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 600 12.5px var(--f-body); text-transform: uppercase; letter-spacing: .06em; }
.ag-d b { font: 800 28px/1 var(--f-disp); color: #fff; letter-spacing: 0; }
.ag-b { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ag-b b { font: 700 16.5px/1.3 var(--f-disp); color: var(--navy); }
.ag-b small { color: var(--mut2); font-size: 13.5px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ag-b small .i { width: 15px; height: 15px; }
.contact { display: grid; gap: 12px; }
.ct { display: flex; gap: 16px; align-items: center; text-decoration: none; padding: 16px 20px; }
.ct b { display: block; font: 700 16px var(--f-disp); color: var(--navy); word-break: break-word; }
.ct .ib { width: 48px; height: 48px; }
.ct .ib .i { width: 24px; height: 24px; }
a.ct:hover { border-color: var(--blue); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .grid4 { grid-template-columns: repeat(2, 1fr); }
    .cover-kpi { grid-template-columns: repeat(4, 1fr); gap: 10px; }
}
@media (max-width: 900px) {
    .grid3, .two, .mayor { grid-template-columns: 1fr; }
    .mayor-photo { max-width: 420px; }
    .photo { width: 100%; }
    .photo::after { background: linear-gradient(0deg, var(--night) 8%, rgba(15,18,21,.75) 55%, rgba(15,18,21,.45) 100%); }
    .gallery { grid-template-columns: 1fr 1fr; grid-template-rows: 200px 160px 160px; }
    .g-item:first-child { grid-column: span 2; grid-row: auto; }
}
@media (max-width: 640px) {
    .grid4 { grid-template-columns: 1fr; }
    .cover-in { padding-bottom: 330px; }
    .cover-kpi { grid-template-columns: 1fr 1fr; bottom: 86px; }
    .cover-kpi .box { padding: 14px 10px 12px; }
    .hs-dots { max-width: none; }
    .cover-nav .hs-prev, .cover-nav .hs-next { display: none !important; }
    .gallery { grid-template-columns: 1fr; grid-template-rows: none; }
    .g-item { height: 200px; }
    .g-item:first-child { grid-column: auto; height: 240px; }
}

/* Cadrage des photos : point focal dans le tiers supérieur (visages) */
.photo img { object-position: 50% 30%; }
.cover { max-height: 880px; min-height: 640px; }
.pcard-img { aspect-ratio: 3 / 2; }
.pcard-img img { object-position: 50% 28%; }
.g-item img, .mayor-photo img { object-position: 50% 25%; }
@media (max-width: 900px) {
    .photo img { object-position: 50% 25%; }
}

/* ==========================================================================
   ÉCHELLE DES TAILLES — accueil
   ========================================================================== */
.cover { max-height: 840px; min-height: 620px; }
.mega { font-size: clamp(34px, 4.6vw, 62px); line-height: 1; }
.cover-t {
    font-size: clamp(21px, 2.2vw, 31px); line-height: 1.22; max-width: 640px;
    -webkit-line-clamp: 4; line-clamp: 4;
}
.cover .lede { -webkit-line-clamp: 2; font-size: clamp(14.5px, 1.15vw, 16px); max-width: 560px; }
.cover-in { padding-bottom: 210px; }
.cover-in > * { max-width: 640px; }
.cover-actions { margin-top: 24px; }
.cover-kpi { bottom: 84px; gap: 12px; }
.cover-kpi .box { padding: 14px 12px 12px; }
.cover-nav { bottom: 26px; }

.mt { margin-top: 28px; }
.grid3, .grid4 { gap: 18px; }
.pcard-body { padding: 16px 18px 20px; gap: 6px; }
.pcard-body h3 { font-size: 16px; line-height: 1.38; }
.pcard-body p { font-size: 14px; }
.pcard-img .tag { left: 12px; top: 12px; }
.mayor-text { font-size: 15px; }
.callout { font-size: clamp(17px, 1.6vw, 21px); }
.callout::before { font-size: 56px; }
.dcard h3 { font-size: 16.5px; }
.dcard p, .tcard p { font-size: 14px; }
.gallery { grid-template-rows: 210px 210px; gap: 14px; }
.g-item:first-child .g-cap b { font-size: 18px; }
.g-cap b { font-size: 14.5px; }
.ag-d { width: 64px; height: 64px; }
.ag-d b { font-size: 24px; }
.ag-b b { font-size: 15.5px; }
.ct b { font-size: 15px; }
.modal-head h3 { font-size: 19px; }

@media (max-width: 640px) {
    .cover { min-height: 640px; }
    .cover-in { padding-bottom: 290px; }
    .cover-t { -webkit-line-clamp: 4; font-size: 21px; }
    .mega { font-size: 36px; }
    .cover-kpi { bottom: 74px; gap: 8px; }
    .cover-kpi .box .n { font-size: 22px; }
}
.hs-dots { max-width: min(360px, calc(100% - 150px)); }

/* Illustrations des cartes « Services en ligne » (fidèles au service présenté) */
.pcard-img.ill {
    display: flex; align-items: flex-end; justify-content: center; padding: 22px 22px 0;
    background: linear-gradient(#E6E9EC 1px, transparent 1px) 0 0 / 100% 24px, #F1F3F5;
}
.ill-win {
    width: 100%; max-width: 330px; height: 100%; background: #fff; border: 1px solid var(--line); border-bottom: 0;
    border-radius: 8px 8px 0 0; padding: 0 14px 14px; box-shadow: 0 -2px 0 rgba(0,0,0,.01), 0 18px 34px -22px rgba(20,24,28,.4);
    display: flex; flex-direction: column; gap: 8px; font-size: 11px; color: var(--mut); overflow: hidden;
    transition: transform .4s var(--ease);
}
.pcard:hover .ill-win { transform: translateY(-4px); }
.ill-bar { display: flex; align-items: center; gap: 5px; margin: 0 -14px 4px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #FAFBFC; border-radius: 8px 8px 0 0; }
.ill-bar i { width: 7px; height: 7px; border-radius: 50%; background: #D5DADF; }
.ill-bar span { margin-left: 6px; font: 600 10.5px var(--f-body); color: var(--navy); }
.ill-f small { display: block; font-size: 9.5px; font-weight: 600; color: var(--mut2); margin-bottom: 3px; }
.ill-in { height: 26px; border: 1px solid var(--line); border-radius: 4px; padding: 0 8px; display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 11px; background: #fff; }
.ill-in.sel { justify-content: space-between; }
.ill-in.sel::after { content: ''; width: 6px; height: 6px; border-right: 1.5px solid var(--mut2); border-bottom: 1.5px solid var(--mut2); transform: rotate(45deg) translateY(-2px); }
.ill-in.ref { font: 600 11px 'Courier New', monospace; letter-spacing: .04em; border-color: var(--blue); }
.ill-in .i { width: 13px; height: 13px; color: var(--blue); }
.ill-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ill-btn { margin-top: 2px; height: 28px; border-radius: 4px; background: var(--blue); color: #fff; font: 600 11px var(--f-body); display: grid; place-items: center; }
.ill-steps { list-style: none; display: grid; gap: 7px; margin-top: 2px; }
.ill-steps li { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 500; }
.ill-steps b { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); flex: none; }
.ill-steps b .i { width: 11px; height: 11px; stroke-width: 3; }
.ill-steps .ok b { background: var(--blue); border-color: var(--blue); color: #fff; }
.ill-steps .cur b { border-color: var(--blue); box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 6px var(--blue); }
.ill-steps .cur { color: var(--blue); font-weight: 600; }
.ill-list { list-style: none; display: grid; gap: 6px; }
.ill-list li { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; }
.ill-list .ib { width: 26px; height: 26px; border-radius: 4px; color: var(--blue); }
.ill-list .ib .i { width: 14px; height: 14px; }
.ill-list b { display: block; font: 600 11px var(--f-body); color: var(--ink); }
.ill-list small { font-size: 9.5px; color: var(--mut2); }
