:root {
  --brand: #009fe3;        /* bleu azur Esenca */
  --brand-dark: #007cb8;
  --brand-light: #e6f5fd;
  --accent: #ea5b0c;       /* orange Esenca */
  --accent-dark: #c94d0a;
  --ink: #333333;
  --muted: #6a7580;
  --bg: #f4f8fb;
  --card: #ffffff;
  --border: #e1e8ee;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 120, 180, 0.08);
  --shadow-hover: 0 10px 32px rgba(0, 120, 180, 0.16);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap {
  width: min(1080px, 92%);
  margin: 0 auto;
}

/* Header */
.site-header {
  background: linear-gradient(120deg, var(--brand) 0%, #12b0f0 100%);
  color: #fff;
  padding: 2.6rem 0 3.8rem;
  clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
}
.btn-doc {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.6rem 1.1rem;
  border-radius: 10px;
  transition: background 0.15s, transform 0.1s;
}
.btn-doc:hover { background: #fff; color: var(--brand-dark); }
.btn-doc:active { transform: scale(0.98); }
.btn-doc:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.site-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.site-header h1 span { color: var(--accent); }
.subtitle {
  margin: 0.4rem 0 0;
  opacity: 0.92;
  font-size: 1.02rem;
}

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin-top: -1.6rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}
.filter { display: flex; flex-direction: column; gap: 0.3rem; }
.filter label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.filter select {
  appearance: none;
  min-width: 190px;
  padding: 0.6rem 2.2rem 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236b7a72' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.8rem center;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
}
.filter select:focus-visible,
.btn-reset:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.btn-reset {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-reset:hover { background: var(--brand-light); color: var(--brand-dark); }
.filter-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.filter-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
  cursor: pointer;
}
.result-count {
  margin: 0 0 0 auto;
  align-self: center;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

/* Events — sections mensuelles + lignes */
.events {
  margin: 1.6rem 0 3rem;
}
.month-group + .month-group { margin-top: 1.6rem; }
.month-title {
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.01em;
  margin: 0 0 0.9rem;
}
.month-group:first-child .month-title { margin-top: 0; }

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}
.event-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1.05rem;
  box-shadow: 0 4px 14px rgba(0, 60, 110, 0.07);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s;
}
.event-card:hover,
.event-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand);
  outline: none;
}
.event-card.past { opacity: 0.5; }
.event-card.past:hover,
.event-card.past:focus-visible { opacity: 0.9; }

.card-date {
  flex: none;
  width: 50px;
  text-align: center;
  color: var(--brand-dark);
}
.card-date .day { display: block; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.card-date .mon {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.card-divider {
  flex: none;
  align-self: stretch;
  width: 2px;
  background: var(--brand-light);
  border-radius: 2px;
}
.card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.card-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.8rem;
  font-size: 0.86rem;
  color: var(--muted);
}
.card-sub > span { display: inline-flex; align-items: center; gap: 0.3rem; }
.card-sport {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Bouton flottant "Filtrer" + feuille */
.filter-fab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 80, 140, 0.35);
  transition: background 0.15s, transform 0.12s;
}
.filter-fab[hidden] { display: none; }
.filter-fab:hover { background: var(--brand-dark); }
.filter-fab:active { transform: translateX(-50%) scale(0.97); }
.filter-fab:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.fab-ico { display: block; }
.fab-count {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  min-width: 1.3rem;
  height: 1.3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
}
.fab-count[hidden] { display: none; }

.filter-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.filter-sheet[hidden] { display: none; }
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 30, 45, 0.45);
  animation: fade 0.2s ease;
}
.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 1rem 1.2rem 1.5rem;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  max-height: 85vh;
  overflow-y: auto;
  animation: sheetUp 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.9rem;
}
.sheet-close {
  border: none;
  background: var(--bg);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sheet-close:hover { background: var(--brand-light); color: var(--brand-dark); }

/* La barre de filtres, quand elle est déplacée dans la feuille */
.filters.in-sheet {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.9rem;
}
.filters.in-sheet .filter { width: 100%; }
.filters.in-sheet .filter select { width: 100%; }
.filters.in-sheet .result-count { display: none; }

.btn-apply {
  display: block;
  width: 100%;
  margin-top: 1.1rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-apply:hover { background: var(--brand-dark); }
.btn-apply:active { transform: scale(0.99); }
.btn-apply:focus-visible { outline: 2px solid var(--brand-dark); outline-offset: 2px; }

/* States */
.state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}
.state.error { color: #b3261e; }
.spinner {
  width: 34px; height: 34px;
  margin: 0 auto 1rem;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.overlay[hidden] { display: none; }
.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 30, 22, 0.55);
  backdrop-filter: blur(2px);
  animation: fade 0.2s ease;
}
.overlay-card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.8rem 1.7rem 1.7rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: pop 0.22s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
.overlay-close {
  position: absolute;
  top: 0.8rem; right: 0.9rem;
  border: none;
  background: var(--bg);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.overlay-close:hover { background: var(--brand-light); color: var(--brand-dark); }
.ov-sport {
  display: inline-block;
  background: var(--brand-light);
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.overlay-card h2 {
  margin: 0.7rem 0 1rem;
  font-size: 1.4rem;
  line-height: 1.25;
}
.ov-meta {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.ov-meta li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-size: 0.98rem;
  color: var(--ink);
}
.ov-meta .ic { flex: none; }
.ov-desc {
  font-size: 0.94rem;
  color: var(--muted);
  white-space: pre-wrap;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-bottom: 1.3rem;
  word-break: break-word;
}
.ov-desc a { color: var(--brand-dark); }
.ov-desc:empty { display: none; }
.btn-inscription {
  display: block;
  text-align: center;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  transition: background 0.15s, transform 0.1s;
}
.btn-inscription:hover { background: var(--brand-dark); }
.btn-inscription:active { transform: scale(0.99); }
.btn-inscription.disabled {
  background: var(--border);
  color: var(--muted);
  pointer-events: none;
}
.ov-member {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  text-align: center;
  color: var(--muted);
  line-height: 1.5;
}
.ov-member a { color: var(--accent); font-weight: 700; text-decoration: none; }
.ov-member a:hover { text-decoration: underline; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.4rem 0;
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}
.site-footer p { margin: 0.25rem 0; }
.site-footer a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-membre { display: inline-flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
.footer-cta {
  display: inline-block;
  border: 1.5px solid var(--brand);
  color: var(--brand-dark) !important;
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s;
}
.footer-cta:hover { background: var(--brand); color: #fff !important; text-decoration: none; }

@media (max-width: 560px) {
  .filters { flex-direction: column; align-items: stretch; }
  .filter select { width: 100%; }
  .result-count { margin: 0.2rem 0 0; }
}
