/* ==========================================================================
   Mairie de Boufflers — design system (mobile d'abord)
   Mobile : base. Tablette : ≥ 768px. Bureau : ≥ 1024px.
   ========================================================================== */

:root {
    --bg: #F6F4EE;
    --surface: #FFFFFF;
    --surface-2: #EEEBE2;
    --ink: #17211D;
    --ink-2: #4B5752;
    --line: rgba(23, 33, 29, 0.10);
    --brand: #2F5D50;
    --brand-strong: #224A3F;
    --brand-soft: #E2ECE7;
    --on-brand: #FFFFFF;
    --accent: #9E4F1B;
    --open: #1E7A4C;
    --closed: #B3261E;
    --focus: #C26A2C;

    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;

    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 26px;
    --shadow-sm: 0 1px 2px rgba(23, 33, 29, 0.06), 0 1px 1px rgba(23, 33, 29, 0.04);
    --shadow: 0 12px 32px -12px rgba(23, 33, 29, 0.18), 0 2px 6px rgba(23, 33, 29, 0.05);
    --shadow-lg: 0 30px 60px -20px rgba(23, 33, 29, 0.35);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

    --header-h: 60px;
    --tabbar-h: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0E1412;
        --surface: #161F1C;
        --surface-2: #1C2724;
        --ink: #E9EFEC;
        --ink-2: #A8B6B0;
        --line: rgba(233, 239, 236, 0.11);
        --brand: #86C7B1;
        --brand-strong: #A5DAC7;
        --brand-soft: #1E322C;
        --on-brand: #0E1412;
        --accent: #F0A46E;
        --open: #6FD39C;
        --closed: #FF8A80;
        --focus: #F0A46E;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
    }
}

@media (min-width: 768px) {
    :root { --header-h: 68px; --tabbar-h: 0px; --gutter: 32px; }
}
@media (min-width: 1024px) {
    body { font-size: 1rem; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 12px);
    scroll-padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
html:has(dialog[open]) { overflow: hidden; }

body {
    margin: 0;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

img, video, svg, iframe { display: block; max-width: 100%; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
main:focus { outline: none; }

.icon { width: 1.25em; height: 1.25em; flex-shrink: 0; }

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: fixed;
    top: 8px; left: 8px;
    z-index: 100;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
    text-decoration: none;
    clip-path: inset(50%);
}
.skip-link:focus { clip-path: none; }

.container {
    width: 100%;
    max-width: calc(1180px + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px));
}

.muted { color: var(--ink-2); }

/* ---------- Typo ---------- */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: .875rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 20px; height: 2px; border-radius: 2px; background: currentColor; }
.eyebrow-light { color: #F6D2B4; }

.section-title {
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(1.875rem, 1.4rem + 1.6vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

.sub-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    font-size: .875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-2);
}

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 24px;
    border-radius: 999px;
    border: 1.5px solid transparent;
    background: none;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .2s var(--ease), background-color .2s, border-color .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: #FFFFFF; color: #17211D; box-shadow: var(--shadow); }
.btn-glass {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
    color: #FFFFFF;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.btn-solid { background: var(--brand); color: var(--on-brand); }
.btn-outline { border-color: color-mix(in srgb, var(--ink) 22%, transparent); color: var(--ink); }
@media (hover: hover) {
    .btn:hover { transform: translateY(-2px); }
    .btn-glass:hover { background: rgba(255, 255, 255, 0.22); }
    .btn-solid:hover { background: var(--brand-strong); }
    .btn-outline:hover { border-color: var(--brand); color: var(--brand); }
}

.link-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
}
.link-more .icon { width: 1.1em; height: 1.1em; transition: transform .25s var(--ease); }
@media (hover: hover) {
    .link-more:hover { text-decoration: underline; text-underline-offset: 4px; }
    .link-more:hover .icon { transform: translateX(3px); }
}

/* Toute la carte devient la zone tactile du bouton. */
.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.stretched:focus-visible { outline: none; }
.stretched:focus-visible::after { outline: 3px solid var(--focus); outline-offset: 3px; }

/* ---------- En-tête ---------- */
.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 50;
    height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s, box-shadow .3s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 24px -18px rgba(0, 0, 0, .35); }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; }
.brand-mark { display: block; width: 30px; flex-shrink: 0; }
.blason { display: block; width: 100%; height: auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .18)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-serif); font-weight: 600; font-size: 1.25rem; letter-spacing: -.01em; }
.brand-sub { display: none; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }

.site-nav { display: none; }
.header-call {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
    font-size: .9375rem;
    text-decoration: none;
}
.header-call .icon { width: 18px; height: 18px; }

@media (min-width: 768px) {
    .brand-mark { width: 36px; }
    .brand-name { font-size: 1.35rem; }
    .brand-sub { display: block; }
    .header-call { display: none; }
    .site-nav { display: block; }
    .menu { display: flex; align-items: center; gap: 4px; }
    .menu a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 0 16px;
        border-radius: 999px;
        font-weight: 500;
        font-size: .975rem;
        text-decoration: none;
        color: var(--ink-2);
        transition: background-color .2s, color .2s;
    }
    .menu a:hover, .menu a[aria-current="true"] { color: var(--ink); background: var(--surface-2); }
    .menu a.menu-cta { margin-left: 8px; background: var(--brand); color: var(--on-brand); font-weight: 600; }
    .menu a.menu-cta:hover { background: var(--brand-strong); }
}

/* ---------- Barre d'onglets mobile ---------- */
.tabbar {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    padding-bottom: var(--safe-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.6) blur(18px);
    -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--line);
}
.tabbar ul { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: var(--tabbar-h); }
.tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    color: var(--ink-2);
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: -.01em;
    text-decoration: none;
}
.tabbar .icon {
    width: 56px;
    height: 30px;
    padding: 4px 16px;
    border-radius: 999px;
    stroke-width: 1.9;
    transition: background-color .25s var(--ease), color .25s;
}
.tabbar a[aria-current="true"] { color: var(--ink); }
.tabbar a[aria-current="true"] .icon { background: var(--brand-soft); color: var(--brand); }
.tabbar a:focus-visible { outline-offset: -4px; }
@media (min-width: 768px) { .tabbar { display: none; } }
@media (max-width: 359px) {
    .tabbar ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .tabbar li:first-child { display: none; } /* le blason ramène déjà en haut de page */
    .contact-actions .action { font-size: .9375rem; padding-inline: 4px; }
    .quick-item .quick-label { font-size: .875rem; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: min(68svh, 560px);
    padding: calc(var(--header-h) + 40px) 0 88px;
    overflow: hidden;
    isolation: isolate;
    color: #FFFFFF;
    background: linear-gradient(160deg, #2F5D50 0%, #1B3A31 60%, #12271F 100%);
}
.hero-poster, .hero-poster img, .hero-video {
    position: absolute;
    inset: 0;
    z-index: -3;
    width: 100%; height: 100%;
    object-fit: cover;
}
.hero-video { z-index: -2; opacity: 0; transition: opacity 1s ease; }
.hero-video.is-playing { opacity: 1; }
.hero-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(10, 20, 16, .55) 0%, rgba(10, 20, 16, .1) 35%, rgba(10, 20, 16, .82) 100%),
        linear-gradient(90deg, rgba(10, 20, 16, .5) 0%, transparent 75%);
}
.hero-blason { display: none; }
.hero-title {
    max-width: 14ch;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(2.5rem, 1.5rem + 4.2vw, 4.5rem);
    line-height: 1.02;
    letter-spacing: -0.015em;
    text-wrap: balance;
}
.hero-title em { font-style: italic; color: #F6D2B4; }
.hero-lead {
    max-width: 34ch;
    margin-top: 14px;
    font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem);
    line-height: 1.5;
    color: rgba(255, 255, 255, .92);
}
.hero-actions { display: none; }

.video-toggle {
    position: absolute;
    top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 12px);
    right: var(--gutter);
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(10, 20, 16, .35);
    color: #FFFFFF;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.video-toggle .icon { width: 18px; height: 18px; }
.video-toggle .icon-play, .video-toggle.is-paused .icon-pause { display: none; }
.video-toggle.is-paused .icon-play { display: block; }

@media (min-width: 768px) {
    /* Le hero + la barre d'infos (qui le chevauche de 64px) tiennent dans la fenêtre, même sur un portable 15". */
    .hero { min-height: clamp(440px, calc(100svh - 56px), 760px); padding-bottom: clamp(96px, 13vh, 140px); }
    .hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
    .video-toggle { top: auto; bottom: clamp(96px, 13vh, 140px); width: 48px; height: 48px; }
}
@media (min-width: 768px) and (max-height: 800px) {
    .hero-title { font-size: clamp(2.5rem, 1rem + 5vh, 3.75rem); }
    .hero-lead { margin-top: 10px; }
    .hero-actions { margin-top: 22px; }
}
@media (min-width: 1024px) {
    .hero-title { max-width: 22ch; }
    .hero-blason {
        display: block;
        position: absolute;
        z-index: -1;
        right: max(-40px, calc((100vw - 1180px) / 2 - 40px));
        top: 50%;
        width: clamp(280px, 28vw, 420px);
        opacity: .1;
        filter: grayscale(1) brightness(2.4);
        transform: translateY(-50%) rotate(-6deg);
        pointer-events: none;
    }
}

/* ---------- Statut + accès rapides ---------- */
.quick-wrap { position: relative; z-index: 2; margin-top: -56px; }
.quick {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.quick-status {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
}
.quick-status-text { flex: 1; min-width: 0; }
.quick-chevron { color: var(--ink-2); width: 20px; height: 20px; }
.status-dot {
    position: relative;
    width: 12px; height: 12px;
    margin-inline: 6px;
    border-radius: 999px;
    background: var(--ink-2);
    flex-shrink: 0;
}
[data-state="open"] .status-dot { background: var(--open); box-shadow: 0 0 0 4px color-mix(in srgb, var(--open) 22%, transparent); }
[data-state="soon"] .status-dot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
[data-state="closed"] .status-dot { background: var(--closed); }
@media (prefers-reduced-motion: no-preference) {
    [data-state="open"] .status-dot::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: inherit;
        background: var(--open);
        animation: pulse 2s ease-out infinite;
    }
}
@keyframes pulse { to { transform: scale(2.6); opacity: 0; } }

.quick-label { display: block; font-size: .875rem; color: var(--ink-2); line-height: 1.3; }
.quick-value { display: block; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
.quick-actions li + li { border-left: 1px solid var(--line); }
.quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    padding: 14px 6px 12px;
    text-decoration: none;
    text-align: center;
    transition: background-color .2s;
}
.quick-item:active { background: var(--surface-2); }
.quick-item:focus-visible { outline-offset: -4px; }
.quick-icon {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand);
    flex-shrink: 0;
}
.quick-item .quick-label { color: var(--ink); font-weight: 600; font-size: .9375rem; }
.quick-item .quick-value { display: none; }

@media (min-width: 768px) {
    .quick-wrap { margin-top: -64px; }
    .quick { display: grid; grid-template-columns: 1.15fr 3fr; }
    .quick-status { border-bottom: 0; border-right: 1px solid var(--line); padding: 20px 22px; }
    .quick-item { flex-direction: row; text-align: left; gap: 14px; padding: 20px; }
    .quick-item .quick-label { color: var(--ink-2); font-weight: 400; font-size: .875rem; }
    .quick-item .quick-value { display: block; font-size: .9375rem; }
}
@media (hover: hover) {
    .quick-item:hover, .quick-status:hover { background: var(--surface-2); }
}

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--surface-2); }
#actualites { padding-top: 48px; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 48px; margin-bottom: 24px; }
.section-intro { max-width: 46ch; color: var(--ink-2); font-size: 1rem; }

@media (min-width: 768px) {
    .section { padding: clamp(56px, 5vw, 80px) 0; }
    #actualites { padding-top: clamp(56px, 5vw, 72px); }
    .section-head { margin-bottom: clamp(24px, 2.5vw, 36px); }
    .section-intro { font-size: 1rem; }
}

/* ---------- Cartes ---------- */
.card {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.card:has(.stretched:active) { transform: scale(.985); }
@media (hover: hover) {
    .card:has(.stretched):hover { transform: translateY(-4px); box-shadow: var(--shadow); }
    .card:hover .card-media img { transform: scale(1.04); }
}
.card-media { overflow: hidden; background: var(--brand-soft); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card-media-fallback { display: grid; place-items: center; height: 100%; color: var(--brand); opacity: .55; }
.card-media-fallback .icon { width: 32px; height: 32px; }
.card-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-meta { display: block; font-size: .875rem; font-weight: 600; color: var(--accent); }
.card-meta::first-letter { text-transform: uppercase; }
.card-title { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.card-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ink-2);
    font-size: .9375rem;
}

/* Actualités — mobile : une « une » puis une liste compacte */
.news-grid { display: grid; gap: 12px; }
.news-card { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 14px; padding: 12px; }
.news-card .card-media { aspect-ratio: 1; border-radius: 12px; }
.news-card .card-excerpt { display: none; }
/* Bouton « Lire la suite » visuellement masqué : la ligne entière reste la zone tactile. */
.news-card .link-more { font-size: 0; }
.news-card .card-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.news-card-featured { grid-template-columns: 1fr; padding: 0; overflow: hidden; }
.news-card-featured .card-media { aspect-ratio: 16 / 9; border-radius: 0; }
.news-card-featured .card-body { padding: 16px 18px 18px; gap: 6px; }
.news-card-featured .card-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.375rem; line-height: 1.2; }
.news-card-featured .card-excerpt { display: -webkit-box; -webkit-line-clamp: 3; }
.news-card-featured .link-more { font-size: 1rem; margin-top: 4px; }

.btn-more { width: 100%; margin-top: 16px; padding-block: 10px; white-space: normal; text-align: center; }

@media (min-width: 768px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .news-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-items: stretch; padding: 0; overflow: hidden; }
    .news-card .card-media { aspect-ratio: 16 / 10; border-radius: 0; }
    .news-card .card-body { padding: 20px 22px 22px; gap: 8px; }
    .news-card .card-excerpt { display: -webkit-box; }
    .news-card .link-more { font-size: 1rem; margin-top: auto; padding-top: 6px; }
    .news-card .card-title { font-size: 1.1875rem; }
    .news-card-featured { grid-column: 1 / -1; }
    .btn-more { width: auto; margin: 28px auto 0; display: flex; }
}
@media (min-width: 1024px) {
    .news-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
    .news-card-featured { grid-column: span 2; grid-template-columns: 1.15fr 1fr; grid-template-rows: 1fr; }
    .news-card-featured .card-media { aspect-ratio: auto; }
    .news-card-featured .card-body { padding: 32px; justify-content: center; }
    .news-card-featured .card-title { font-size: 1.75rem; }
}

/* État vide */
.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 40px 20px;
    border: 1.5px dashed color-mix(in srgb, var(--ink) 18%, transparent);
    border-radius: var(--radius);
    text-align: center;
}
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty-title { font-weight: 700; font-size: 1.125rem; }
.empty-text { color: var(--ink-2); max-width: 44ch; font-size: 1rem; }

/* ---------- Agenda ---------- */
.event-list { display: grid; gap: 12px; }
.event-card {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 4px 14px;
    padding: 14px;
}
.date-tile {
    grid-row: 1 / span 2;
    align-self: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px 10px;
    border-radius: 14px;
    background: var(--brand);
    color: var(--on-brand);
    line-height: 1;
    text-transform: uppercase;
}
.date-weekday, .date-month { font-size: .8125rem; font-weight: 700; letter-spacing: .06em; }
.date-day { font-family: var(--font-serif); font-size: 1.875rem; font-weight: 600; margin: 4px 0 3px; }
.event-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.event-facts { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-2); font-size: .9375rem; }
.event-facts span { display: inline-flex; align-items: center; gap: 6px; }
.event-facts .icon { width: 1.05em; height: 1.05em; color: var(--brand); }
.event-card .card-excerpt { margin-top: 2px; }
/* Mobile : affiche en bandeau au-dessus de la carte (placement explicite). */
.event-card:has(.event-thumb) .date-tile { grid-row: 2 / span 2; }
.event-card:has(.event-thumb) .event-main { grid-column: 2; grid-row: 2; }
.event-card:has(.event-thumb) .event-actions { grid-row: 3; }
.event-thumb {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    aspect-ratio: 2 / 1;
    margin-bottom: 10px;
    object-fit: cover;
    object-position: center 25%;
    border-radius: 12px;
}
.event-actions {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: 6px;
}
.event-actions .link-more { min-height: 44px; }
.chip-action {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
    font-size: .9375rem;
    text-decoration: none;
}
.chip-action .icon { width: 18px; height: 18px; }
@media (hover: hover) { .chip-action:hover { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); } }

@media (min-width: 768px) {
    .event-card { grid-template-columns: 88px 1fr auto; gap: 6px 24px; padding: 20px; align-items: center; }
    .date-tile { align-self: stretch; justify-content: center; padding: 12px; }
    .date-day { font-size: 2.25rem; }
    .event-card:has(.event-thumb) .date-tile { grid-row: 1 / span 2; }
    .event-card:has(.event-thumb) .event-main { grid-row: 1; }
    .event-card:has(.event-thumb) .event-actions { grid-row: 2; }
    .event-thumb { grid-column: 3; grid-row: 1 / span 2; width: 168px; height: 118px; aspect-ratio: auto; margin: 0; }
    .event-card .card-title { font-size: 1.1875rem; }
    .event-actions { justify-content: flex-start; gap: 8px 24px; margin-top: 2px; }
}

/* Événements passés : carrousel horizontal sur mobile */
.past { margin-top: 40px; }
.past-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 72%;
    gap: 12px;
    margin-inline: calc(-1 * var(--gutter));
    padding: 4px var(--gutter) 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.past-grid::-webkit-scrollbar { display: none; }
.past-card { scroll-snap-align: start; overflow: hidden; }
.past-card .card-media { aspect-ratio: 16 / 9; }
.past-card .card-body { padding: 12px 14px 14px; }
.past-card .card-meta { color: var(--ink-2); font-weight: 500; }
.past-card .card-title { font-size: 1rem; }
.past-card .link-more { margin-top: 6px; min-height: 32px; }
.past-card img { filter: saturate(.85); }
@media (min-width: 768px) {
    .past { margin-top: 56px; }
    .past-grid {
        grid-auto-flow: row;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
        margin: 0;
        padding: 0;
        overflow: visible;
    }
}

/* ---------- Conseil ---------- */
.council { display: grid; gap: 28px; align-items: start; }
.council-photo { position: relative; }
.council-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.council-photo figcaption {
    position: absolute;
    left: 12px; bottom: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(8px);
    font-weight: 600;
    font-size: .9375rem;
    box-shadow: var(--shadow);
}
.council-photo figcaption .icon { color: var(--brand); }
.council-lists { display: flex; flex-direction: column; }
.council-lists .sub-title:not(:first-child) { margin-top: 28px; }

.exec-list { display: grid; gap: 8px; }
.exec {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.exec-name { display: block; font-weight: 700; }
.exec-role { display: block; color: var(--accent); font-size: .9375rem; font-weight: 500; }
.exec-role::first-letter { text-transform: uppercase; }

.avatar {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border-radius: 999px;
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 700;
    font-size: .875rem;
    letter-spacing: .04em;
    flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: .8125rem; background: var(--brand-soft); color: var(--brand); }

.member-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.member-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
    font-weight: 500;
    font-size: .9375rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.callout {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 24px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--on-brand);
    text-decoration: none;
    transition: transform .2s var(--ease), background-color .2s;
}
.callout:active { transform: scale(.98); }
.callout-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, .16); flex-shrink: 0; }
.callout-title { display: block; font-weight: 700; }
.callout-text { display: block; font-size: .9375rem; opacity: .92; }
.callout-arrow { margin-left: auto; }
@media (hover: hover) { .callout:hover { background: var(--brand-strong); transform: translateY(-2px); } }

@media (min-width: 768px) {
    .member-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 16px; }
    .member-list li { font-size: 1rem; }
    .avatar { width: 48px; height: 48px; }
    .exec { padding: 14px 18px; }
}
@media (min-width: 1024px) {
    .council { gap: 40px; }
    .council.has-photo { grid-template-columns: 5fr 7fr; }
    .council-photo img { box-shadow: var(--shadow-lg); }
    .council-lists .sub-title:not(:first-child) { margin-top: 22px; }
    .exec-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .exec { gap: 12px; padding: 10px 12px; }
    .exec .avatar { width: 40px; height: 40px; }
    .exec-role { font-size: .875rem; }
    .member-list { grid-template-columns: repeat(3, 1fr); }
    .member-list li { min-height: 46px; font-size: .9375rem; }
    .callout { margin-top: 20px; padding: 12px 16px; }
}

/* ---------- Contact ---------- */
.contact { display: grid; gap: 16px; }
.contact-main { display: grid; gap: 12px; align-content: start; }

.contact-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 88px;
    padding: 12px 6px;
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    transition: transform .2s var(--ease), background-color .2s;
}
.action:active { transform: scale(.96); }
.action .icon { width: 24px; height: 24px; }
.action-value { display: none; }
@media (hover: hover) { .action:hover { background: var(--brand-strong); } }

.hours-card { padding: 16px 16px 6px; }
.hours-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.hours-head .info-label { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.hours-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: .875rem;
    font-weight: 700;
    background: var(--surface-2);
}
.hours-status[data-state="open"] { color: var(--open); background: color-mix(in srgb, var(--open) 12%, transparent); }
.hours-status[data-state="soon"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.hours-status[data-state="closed"] { color: var(--closed); background: color-mix(in srgb, var(--closed) 10%, transparent); }

.week li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 10px;
    margin-inline: -10px;
    border-radius: 10px;
    font-variant-numeric: tabular-nums;
}
.week li + li { box-shadow: 0 -1px 0 var(--line); }
.week-day { font-weight: 600; }
.week-slots { text-align: right; font-weight: 500; }
.week li.is-closed { color: var(--ink-2); }
.week li.is-closed .week-day { font-weight: 500; }
.week li.is-today { background: var(--brand-soft); color: var(--ink); box-shadow: none; }
.week li.is-today + li { box-shadow: none; }
.week li.is-today .week-day::after { content: " · aujourd’hui"; font-weight: 500; color: var(--brand); }

.hours > * { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 500; }
.hours > *:last-child { border-bottom: 0; }

.info { display: flex; align-items: flex-start; gap: 14px; padding: 16px; }
.info-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.info-label { margin-bottom: 4px; font-size: .875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.info-label .icon { width: 18px; height: 18px; color: var(--brand); }
.info-value { display: block; font-weight: 600; overflow-wrap: anywhere; }

.map {
    position: relative;
    height: 280px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.map iframe { width: 100%; height: 100%; border: 0; }
.map-open {
    position: absolute;
    left: 12px; right: 12px; bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
}
.map-open .icon { color: var(--brand); width: 18px; height: 18px; }
/* Sur écran tactile, la carte n'intercepte pas le défilement : on ouvre l'appli de cartes. */
@media (hover: none) { .map iframe { pointer-events: none; } }
@media (prefers-color-scheme: dark) { .map iframe { filter: invert(.9) hue-rotate(180deg) saturate(.6); } }

@media (min-width: 768px) {
    .contact-main { gap: 10px; }
    .contact-actions { grid-template-columns: 1fr; gap: 6px; }
    .action {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        min-height: 48px;
        padding: 8px 16px;
        border-radius: var(--radius-sm);
        background: var(--surface);
        color: var(--ink);
        border: 1px solid var(--line);
        font-size: .9375rem;
        text-align: left;
    }
    .action .icon { width: 20px; height: 20px; color: var(--brand); }
    .action-label { min-width: 76px; color: var(--ink-2); font-weight: 500; }
    .action-value { display: block; color: var(--brand); overflow-wrap: anywhere; }
    .action:hover { background: var(--surface); border-color: var(--brand); }
    .hours-card { padding: 14px 18px 6px; border-radius: var(--radius-sm); }
    .hours-head { margin-bottom: 2px; }
    .week li { padding: 6px 10px; font-size: .9375rem; }
    /* L'adresse figure déjà sur la ligne « Itinéraire ». */
    .contact-main > .info { display: none; }
    .map { height: auto; min-height: 320px; border-radius: var(--radius); }
}
@media (min-width: 1024px) {
    .contact { grid-template-columns: 5fr 7fr; gap: 20px; align-items: stretch; }
}

/* ---------- Pied de page ---------- */
.site-footer { padding: 40px 0 24px; background: #12221D; color: #D6E2DD; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; padding-bottom: 24px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.footer-brand { display: flex; align-items: center; gap: 14px; }
.footer-brand .brand-mark { width: 38px; }
.footer-name { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: #FFFFFF; }
.footer-address { font-size: .9375rem; color: #A9BCB4; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 8px; margin-inline: -12px; }
.footer-links a, .admin-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: #D6E2DD; text-decoration: none; font-weight: 500; }
.footer-links a:hover, .admin-link:hover { color: #FFFFFF; text-decoration: underline; text-underline-offset: 4px; }
.socials { display: flex; gap: 8px; }
.socials a { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 999px; background: rgba(255, 255, 255, .08); color: #FFFFFF; text-decoration: none; }
.socials a:hover { background: rgba(255, 255, 255, .18); }
.footer-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding-top: 12px; font-size: .875rem; color: #A9BCB4; }
.admin-link { gap: 6px; margin-right: -12px; color: #A9BCB4; font-size: .875rem; }
.admin-link .icon { width: 1em; height: 1em; }

/* ---------- Fenêtres modales : feuille glissante sur mobile ---------- */
.modal {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    overscroll-behavior: contain;
}
.modal[open] { animation: sheet-in .38s var(--ease); }
.modal.is-releasing { transition: transform .3s var(--ease); }
.modal::backdrop { background: rgba(8, 14, 12, .55); backdrop-filter: blur(3px); }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }

.modal-panel { position: relative; display: flex; flex-direction: column; max-height: 92dvh; }
.modal-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-grabber {
    position: absolute;
    inset: 0 0 auto;
    z-index: 3;
    display: grid;
    place-items: center;
    height: 28px;
    touch-action: none;
    cursor: grab;
}
.sheet-grabber span { width: 40px; height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 35%, transparent); }
.modal-close {
    position: absolute;
    top: 14px; right: 14px;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(10, 20, 16, .55);
    color: #FFFFFF;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.modal-close:hover { background: rgba(10, 20, 16, .8); }
.modal-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.modal-body { display: flex; flex-direction: column; gap: 8px; padding: 24px 20px 20px; }
.modal-scroll > .modal-body:first-child { padding-top: 40px; }
.modal-scroll > .modal-body:first-child .card-meta { padding-right: 52px; }
.modal-title { font-family: var(--font-serif); font-weight: 600; font-size: clamp(1.5rem, 1.2rem + 1.6vw, 2.25rem); line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
.modal .event-facts { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.modal-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px calc(12px + var(--safe-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface);
}
.modal-actions .btn { flex: 1; min-height: 48px; padding: 0 16px; }
.modal-actions .btn .icon { width: 18px; height: 18px; }

@media (min-width: 768px) {
    .modal { width: min(100% - 48px, 760px); max-height: calc(100dvh - 64px); margin: auto; border-radius: var(--radius-lg); }
    .modal[open] { animation-name: modal-in; }
    .modal-panel { max-height: calc(100dvh - 64px); }
    .sheet-grabber { display: none; }
    .modal-body { padding: 36px 40px 28px; gap: 10px; }
    .modal-scroll > .modal-body:first-child { padding-top: 36px; }
    .modal-actions { justify-content: flex-end; padding: 16px 24px; }
    .modal-actions .btn { flex: 0 0 auto; }
}

.prose { font-size: 1.0625rem; line-height: 1.7; color: var(--ink); overflow-wrap: anywhere; }
.prose > * + * { margin-top: .8em; }
.prose > div > br:last-child { display: none; }
.prose a { color: var(--brand); text-underline-offset: 3px; }
.prose ul { list-style: disc; padding-left: 1.4em; }
.prose ol { list-style: decimal; padding-left: 1.4em; }
.prose strong { font-weight: 700; }
.prose img { height: auto; border-radius: 12px; }

/* Galerie */
.gallery { position: relative; background: var(--surface-2); }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track img { flex: 0 0 100%; width: 100%; height: min(58dvh, 520px); object-fit: contain; scroll-snap-align: center; }
.gallery-btn {
    position: absolute;
    top: 50%;
    display: none;
    place-items: center;
    width: 44px; height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: #17211D;
    transform: translateY(-50%);
    box-shadow: var(--shadow);
}
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
.gallery-count {
    position: absolute;
    left: 50%; bottom: 12px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .6);
    color: #FFFFFF;
    font-size: .875rem;
    font-weight: 600;
    transform: translateX(-50%);
}
@media (hover: hover) { .gallery-btn { display: grid; } }
@media (min-width: 768px) { .gallery-track img { height: min(52dvh, 480px); } }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
    z-index: 200;
    padding: 12px 18px;
    border-radius: 999px;
    background: #17211D;
    color: #FFFFFF;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity .25s, transform .25s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

/* ---------- Apparition au défilement ---------- */
@media (prefers-reduced-motion: no-preference) {
    .js [data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
    .js [data-reveal].is-visible { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Page de connexion
   ========================================================================== */
.auth-page { padding-bottom: 0; }
.auth {
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 24px var(--gutter);
    background:
        radial-gradient(80% 60% at 100% 0%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
        radial-gradient(60% 50% at 0% 100%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: clamp(24px, 6vw, 44px);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}
.auth-card .brand { margin-bottom: 24px; }
.auth-card .brand-sub { display: block; }
.auth-title { font-family: var(--font-serif); font-weight: 600; font-size: 1.875rem; line-height: 1.1; letter-spacing: -0.01em; }
.auth-lead { margin-top: 8px; color: var(--ink-2); }
.form { display: grid; gap: 18px; margin-top: 24px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .9375rem; }
.field input {
    min-height: 52px;
    padding: 0 16px;
    border: 1.5px solid color-mix(in srgb, var(--ink) 20%, transparent);
    border-radius: 12px;
    background: var(--bg);
    color: var(--ink);
    font: inherit;
    font-size: 1.0625rem; /* ≥ 16px : évite le zoom automatique d'iOS */
    transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
.btn-block { width: 100%; background: var(--brand); color: var(--on-brand); border: 0; }
.btn-block:hover { background: var(--brand-strong); }
.alert { padding: 12px 16px; border-radius: 12px; background: #FDECEA; color: #8A1C12; font-weight: 500; border: 1px solid #F5C2BC; }
@media (prefers-color-scheme: dark) { .alert { background: #3A1A16; color: #FFC9C0; border-color: #6B2A22; } }
.auth-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 12px; color: var(--ink-2); font-size: .9375rem; text-decoration: none; }
.auth-back:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.auth-back .icon { width: 1em; height: 1em; }
