/* tutorial.css — visites guidées (v160).
 *
 * Aucune librairie : le spotlight repose sur une seule astuce, une ombre
 * portee de tres grande extension posee sur un element vide. L'element est le
 * TROU ; tout ce qui l'entoure est assombri par son ombre. Un seul element a
 * positionner, donc un seul rectangle a suivre quand la page defile, se
 * redimensionne ou se re-rend — la ou un masque SVG ou quatre volets
 * demanderaient quatre calculs coherents entre eux.
 *
 * Toutes les couleurs viennent des jetons du site : la visite suit donc le
 * theme clair/sombre et la couleur d'accent personnalisee sans code dedie.
 *
 * Couches : le voile est a 800 — au-dessus des modales (220), des calques de
 * cloture (500), de la visionneuse (600) et de l'ile de notifications (640),
 * mais SOUS les toasts (900), pour que le message de fin reste lisible.
 */

:root {
  --mct-veil: rgba(9, 11, 15, .74);
  --mct-z: 800;
}
:root[data-theme="light"] {
  --mct-veil: rgba(18, 22, 30, .52);
}

/* ---------------------------------------------------------------- blocage
   Un plan transparent capte TOUS les evenements pendant la visite. C'est ce
   qui garantit la regle « la visite n'agit jamais sur le registre » : meme un
   clic sur l'element mis en avant ne declenche rien. */
.mct-block {
  position: fixed; inset: 0;
  z-index: var(--mct-z);
  cursor: default;
  background: transparent;
}

/* ------------------------------------------------------------- spotlight */
.mct-hole {
  position: fixed;
  z-index: calc(var(--mct-z) + 1);
  pointer-events: none;
  border-radius: var(--radius-md);
  box-shadow:
    0 0 0 9999px var(--mct-veil),
    0 0 0 1.5px color-mix(in srgb, var(--club) 62%, transparent),
    0 0 22px 2px color-mix(in srgb, var(--club) 26%, transparent);
  /* v161 : 340 ms -> 190 ms. La courbe maison (.2,.9,.3,1) part deja vite et
     finit doux : on la garde, on raccourcit seulement le trajet. */
  transition: top .19s cubic-bezier(.2, .9, .3, 1),
              left .19s cubic-bezier(.2, .9, .3, 1),
              width .19s cubic-bezier(.2, .9, .3, 1),
              height .19s cubic-bezier(.2, .9, .3, 1),
              border-radius .14s ease;
}
/* Sans cible (etape d'introduction ou de synthese) : le voile couvre tout,
   le trou est reduit a rien au centre. */
.mct-hole.mct-hole-none {
  box-shadow: 0 0 0 9999px var(--mct-veil);
  opacity: 1;
}

/* Battement joue UNE seule fois a l'arrivee sur l'etape : l'attention doit
   aller a la fonction, pas a l'effet. */
.mct-hole.mct-pulse::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: inherit;
  border: 2px solid var(--club);
  opacity: 0;
  animation: mctPulse .5s cubic-bezier(.2, .9, .3, 1) 1;
}
@keyframes mctPulse {
  0%   { opacity: .85; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.06); }
}

/* ------------------------------------------------------------------ carte */
.mct-card {
  position: fixed;
  z-index: calc(var(--mct-z) + 2);
  width: min(340px, calc(100vw - 24px));
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px 18px 14px;
  color: var(--text);
  font-family: var(--font-body);
  animation: mctCardIn .16s cubic-bezier(.2, .9, .3, 1.05);
}
@keyframes mctCardIn {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.mct-card:focus { outline: none; }
/* Anneau de focus clavier NEUTRE, et non accentue : la couleur d'accent est
   deja celle du spotlight. Deux anneaux rouges cote a cote, et l'on ne sait
   plus lequel designe l'element explique. */
.mct-card:focus-visible { outline: 2px solid var(--text-dim); outline-offset: 3px; }

/* Filet d'accent en tete de carte : le meme repere visuel que les titres de
   section du site. */
.mct-card::before {
  content: '';
  position: absolute; top: 0; left: 18px; right: 18px; height: 2px;
  background: linear-gradient(90deg, var(--club), transparent 72%);
  border-radius: 2px;
}

.mct-x {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; padding: 0;
  color: var(--text-dim); font-size: 15px; line-height: 1;
  border-radius: var(--radius-sm); cursor: pointer;
  opacity: .55; transition: opacity .16s ease, color .16s ease;
}
.mct-x:hover { opacity: 1; color: var(--text); }
.mct-x:focus-visible { outline: 2px solid var(--club); outline-offset: 1px; opacity: 1; }

.mct-title {
  margin: 2px 34px 8px 0;
  font-family: var(--font-display);
  font-size: 16px; font-weight: 700;
  letter-spacing: .055em; text-transform: uppercase;
  color: var(--text); line-height: 1.2;
}
.mct-text {
  margin: 0;
  font-size: 13.5px; line-height: 1.6;
  color: var(--text-dim);
}
.mct-text strong { color: var(--text); font-weight: 600; }

.mct-sep {
  height: 1px; margin: 14px 0 11px;
  background: var(--border);
}

.mct-foot {
  display: flex; align-items: center; gap: 12px;
}
.mct-progress {
  display: flex; align-items: center; gap: 7px;
  flex: 1; min-width: 0;
}
.mct-dots { display: flex; align-items: center; gap: 5px; }
.mct-dot {
  width: 5px; height: 5px; border-radius: var(--pill);
  background: var(--border);
  transition: background .16s ease, width .16s ease;
}
.mct-dot.done { background: color-mix(in srgb, var(--club) 45%, var(--border)); }
.mct-dot.now  { width: 16px; background: var(--club); }
.mct-count {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-dim); letter-spacing: .02em;
  white-space: nowrap;
}
.mct-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.mct-btn {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: var(--control-h-sm); padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  color: var(--text); font-family: var(--font-body);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: border-color .16s ease, background .16s ease, filter .16s ease;
}
.mct-btn:hover { border-color: var(--club); }
.mct-btn:focus-visible { outline: 2px solid var(--club); outline-offset: 2px; }
.mct-btn-primary {
  background: var(--club); border-color: var(--club); color: var(--on-accent);
}
.mct-btn-primary:hover { filter: brightness(1.08); }
.mct-btn-quiet { border-color: transparent; color: var(--text-dim); padding: 0 8px; }
.mct-btn-quiet:hover { color: var(--text); border-color: var(--border); }
.mct-btn[disabled] { opacity: .35; cursor: default; }
.mct-btn[disabled]:hover { border-color: var(--border); filter: none; }

/* ---------------------------------------------------------------- fleche
   Petit triangle colle a la carte, du cote de la cible. Masque en mode
   feuille (mobile) ou il n'aurait plus de sens. */
.mct-card .mct-arrow {
  position: absolute; width: 10px; height: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  transform: rotate(45deg);
}
.mct-card[data-place="bottom"] .mct-arrow { top: -6px;    border-right: 0; border-bottom: 0; }
.mct-card[data-place="top"]    .mct-arrow { bottom: -6px; border-left: 0;  border-top: 0; }
.mct-card[data-place="right"]  .mct-arrow { left: -6px;   border-right: 0; border-top: 0; }
.mct-card[data-place="left"]   .mct-arrow { right: -6px;  border-left: 0;  border-bottom: 0; }
.mct-card[data-place="center"] .mct-arrow,
.mct-card.is-sheet .mct-arrow { display: none; }

/* Etape sans cible : la carte se pose au centre, un peu plus large. */
.mct-card[data-place="center"] {
  width: min(420px, calc(100vw - 28px));
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  animation: mctCenterIn .18s cubic-bezier(.2, .9, .3, 1.05);
}
@keyframes mctCenterIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.97); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ------------------------------------------------- feuille basse (mobile) */
.mct-card.is-sheet {
  left: 10px; right: 10px; width: auto;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  top: auto;
  border-radius: var(--radius-lg);
  padding: 15px 16px 14px;
  animation: mctSheetIn .18s cubic-bezier(.2, .9, .3, 1);
}
.mct-card.is-sheet.is-sheet-top {
  top: calc(10px + env(safe-area-inset-top, 0px));
  bottom: auto;
  animation: mctSheetTopIn .18s cubic-bezier(.2, .9, .3, 1);
}
@keyframes mctSheetIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes mctSheetTopIn {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: none; }
}
.mct-card.is-sheet .mct-btn { min-height: 38px; padding: 0 14px; font-size: 13px; }
.mct-card.is-sheet .mct-x { width: 32px; height: 32px; font-size: 16px; }

/* ------------------------------------------------------------- ouverture
   Ecran d'accueil de la visite : plus large, centre, sans cible. */
.mct-intro {
  position: fixed; inset: 0;
  z-index: calc(var(--mct-z) + 3);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: var(--mct-veil);
  animation: mctFade .15s ease;
}
@keyframes mctFade { from { opacity: 0; } to { opacity: 1; } }

.mct-intro-card {
  position: relative;
  width: min(460px, 100%);
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--club);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 30px 28px 24px;
  text-align: center;
  animation: mctIntroIn .22s cubic-bezier(.2, .9, .3, 1.05);
  overflow: hidden;
}
@keyframes mctIntroIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
/* Halo tres discret qui respire derriere le pictogramme. */
.mct-intro-card::after {
  content: '';
  position: absolute; top: -70px; left: 50%; width: 240px; height: 240px;
  transform: translateX(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--club) 16%, transparent), transparent 68%);
  pointer-events: none;
  animation: mctHalo 5s ease-in-out infinite;
}
@keyframes mctHalo {
  0%, 100% { opacity: .5; transform: translateX(-50%) scale(1); }
  50%      { opacity: .9; transform: translateX(-50%) scale(1.08); }
}

.mct-intro-ico {
  position: relative; z-index: 1;
  width: 52px; height: 52px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--club) 14%, var(--surface-alt));
  border: 1px solid color-mix(in srgb, var(--club) 34%, transparent);
  color: var(--club);
}
.mct-intro-ico svg { width: 24px; height: 24px; }

.mct-intro-title {
  position: relative; z-index: 1;
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 25px; font-weight: 700; letter-spacing: .02em;
  color: var(--text); line-height: 1.15;
}
.mct-intro-text {
  position: relative; z-index: 1;
  margin: 0 auto 22px; max-width: 340px;
  font-size: 14px; line-height: 1.6; color: var(--text-dim);
}
.mct-intro-actions {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.mct-intro-actions .mct-btn { min-height: var(--control-h); padding: 0 22px; font-size: 13.5px; }
.mct-intro-later {
  background: transparent; border: 0; padding: 4px 8px;
  color: var(--text-dim); font-family: var(--font-body);
  font-size: 12.5px; cursor: pointer; border-radius: var(--radius-sm);
}
.mct-intro-later:hover { color: var(--text); text-decoration: underline; }
.mct-intro-later:focus-visible { outline: 2px solid var(--club); outline-offset: 2px; }

/* ------------------------------------------------------------------- fin */
.mct-end {
  position: fixed; inset: 0;
  z-index: calc(var(--mct-z) + 4);
  display: flex; align-items: center; justify-content: center;
  background: var(--mct-veil);
  animation: mctFade .12s ease;
  pointer-events: none;
}
.mct-end-inner { text-align: center; animation: mctEndIn .22s cubic-bezier(.2, .9, .3, 1.05); }
@keyframes mctEndIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: none; }
}
.mct-end svg { width: 62px; height: 62px; margin-bottom: 12px; }
.mct-end .mct-end-circle {
  stroke: var(--ok); stroke-width: 2.5; fill: none;
  stroke-dasharray: 151; stroke-dashoffset: 151;
  animation: mctEndCircle .28s cubic-bezier(.65, 0, .45, 1) forwards;
}
.mct-end .mct-end-tick {
  stroke: var(--ok); stroke-width: 3; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: mctEndTick .2s cubic-bezier(.65, 0, .45, 1) .24s forwards;
}
@keyframes mctEndCircle { to { stroke-dashoffset: 0; } }
@keyframes mctEndTick   { to { stroke-dashoffset: 0; } }
.mct-end-title {
  font-family: var(--font-display); font-size: 21px; font-weight: 700;
  letter-spacing: .03em; color: var(--text);
}

/* ------------------------------------------- aide : bloc « visites guidées »
   Le panneau d'aide existant garde sa forme ; on lui ajoute une section. */
.help-tours { margin-top: 4px; }
.help-tours-title {
  margin: 0 0 8px;
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--text-dim);
}
.help-tour {
  display: flex; align-items: center; gap: 11px; width: 100%;
  text-align: left; box-sizing: border-box;
  padding: 11px 12px; margin-bottom: 7px;
  background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  color: var(--text); font-family: var(--font-body); font-size: 13.5px;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.help-tour:hover { border-color: var(--club); transform: translateY(-1px); }
.help-tour:focus-visible { outline: 2px solid var(--club); outline-offset: 2px; }
.help-tour[disabled] { cursor: default; opacity: .72; }
.help-tour[disabled]:hover { border-color: var(--border); transform: none; }
.help-tour-ico {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--club) 13%, transparent);
  color: var(--club);
}
.help-tour-ico svg { width: 16px; height: 16px; }
.help-tour-ico.quiet {
  background: var(--surface); color: var(--text-dim);
  border: 1px solid var(--border);
}
.help-tour-body { min-width: 0; flex: 1; }
.help-tour-lbl { display: block; font-weight: 600; }
.help-tour-sub {
  display: block; margin-top: 2px;
  font-size: 12px; line-height: 1.45; color: var(--text-dim);
}
.help-tour-done {
  flex-shrink: 0; font-size: 10.5px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ok);
  font-family: var(--font-display); font-weight: 700;
}

/* Separateur entre l'aide de la page et les visites. */
.help-sep-tours { height: 1px; background: var(--border); margin: 18px 0 14px; }

/* ------------------------------ profil : carte « Aide & découverte » ------
   Reprend .settings-card ; seules les lignes de tutoriel sont propres a nous. */
.tuto-rows { display: flex; flex-direction: column; gap: 10px; }
.tuto-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: var(--radius-md);
}
.tuto-row-body { flex: 1; min-width: 0; }
.tuto-row-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; font-weight: 600; color: var(--text);
}
.tuto-row-desc {
  margin: 3px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--text-dim);
}
.tuto-row-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}
.tuto-badge {
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  font-family: var(--font-display); font-weight: 700;
  padding: 2px 7px; border-radius: var(--pill);
  border: 1px solid var(--border); color: var(--text-dim);
}
.tuto-badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }

@media (max-width: 640px) {
  .tuto-row { flex-direction: column; gap: 8px; }
}

/* ------------------------------------------------- mouvement reduit ------
   La fonctionnalite reste ENTIEREMENT utilisable : on ne supprime que le
   mouvement. Le spotlight saute d'une cible a l'autre au lieu de glisser. */
@media (prefers-reduced-motion: reduce) {
  .mct-hole { transition: none; }
  .mct-hole.mct-pulse::after { animation: none; }
  .mct-card,
  .mct-card[data-place="center"],
  .mct-card.is-sheet,
  .mct-card.is-sheet.is-sheet-top { animation: none; }
  .mct-intro, .mct-intro-card, .mct-end, .mct-end-inner { animation: none; }
  .mct-intro-card::after { animation: none; opacity: .6; }
  .mct-end .mct-end-circle,
  .mct-end .mct-end-tick { animation: none; stroke-dashoffset: 0; }
  .help-tour:hover { transform: none; }
}

/* Impression : une visite n'a rien a faire sur un rapport papier. */
@media print {
  .mct-block, .mct-hole, .mct-card, .mct-intro, .mct-end { display: none !important; }
}

/* Cible plus haute que l'ecran (la timeline) : panneau flottant dans un coin,
   sans fleche — il n'y aurait rien a designer de precis. */
.mct-card[data-place="flottant"] {
  left: auto; top: auto;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}
.mct-card[data-place="flottant"] .mct-arrow { display: none; }
