/* =====================================================================
   STYLE DU SITE - polices hébergées localement (pas d'appel à Google)
   Mise en page : bandeau, frise des jours, carte collante + programme
   ===================================================================== */

/* Polices locales */
@font-face { font-family: "Marcellus"; src: url("fonts/marcellus-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jost"; src: url("fonts/jost-var.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/plexmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/plexmono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* Couleurs : thème clair par défaut */
:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1b2340;
  --muted: #5d6478;
  --line: #dcd8cf;
  --lapis: #22408f;
  --gold: #a97a1f;
  --flight: #8a4fb0;
  --chip: #ebe7de;
  --font-display: "Marcellus", Georgia, serif;
  --font-body: "Jost", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}

/* Couleurs : thème sombre si le téléphone est en mode sombre */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1326; --panel: #161c34; --ink: #ece6d6; --muted: #a3a8bd; --line: #2a3150;
    --lapis: #8ea8f2; --gold: #e2b65a; --flight: #c79cf0; --chip: #1e2542;
    color-scheme: dark;
  }
}

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left)); }
button { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Bandeau */
header.hero { padding: 36px 0 20px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(2.1rem, 5.5vw, 3.8rem); line-height: 1.05; margin: 8px 0 10px; text-wrap: balance; }
h1 em { font-style: normal; color: var(--lapis); }
.sub { color: var(--muted); max-width: 60ch; margin: 0; }
.countdown { text-align: right; }
.countdown .n { font-family: var(--font-display); font-size: clamp(2.6rem, 6vw, 4rem); line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.countdown .l { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* Frise des jours */
.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scroll-snap-type: x mandatory; }
.days button { scroll-snap-align: start; flex: 0 0 auto; border: 1px solid var(--line); background: var(--chip); border-radius: 999px; padding: 6px 14px; font-weight: 500; font-size: 14px; cursor: pointer; display: flex; gap: 6px; align-items: baseline; }
.days button .d { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.days button[aria-pressed="true"] { background: var(--lapis); border-color: var(--lapis); color: var(--bg); }
.days button[aria-pressed="true"] .d { color: var(--bg); opacity: .8; }
.days button.today { box-shadow: 0 0 0 2px var(--gold); }

/* Grille principale */
.grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.mapcol { position: sticky; top: 12px; min-width: 0; }
.mapbox { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--chip); }
#map { height: min(76vh, 760px); width: 100%; }
#map.illus { background: #1c1f30; }
#map.illus .leaflet-tooltip.lbl { background: #161c34; color: #ece6d6; border-color: #2a3150; }
.mapbox.full { position: fixed; inset: 0; z-index: 2000; border-radius: 0; border: 0; }
.mapbox.full #map { height: 100vh; height: 100dvh; }

/* Boutons de la carte */
.maptools { position: absolute; top: 10px; left: 56px; right: 56px; z-index: 1000; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.maptools button { pointer-events: auto; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 500; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.maptools button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #fff; }
.status { position: absolute; left: 10px; bottom: 26px; z-index: 1000; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; max-width: calc(100% - 20px); }

/* Panneau de partage de position */
.share { position: absolute; z-index: 1100; top: 52px; left: 56px; width: min(320px, calc(100% - 66px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: 14px; }
.share-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.share-head b { font-family: var(--font-display); font-weight: 400; font-size: 17px; }
.share-head button { border: 0; background: none; cursor: pointer; font-size: 16px; color: var(--muted); }
.share p { margin: 6px 0; }
.share fieldset { border: 0; padding: 0; margin: 6px 0; }
.share legend, .share label { font-size: 13px; color: var(--muted); }
.share .who { display: flex; gap: 6px; margin-top: 4px; }
.share .who button { flex: 1; border: 1px solid var(--line); background: var(--chip); border-radius: 8px; padding: 6px; cursor: pointer; }
.share .who button[aria-pressed="true"] { background: var(--lapis); color: var(--bg); border-color: var(--lapis); }
.share input[type="password"] { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; margin: 4px 0 8px; }
.share .primary { width: 100%; border: 0; border-radius: 8px; padding: 8px; background: var(--lapis); color: var(--bg); font-weight: 600; cursor: pointer; }
.share .switch { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); font-size: 15px; cursor: pointer; }
.share .switch input { width: 20px; height: 20px; accent-color: #d62828; }
.share .small { font-size: 13px; }
.share .muted { color: var(--muted); font-size: 12px; }
.share .err { color: #d62828; font-size: 13px; }
.share .link { border: 0; background: none; color: var(--lapis); padding: 0; cursor: pointer; font-size: 13px; text-decoration: underline; }
.share .other { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; margin: 8px 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.share .other button { border: 1px solid var(--line); background: var(--chip); border-radius: 8px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.mate { width: 30px; height: 30px; border-radius: 50%; background: #e0457b; border: 3px solid #fff; color: #fff; display: grid; place-items: center; font: 700 13px/1 var(--font-body); box-shadow: 0 0 0 2px #e0457b, 0 2px 8px rgba(0,0,0,.5); }
.mate.old { background: #9a8a92; box-shadow: 0 0 0 2px #9a8a92, 0 2px 8px rgba(0,0,0,.5); }

/* Légende */
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); padding-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid; }
.legend b { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }

/* Marqueurs Leaflet */
.pin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.45); }
.pin.stop { width: 26px; height: 26px; background: #d62828; border: 3px solid #fff; display: grid; place-items: center; color: #fff; font: 600 11px/1 var(--font-body); box-shadow: 0 0 0 2px #d62828, 0 2px 6px rgba(0,0,0,.5); }
.pin.poi { width: 11px; height: 11px; border-width: 2px; opacity: .85; }
.leaflet-tooltip.prog-lbl { font-weight: 600; font-size: 13px; border-color: #d62828; display: none; }
#map.show-lbl .leaflet-tooltip.prog-lbl { display: block; }
.pin.stay { background: var(--lapis); }
.me { width: 18px; height: 18px; border-radius: 50%; background: #1e88ff; border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(30,136,255,.6); animation: me 2s infinite; }
@keyframes me { 0% { box-shadow: 0 0 0 0 rgba(30,136,255,.6); } 100% { box-shadow: 0 0 0 16px rgba(30,136,255,0); } }
@media (prefers-reduced-motion: reduce) { .me { animation: none; } }

/* Bulles d'information */
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--ink); }
.leaflet-popup-content { font-family: var(--font-body); font-size: 14px; line-height: 1.45; margin: 12px 14px; }
.pop h4 { font-family: var(--font-display); font-weight: 400; font-size: 17px; margin: 0 0 2px; }
.pop .cat { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.pop p { margin: 6px 0; }
.pop .approx { color: var(--muted); font-size: 12px; }
.pop a { color: var(--lapis); font-weight: 500; }
.leaflet-tooltip.lbl { background: var(--panel); color: var(--ink); border: 1px solid var(--line); font-family: var(--font-body); font-size: 12px; font-weight: 500; padding: 1px 6px; box-shadow: none; }
.leaflet-tooltip.lbl::before { display: none; }
.leaflet-control-layers { font-family: var(--font-body); }
.leaflet-container { font-family: var(--font-body); }

/* Programme */
.prog { display: grid; gap: 14px; min-width: 0; }
.day { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; scroll-margin-top: 16px; cursor: pointer; }
.day.sel { border-color: var(--lapis); box-shadow: 0 0 0 1px var(--lapis); }
.day header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.day h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.45rem; margin: 0; text-wrap: balance; }
.day .date { font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.day .where { color: var(--muted); font-size: 14px; margin: 2px 0 10px; }
.day ul { margin: 0; padding-left: 18px; }
.day li { margin: 3px 0; }
.day .vig { color: var(--muted); font-size: 14px; border-top: 1px dashed var(--line); padding-top: 8px; margin: 10px 0 0; }
.extra { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.extra h3 { font-size: 13px; font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.extra .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.extra button { border: 1px solid var(--line); background: var(--chip); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.extra button i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* Billet d'avion */
.ticket { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; border: 1px dashed var(--flight); border-radius: 10px; padding: 10px 14px; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.ticket .t { font-family: var(--font-mono); font-size: 20px; font-weight: 500; }
.ticket .c { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.ticket .mid { text-align: center; font-family: var(--font-mono); font-size: 12px; color: var(--flight); border-bottom: 1px solid var(--flight); padding-bottom: 2px; }
.ticket .r { text-align: right; }

/* Bloc « Rester joignables » */
.safety { margin-top: 36px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.safety h2 { grid-column: 1 / -1; font-family: var(--font-display); font-weight: 400; font-size: 1.8rem; margin: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p, .card li { font-size: 14px; color: var(--muted); }
.card ul { padding-left: 18px; margin: 0; }
.num { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }
footer { margin-top: 32px; font-size: 12px; color: var(--muted); }

/* Téléphone : carte au-dessus, programme dessous */
@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .mapcol { position: relative; top: 0; }
  #map { height: 62vh; }
  header.hero { grid-template-columns: 1fr; }
  .countdown { text-align: left; }
}
