/* ooEvent : le cadre de l'agenda (intégré sur le site du média). Couleurs, polices et arrondi viennent des réglages
   du cadre (variables posées par cadre.js). Six formats : liste, compact, cartes, bento, bandeau, calendrier ; le détail
   d'un événement ; le formulaire « Proposer un événement » d'un lecteur. */

:root {
  --fond: #FFFFFF; --surface: #F6F4EF; --texte: #14171F; --discret: #5B6475; --accent: #B34700; --sur-accent: #FFFFFF; --bordure: #E2DDD3;
  --police-titres: "Montserrat", system-ui, sans-serif; --police-texte: "Inter", system-ui, sans-serif; --rayon: 12px; --esp: 16px;
  --erreur: #B42318;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--fond); color: var(--texte); }
body { font-family: var(--police-texte); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.cadre { padding: var(--esp); }
.densite-aeree { --esp: 22px; }
.densite-serree { --esp: 10px; font-size: 15px; }

.entete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: var(--esp); }
.entete-texte { flex: 1 1 240px; min-width: 0; }
.logo { height: 28px; width: auto; max-width: 180px; object-fit: contain; object-position: left center; }
.cadre-titre { margin: 0; font-family: var(--police-titres); font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 700; line-height: 1.15; }
.sous-titre { margin: 4px 0 0; color: var(--discret); }

/* Outils du lecteur */
.outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: var(--esp); }
.champ { display: block; }
.champ.recherche { flex: 1 1 220px; }
.outils input, .outils select { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--fond); border: 1px solid var(--bordure); border-radius: calc(var(--rayon) * .6); }
.outils select { width: auto; max-width: 100%; }
.quand { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { min-height: 40px; padding: 6px 14px; border: 1px solid var(--bordure); border-radius: 999px; background: var(--fond); cursor: pointer; font-size: .92rem; }
.puce[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 600; }
.choix-dates { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.champ-date { display: inline-flex; align-items: center; gap: 6px; font-size: .92rem; font-weight: 600; }
.outils .champ-date input { width: auto; min-height: 40px; padding: 6px 10px; }
.proposer-bouton { margin-left: auto; min-height: 40px; padding: 6px 14px; border: 1px solid var(--accent); border-radius: 999px;
  background: var(--fond); color: var(--accent); font-size: .92rem; font-weight: 600; cursor: pointer; }
.proposer-bouton::before { content: "+ "; }
.proposer-bouton:hover { background: var(--accent); color: var(--sur-accent); }
.outils > .proposer-bouton:only-child { margin-left: 0; }

/* Morceaux communs */
.ev { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.titre { display: block; font-family: var(--police-titres); font-weight: 700; line-height: 1.25; }
.surtitre { margin: 0 0 3px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.surtitre .statut { color: var(--erreur); }
.meta { margin: 4px 0 0; font-size: .9rem; color: var(--discret); }
.ev.annule .titre { text-decoration: line-through; text-decoration-thickness: 1px; }
.ev:hover .titre { color: var(--accent); }
.vide, .aide { color: var(--discret); padding: var(--esp) 0; margin: 0; }
.mention { margin: var(--esp) 0 0; font-size: .75rem; color: var(--discret); text-align: right; }

/* Liste par jour */
.jour + .jour { margin-top: calc(var(--esp) * 1.2); }
.jour-titre { margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--texte); font-family: var(--police-titres); font-size: 1.05rem; font-weight: 700; }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li + li { border-top: 1px solid var(--bordure); }
.ligne { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 12px 4px; border-radius: calc(var(--rayon) * .5); }
.ligne:hover { background: var(--surface); }
.ligne .heure { font-family: var(--police-titres); font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--texte); padding-top: 1px; }
.ligne .titre { font-size: 1.05rem; }
.ligne .heure.jusque { font-family: var(--police-texte); font-size: .74rem; font-weight: 600; line-height: 1.3; color: var(--discret); text-transform: uppercase; letter-spacing: .03em; }

.voir-plus { min-height: 40px; margin-top: 6px; padding: 0 2px; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; }

/* Compact (colonne) */
.compact { list-style: none; margin: 0; padding: 0; }
.compact li + li { border-top: 1px solid var(--bordure); }
.ligne-compacte { padding: 10px 2px; }
.c-date { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.ligne-compacte .titre { font-size: .98rem; margin-top: 2px; }
.c-lieu { display: block; font-size: .85rem; color: var(--discret); margin-top: 2px; }

/* Cartes, bento, bandeau */
.carte { position: relative; display: flex; flex-direction: column; overflow: hidden; height: 100%; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); }
.carte .corps { display: block; padding: 0 var(--esp) var(--esp); }
.carte .titre { font-size: 1.08rem; }
.carte .visuel { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.pastille-date { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; align-self: flex-start;
  min-width: 54px; margin: var(--esp) var(--esp) 10px; padding: 6px 8px; border-radius: calc(var(--rayon) * .6); background: var(--accent); color: var(--sur-accent); line-height: 1; }
.pd-jour { font-family: var(--police-titres); font-size: 1.45rem; font-weight: 800; }
.pd-jusque { margin-bottom: 3px; font-size: .62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.pd-mois { margin-top: 3px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.carte:hover { border-color: var(--accent); }

.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--esp); }

.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(150px, auto); grid-auto-flow: dense; gap: var(--esp); }
.bento .vedette { grid-column: span 2; grid-row: span 2; background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.bento .vedette .titre { font-size: clamp(1.4rem, 3.4vw, 2.1rem); color: var(--sur-accent); }
.bento .vedette .surtitre, .bento .vedette .meta { color: var(--sur-accent); opacity: .9; }
.bento .vedette .pastille-date { background: var(--sur-accent); color: var(--accent); }
.bento .vedette .corps { margin-top: auto; }
.bento .large { grid-column: span 2; }
.bento .haute { grid-row: span 2; }
.bento .haute .corps { margin-top: auto; }
.bento .haute .titre { font-size: 1.25rem; }

.bandeau { position: relative; display: flex; align-items: stretch; gap: 6px; }
.piste { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 31%); gap: var(--esp); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; flex: 1; scrollbar-width: thin; }
.piste > .carte { scroll-snap-align: start; }
.fleche { flex: 0 0 auto; width: 44px; min-height: 44px; border: 1px solid var(--bordure); border-radius: calc(var(--rayon) * .6); background: var(--fond); font-size: 1.5rem; line-height: 1; cursor: pointer; align-self: center; }
.fleche:hover { border-color: var(--accent); color: var(--accent); }

/* Calendrier du mois */
.cal-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-mois { margin: 0; font-family: var(--police-titres); font-size: 1.2rem; font-weight: 700; }
.cal-semaine, .cal-grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-semaine span { padding: 4px 0; text-align: center; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--discret); }
.case { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; min-height: 54px; padding: 6px 2px;
  border: 1px solid var(--bordure); border-radius: calc(var(--rayon) * .5); background: var(--fond); font-variant-numeric: tabular-nums; }
.case.vide { border: 0; background: none; }
.case:disabled { color: var(--discret); opacity: .55; cursor: default; }
.case.occupee { cursor: pointer; background: var(--surface); font-weight: 700; }
.case.occupee:hover { border-color: var(--accent); }
.case.aujourdhui .num { text-decoration: underline; text-underline-offset: 3px; }
.case.choisie, .case[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.case.choisie .point { background: var(--sur-accent); }
.points { display: flex; gap: 3px; align-items: center; font-size: .7rem; line-height: 1; }
.point { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.cal-grille + .jour, .cal-grille + .aide { margin-top: var(--esp); }

/* Détail */
.detail { max-width: 720px; }
.retour { min-height: 44px; margin: 0 0 10px; padding: 0 2px; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; }
.visuel-detail { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--rayon); margin-bottom: var(--esp); }
.detail-titre { margin: 0 0 10px; font-family: var(--police-titres); font-size: clamp(1.4rem, 4vw, 2rem); font-weight: 700; line-height: 1.15; }
.detail-titre:focus { outline: none; }
.description { margin: 0 0 var(--esp); }
.infos { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 var(--esp); }
.infos dt { font-weight: 700; color: var(--discret); }
.infos dd { margin: 0; overflow-wrap: anywhere; }
.infos dd a { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.action { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--accent); border-radius: calc(var(--rayon) * .6);
  background: var(--fond); color: var(--accent); font-weight: 600; text-decoration: none; cursor: pointer; }
.action.principale { background: var(--accent); color: var(--sur-accent); }
.action[aria-disabled="true"] { opacity: .6; cursor: progress; }

/* Proposer un événement (formulaire d'un lecteur) */
.proposer { max-width: 720px; }
.f-intro { margin: 0 0 var(--esp); color: var(--discret); }
.formulaire .bloc { min-width: 0; margin: 0 0 var(--esp); padding: var(--esp); border: 1px solid var(--bordure); border-radius: var(--rayon); }
.formulaire .bloc > legend { padding: 0 6px; font-family: var(--police-titres); font-size: 1.05rem; font-weight: 700; }
.formulaire .f-groupe { min-width: 0; margin: 0 0 14px; padding: 0; border: 0; }
.formulaire .f-groupe > legend { padding: 0; }
.facultatif { font-weight: 400; color: var(--discret); font-size: .9em; }
.f-champ { margin: 0 0 14px; min-width: 0; }
.f-etiquette { display: block; margin-bottom: 4px; font-weight: 600; }
.f-aide { margin: 0 0 6px; font-size: .86rem; color: var(--discret); }
.f-champ > .f-aide:last-child, .f-accord > .f-aide { margin: 6px 0 0; }
.f-erreur { margin: 0 0 6px; font-size: .9rem; font-weight: 600; color: var(--erreur); }
.f-note { margin: 0 0 14px; }
.formulaire input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), .formulaire select, .formulaire textarea {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px; background: var(--fond); color: var(--texte);
  border: 1px solid var(--bordure); border-radius: calc(var(--rayon) * .6); }
.formulaire textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
.formulaire input:disabled { opacity: .55; }
.formulaire [aria-invalid="true"] { border-color: var(--erreur); box-shadow: 0 0 0 1px var(--erreur); }
.formulaire input[type="radio"], .formulaire input[type="checkbox"] { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.f-ligne { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.f-modes { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 2px 0 12px; }
.f-mode { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.f-mode input[type="radio"] { margin: 0; }
.f-case { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 14px; }
.f-case label { cursor: pointer; }
.f-autres:empty { display: none; }
.f-autre { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 0 10px; align-items: end; }
.f-autre .lien-bouton { margin-bottom: 14px; }
.lien-bouton { min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; }
.lien-bouton:hover { text-decoration: underline; }
.formulaire input[type="file"] { max-width: 100%; font-size: .92rem; }
.formulaire input[type="file"]::file-selector-button { min-height: 40px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--accent);
  border-radius: calc(var(--rayon) * .6); background: var(--fond); color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.formulaire input[type="file"][aria-invalid="true"] { box-shadow: none; }
.affiche { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; padding: 10px; background: var(--surface);
  border: 1px solid var(--bordure); border-radius: calc(var(--rayon) * .6); }
.affiche-miniature { display: block; max-width: 160px; max-height: 160px; border-radius: calc(var(--rayon) * .4); }
.affiche-pdf { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 64px; border: 2px solid var(--accent);
  border-radius: 6px; color: var(--accent); font-family: var(--police-titres); font-weight: 800; font-size: .85rem; }
.affiche-infos { flex: 1 1 180px; min-width: 0; font-size: .9rem; overflow-wrap: anywhere; }
.f-accord { margin: 0 0 var(--esp); }
.f-accord .f-case { margin: 0; }
.piege { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.f-statut { margin: 0 0 10px; }
.f-statut:empty { display: none; }
.f-statut.erreur { color: var(--erreur); font-weight: 600; }
.f-statut.info { padding: 10px 12px; border-radius: calc(var(--rayon) * .6); background: var(--surface); border: 1px solid var(--bordure); font-weight: 600; }
.merci p { margin: 0 0 var(--esp); max-width: 62ch; }
.merci strong { overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(140px, auto); }
  .bento .haute { grid-row: span 1; }
  .piste { grid-auto-columns: minmax(220px, 80%); }
  .fleche { display: none; }
  .proposer-bouton { margin-left: 0; }
}
@media (max-width: 420px) {
  .bento .large { grid-column: span 2; }
  .infos { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .infos dd { margin-bottom: 8px; }
  .ligne { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; }
  .f-autre { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .f-autre .lien-bouton { grid-column: 1 / -1; justify-self: start; margin: -8px 0 8px; }
  .formulaire .bloc { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) { .piste { scroll-behavior: auto; } }

/* « Ajouter à mon agenda » (ooEvent 1.18) : déplié dans la page, l'iframe suit la hauteur */
.agenda-fleche { margin-left: 8px; display: inline-block; transition: transform .15s; }
[aria-expanded="true"] .agenda-fleche { transform: rotate(180deg); }
.agenda-menu { flex-basis: 100%; padding: 12px; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); }
.agenda-menu[hidden] { display: none; }
.agenda-question { margin: 0 0 6px; font-family: var(--police-titres); font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--discret); }
.agenda-choix-liste { display: grid; gap: 6px; margin-bottom: 12px; }
.agenda-choix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-height: 44px; padding: 6px 10px; background: var(--fond); border: 1px solid var(--bordure); border-radius: calc(var(--rayon) * .6); cursor: pointer; }
.agenda-choix input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
.agenda-choix input[type="date"] { margin-left: auto; min-height: 36px; padding: 2px 6px; background: var(--fond); color: var(--texte); border: 1px solid var(--bordure); border-radius: calc(var(--rayon) * .4); }
.agenda-choix small, .agenda-liste small { display: block; font-size: .8rem; font-weight: 400; color: var(--discret); }
.agenda-liste { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.agenda-liste a, .agenda-liste button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: calc(var(--rayon) * .6); background: none; color: var(--texte); font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
.agenda-liste a:hover, .agenda-liste button:hover { background: var(--fond); }
.agenda-pastille { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; font-family: var(--police-titres); font-size: .78rem; font-weight: 800; color: #FFFFFF; }
.agenda-google { background: #1A73E8; } .agenda-outlook { background: #0F6CBD; } .agenda-m365 { background: #243A5E; } .agenda-apple { background: #3C3C43; } .agenda-fichier { background: #6B7280; font-size: .66rem; }
@media (prefers-reduced-motion: reduce) { .agenda-fleche { transition: none; } }
