@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Instrument+Sans:wght@400;500;600&display=swap");

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --ink: #16181f;
  --text: #1a1d26;
  --muted: #5a6070;
  --soft: #4a4f5e;
  --accent: #7a1f2b;
  --accent-dark: #5e1620;
  --gold: #d9a441;
  --border: #e4e0d6;
  --border-strong: #d8d3c6;
  --stone: #ece8df;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.container { width: min(1120px, 100% - 4rem); margin-inline: auto; }
@media (max-width: 600px) { .container { width: calc(100% - 2rem); } }

/* En-tête sombre (commun) */
.site-header { background: var(--ink); color: #fff; }
.site-header .container {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem 2rem; padding-block: 1.75rem;
}
.logo { display: flex; align-items: center; gap: 0.75rem; color: #fff; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; }
.logo:hover { color: #fff; }
.logo svg { flex: none; }
.logo small {
  font-family: var(--sans); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--gold); background: rgba(217, 164, 65, 0.18); padding: 0.2rem 0.6rem; border-radius: 999px;
}
nav ul { display: flex; gap: 1.75rem; margin: 0; padding: 0; list-style: none; }
nav a { color: #b9bdc9; font-weight: 500; font-size: 0.95rem; padding-block: 0.25rem; }
nav a:hover, nav a[aria-current="page"] { color: #fff; }

/* Hero (accueil) */
.hero { background: var(--ink); color: #fff; padding: 3rem 0 8rem; }
.hero .container { max-width: 1120px; }
.eyebrow { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin: 0 0 1.25rem; }
.hero h1 {
  font-family: var(--serif); font-weight: 500; font-size: clamp(2.2rem, 5.5vw, 4rem);
  line-height: 1.05; letter-spacing: -0.025em; margin: 0; max-width: 46rem;
}
.hero .lead { font-size: 1.15rem; color: #b9bdc9; max-width: 38rem; margin: 1.5rem 0 2.5rem; }

.searchbox {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  background: var(--surface); border-radius: 16px; padding: 0.6rem; max-width: 51rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.searchbox .field { flex: 1 1 18rem; display: flex; align-items: center; gap: 0.75rem; padding: 0 0.9rem; min-height: 3.5rem; }
.searchbox .field svg { flex: none; color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 1.1rem; color: var(--text); background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 1.25rem; font-size: 0.9rem; color: #9096a5; }
.chip {
  font: inherit; font-size: 0.9rem; color: #e6e8ee; background: rgba(255, 255, 255, 0.08); border: 0;
  padding: 0.5rem 1rem; border-radius: 999px; cursor: pointer;
}
.chip:hover { background: rgba(255, 255, 255, 0.16); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 3rem;
  background: var(--accent); color: #fff; padding: 0 1.75rem; border: 0; border-radius: 10px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.searchbox .btn { min-height: 3.5rem; padding-inline: 2rem; }

/* Résultats de recherche */
.results-wrap { margin-top: -4rem; position: relative; }
#results:empty { display: none; }
#results {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.75rem 2rem; box-shadow: 0 12px 40px rgba(26, 29, 38, 0.08);
}
.count { color: var(--muted); font-size: 0.9rem; margin: 0 0 1rem; }
.result { border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 0.75rem; }
.result:hover { border-color: var(--accent); }
.result h3 { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; margin: 0; }
.result .meta { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
.result .snippet { margin: 0.4rem 0 0; font-size: 0.95rem; color: var(--soft); }
.result .pg { font-weight: 600; margin-right: 0.25rem; }
mark { background: #f7e2a6; color: inherit; padding: 0 0.15em; border-radius: 2px; }
.empty { color: var(--muted); font-style: italic; }

/* Sections */
main section { padding: 4rem 0; }
h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0 0 1rem; color: var(--text); }
.section-label { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin: 0 0 1rem; }

/* Histoire */
.history { display: flex; flex-wrap: wrap; gap: 3.5rem; padding-top: 6rem; }
.history .intro { flex: 1 1 18rem; }
.history .intro p { color: var(--soft); font-size: 1.05rem; }
.timeline { flex: 1.4 1 26rem; list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; margin: 0 0 0 0.4rem; padding: 0 0 2.25rem 1.75rem; border-left: 2px solid var(--gold); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 0.4rem; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.timeline li:last-child::before { background: var(--gold); }
.timeline .year { display: block; font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--accent); }
.timeline strong { display: block; font-size: 1.1rem; }
.timeline p { margin: 0.3rem 0 0; color: var(--soft); }

/* Missions */
.cards { display: flex; flex-wrap: wrap; gap: 1rem; }
.card { flex: 1 1 14rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.75rem; }
.card .num { font-family: var(--serif); font-size: 2rem; font-weight: 600; color: var(--gold); line-height: 1; }
.card h3 { font-size: 1.2rem; margin: 0.75rem 0 0.5rem; }
.card p { margin: 0; color: var(--soft); }

/* Derniers bulletins */
.latest { background: var(--stone); }
.latest-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 2rem; }
.latest-head h2 { margin: 0; }
.latest-head a { font-weight: 600; }
.thumbs { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.thumb { flex: 1 1 12rem; max-width: 22rem; color: var(--text); display: flex; flex-direction: column; gap: 0.85rem; }
.thumb:hover { color: var(--accent); }
.thumb .page {
  aspect-ratio: 3 / 4; max-height: 21rem; background: var(--surface); border-radius: 10px; padding: 1.75rem;
  box-shadow: 0 10px 30px rgba(26, 29, 38, 0.12); display: flex; flex-direction: column; gap: 0.6rem;
}
.thumb .page i { display: block; height: 6px; background: var(--border); border-radius: 2px; }
.thumb .page i.t { height: 10px; width: 60%; background: var(--accent); }
.thumb .page i.s { width: 75%; }
.thumb .page i.img { flex: 1; height: auto; background: #f0ede5; border-radius: 4px; margin: 0.5rem 0; }
.thumb strong { font-size: 1.1rem; display: block; }
.thumb span { color: var(--muted); font-size: 0.9rem; }

/* Page Bulletins */
.page-title { background: var(--ink); color: #fff; padding: 1rem 0 3.5rem; }
.page-title h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.025em; margin: 0 0 0.5rem; }
.page-title p { margin: 0; color: #b9bdc9; font-size: 1.1rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-bottom: 0.5rem; }
.toolbar label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.toolbar select, .toolbar input {
  font: inherit; min-height: 3rem; padding: 0 1rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
}
.toolbar input { flex: 1 1 18rem; }

.year-group h2 { font-size: 2rem; margin: 2.25rem 0 1rem; }
.bulletin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.bulletin {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.25rem;
}
.bulletin:hover { border-color: var(--accent); }
.bulletin .icon {
  flex: none; width: 2.75rem; height: 3.5rem; display: grid; place-items: center;
  background: #f3e3e4; color: var(--accent); border-radius: 6px; font-size: 0.7rem; font-weight: 700;
}
.bulletin .info { flex: 1 1 14rem; min-width: 0; }
.bulletin .info strong { display: block; font-size: 1.1rem; }
.bulletin .info span { color: var(--muted); font-size: 0.9rem; }
.bulletin .open { font: inherit; font-weight: 600; cursor: pointer; }
.bulletin button.open {
  min-height: 2.75rem; padding: 0 1.4rem; border: 0; border-radius: 10px; background: var(--accent); color: #fff;
}
.bulletin button.open:hover { background: var(--accent-dark); }
.bulletin a.open {
  min-height: 2.75rem; padding: 0 1.25rem; display: inline-flex; align-items: center;
  border: 1px solid var(--border-strong); border-radius: 10px; color: var(--text);
}
.bulletin a.open:hover { border-color: var(--accent); color: var(--accent); }
.bulletin button.danger { font: inherit; font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; color: #a01818; }

/* Lecteur PDF */
.viewer { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 12px 40px rgba(26, 29, 38, 0.08); margin-bottom: 3rem; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); }
.viewer-bar strong { font-family: var(--serif); font-size: 1.25rem; }
.viewer iframe { display: block; width: 100%; height: 80vh; border: 0; background: #e9e6de; }
button.linklike { font: inherit; font-weight: 600; cursor: pointer; background: none; border: 0; padding: 0; color: var(--muted); }
button.linklike:hover { color: var(--accent); }
#viewer-dl { font-weight: 600; margin-right: 1rem; }

/* Admin */
.admin-grid { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; }
.panel h2 { font-size: 1.9rem; margin-bottom: 1.5rem; }
.admin-grid .panel:first-child { flex: 1 1 24rem; }
.admin-grid .panel:last-child { flex: 1.2 1 26rem; min-width: 0; background: none; border: 0; padding: 0; }
.form { display: grid; gap: 0.5rem; max-width: 34rem; }
.form label { font-weight: 600; font-size: 0.95rem; margin-top: 0.75rem; }
.form input { font: inherit; min-height: 3rem; padding: 0 0.9rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.form input[type="file"] { padding: 0.7rem 0.9rem; background: #faf8f3; border-style: dashed; border-width: 2px; }
.form .btn { justify-self: stretch; margin-top: 1rem; min-height: 3.25rem; }
.form .btn:disabled { opacity: 0.6; cursor: wait; }
.msg { margin: 0.5rem 0 0; min-height: 1.5em; color: var(--muted); font-size: 0.95rem; }
.msg.ok { color: #2f6b3f; background: #e6f2e8; padding: 0.75rem 1rem; border-radius: 10px; }
.msg.err { color: #a01818; }
.logout-row { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0.5rem; }
.login-wrap { max-width: 28rem; margin-inline: auto; }

/* Pied de page */
.site-footer { background: var(--ink); color: #b9bdc9; padding: 2.5rem 1rem; font-size: 0.95rem; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.site-footer a { color: #b9bdc9; text-decoration: underline; }
.site-footer a:hover { color: #fff; }
.site-footer strong { color: #fff; font-family: var(--serif); font-size: 1.15rem; }

@media (max-width: 600px) {
  #results { padding: 1.25rem; }
  .hero { padding-bottom: 7rem; }
  .viewer iframe { height: 70vh; }
}

/* Textes de l'association */
.expos { margin: 0.5rem 0 0; padding-left: 1.2rem; color: var(--soft); }
.expos li { position: static; margin: 0.25rem 0; padding: 0; border: 0; }
.expos li::before { display: none; }
.project { padding-top: 0; }
.project-box { background: var(--ink); color: #fff; border-radius: 16px; padding: 2.5rem; }
.project-box .section-label { color: var(--gold); }
.project-text { font-family: var(--serif); font-size: clamp(1.2rem, 2.4vw, 1.6rem); line-height: 1.5; margin: 0; }
.news { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: 16px; padding: 2.5rem; max-width: 52rem; }
.news p { color: var(--soft); }
.news h2 { margin-bottom: 1.25rem; }

.news-row { display: flex; flex-wrap: wrap; gap: 2rem; align-items: flex-start; }
.news-photo { flex: 0 1 22rem; margin: 0; position: sticky; top: 1.5rem; }
.news-photo img { display: block; width: 100%; height: auto; border-radius: 16px; box-shadow: 0 12px 40px rgba(26, 29, 38, 0.15); }
.news-row .news { flex: 1 1 26rem; max-width: none; }
@media (max-width: 900px) { .news-photo { position: static; flex-basis: 100%; } .news-photo img { max-height: 26rem; object-fit: cover; object-position: center 40%; } }

/* Identité */
.identity .card { flex: 1 1 20rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; margin: 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; color: var(--soft); }

.site-footer a.adm { display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none; font-size: 0.85rem; opacity: 0.8; }
.site-footer a.adm:hover { opacity: 1; }

/* Pied de page toujours en bas de la fenêtre */
main { flex: 1 0 auto; }
.site-footer { margin-top: auto; flex-shrink: 0; }

/* Images de couverture */
.thumb .cover {
  display: block; width: 100%; aspect-ratio: 3 / 4; max-height: 21rem; object-fit: contain; object-position: center;
  padding: 0.5rem; background: var(--surface); border-radius: 10px; box-shadow: 0 10px 30px rgba(26, 29, 38, 0.12);
}
.thumb:hover .cover { box-shadow: 0 14px 36px rgba(26, 29, 38, 0.2); }
.cover-thumb { flex: none; width: 2.75rem; height: 3.5rem; object-fit: contain; object-position: center; background: var(--surface); padding: 2px; border-radius: 6px; border: 1px solid var(--border); }
.hint { margin: 0; font-size: 0.85rem; color: var(--muted); }
.opt { font-weight: 400; color: var(--muted); }
.bulletin button.linklike { font-size: 0.9rem; font-weight: 600; text-decoration: underline; }

/* Activités */
.activities-intro { color: var(--soft); font-size: 1.05rem; margin: 0 0 1.5rem; }
.activities .card { flex: 1 1 18rem; border-top: 3px solid var(--gold); }
.outings { margin-top: 2.5rem; max-width: 52rem; }
.outings h3 { font-family: var(--serif); font-size: 1.6rem; font-weight: 500; margin: 0 0 0.75rem; }
.outings p { color: var(--soft); }
.escapades { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.escapades li { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; padding: 1.1rem 1.4rem; }
.escapades strong { display: block; font-size: 1.1rem; }
.escapades span { color: var(--soft); }

/* Blason (logo) */
.logo-img { display: block; height: 3rem; width: auto; flex: none; }

/* Logos de l'association */
.logos { margin: 2rem 0 0; }
.logos-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 1.75rem; }
.logos-row img { display: block; height: auto; }
.logos-row img:first-child { width: 11rem; max-width: 100%; }
.logos-row img:last-child { width: 7.5rem; max-width: 100%; }
.logos figcaption { margin-top: 0.9rem; font-size: 0.95rem; font-style: italic; color: var(--muted); max-width: 22rem; }

/* Agenda */
.agenda { padding-top: 2rem; padding-bottom: 1rem; }
.agenda-intro { color: var(--soft); font-size: 1.05rem; margin: 0 0 1.5rem; }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; max-width: 52rem; }
.event { display: flex; gap: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.1rem 1.4rem 1.1rem 1.1rem; }
.event-badge {
  flex: none; width: 4.75rem; min-height: 4.75rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 0.4rem 0.3rem; text-align: center;
}
.event-badge strong { font-family: var(--serif); font-size: 1.6rem; line-height: 1.1; }
.event-badge span { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.event-body { min-width: 0; }
.event-type {
  display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); background: #f3e3e4; padding: 0.15rem 0.6rem; border-radius: 999px;
}
.event h3 { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; margin: 0.4rem 0 0.2rem; }
.event p { margin: 0.15rem 0; color: var(--soft); }
.event-when { font-weight: 600; color: var(--text) !important; }
.event-when::first-letter { text-transform: uppercase; }
.event-where::before { content: "Lieu : "; font-weight: 600; color: var(--muted); }
.event-desc { margin-top: 0.5rem !important; }
@media (max-width: 520px) { .event { flex-direction: column; gap: 0.75rem; } .event-badge { flex-direction: row; gap: 0.5rem; width: auto; min-height: 0; align-self: flex-start; padding: 0.4rem 0.9rem; } }

/* Admin : calendrier */
.form select, .form textarea { font: inherit; padding: 0.7rem 0.9rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.form select { min-height: 3rem; }
.form textarea { resize: vertical; line-height: 1.5; }
.form .linklike { justify-self: start; text-decoration: underline; }
.events-admin { margin-top: 2.5rem; }
.ev-group { font-family: var(--serif); font-size: 1.2rem; margin: 1.25rem 0 0.6rem; }
.ev-group:first-child { margin-top: 0; }
.bulletin.past { opacity: 0.65; }

/* Confort tactile (mobile et tablette) : zones cliquables d'au moins ~44 px */
@media (max-width: 1024px) {
  nav a { display: inline-block; padding-block: 0.7rem; }
  .chip { min-height: 2.75rem; }
  .site-footer a.adm { padding: 0.8rem 0.5rem; }
  .site-footer a[href^="mailto"], .site-footer a[href^="tel"], .card a { display: inline-block; padding-block: 0.4rem; }
  .latest-head a { display: inline-block; padding-block: 0.6rem; }
  .rep-num a { display: inline-block; padding: 0.35rem 0.25rem; }
}

/* Formulaires : ne jamais dépasser la largeur de l'écran */
.panel { min-width: 0; }
.admin-grid .panel:first-child { flex-basis: 18rem; }
.form { grid-template-columns: minmax(0, 1fr); min-width: 0; }
.form input, .form select, .form textarea { min-width: 0; max-width: 100%; width: 100%; }
.form input[type="file"] { font-size: 0.9rem; }
@media (max-width: 600px) { .panel { padding: 1.25rem; } }

@media (max-width: 1024px) {
  #admin-list .bulletin, #admin-events .bulletin { gap: 0 1rem; }
  #admin-list .linklike, #admin-list .danger, #admin-events .linklike, #admin-events .danger,
  #admin-list a.open { padding: 0.75rem 0.1rem; min-height: 2.75rem; }
  #admin-list a.open { display: inline-flex; align-items: center; border: 0; }
  #admin-list .bulletin .info, #admin-events .bulletin .info { flex-basis: 100%; }
  #admin-list .cover-thumb { margin-right: -0.25rem; }
}
