/*
Theme Name: 3615 CHM Montalivet – Annonces
Theme URI: https://3615chm.com
Author: Jean-Charles
Description: Site d'annonces indépendant pour le CHM Montalivet. Dépôt sans inscription, modération, photos, expiration automatique, contact sans dévoiler son e-mail, installable sur téléphone (PWA). Tout est inclus : aucune extension nécessaire.
Version: 1.6.3
Requires at least: 6.0
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: chm
*/

:root {
  --red: #ff003c;
  --red-dark: #d60033;
  --ink: #1a1a1a;
  --text: #333;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --gray: #f2f2f2;
  --black: #111;
  --white: #fff;
  --ok: #0a7d3c;
  --ok-bg: #e8f6ee;
  --warn-bg: #fff4d6;
  --err-bg: #ffe8ec;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .12);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-title: "Gabarito", "Inter", system-ui, sans-serif;
  --font-logo: "Modak", "Gabarito", system-ui, sans-serif;
  --font-sub: "Jaldi", "Inter", system-ui, sans-serif;
  --wrap: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg, var(--white));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-title); line-height: 1.15; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(24px, 4vw, 32px); font-weight: 800; letter-spacing: -.02em; }
h3 { font-size: 20px; font-weight: 700; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: #fff; padding: 8px 12px; clip: auto; width: auto; height: auto; }

/* ---------- En-tête ---------- */
.site-header { background: var(--bg, var(--white)); position: sticky; top: 0; z-index: 50; border-bottom: 1px solid transparent; transition: border-color .2s; }
.site-header.scrolled { border-bottom-color: var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.logo { font-family: var(--font-logo); font-size: 36px; line-height: 1; color: var(--red); text-decoration: none; white-space: nowrap; }
.logo small { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); margin-top: 2px; }
.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav a { font-weight: 500; text-decoration: none; color: var(--black); white-space: nowrap; }
.main-nav a:hover, .main-nav a.current { color: var(--red); }
.main-nav .btn { color: var(--white); }
.main-nav .btn:hover { color: var(--white); }
.menu-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.menu-toggle span { display: block; width: 24px; height: 2px; background: var(--black); margin: 5px 0; transition: transform .2s, opacity .2s; }
@media (max-width: 1080px) {
  .menu-toggle { display: block; }
  .main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--white); flex-direction: column; align-items: stretch; gap: 0; padding: 8px 20px 20px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .main-nav .btn { margin-top: 12px; border-bottom: 0; text-align: center; }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-body); font-size: 14px; font-weight: 600; line-height: 1.2; padding: 12px 18px; border-radius: var(--radius-sm); border: 0; cursor: pointer; text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-dark { background: var(--black); color: var(--white); box-shadow: var(--shadow); }
.btn-dark:hover { background: #000; }
.btn-light { background: var(--gray); color: var(--black); }
.btn-light:hover { background: #e7e7e7; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { background: var(--red-dark); }
.btn-outline { background: var(--white); color: var(--black); border: 1px solid var(--black); }
.btn-danger { background: var(--white); color: #b00020; border: 1px solid #b00020; }
.btn-block { width: 100%; }
.btn-lg { font-size: 16px; padding: 15px 22px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-row.center { justify-content: center; }

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }
.intro h1 { margin-bottom: .4em; }
.intro p { font-size: 18px; max-width: 720px; }
.cta-block { text-align: center; padding: 48px 0 24px; }
.cta-block h2 { margin-bottom: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.link-more { font-weight: 600; color: var(--red); text-decoration: none; }

/* ---------- Recherche ---------- */
.search-bar { display: flex; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, .05); max-width: 760px; }
.search-bar input[type="search"] { flex: 1; min-width: 0; border: 0; font-size: 16px; padding: 10px 12px; background: transparent; }
.search-bar input[type="search"]:focus { outline: none; }
.search-bar select { border: 0; border-left: 1px solid var(--line); font-size: 15px; padding: 0 10px; background: transparent; max-width: 40%; }
@media (max-width: 600px) {
  .search-bar { flex-wrap: wrap; }
  .search-bar input[type="search"] { flex: 1 1 100%; }
  .search-bar select { flex: 1; border-left: 0; border-top: 1px solid var(--line); padding: 10px; max-width: none; }
}

/* ---------- Catégories ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 48px; }
@media (max-width: 820px) { .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 20px; } }
.cat-card { text-decoration: none; color: inherit; display: block; }
.cat-card .cat-img { aspect-ratio: 1 / 1; border-radius: var(--radius); border: 1px solid var(--black); overflow: hidden; background: var(--gray); display: flex; align-items: center; justify-content: center; font-size: 72px; transition: transform .2s; }
.cat-card .cat-img img { width: 100%; height: 100%; object-fit: cover; }
.cat-card:hover .cat-img { transform: translateY(-3px); }
.cat-card h3 { hyphens: auto; overflow-wrap: anywhere; font-family: var(--font-body); font-size: 17px; font-weight: 700; text-transform: uppercase; color: var(--text); margin: 18px 0 4px; letter-spacing: -.01em; }
.cat-card p { font-family: var(--font-sub); font-size: 17px; line-height: 1.4; margin: 0; color: var(--black); }
.cat-card .count { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--red); }

.cat-pills { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.cat-pills::-webkit-scrollbar { display: none; }
.cat-pills a { flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.cat-pills a.active { background: var(--black); color: var(--white); border-color: var(--black); }

/* ---------- Cartes d'annonces ---------- */
.ad-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 1000px) { .ad-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .ad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
.ad-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.ad-card .ad-thumb { aspect-ratio: 4 / 3; border-radius: 12px; border: 1px solid var(--black); overflow: hidden; background: var(--gray); display: flex; align-items: center; justify-content: center; font-size: 44px; }
.ad-card .ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-card .ad-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-top: 10px; letter-spacing: .02em; }
.ad-card h3 { overflow-wrap: anywhere; font-family: var(--font-body); font-size: 16px; font-weight: 600; margin: 2px 0 2px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ad-card .ad-price { font-weight: 700; color: var(--red); }
.ad-card .ad-meta { font-size: 13px; color: var(--muted); }
.ad-card:hover h3 { text-decoration: underline; }

.empty { text-align: center; padding: 48px 20px; background: var(--gray); border-radius: var(--radius); }
.empty p { font-size: 18px; }

/* Pagination */
.pagination { margin-top: 40px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination .page-numbers { min-width: 40px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); text-decoration: none; text-align: center; }
.pagination .page-numbers.current { background: var(--black); color: var(--white); border-color: var(--black); }

/* ---------- Annonce seule ---------- */
.breadcrumb { font-size: 14px; color: var(--muted); margin: 20px 0; }
.breadcrumb a { color: var(--muted); }
.ad-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 860px) { .ad-layout { grid-template-columns: 1fr; gap: 24px; } }
.gallery-main { border-radius: var(--radius); border: 1px solid var(--black); overflow: hidden; background: var(--gray); aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; font-size: 80px; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: #fafafa; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs button { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; width: 72px; height: 72px; cursor: pointer; background: none; }
.gallery-thumbs button.active { border-color: var(--red); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.ad-title { margin-bottom: 6px; }
.ad-price-lg { font-family: var(--font-title); font-size: 26px; font-weight: 800; color: var(--red); margin-bottom: 12px; }
.ad-facts { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 6px; color: var(--text); }
.ad-desc { font-size: 17px; white-space: normal; overflow-wrap: anywhere; }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--white); }
.box + .box { margin-top: 16px; }
.box h3 { margin-bottom: 12px; }
.sticky-col { position: sticky; top: 88px; }
@media (max-width: 860px) { .sticky-col { position: static; } }
details.report summary { cursor: pointer; color: var(--muted); font-size: 14px; }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 18px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.req { color: var(--red); }
.form input[type="text"], .form input[type="email"], .form input[type="tel"], .form input[type="number"], .form select, .form textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid #cfcfcf; border-radius: 10px; background: var(--white); color: var(--ink);
}
.form textarea { min-height: 160px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--black); outline-offset: 1px; border-color: var(--black); }
.form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 600px) { .form .row-2 { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: 0 0 auto; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.photo-drop { border: 2px dashed #cfcfcf; border-radius: var(--radius); padding: 22px; text-align: center; cursor: pointer; background: #fcfcfc; display: block; }
.photo-drop:hover { border-color: var(--black); }
.photo-drop input { display: none; }
.photo-drop strong { display: block; font-size: 16px; }
.photo-previews, .photo-existing { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.photo-previews img, .photo-existing img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photo-existing label { position: relative; display: block; }
.photo-existing label span { display: block; font-size: 12px; text-align: center; margin-top: 4px; font-weight: 400; }

.notice { padding: 14px 18px; border-radius: 12px; margin: 0 0 20px; font-weight: 500; }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-warn { background: var(--warn-bg); color: #7a5400; }
.notice-err { background: var(--err-bg); color: #9b0026; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }

.status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.status-publish { background: var(--ok-bg); color: var(--ok); }
.status-pending { background: var(--warn-bg); color: #7a5400; }
.status-expiree { background: var(--gray); color: var(--muted); }

/* Contenu de page (règles…) */
.entry-content { font-size: 17px; }
.entry-content ul, .entry-content ol { padding-left: 22px; }
.entry-content li { margin-bottom: 6px; }
.entry-content a { color: var(--red); }

/* ---------- Pied de page ---------- */
.site-footer { background: var(--red); color: var(--white); padding: 48px 0 28px; margin-top: 64px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }
.site-footer .logo { color: var(--white); }
.site-footer .logo small { color: var(--white); }
.footer-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 10px; opacity: .85; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--white); text-decoration: none; font-weight: 500; }
.site-footer a:hover { text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .35); margin-top: 32px; padding-top: 18px; font-size: 14px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* Bouton flottant mobile */
.fab { display: none; }
@media (max-width: 720px) {
  .fab { display: inline-flex; position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40; border-radius: 999px; padding: 14px 20px; }
  body.no-fab .fab { display: none; }
}

/* ---------- Alertes ---------- */
.alert-link { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--red); padding-bottom: 2px; }
.alert-link:hover { color: var(--red); }
.alert-box { margin-top: 40px; background: #fff4f6; border: 1px solid #ffd0db; border-radius: var(--radius); padding: 22px; }
.alert-box-text { margin-bottom: 14px; }
.alert-box-text strong { display: block; font-family: var(--font-title); font-size: 20px; margin-bottom: 2px; }
.alert-box-text span { color: var(--text); }
.alert-compact .alert-row { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr auto; gap: 12px; align-items: end; }
.alert-compact .field label { font-size: 13px; margin-bottom: 4px; }
.alert-compact input, .alert-compact select { padding: 10px 12px !important; }
.alert-compact .btn { padding: 12px 16px; white-space: nowrap; }
@media (max-width: 820px) { .alert-compact .alert-row { grid-template-columns: 1fr 1fr; } .alert-compact .field-btn { grid-column: 1 / -1; } .alert-compact .field-btn .btn { width: 100%; } }
@media (max-width: 520px) { .alert-compact .alert-row { grid-template-columns: 1fr; } }
.alert-form:not(.alert-compact) .field + .field { margin-top: 18px; }
.alert-form:not(.alert-compact) .field-btn { margin-top: 20px; }

/* ---------- Langues ---------- */
.header-right { display: flex; align-items: center; gap: 14px; }
.lang-switch { display: flex; gap: 2px; font-size: 12px; font-weight: 600; }
.lang-switch a { text-decoration: none; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.lang-switch a.active { background: var(--black); color: var(--white); }
.lang-switch a:hover:not(.active) { color: var(--red); }
@media (min-width: 1081px) {
  .header-inner { flex-wrap: nowrap; }
  .header-right { order: 3; }
  .main-nav { order: 2; margin-left: auto; }
}
.translate-note { margin: 14px 0 0; font-size: 15px; }
.translate-note a { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--muted); }
.translate-note a:hover { color: var(--red); border-color: var(--red); }

/* ---------- Partage ---------- */
.share h3 { margin-bottom: 10px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; cursor: pointer; }
.share-btn:hover { border-color: var(--black); }
.share-wa { background: #25d366; border-color: #25d366; color: #fff; }
.share-wa:hover { background: #1ebe5a; border-color: #1ebe5a; }
.share-native { background: var(--black); border-color: var(--black); color: #fff; }
.share-btn.copied { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }

/* ---------- Vendu / Donné / Retrouvé ---------- */
.ad-thumb { position: relative; }
.ribbon { position: absolute; top: 10px; left: 10px; background: var(--ok); color: #fff; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; padding: 5px 10px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.ad-card.is-done .ad-thumb img, .ad-card.is-done .ad-thumb > span[aria-hidden] { opacity: .45; filter: grayscale(.6); }
.ad-card.is-done h3, .ad-card.is-done .ad-price { color: var(--muted); }
.done-banner { background: var(--ok-bg); color: var(--ok); border: 1px solid #b9e4c9; border-radius: 12px; padding: 14px 18px; margin-bottom: 20px; font-size: 17px; }
.status-conclu { background: var(--ok); color: #fff; margin-left: 6px; }
.box-conclu { background: #f6fbf8; border-color: #cfe9d9; }
.done-count { margin: 16px 0 0; font-weight: 600; color: var(--ok); }

/* ---------- Agenda ---------- */
.date-chip { position: absolute; bottom: 8px; left: 8px; right: 8px; background: rgba(17, 17, 17, .85); color: #fff; font-size: 12px; font-weight: 600; padding: 5px 8px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.agenda-box { background: var(--bg, var(--white)); border: 1px solid var(--black); border-radius: var(--radius); padding: 22px 24px; }
.agenda-box h2 { font-size: 24px; margin: 0; }
.agenda-day { font-family: var(--font-body); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 6px; }
.agenda-list { list-style: none; margin: 0; padding: 0; }
.agenda-list li + li { border-top: 1px solid var(--line); }
.agenda-list a { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: baseline; padding: 10px 0; text-decoration: none; color: var(--ink); }
.agenda-list a:hover .agenda-title { color: var(--red); }
.agenda-time { font-weight: 800; font-family: var(--font-title); }
.agenda-title { font-weight: 600; }
.agenda-place { font-size: 14px; color: var(--muted); white-space: nowrap; }
.agenda-done { font-style: normal; font-size: 12px; color: var(--ok); font-weight: 700; margin-left: 6px; }
@media (max-width: 600px) { .agenda-list a { grid-template-columns: 54px 1fr; } .agenda-place { grid-column: 2; white-space: normal; } }
.fact-event { font-size: 17px; }
.field-event { background: #f7f5ff; border: 1px solid #e3ddfb; border-radius: 12px; padding: 16px; }
.field-event[hidden] { display: none; }

/* ---------- Récap du dimanche ---------- */
.recap-box { background: var(--black); color: #fff; border-radius: var(--radius); padding: 26px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.recap-box strong { hyphens: auto; overflow-wrap: anywhere; display: block; font-family: var(--font-title); font-size: 22px; margin-bottom: 4px; }
.recap-box span { opacity: .85; }
.recap-form { display: flex; gap: 8px; }
.recap-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 10px; border: 0; }
.recap-form .btn { background: var(--red); box-shadow: none; }
.recap-form .btn:hover { background: var(--red-dark); }
.recap-box .notice { grid-column: 1 / -1; margin: 0; }
@media (max-width: 720px) { .recap-box { grid-template-columns: minmax(0, 1fr); } }

html, body { overflow-x: hidden; }
.site-header { position: sticky; }
@media (max-width: 1080px) { .site-header .header-inner { position: relative; } }
h1, h2 { hyphens: auto; overflow-wrap: break-word; }

/* ---------- Aujourd'hui à Montalivet ---------- */
.meteo { background: var(--bg, var(--white)); border: 1px solid var(--black); border-radius: var(--radius); padding: 22px 24px 14px; }
.meteo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.meteo-head h2 { font-size: 24px; margin: 0; }
.meteo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
@media (max-width: 900px) { .meteo-grid { grid-template-columns: minmax(0, 1fr); } .meteo-card + .meteo-card { border-left: 0 !important; border-top: 1px solid var(--line); } }
.meteo-card { background: transparent; padding: 14px 20px; }
.meteo-card:first-child { padding-left: 0; }
.meteo-card + .meteo-card { border-left: 1px solid var(--line); }
@media (max-width: 900px) { .meteo-card, .meteo-card:first-child { padding: 16px 0; } }
.meteo-card h3 { font-size: 17px; margin: 0 0 10px; }
.meteo-now { display: flex; align-items: center; gap: 10px; }
.meteo-icon { font-size: 44px; line-height: 1; }
.meteo-temp { font-family: var(--font-title); font-size: 44px; font-weight: 800; line-height: 1; }
.meteo-label { font-weight: 600; margin: 4px 0 10px; }
.meteo-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.meteo-tomorrow { color: var(--muted); margin-top: 4px; }
.meteo-sea { display: flex; gap: 14px; flex-wrap: wrap; font-weight: 700; font-size: 18px; margin: 0 0 10px; }
.tides { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.tides { gap: 0; }
.tides li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.tides li:last-child { border-bottom: 0; }
.meteo-swim p { margin: 0 0 10px; font-size: 15px; }
.flags summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.flags ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; font-size: 14px; }
.flags li { display: flex; gap: 10px; align-items: flex-start; }
.flag { flex: 0 0 auto; width: 26px; height: 18px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .25); margin-top: 1px; }
.flag-g { background: #1e9e4a; } .flag-y { background: #f7d117; } .flag-r { background: #d7192f; } .flag-v { background: #7a3db8; }
.flag-ry { background: linear-gradient(180deg, #d7192f 50%, #f7d117 50%); }
.flag-c { background: conic-gradient(#000 25%, #fff 0 50%, #000 0 75%, #fff 0) 0 0 / 9px 9px; }
.flag-none { background: repeating-linear-gradient(45deg, #fff, #fff 3px, #ddd 3px, #ddd 6px); }
.meteo-credit { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: right; }

/* ---------- Favoris ---------- */
.ad-card-wrap { position: relative; min-width: 0; }
.fav-btn { position: absolute; top: 8px; right: 8px; z-index: 2; width: 38px; height: 38px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); cursor: pointer; font-size: 19px; line-height: 1; display: flex; align-items: center; justify-content: center; color: var(--ink); transition: transform .15s; }
.fav-btn:hover { transform: scale(1.08); }
.fav-btn .fav-on { display: none; }
.fav-btn.is-fav .fav-on { display: inline; }
.fav-btn.is-fav .fav-off { display: none; }
.fav-btn.pop { animation: favpop .4s ease; }
@keyframes favpop { 50% { transform: scale(1.35); } }
.ad-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fav-big { position: static; flex: 0 0 auto; width: 46px; height: 46px; font-size: 22px; border: 1px solid var(--line); box-shadow: none; margin-top: 4px; }
.fav-link { position: relative; text-decoration: none; font-size: 22px; line-height: 1; color: var(--ink); padding: 4px; }
.fav-link:hover { color: var(--red); }
.fav-count { position: absolute; top: -4px; right: -8px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.fav-count[hidden] { display: none; }
.stats { color: var(--muted); font-weight: 500; }

/* ---------- Notifications ---------- */
.push-box { border-color: #d6e9f8; background: #f4faff; }
.push-msg { margin: 12px 0 0; }
.push-msg[hidden] { display: none; }

/* ---------- Radio ---------- */
.radio { display: flex; align-items: center; gap: 14px; border: 1px solid var(--black); border-radius: 999px; padding: 8px 18px 8px 8px; background: var(--bg, var(--white)); }
.radio-btn { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 999px; border: 0; background: var(--black); color: var(--white); display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.radio-btn:hover { background: var(--red); }
.radio-btn-off { background: var(--gray); color: var(--ink); font-size: 20px; cursor: default; }
.radio-btn-off:hover { background: var(--gray); }
.radio .i-pause, .radio .i-load { display: none; }
.radio.is-playing .i-play, .radio.is-loading .i-play { display: none; }
.radio.is-playing .i-pause { display: block; }
.radio.is-loading .i-load { display: block; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: radiospin .8s linear infinite; }
@keyframes radiospin { to { transform: rotate(360deg); } }
.radio-text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.radio-text strong { font-family: var(--font-title); font-size: 18px; }
.radio-status { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.radio-live { display: none; align-items: flex-end; gap: 2px; height: 12px; }
.radio-live i { width: 3px; background: var(--red); border-radius: 1px; height: 4px; }
.radio.is-playing .radio-live { display: inline-flex; }
.radio.is-playing .radio-live i { animation: radiobar .9s ease-in-out infinite; }
.radio.is-playing .radio-live i:nth-child(2) { animation-delay: .2s; }
.radio.is-playing .radio-live i:nth-child(3) { animation-delay: .4s; }
@keyframes radiobar { 0%, 100% { height: 4px; } 50% { height: 12px; } }
.radio.is-error .radio-btn { background: var(--gray); color: var(--muted); }
.radio-spotify { font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; }
.radio-spotify:hover { color: var(--red); }

/* Page d'accueil construite avec l'éditeur : textes, images et boutons ajoutés entre les blocs */
.home-blocks > :not(.chm-blk):not(.alignfull) { width: 100%; max-width: var(--wrap); margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; box-sizing: border-box; }
.home-blocks > :not(.chm-blk) { margin-top: 24px; margin-bottom: 24px; }
.home-blocks > .alignwide { max-width: calc(var(--wrap) + 200px); }
.home-blocks img { max-width: 100%; height: auto; }
.home-blocks > .wp-block-image img { border-radius: 14px; }
.home-blocks > div.wrap.chm-blk { margin-top: 24px; }

/* Blocs de l'éditeur : largeur, couleurs, colonnes */
.entry-content .alignfull, .home-blocks > .alignfull { width: 100vw; max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.home-blocks > .alignfull { margin-left: 0; margin-right: 0; width: 100%; padding-left: 0; padding-right: 0; }
.entry-content .alignwide { max-width: none; }
.home-blocks .wp-block-cover { border-radius: 0; }
.home-blocks .wp-block-group.alignfull > * { max-width: var(--wrap); margin-left: auto; margin-right: auto; }
.home-blocks .wp-block-columns { gap: 24px; }
.home-blocks .wp-block-button__link, .entry-content .wp-block-button__link { border-radius: 999px; font-weight: 600; text-decoration: none; padding: 12px 24px; }
.wp-block-details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.wp-block-details summary { font-weight: 600; cursor: pointer; }
.has-chm-rouge-color { color: #ff003c !important; } .has-chm-rouge-background-color { background-color: #ff003c !important; }
.has-chm-noir-color { color: #111 !important; } .has-chm-noir-background-color { background-color: #111 !important; }
.has-chm-blanc-color { color: #fff !important; } .has-chm-blanc-background-color { background-color: #fff !important; }
.has-chm-gris-color { color: #f2f2f2 !important; } .has-chm-gris-background-color { background-color: #f2f2f2 !important; }
.has-chm-jaune-color { color: #ffe94d !important; } .has-chm-jaune-background-color { background-color: #ffe94d !important; }
.has-chm-vert-color { color: #1f5a3a !important; } .has-chm-vert-background-color { background-color: #1f5a3a !important; }
.has-chm-bleu-color { color: #cfe3f2 !important; } .has-chm-bleu-background-color { background-color: #cfe3f2 !important; }
.has-chm-sable-color { color: #f3dfc9 !important; } .has-chm-sable-background-color { background-color: #f3dfc9 !important; }
.has-chm-blanc-color h1, .has-chm-blanc-color h2, .has-chm-blanc-color h3, .has-chm-blanc-color p { color: inherit; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; padding: 24px 0; border-top: 1px solid rgba(255,255,255,.2); margin-top: 24px; }
.footer-widgets img { max-width: 100%; height: auto; }

/* Radio : formes, tailles et couleurs réglables dans le bloc */
.radio-logo { width: 44px; height: 44px; border-radius: 999px; object-fit: cover; flex: 0 0 auto; }
.radio-phrase { font-size: 14px; }
.radio.radio-carte { border-radius: var(--radius); padding: 18px 22px; }
.radio.radio-simple { border: 0; background: transparent; padding: 0; border-radius: 0; }
.radio.radio-bandeau { display: block; border: 0; border-radius: 0; padding: 16px 0; background: var(--gray); }
.radio-bandeau .radio-inner { display: flex; align-items: center; gap: 14px; }
.radio-band-wrap { margin-top: 0; }
.home-blocks > .radio-band-wrap { margin: 0; padding: 0; max-width: none; }
.radio.radio-grande .radio-btn, .radio.radio-grande .radio-logo { width: 64px; height: 64px; }
.radio.radio-grande .radio-btn svg { width: 26px; height: 26px; }
.radio.radio-grande .radio-text strong { font-size: 26px; }
.radio.radio-grande .radio-status, .radio.radio-grande .radio-phrase, .radio.radio-grande .radio-spotify { font-size: 16px; }
.radio.radio-centre, .radio-centre .radio-inner { justify-content: center; text-align: center; flex-wrap: wrap; }
.radio.radio-centre .radio-text { flex: 0 1 auto; justify-content: center; }
.radio.radio-fg .radio-text strong, .radio.radio-fg .radio-status, .radio.radio-fg .radio-phrase, .radio.radio-fg .radio-spotify { color: inherit; }
.radio.radio-fg .radio-status { opacity: .8; }

/* ---- Apparence réglable des sections (éditeur : panneaux Apparence et Couleurs) ---- */
.meteo-cols-2 .meteo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.meteo-cols-1 .meteo-grid { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .meteo-cols-2 .meteo-grid { grid-template-columns: minmax(0, 1fr); } }

.chm-look.has-bg .chm-box { background: var(--b-bg) !important; }
.chm-look.has-fg .chm-box { color: var(--b-fg) !important; }
.chm-look.has-fg .chm-box :is(p, span, li, strong, small, em, summary, label, h3, .muted, .hint, .count, .agenda-place, .agenda-time, .agenda-day, .link-more, .alert-link, .meteo-credit, a:not(.btn)) { color: inherit !important; }
.chm-look.has-title .chm-box :is(h1, h2) { color: var(--b-title) !important; }
.chm-look.has-border .chm-box { border-color: var(--b-border) !important; }
.chm-look.has-btn .chm-box .btn:not(.btn-light), .chm-look.has-btn .chm-box button[type="submit"] { background: var(--b-btn) !important; border-color: var(--b-btn) !important; }

/* Forme « encadré » */
.chm-forme-encadre .chm-box { border: 1px solid var(--b-border, var(--black)); border-radius: var(--radius); padding: 24px; }
.chm-forme-encadre .wrap.chm-box { width: calc(100% - 40px); }
.chm-forme-encadre .cta-block, .chm-forme-encadre .intro { padding-top: 32px; padding-bottom: 32px; }
/* Forme « sans cadre » */
.chm-forme-sans-cadre .chm-box { border-color: transparent !important; box-shadow: none !important; background: transparent !important; border-radius: 0; }
.chm-forme-sans-cadre .meteo.chm-box, .chm-forme-sans-cadre .agenda-box.chm-box { padding-left: 0; padding-right: 0; }
.chm-look.chm-forme-sans-cadre.has-bg .chm-box { background: var(--b-bg) !important; padding-left: 24px; padding-right: 24px; }
/* Forme « bandeau pleine largeur » */
.chm-forme-bandeau { background: var(--b-bg, var(--gray)); padding-top: 40px; padding-bottom: 40px; }
.chm-forme-bandeau .chm-box { border-color: transparent !important; box-shadow: none !important; }
.chm-look.chm-forme-bandeau.has-bg .chm-box { background: transparent !important; }
.chm-forme-bandeau > * > .section, .chm-forme-bandeau > .section, .chm-forme-bandeau > .section-tight, .chm-forme-bandeau > .cta-block { padding-top: 0; padding-bottom: 0; }
.chm-forme-bandeau > .wrap { margin-top: 0 !important; }

/* Espacement */
.chm-sp-top > * { padding-top: 0 !important; margin-top: 0 !important; }
.chm-sp-bottom > * { padding-bottom: 0 !important; margin-bottom: 0 !important; }

/* Alignement */
.chm-align-centre .chm-box { text-align: center; }
.chm-align-centre .section-head, .chm-align-centre .meteo-head { justify-content: center; flex-direction: column; align-items: center; gap: 6px; }
.chm-align-centre .search-bar { margin-left: auto; margin-right: auto; }
.chm-align-centre .intro p { margin-left: auto; margin-right: auto; }
.chm-align-gauche .chm-box { text-align: left; }
.chm-align-gauche .btn-row { justify-content: flex-start; }
/* Le texte choisi s'applique aussi aux titres, sauf si une couleur de titre est choisie */
.chm-look.has-fg .chm-box :is(h1, h2) { color: inherit !important; }
.chm-look.has-title .chm-box :is(h1, h2) { color: var(--b-title) !important; }
