:root {
  /* Palette tirée du logo du Village de Saône */
  --brique: #b03518;   /* le pont */
  --marine: #1a3e7d;   /* la vague sombre */
  --saone: #6fc9eb;    /* la vague claire */
  --ciel: #e3f6fd;
  --vert: #bada89;     /* l'arbre */
  --orange: #da6a36;   /* l'affiche d'automne */

  --bg: #f7f1e6;
  --card: #ffffff;
  --ink: #1d2546;
  --muted: #5d6680;
  --line: #e6e1d8;
  --accent: var(--brique);
  --accent-ink: #ffffff;
  --water: var(--marine);
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg) url(eau.svg?v=4) 0 0 / 480px 480px;
  color: var(--ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--marine); }
img { max-width: 100%; height: auto; }

main, .top, .foot-in { max-width: 720px; margin: 0 auto; padding: 0 16px; }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-top: 12px; padding-bottom: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--marine); text-decoration: none; }
.brand img { width: 40px; height: auto; }
.top-link { font-size: .95rem; font-weight: 600; white-space: nowrap; }
.brand span { line-height: 1.15; }

.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.1; margin: 0 0 8px; letter-spacing: -.02em; color: var(--marine); }
.hero-home { display: flex; gap: 28px; align-items: center; }
.hero-logo { flex: 0 0 auto; width: 170px; }
@media (max-width: 560px) {
  .hero-home { flex-direction: column; align-items: flex-start; gap: 12px; }
  .hero-logo { width: 130px; }
}
.tagline { color: var(--brique); font-weight: 700; margin: 0 0 12px; text-transform: uppercase; font-size: .85rem; letter-spacing: .06em; }
.hero-nl .tagline { margin-bottom: 6px; }
.lead { font-size: 1.1rem; color: var(--muted); }

h2 { font-size: 1.3rem; margin: 36px 0 14px; color: var(--marine); }
h2::after { content: ""; display: block; width: 44px; height: 4px; border-radius: 4px; background: var(--saone); margin-top: 6px; }
.card h2::after { display: none; }

.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  padding: 12px 20px; border-radius: 6px; text-decoration: none; font-weight: 700; border: 0;
  font-size: 1rem; cursor: pointer;
}
.btn:hover { filter: brightness(.92); }
.btn-small { padding: 7px 14px; font-size: .9rem; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: #b3261e; }

.event {
  display: flex; gap: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.event-date {
  flex: 0 0 58px; min-height: 62px; align-self: flex-start; padding: 8px 0; border-radius: 4px; background: var(--ev, var(--marine)); color: var(--ev-txt, #fff);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
}
.event-date .d { font-size: 1.5rem; font-weight: 800; }
.event-date .m { font-size: .75rem; text-transform: uppercase; opacity: .85; }
.event-date .p { margin-top: 6px; line-height: 0; }
.event-date .p svg { width: 24px; height: 24px; }
.event-body { min-width: 0; flex: 1; }
.event-body h3 { margin: 0 0 4px; font-size: 1.15rem; }
.event-asso { margin: 0 0 2px; font-size: .8rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.event-infos { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.event-img { display: block; border-radius: 4px; margin: 10px 0; max-height: 420px; width: auto; }
.event-desc { margin: 8px 0; overflow-wrap: anywhere; }

.top-nav { display: flex; gap: 16px; }

.pubs { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-top: 20px; }
.pub { background: var(--card); border: 1px solid var(--line); border-top: 6px solid var(--saone); border-radius: var(--radius); padding: 18px; }
.pub-canard { border-top-color: var(--brique); }
.pub h2 { margin: 0; font-size: 1.5rem; }
.pub h2::after { display: none; }
.pub-rythme { margin: 0 0 4px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.pub-genre { margin: 2px 0 14px; color: var(--muted); }
.pub .archive { margin-top: 14px; font-size: .95rem; }

.article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.article-coul { border-top: 5px solid var(--art); }
.article-picto { float: left; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin: 0 12px 6px 0; border-radius: 50%; background: var(--art, var(--ciel)); color: var(--art-txt, var(--marine)); }
.article-picto svg { width: 22px; height: 22px; }
.entete { margin: 8px 0 0; }
.entete img { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: var(--radius); }
.entete figcaption { margin-top: 4px; font-size: .8rem; color: var(--muted); text-align: right; }
.pub-entete { display: block; width: 100%; max-height: 150px; object-fit: contain; margin-bottom: 12px; border-radius: 4px; }
.article h3 { margin: 0 0 4px; font-size: 1.35rem; line-height: 1.25; color: var(--marine); }
.article-auteur { margin: 0 0 12px; font-size: .8rem; font-weight: 700; color: var(--brique); text-transform: uppercase; letter-spacing: .04em; }
.article-img { display: block; border-radius: 4px; margin: 12px 0; }
.article p { overflow-wrap: anywhere; }
.article p:last-child { margin-bottom: 0; }
.encart { background: var(--ciel); border-radius: var(--radius); padding: 4px 16px 14px; margin-top: 28px; }
.encart h2 { margin-top: 18px; }
.encart-note { margin: 4px 0 0; font-size: .9rem; color: var(--muted); }
.hero-canard h1 { font-family: Georgia, "Times New Roman", serif; }
.articles .article h3 { font-family: Georgia, "Times New Roman", serif; }

.archive { list-style: none; padding: 0; margin: 0; }
.archive li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.archive span { color: var(--muted); font-size: .9rem; white-space: nowrap; }

.empty { color: var(--muted); font-style: italic; }
.back { margin: 28px 0; }
.banner { background: #fff3cd; border: 1px solid #f0d98a; border-radius: 4px; padding: 10px 14px; font-size: .9rem; }

.foot { margin-top: 48px; background: #fff; }
.wave { display: block; width: 100%; height: 44px; }
.foot { background: linear-gradient(transparent 43px, #fff 43px); }
.wave .w1 { fill: var(--saone); }
.wave .w2 { fill: var(--marine); }
.foot-in { padding-top: 26px; padding-bottom: 26px; text-align: center; }
.foot-title { margin: 0 0 14px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.membres { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 14px 30px; }
.membres img { display: block; height: 64px; width: auto; }
.membres li:nth-child(2) img { height: 86px; }
.membres li:nth-child(4) img { height: 44px; }
.foot-line { margin: 0; color: var(--muted); font-size: .85rem; }

/* ---------------------------------------------------------------- mots fléchés */

.fl { margin-bottom: 18px; }
/* La grille est volontairement en niveaux de gris (elle s'imprime aussi en noir et blanc). */
.fl-clue { position: sticky; top: 6px; z-index: 2; margin: 0 0 8px; padding: 9px 12px; border-radius: 4px; background: #3a3a3a; color: #fff; font-weight: 600; min-height: 2.6em; }
.fl-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 1px; max-width: calc(var(--cols) * 60px); background: #3a3a3a; border: 2px solid #3a3a3a; border-radius: 3px; overflow: hidden; }
.fl-c { aspect-ratio: 1; min-width: 0; background: #fff; }
.fl-vide { background: #cfcfcf; }
.fl input.fl-l { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; text-align: center; text-transform: uppercase; font: 700 clamp(15px, 4.4vw, 26px)/1 system-ui, sans-serif; color: #1a1a1a; caret-color: #1a1a1a; }
.fl input.fl-l:focus { outline: 3px solid #1a1a1a; outline-offset: -3px; }
.fl input.fl-on { background: #e9e9e9; }
.fl input.fl-ok { color: #1a7f37; }
.fl input.fl-ko { background: #fde7e5; color: #b3261e; }
.fl-def { display: flex; flex-direction: column; background: #f1f1f1; }
.fl-d { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; padding: 1px 9px 1px 2px; border: 0; background: none; color: #1a1a1a; font: 600 clamp(6px, 1.3vw, 9.5px)/1.1 system-ui, sans-serif; text-align: center; cursor: pointer; overflow: hidden; }
.fl-d span { overflow: hidden; overflow-wrap: break-word; hyphens: auto; max-height: 100%; }
.fl-d + .fl-d { border-top: 1px solid #3a3a3a; }
.fl-d::after { position: absolute; color: #1a1a1a; font-size: 11px; line-height: 1; }
.fl-dh::after { content: "▶"; right: 1px; top: 50%; transform: translateY(-50%); }
.fl-dv { padding: 1px 2px 9px; }
.fl-dv::after { content: "▼"; bottom: 0; left: 50%; transform: translateX(-50%); }
.fl-d.fl-on { background: #dcdcdc; }
.fl-actions { margin: 12px 0 4px; }
.fl-msg { margin: 6px 0; font-weight: 700; color: var(--marine); min-height: 1.4em; }
.fl-liste { font-size: .95rem; }
.fl-liste summary { cursor: pointer; color: var(--marine); font-weight: 600; }
.fl-liste p { margin: 10px 0 2px; font-weight: 700; }
.fl-liste ul { margin: 0; padding-left: 20px; }
/* Sur petit écran les définitions ne tiennent plus dans les cases : restent les flèches, la définition s'affiche au-dessus */
@media (max-width: 640px) {
  .fl-d span { display: none; }
  .fl-d, .fl-dv { padding: 0; }
  .fl-d::after { position: static; transform: none; font-size: 12px; }
}

/* choix de la couleur et du picto d'un événement (admin) */
.choix { display: flex; flex-wrap: wrap; gap: 6px; }
.choix label { margin: 0; cursor: pointer; }
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix span { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 4px; border: 2px solid var(--line); background: #fff; color: var(--ink); font-size: .7rem; font-weight: 600; }
.choix svg { width: 22px; height: 22px; }
.choix input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.choix input:focus-visible + span { outline: 3px solid var(--brique); outline-offset: 2px; }
.choix-couleur span { border-radius: 50%; border-color: transparent; }
.choix-couleur span.sans { border-radius: 4px; border-color: var(--line); width: auto; padding: 0 8px; }

/* aperçu avec solution (admin) */
table.fl { border-collapse: collapse; }
table.fl td { width: 30px; height: 30px; border: 1px solid #3a3a3a; text-align: center; font-weight: 700; padding: 0; }
table.fl td.fl-vide { background: #cfcfcf; }
table.fl td.fl-def { background: #f1f1f1; color: #1a1a1a; font-size: 11px; }
.fl-apercu { overflow-x: auto; }
.fl-saisie { width: 100%; border-collapse: collapse; }
.fl-saisie th { text-align: left; font-size: .85rem; padding: 0 4px 4px; }
.fl-saisie td { padding: 3px 4px; }
.fl-saisie td:first-child { width: 34%; }

/* ---------------------------------------------------------------- admin */

body.admin { background: var(--bg); }

.admin main { max-width: 820px; }
.admin h1 { font-size: 1.6rem; margin: 20px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card h2 { margin-top: 0; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 4px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=url], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #cfc6b6; border-radius: 3px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1 1 160px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 14px 0; }
.check input { width: 18px; height: 18px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }

.flash { padding: 10px 14px; border-radius: 4px; margin: 14px 0; }
.flash.ok { background: #e3f4e6; border: 1px solid #a9d8b1; }
.flash.err { background: #fde7e5; border: 1px solid #f0b0aa; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: .88rem; }
.pill { font-size: .75rem; padding: 2px 8px; border-radius: 6px; background: #e3f4e6; }
.pill.draft { background: #eee; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 3px; }
.qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr img { width: 170px; height: 170px; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.qr code { overflow-wrap: anywhere; }
form.inline { display: inline; }
