/* ============================================================
   viewer.css — l'IMOCA en 3D, interface en verre liquide.

   Même matière que le module Tenues de Violette : fond bleu façon
   initiatives-coeur.fr, verre clair et neutre, réfraction des bords
   (Chromium, voir liquid-glass.js), liseré qui accroche la lumière du
   côté de la souris, apparitions qui rebondissent. Tout en Inter
   (variable, embarquée).
   Vrai flou d'arrière-plan réservé à la carte (une seule surface au-dessus
   du WebGL) ; les pastilles imitent le verre sans flouter.
   ============================================================ */

@font-face { font-family: 'IC Craie'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/caveat-brush-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IC Inter'; font-weight: 100 900; font-style: normal; font-display: swap; src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2-variations'), url('../fonts/inter-latin-wght-normal.woff2') format('woff2'); }

/* Angle de la lumière qui accroche le verre (suit la souris) : animable. */
@property --lg-light {
  syntax: '<angle>';
  inherits: true;
  initial-value: -40deg;
}

:root {
  --navy: #293258;        /* bleu du site initiatives-coeur.fr */
  --navy-deep: #1b2143;
  --navy-night: #12162e;
  --rouge: #e30613;
  --ink: #fff;
  --ink-soft: rgba(255, 255, 255, 0.9);
  --ink-quiet: rgba(255, 255, 255, 0.66);
  --glass-tint: rgba(16, 20, 38, 0.3);   /* teinte neutre : le verre ne vire pas au bleu */
  --glass-sheen: rgba(255, 255, 255, 0.16);
  --title: 'IC Inter', 'Inter', system-ui, -apple-system, sans-serif;
  --body: 'IC Inter', 'Inter', system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.36, 0.5, 1); /* léger rebond : le verre est « liquide » */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(120% 90% at 50% 18%, #3a4677 0%, var(--navy) 42%, var(--navy-deep) 78%, var(--navy-night) 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* Le pinch pilote la caméra, pas le zoom de la page. */
  touch-action: none;
  overscroll-behavior: none;
}

#stage {
  position: absolute; inset: 0;
  transition: --lg-light 600ms ease-out;
}
#three-canvas { position: absolute; inset: 0; z-index: 1; }
#three-canvas canvas { display: block; width: 100%; height: 100%; cursor: grab; }
#three-canvas canvas:active { cursor: grabbing; }

/* ---------- Verre liquide (matière commune) ---------- */

.glass {
  isolation: isolate;
  background:
    linear-gradient(165deg, var(--glass-sheen), transparent 45%),
    var(--glass-tint);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.45),
    inset 0 -1px 1px rgba(255, 255, 255, 0.12),
    inset 0 0 24px rgba(255, 255, 255, 0.06),
    0 18px 40px rgba(6, 10, 30, 0.32),
    0 3px 10px rgba(6, 10, 30, 0.18);
}
/* Liseré : deux reflets opposés, orientés vers la lumière (la souris). */
.glass::before {
  content: '';
  position: absolute; inset: 0; z-index: 2;
  border-radius: inherit;
  padding: 1.2px;
  background: conic-gradient(
    from calc(var(--lg-light) - 70deg),
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.95) 19%,
    rgba(255, 255, 255, 0.14) 38%,
    rgba(255, 255, 255, 0.05) 52%,
    rgba(255, 255, 255, 0.5) 69%,
    rgba(255, 255, 255, 0.08) 86%,
    rgba(255, 255, 255, 0.1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ---------- Chargement ---------- */

.loader {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  transition: opacity 0.6s ease;
}
.loader.hidden { opacity: 0; pointer-events: none; }
/* Un cœur qui se dessine, se referme et bat doucement. */
.loader-heart { width: 54px; height: 50px; overflow: visible; animation: heart-beat 1.6s ease-in-out infinite; }
.loader-heart path { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.loader-heart .heart-track { stroke: rgba(255, 255, 255, 0.16); }
.loader-heart .heart-draw {
  stroke: #fff; stroke-dasharray: 100 100;
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.55));
  animation: heart-draw 1.6s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}
@keyframes heart-draw {
  0% { stroke-dashoffset: 100; }
  55% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -100; }
}
@keyframes heart-beat {
  0%, 100% { transform: scale(1); }
  55% { transform: scale(1.08); }
  70% { transform: scale(0.98); }
}
.loader .label {
  font-family: var(--title); font-size: 13px; font-weight: 500;
  letter-spacing: 0.01em; color: var(--ink-quiet);
  text-align: center; max-width: 80%; line-height: 1.6;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Lignes de rappel ---------- */

.leaders-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 3; overflow: visible;
  filter: drop-shadow(0 0 3px rgba(6, 10, 30, 0.7));
  transition: opacity 0.3s ease;
}
.leader-line {
  stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.5; stroke-linecap: round; fill: none;
}
.leader-line, .leader-anchor { transition: opacity 0.2s ease 0.22s; }
.leader-line.hidden, .leader-anchor.hidden { opacity: 0 !important; transition: opacity 0.12s ease; }
.leader-anchor { fill: #fff; }
.leader-anchor:not(.hidden) { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { r: 3.5; } 50% { r: 5; } }

/* ---------- Pastilles : petites bulles de verre ---------- */

.hotspots-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }

/* ---------- Fiche du bateau (survol, vue générale) ---------- */
.fiche {
  position: absolute; z-index: 8;
  top: max(16px, env(safe-area-inset-top)); right: 16px;
  padding: 10px 16px 12px; border-radius: 18px;
  opacity: 0; translate: 0 -6px; pointer-events: none;
  transition: opacity 0.3s ease, translate 0.45s var(--spring);
}
.fiche.show { opacity: 1; translate: 0 0; }
.fiche > * { position: relative; z-index: 3; }
.fiche-title { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-quiet); margin-bottom: 6px; }
.fiche dl { display: grid; gap: 3px; margin: 0; }
.fiche dl + dl { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.fiche dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.fiche dt { font-size: 11.5px; color: var(--ink-quiet); }
.fiche dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.edition .fiche { top: calc(max(16px, env(safe-area-inset-top)) + 64px); }
/* Sous le bouton plein écran, quand il est là. */
.has-fs:not(.edition) .fiche { top: calc(max(16px, env(safe-area-inset-top)) + 44px); }

/* ---------- Plein écran (même bouton que le Globe des courses) ----------
   Une pastille de verre en haut à droite, à la hauteur de Voiles et Nuit.
   Au survol, rien ne change (seulement la main) ; au clavier, un contour
   rouge. Les quatre coins d'un carré, tracés en blanc. */
.fs-btn {
  position: absolute; right: 16px; top: max(16px, env(safe-area-inset-top)); z-index: 8;
  display: inline-flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 14px 0 11px; border: 0; border-radius: 999px;
  color: var(--ink); cursor: pointer;
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
}
.fs-btn[hidden] { display: none; }
.fs-btn > * { position: relative; z-index: 3; }
.fs-btn:focus { outline: none; }
.fs-btn:focus-visible { outline: 2px solid var(--rouge); outline-offset: 2px; }
.fs-btn-label { font: 700 10px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; }
.fs-btn-icon { width: 16px; height: 16px; flex-shrink: 0; transition: transform 0.3s ease; }
.fs-btn-icon::before, .fs-btn-icon::after {
  content: ''; position: absolute; inset: 0;
  border: 2px solid currentColor; border-radius: 2px;
}
.fs-btn-icon::before { clip-path: polygon(0 0, 40% 0, 40% 2px, 2px 2px, 2px 40%, 0 40%, 0 100%, 40% 100%, 40% calc(100% - 2px), 2px calc(100% - 2px), 2px 60%, 0 60%); }
.fs-btn-icon::after { clip-path: polygon(60% 0, 100% 0, 100% 40%, calc(100% - 2px) 40%, calc(100% - 2px) 2px, 60% 2px, 60% 100%, 100% 100%, 100% 60%, calc(100% - 2px) 60%, calc(100% - 2px) calc(100% - 2px), 60% calc(100% - 2px)); }
.fs-btn.is-active .fs-btn-icon { transform: rotate(180deg); }
/* Site d'édition : à gauche de la barre d'édition, sur la même ligne. */
.edition .fs-btn { right: calc(16px + min(420px, 100% - 32px) + 10px); }
/* Le temps du survol, les pastilles s'effacent devant la craie. */
.hotspot, .leader-line, .leader-anchor { transition: opacity 0.25s ease; }
body.fiche-on .hotspot, body.fiche-on .leader-line, body.fiche-on .leader-anchor { opacity: 0 !important; pointer-events: none; }

/* ---------- Annotations à la craie (craie.js) ---------- */
.craie {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 3; overflow: visible;
  -webkit-user-select: none; user-select: none;
}
.craie text {
  font-family: 'IC Craie', 'Segoe Print', 'Comic Sans MS', cursive;
  fill: #fff; letter-spacing: 0.01em;
}
.craie-stroke {
  fill: none; stroke: #fff; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round;
}
.craie-stroke.thin { stroke-width: 1.3; stroke-opacity: 0.6; }
.craie-stroke.ghost { stroke-width: 1.6; stroke-opacity: 0.45; }
.craie-stroke.dash { stroke-dasharray: 2 6; }
/* Dessin fin (fiche du bateau) : traits de cote, comme au tire-ligne. */
.craie-set.fine .craie-stroke { stroke-width: 1.1; }
/* Filets d'air (calque sans grain) : fins, en pointillés qui avancent. */
.craie-free .craie-stroke { fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; }
.craie-free .craie-stroke.flow { stroke-width: 1; stroke-opacity: 0.55; }
.craie-free .craie-stroke.flowtip { stroke-width: 1.1; stroke-opacity: 0.7; }
.craie-free .craie-stroke.flow.moving { stroke-dasharray: 6 10; animation: craie-flow 1.4s linear infinite; }
.craie-free .craie-stroke.far { stroke-opacity: 0.16; }
@keyframes craie-flow { to { stroke-dashoffset: -16; } }
@media (prefers-reduced-motion: reduce) { .craie-free .craie-stroke.flow.moving { animation: none; } }
.craie-set.fine .craie-stroke.thin { stroke-width: 0.8; stroke-opacity: 0.5; }
.craie-big { opacity: 0.97; }
.craie-mid { opacity: 0.92; }
.craie-small { opacity: 0.82; }
.craie-formula { opacity: 0.5; }
.craie-sub { opacity: 0.62; }
.craie-formula ~ .craie-sub { opacity: 0.42; }

.hotspot {
  position: absolute; top: 0; left: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 13px 3px 3px;
  border: 0; border-radius: 999px;
  color: var(--ink); cursor: pointer; white-space: nowrap;
  pointer-events: auto;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.3), transparent 60%),
    rgba(20, 26, 52, 0.42);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.6),
    inset 0 -1px 1px rgba(255, 255, 255, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 6px 18px rgba(6, 10, 30, 0.35);
  transition: opacity 0.25s ease 0.12s, background 0.2s ease;
}
.hotspot:hover, .hotspot:focus-visible {
  outline: none;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.42), transparent 60%),
    rgba(30, 38, 74, 0.55);
}
.hotspot.active {
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.5), transparent 60%),
    rgba(40, 50, 96, 0.62);
}
.hotspot.hidden { opacity: 0 !important; pointer-events: none; transition: opacity 0.2s ease 0.14s; }
/* Point ouvert (ordinateur) : la pastille s'est posée sur la carte et s'y fond. */
.hotspot.docked { opacity: 0 !important; pointer-events: none; transition: opacity 0.35s ease; }
.hotspot .num {
  width: 10px; height: 10px; margin: 0 0 0 7px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--title); font-size: 12px; font-weight: 650;
  font-variant-numeric: tabular-nums; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff4a55, var(--rouge) 70%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 2px 6px rgba(120, 0, 10, 0.4);
}
.hotspot.sail-pin .num { width: 24px; height: 24px; margin: 0; }
.hotspot .num svg, .card-num svg {
  width: 14px; height: 14px;
  fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.card-num svg { width: 16px; height: 16px; }
.hotspot .lbl {
  font-family: var(--title); font-size: 13px; font-weight: 600;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 6px rgba(6, 10, 30, 0.45);
}

/* Un élément ouvert : le reste passe à 20 %, comme le bateau. */
body.has-active .hotspot:not(.active) { opacity: 0.2; }
body.has-active .hotspot:not(.active):hover { opacity: 0.6; }
body.has-active .leader-line:not(.active),
body.has-active .leader-anchor:not(.active) { opacity: 0.2; animation: none; }

/* ---------- Aide : comment se déplacer (bas à gauche, discrète) ---------- */

.aide {
  position: absolute; left: 18px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 6;
  display: flex; flex-wrap: wrap; gap: 4px 16px;
  max-width: calc(100% - 36px); margin: 0;
  font-size: 11px; font-weight: 500; line-height: 18px; letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.4);
  pointer-events: none; user-select: none;
  opacity: 0; transition: opacity 0.8s ease;
}
.aide.show { opacity: 1; }
.aide > span { white-space: nowrap; }
.aide kbd {
  display: inline-block; margin-right: 6px; padding: 0 6px;
  font: inherit; font-weight: 600; line-height: 16px;
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 6px;
}

/* ---------- Relevé de caméra (débogage, ?hud, très discret) ---------- */

.hud {
  position: absolute; left: 50%; bottom: max(6px, env(safe-area-inset-bottom)); z-index: 6;
  translate: -50% 0;
  font-size: 10px; font-weight: 500; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums; white-space: pre;
  color: rgba(255, 255, 255, 0.32);
  pointer-events: none;
}

/* ---------- Halo : cœur de lumière très flou derrière le bateau ---------- */

.halo {
  position: absolute; left: 50%; top: 50%; z-index: 0;
  --halo-night: calc(1 - 0.85 * var(--night, 0));
  width: min(120vmin, 1100px); aspect-ratio: 62 / 57.4;
  translate: -50% -46%;
  opacity: calc(0.55 * var(--halo, 1) * var(--halo-night));
  filter: blur(min(11vmin, 110px));
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.halo svg { width: 100%; height: 100%; display: block; }
.halo path { fill: #9aa8e6; }

/* ---------- Bouton et panneau des voiles ---------- */

.top-tools {
  position: absolute; left: 16px; top: max(16px, env(safe-area-inset-top)); z-index: 8;
  display: flex; gap: 8px;
}
.sails-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px 9px 13px; border: 0; border-radius: 999px;
  color: var(--ink); font: 600 14px/1 var(--body); letter-spacing: -0.01em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  backdrop-filter: blur(8px) saturate(140%);
  transition: background 0.2s ease;
}
.sails-btn[hidden] { display: none; }
#sails-btn { transition: opacity 0.25s ease, background 0.2s ease; }
body.has-active #sails-btn,
body.has-active #night-btn { opacity: 0; pointer-events: none; }
.sails-btn > * { position: relative; z-index: 3; }
.sails-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sails-btn:hover, .sails-btn:focus-visible, .sails-btn[aria-expanded='true'] { outline: none; --glass-tint: rgba(40, 50, 96, 0.45); }

.sails-panel {
  position: absolute; left: 16px; top: calc(max(16px, env(safe-area-inset-top)) + 50px); z-index: 8;
  width: min(300px, calc(100% - 32px));
  padding: 14px; border-radius: 24px;
  -webkit-backdrop-filter: blur(12px) saturate(140%) brightness(1.06);
  backdrop-filter: var(--lg-lens,) blur(12px) saturate(140%) brightness(1.06);
  opacity: 0; scale: 0.94; transform-origin: 20px 0;
  pointer-events: none;
  transition: opacity 0.18s ease-in, scale 0.18s ease-in;
}
.sails-panel.open {
  opacity: 1; scale: 1; pointer-events: auto;
  transition: opacity 0.25s ease, scale 0.4s var(--spring);
}
.sails-group { position: relative; z-index: 3; }
.sails-group + .sails-group { margin-top: 14px; }
.sails-group h3 { font-size: 12px; font-weight: 500; color: var(--ink-quiet); margin: 0 4px 8px; }
.sails-options { display: flex; flex-wrap: wrap; gap: 6px; }
.sail-opt {
  border: 0; border-radius: 999px; cursor: pointer;
  padding: 7px 12px;
  font: 500 13px/1 var(--body); letter-spacing: -0.005em; color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: background 0.2s ease, color 0.2s ease;
}
.sail-opt:hover, .sail-opt:focus-visible, .sail-opt.hover { outline: none; background: rgba(255, 255, 255, 0.18); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.sail-opt.on {
  color: var(--ink); font-weight: 600;
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.4), transparent 60%),
    rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.28), 0 4px 12px rgba(6, 10, 30, 0.25);
}

/* ---------- Points seuls (fenêtre étroite ou très haute) ---------- */

.dots .hotspot {
  width: 32px; height: 32px; padding: 0; gap: 0; justify-content: center;
  background: transparent; box-shadow: none;
}
.dots .hotspot .lbl { display: none; }
.dots .hotspot .num, .dots .hotspot.sail-pin .num {
  width: 14px; height: 14px; margin: 0;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 2px 10px rgba(6, 10, 30, 0.55);
}
.dots .hotspot .num svg { display: none; }
.dots .hotspot::after {
  content: ''; position: absolute; inset: 7px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.75); pointer-events: none;
  animation: dot-ping 2.4s ease-out infinite;
}
.dots .hotspot.active .num { background: #fff; }
.dots .leader-line, .dots .leader-anchor { display: none; }
@keyframes dot-ping {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2); opacity: 0; }
}

/* ---------- Carte d'explication ---------- */

.card {
  position: absolute; right: 20px; top: 50%; z-index: 7;
  width: min(360px, calc(100% - 40px));
  max-height: calc(100% - 120px);
  display: flex; flex-direction: column;
  border-radius: 28px;
  -webkit-backdrop-filter: blur(12px) saturate(140%) brightness(1.06);
  backdrop-filter: var(--lg-lens,) blur(12px) saturate(140%) brightness(1.06);
  translate: 0 -50%;
  opacity: 0; scale: 0.92;
  pointer-events: none;
  transition: opacity 0.2s ease-in, scale 0.2s ease-in;
}
.card.open {
  opacity: 1; scale: 1; pointer-events: auto;
  transition: opacity 0.3s ease, scale 0.45s var(--spring);
}

.card-head {
  position: relative; z-index: 3;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 20px 10px;
}
.card-num:empty { display: none; }
.card-num {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--title); font-size: 14px; font-weight: 650; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff4a55, var(--rouge) 70%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 3px 8px rgba(120, 0, 10, 0.35);
}
.card-titles { flex: 1; min-width: 0; }
.card-eyebrow {
  font-size: 12px; font-weight: 500; letter-spacing: 0;
  color: var(--ink-quiet); margin-bottom: 2px;
}
.card-title {
  font-family: var(--title); font-weight: 650;
  font-size: 22px; line-height: 1.15; letter-spacing: -0.02em;
  color: var(--ink);
  text-shadow: 0 1px 10px rgba(6, 10, 30, 0.3);
}
.card-close {
  flex-shrink: 0; width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; cursor: pointer; color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition: background 0.2s ease, scale 0.3s var(--spring);
}
.card-close:hover, .card-close:focus-visible { outline: none; background: rgba(255, 255, 255, 0.2); scale: 1.08; }
.card-close svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 1.8; fill: none; }

.card-scroll { position: relative; z-index: 3; overflow-y: auto; min-height: 0; }
.card-body {
  position: relative; z-index: 3;
  padding: 2px 20px 16px 20px;
  font-size: 15px; font-weight: 450; line-height: 1.6; letter-spacing: -0.005em;
  color: var(--ink-soft);
  text-shadow: 0 1px 8px rgba(6, 10, 30, 0.35);
}

.card-foot {
  position: relative; z-index: 3;
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 0 20px 18px 20px;
}
.card-foot:not(:has(.card-btn:not([hidden]))) { display: none; }
.card-btn {
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  padding: 9px 15px;
  font: 600 13px/1 var(--body); color: var(--ink);
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255, 255, 255, 0.32), transparent 60%),
    rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  transition: background 0.2s ease, opacity 0.2s ease;
}
.card-btn[hidden] { display: none; }
.card-btn:hover, .card-btn:focus-visible { outline: none; background: rgba(255, 255, 255, 0.22); }
.card-btn[aria-disabled='true'] { opacity: 0.5; cursor: default; }

/* Pièce seule : plus d'eau ni de halo marqué, plus d'autres pastilles. */
body.solo .hotspot:not(.active), body.solo .leader-line:not(.active), body.solo .leader-anchor:not(.active) { opacity: 0 !important; pointer-events: none; }

/* ---------- Nuit ---------- */

.night-sky {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 12%, #0d1330 0%, #060a1d 48%, #020308 100%);
  opacity: var(--night, 0);
}
.night-btn[aria-pressed='true'] { --glass-tint: rgba(255, 255, 255, 0.16); }
.night-btn[aria-pressed='true'] svg { fill: currentColor; }

/* ---------- Vidéos des cartes ---------- */

.card-media {
  position: relative; z-index: 3;
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 20px 14px;
}
.card-media[hidden] { display: none; }

/* Logos des sponsors : blancs, posés sur le verre, cliquables (sites
   officiels). --h : hauteur propre à chaque logo (textes.js). */
.card-logos {
  position: relative; z-index: 3;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 26px;
  padding: 4px 20px 20px;
}
.card-logos[hidden] { display: none; }
.logo-pair { display: inline-flex; align-items: center; gap: 16px; }
/* Le petit logo d'à côté, après un filet. */
.logo-pair .logo-link.small { padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, 0.28); border-radius: 0; }
.logo-link {
  display: inline-flex; align-items: center;
  height: var(--h, 36px); border-radius: 6px;
  opacity: 0.9;
  transition: opacity 0.2s ease, translate 0.25s var(--spring);
}
.logo-link img { height: 100%; width: auto; display: block; filter: drop-shadow(0 1px 8px rgba(6, 10, 30, 0.35)); }
.logo-link:hover, .logo-link:focus-visible { outline: none; opacity: 1; translate: 0 -1px; }
.logo-link:focus-visible img { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7)); }
.video-chip {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 6px 12px 6px 6px; border: 0; border-radius: 16px; cursor: pointer;
  text-align: left; color: var(--ink); font: inherit;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
}
.video-chip:hover, .video-chip:focus-visible { outline: none; background: rgba(255, 255, 255, 0.14); }
.video-chip-thumb {
  position: relative; flex: 0 0 auto; width: 88px; aspect-ratio: 16 / 9;
  border-radius: 11px; overflow: hidden; background: #0b0f20;
}
.video-chip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-chip-thumb::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; translate: -50% -50%;
  border-radius: 50%;
  background: rgba(16, 20, 38, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 6.5v11l9-5.5z'/%3E%3C/svg%3E") center / 15px no-repeat;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 2px 8px rgba(6, 10, 30, 0.4);
  transition: scale 0.25s var(--spring);
}
.video-chip:hover .video-chip-thumb::after { scale: 1.12; }
.video-chip-text { min-width: 0; }
.video-chip-kicker { display: block; font-size: 11px; font-weight: 500; color: var(--ink-quiet); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.video-chip-title { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; letter-spacing: -0.005em; }

.video-modal {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(6, 9, 22, 0.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.video-modal[hidden] { display: none; }
.video-frame {
  position: relative; border-radius: 22px; padding: 10px;
  width: min(960px, 100%);
}
.video-frame.vertical { width: min(380px, 100%); }
.video-box { position: relative; z-index: 3; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; background: #000; }
.video-frame.vertical .video-box { aspect-ratio: 9 / 16; max-height: calc(100vh - 100px); margin: 0 auto; }
.video-box iframe { width: 100%; height: 100%; border: 0; display: block; }
/* Une photo (bout-dehors…) : à sa taille, dans la même fenêtre. */
.video-frame.photo .video-box { aspect-ratio: auto; }
.video-box img { width: 100%; height: auto; max-height: calc(100vh - 100px); object-fit: contain; display: block; }
.photo-chip .video-chip-thumb::after { content: none; }
.video-close { position: absolute; z-index: 4; right: -12px; top: -12px; background: rgba(20, 26, 52, 0.9); }

/* ---------- Embarquez : dans le bateau, la vidéo 360° en plein écran ---------- */

.ride { position: fixed; inset: 0; z-index: 50; outline: none; user-select: none; -webkit-user-select: none; }
.ride[hidden] { display: none; }
.ride-black { position: absolute; inset: 0; background: #000; opacity: 0; }
.ride-video { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity 0.9s ease; }
.ride.playing .ride-video { opacity: 1; }
/* L'iframe déborde en haut : le titre que YouTube y affiche reste hors de
   l'écran. Pas en bas : les sous-titres y sont (sans commandes, YouTube
   n'affiche rien d'autre en bas). Les gestes passent par .ride-pad. */
.ride-video iframe {
  position: absolute; left: 0; top: -80px; width: 100%; height: calc(100% + 80px);
  border: 0; pointer-events: none;
}
/* Secours : lecture bloquée par le navigateur → le bouton de YouTube. */
.ride.native .ride-video { opacity: 1; }
.ride.native .ride-video iframe { top: 0; height: 100%; pointer-events: auto; }
.ride.native .ride-pad { display: none; }
.ride-pad { position: absolute; inset: 0; touch-action: none; }
.ride.video .ride-pad { cursor: grab; }
.ride.video .ride-pad:active { cursor: grabbing; }
.ride-wait {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; margin: 0;
  font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.45);
  opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}
.ride.video:not(.playing):not(.native) .ride-wait { opacity: 1; transition-delay: 0.6s; }
.ride-center {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 12, 24, 0.45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; scale: 0.8; pointer-events: none;
  transition: opacity 0.5s ease, scale 0.5s var(--spring);
}
.ride-center.flash { opacity: 1; scale: 1; transition: opacity 0.12s ease, scale 0.3s var(--spring); }
.ride-center svg { position: absolute; width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ride-center .ride-icon-play path { fill: #fff; }
.ride-center:not(.paused) .ride-icon-play, .ride-center.paused .ride-icon-pause { display: none; }
.ride.paused .ride-center { opacity: 1; scale: 1; }
.ride-close {
  position: absolute; z-index: 2;
  right: max(18px, env(safe-area-inset-right)); top: max(18px, env(safe-area-inset-top));
  width: 42px; height: 42px;
  background: rgba(16, 20, 40, 0.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ride-close svg { width: 13px; height: 13px; }
.ride-sound {
  position: absolute; z-index: 2;
  right: calc(max(18px, env(safe-area-inset-right)) + 54px); top: max(22px, calc(env(safe-area-inset-top) + 4px));
  background: rgba(16, 20, 40, 0.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ride-sound[hidden] { display: none; }
/* Pendant la vidéo : le bouton et l'aide, qui s'effacent si la souris ne
   bouge plus (le bouton reste deviné). */
.ride-close, .ride-sound, .ride-aide { opacity: 0; pointer-events: none; transition: opacity 0.4s ease; }
.ride.video .ride-close, .ride.video .ride-sound { opacity: 1; pointer-events: auto; }
.ride.video .ride-aide { opacity: 1; }
.ride.video.idle .ride-close { opacity: 0.3; }
.ride.video.idle .ride-sound { opacity: 0.5; }
.ride.video.idle .ride-aide { opacity: 0; }
.ride.native .ride-aide { opacity: 0; }
/* Sur la vidéo, l'aide a besoin d'un fond pour rester lisible. */
.ride-aide {
  padding: 5px 12px; border-radius: 999px; max-width: calc(100% - 36px);
  color: rgba(255, 255, 255, 0.72);
  background: rgba(10, 12, 26, 0.5);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.ride-aide kbd { color: #fff; border-color: rgba(255, 255, 255, 0.28); }

/* La plongée : plus rien d'autre à l'écran. */
body.riding .hotspots-layer, body.riding .leaders-svg, body.riding .top-tools, body.riding .sails-panel,
body.riding #aide, body.riding .craie, body.riding .fiche, body.riding .edit-bar, body.riding .fs-btn {
  opacity: 0 !important; pointer-events: none !important; transition: opacity 0.3s ease;
}

/* ---------- Édition des textes (site d'édition, ou ?edition) ---------- */

.edit-bar {
  position: absolute; right: 16px; top: max(16px, env(safe-area-inset-top)); z-index: 9;
  width: min(420px, calc(100% - 32px));
  padding: 12px 14px; border-radius: 22px;
  display: flex; flex-direction: column; gap: 8px;
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
}
.edit-bar > * { position: relative; z-index: 3; }
.edit-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.edit-title { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; margin-right: auto; }
.edit-hint { font-size: 12px; color: var(--ink-quiet); line-height: 1.4; }
.edit-count { font-size: 12px; color: var(--ink-quiet); margin-right: auto; font-variant-numeric: tabular-nums; }
.edit-count.on { color: var(--ink); font-weight: 600; }
.edit-lang { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.edit-lang button, .edit-btn {
  border: 0; cursor: pointer; border-radius: 999px;
  font: 600 12px/1 var(--body); color: var(--ink-soft);
  background: transparent; padding: 7px 11px;
}
.edit-lang button.on { color: var(--ink); background: rgba(255, 255, 255, 0.2); }
.edit-btn {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: var(--ink);
}
.edit-btn:hover, .edit-btn:focus-visible { outline: none; background: rgba(255, 255, 255, 0.22); }
.edit-btn.quiet { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); color: var(--ink-soft); }

/* Champs de la carte : on voit qu'on peut écrire dedans. */
.edition .card-eyebrow, .edition .card-title, .edition .card-body {
  outline: 1px dashed transparent; outline-offset: 3px; border-radius: 6px;
  cursor: text; transition: outline-color 0.2s ease, background 0.2s ease;
}
.edition .card-eyebrow:hover, .edition .card-title:hover, .edition .card-body:hover {
  outline-color: rgba(255, 255, 255, 0.35);
}
.edition .card-eyebrow:focus, .edition .card-title:focus, .edition .card-body:focus {
  outline: 1px solid rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.06);
}
.edition .card-body { white-space: pre-wrap; }
.edit-length { position: relative; z-index: 3; padding: 0 20px 10px; font-size: 11px; color: var(--ink-quiet); font-variant-numeric: tabular-nums; }
.edit-length.long { color: #ffd2a6; }
:root:not(.edition) .edit-length { display: none; }
/* La barre d'édition occupe le haut à droite : la carte descend. */
.edition .card { top: calc(50% + 70px); max-height: calc(100% - 220px); }

/* ---------- Message d'erreur ---------- */

.fallback {
  position: absolute; inset: 0; z-index: 30;
  display: none; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.fallback.show { display: flex; }
.fallback p { font-size: 15px; line-height: 1.6; color: var(--ink-soft); max-width: 34ch; }

/* ---------- Téléphone : la carte devient une feuille basse ---------- */

@media (max-width: 640px), (max-aspect-ratio: 4/5) {
  .hotspot { padding: 3px 10px 3px 3px; gap: 6px; }
  .hotspot .lbl { font-size: 12px; }

  .card {
    left: 10px; right: 10px; top: auto; bottom: max(10px, env(safe-area-inset-bottom));
    width: auto; max-height: 46%;
    translate: 0 0;
    border-radius: 26px;
  }
  .card-head { padding: 16px 16px 8px; }
  .card-title { font-size: 20px; }
  .card-body { padding: 0 16px 14px; font-size: 14px; }
  .card-media { padding: 0 16px 12px; }
  .card-logos { padding: 2px 16px 14px; gap: 12px 20px; }
  .logo-link { height: calc(var(--h, 36px) * 0.85); }
  body.has-active .hud,
  body.has-active .aide { opacity: 0; }
  .aide { left: 12px; bottom: max(10px, env(safe-area-inset-bottom)); gap: 2px 12px; font-size: 10.5px; }
  .top-tools { left: 10px; top: max(10px, env(safe-area-inset-top)); }
  .sails-panel { left: 10px; top: calc(max(10px, env(safe-area-inset-top)) + 48px); }
  .card-foot { padding: 0 16px 16px; }
  .edit-bar { left: 10px; right: 10px; width: auto; top: calc(max(10px, env(safe-area-inset-top)) + 48px); padding: 10px 12px; }
  .edition .card { top: auto; max-height: 40%; }
  .fiche { right: 10px; top: max(10px, env(safe-area-inset-top)); padding: 8px 12px 10px; }
  .fs-btn { right: 10px; top: max(10px, env(safe-area-inset-top)); padding: 0 12px; }
  .fs-btn-label { display: none; }  /* petit écran : l'icône seule (le nom reste pour les lecteurs d'écran) */
  .edition .fs-btn { display: none; }  /* la barre d'édition prend la place */
  .has-fs:not(.edition) .fiche { top: calc(max(10px, env(safe-area-inset-top)) + 42px); }
  .fiche dd { font-size: 12.5px; }
}
.hud { transition: opacity 0.3s ease; }
.hud[hidden] { display: none; }

/* ---------- Préférences système ---------- */

@media (prefers-reduced-motion: reduce) {
  .leader-anchor:not(.hidden) { animation: none; }
  .dots .hotspot::after { animation: none; opacity: 0; }
  .card, .card.open, .hotspot { transition: opacity 0.2s ease; scale: none; }
}
/* Moins de transparence : verre remplacé par une surface pleine. */
@media (prefers-reduced-transparency: reduce) {
  .card { -webkit-backdrop-filter: none; backdrop-filter: none; background: #2b3561; }
  .hotspot { background: #2b3561; }
}
@media (prefers-contrast: more) {
  .card { background: #1f2750; box-shadow: 0 0 0 2px #fff, 0 12px 30px rgba(6, 10, 30, 0.3); }
  .card-body { color: #fff; }
}
