/**
 * Hynso — guide de parcours (assets/js/guide.js)
 *
 * Feuille autonome : la vitrine et la coquille de l'application la chargent, sans partager leurs jetons. Les
 * couleurs et les polices reprennent celles de tokens.css ; toutes les classes commencent par « hg- ».
 * Bouton : en bas à gauche sur ordinateur (la fenêtre promo occupe la droite), en bas à droite sur mobile,
 * toujours au-dessus des barres fixées en bas (--hg-lift, calculé par guide.js). Panneau non modal : la page
 * reste utilisable ; sur mobile, il devient une feuille qui monte du bas.
 */

.hg {
  --hg-ink: #0b1638;
  --hg-ink-soft: #bcc5d8;
  --hg-text: #46536e;
  --hg-muted: #5d6a85;
  --hg-border: #d9e1f0;
  --hg-soft: #f2f6fe;
  --hg-primary: #2a3cf4;
  --hg-primary-hover: #1f2dcc;
  --hg-primary-soft: #f2f4ff;
  --hg-primary-line: #c9cfff;
  --hg-signal: #ffc83d;
  --hg-signal-soft: #fff7df;
  --hg-ok: #0b6e4b;
  --hg-ok-soft: #dcf3e9;
  --hg-error: #d3261c;
  --hg-error-soft: #fde5e3;
  --hg-shadow: 0 30px 70px -24px rgb(11 22 56 / 0.35), 0 10px 20px -10px rgb(11 22 56 / 0.12);
  --hg-display: "Schibsted Grotesk", "Schibsted Fallback", system-ui, sans-serif;
  --hg-edge: 24px;
  --hg-lift: 0px;
  font-family: "Instrument Sans", "Instrument Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.hg[hidden],
.hg [hidden] {
  display: none !important;
}

.hg *,
.hg *::before,
.hg *::after {
  box-sizing: border-box;
}

.hg :where(h2, p, ul, ol, dl, dd) {
  margin: 0;
  padding: 0;
}

.hg :where(button) {
  font: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.hg :focus-visible {
  outline: 3px solid var(--hg-primary);
  outline-offset: 2px;
}

.hg-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hg-icon {
  display: inline-grid;
  flex: none;
  width: 18px;
  height: 18px;
}

.hg-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- Bouton */

.hg-launcher {
  position: fixed;
  left: var(--hg-edge);
  bottom: calc(var(--hg-lift) + var(--hg-edge));
  z-index: 64;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 2 * var(--hg-edge));
  min-height: 52px;
  margin: 0;
  padding: 6px 20px 6px 6px;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 999px;
  background: var(--hg-ink);
  color: #fff;
  box-shadow: var(--hg-shadow);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    bottom 0.25s ease,
    border-radius 0.25s ease;
}

.hg-launcher:hover {
  transform: translateY(-2px);
}

.hg-launcher:focus-visible {
  outline: 3px solid var(--hg-signal);
  outline-offset: 3px;
}

.hg-launcher__mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--hg-signal);
  color: var(--hg-ink);
}

.hg-launcher__mark .hg-icon {
  width: 22px;
  height: 22px;
}

.hg-launcher.is-resuming .hg-launcher__mark {
  box-shadow: 0 0 0 4px rgb(255 200 61 / 0.28);
}

.hg-launcher__text {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.hg-launcher__label {
  font-size: 12.5px;
  color: var(--hg-ink-soft);
}

.hg-launcher__title {
  font-size: 15px;
  font-weight: 650;
  color: #fff;
}

.hg-launcher__title:empty {
  display: none;
}

.hg-launcher__sub {
  display: none;
  max-width: 30ch;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--hg-ink-soft);
}

.hg-launcher.is-intro {
  align-items: flex-start;
  padding-block: 12px;
  border-radius: 24px;
}

.hg-launcher.is-intro .hg-launcher__sub {
  display: block;
}

/* --------------------------------------------------------------- Panneau */

.hg-panel {
  position: fixed;
  left: var(--hg-edge);
  bottom: calc(var(--hg-lift) + var(--hg-edge));
  z-index: 66;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 2 * var(--hg-edge)));
  max-height: min(620px, calc(100vh - var(--hg-lift) - 112px));
  max-height: min(620px, calc(100dvh - var(--hg-lift) - 112px));
  /* « clip » : un bouton qui prend le focus ne fait jamais défiler le panneau de côté. */
  overflow: hidden;
  overflow: clip;
  border: 1px solid var(--hg-border);
  border-radius: 22px;
  background: #fff;
  color: var(--hg-text);
  box-shadow: var(--hg-shadow);
  animation: hg-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.hg-head {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 20px 16px;
  background: var(--hg-ink);
  color: #fff;
}

.hg-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--hg-signal);
  color: var(--hg-ink);
}

.hg-name {
  font: 650 15px/1.2 var(--hg-display);
  color: #fff;
}

.hg-stage {
  margin-top: 2px !important;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--hg-ink-soft);
}

.hg-iconbtn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.hg-iconbtn:hover {
  background: rgb(255 255 255 / 0.18);
}

.hg-head :focus-visible {
  outline-color: var(--hg-signal);
}

.hg-progress {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  list-style: none;
}

.hg-progress li {
  height: 4px;
  border-radius: 4px;
  background: rgb(255 255 255 / 0.16);
}

.hg-progress .is-done {
  background: var(--hg-signal);
}

.hg-progress .is-current {
  background: #fff;
}

.hg-body {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 18px 18px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.hg-context {
  justify-self: start;
  padding: 5px 10px !important;
  border-radius: 10px;
  background: var(--hg-primary-soft);
  color: var(--hg-primary-hover);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.hg-title {
  margin-top: 2px !important;
  font: 650 20px/1.25 var(--hg-display);
  letter-spacing: -0.012em;
  color: var(--hg-ink);
}

.hg-title:focus {
  outline: none;
}

.hg-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--hg-text);
}

.hg-note {
  display: flex;
  gap: 8px;
  padding: 10px 12px !important;
  border-left: 3px solid var(--hg-signal);
  border-radius: 10px;
  background: var(--hg-signal-soft);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--hg-ink);
}

.hg-note--ok {
  border-left-color: var(--hg-ok);
  background: var(--hg-ok-soft);
}

.hg-note--ok .hg-icon {
  margin-top: 1px;
  color: var(--hg-ok);
}

.hg-checks,
.hg-steps,
.hg-list {
  display: grid;
  gap: 8px;
  list-style: none;
}

.hg-checks li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.hg-checks .hg-icon {
  margin-top: 2px;
  color: var(--hg-ok);
}

.hg-steps {
  gap: 10px;
}

.hg-steps li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.hg-steps__n {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--hg-primary-soft);
  color: var(--hg-primary);
  font-size: 12.5px;
  font-weight: 700;
}

.hg-service,
.hg-offer {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--hg-border);
  border-radius: 16px;
  background: var(--hg-soft);
}

.hg-service__title,
.hg-offer__name {
  font: 650 16px/1.25 var(--hg-display);
  color: var(--hg-ink);
}

.hg-offer__benefit {
  font-size: 14px;
  line-height: 1.5;
}

.hg-pair {
  display: grid;
  gap: 10px;
}

.hg-facts {
  display: grid;
  gap: 6px;
  padding: 10px 0 !important;
  border-block: 1px solid var(--hg-border);
}

.hg-facts__row {
  display: grid;
  grid-template-columns: minmax(7.5em, 34%) minmax(0, 1fr);
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.45;
}

.hg-facts dt {
  color: var(--hg-muted);
}

.hg-facts dd {
  font-weight: 600;
  color: var(--hg-ink);
}

.hg-list__item {
  display: grid;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--hg-border);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.hg-list__item:hover {
  border-color: var(--hg-primary);
  background: var(--hg-primary-soft);
}

.hg-list__name {
  font-size: 15px;
  font-weight: 650;
  color: var(--hg-ink);
}

.hg-list__text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--hg-muted);
}

.hg-list__price {
  font-size: 13px;
  font-weight: 600;
  color: var(--hg-primary);
}

.hg-show {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 7px 12px;
  border: 1px dashed var(--hg-primary);
  border-radius: 999px;
  background: transparent;
  color: var(--hg-primary);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
}

.hg-show:hover {
  background: var(--hg-primary-soft);
}

.hg-choices {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.hg-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid var(--hg-border);
  border-radius: 14px;
  background: #fff;
  color: var(--hg-ink);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.hg-choice:hover {
  border-color: var(--hg-primary);
  background: var(--hg-primary-soft);
}

.hg-choice:active {
  transform: scale(0.99);
}

.hg-choice__text {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
}

.hg-choice__label {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
}

.hg-choice__hint {
  font-size: 13px;
  line-height: 1.4;
  color: var(--hg-muted);
}

.hg-choice > .hg-icon {
  color: var(--hg-primary);
}

.hg-choice--primary {
  border-color: var(--hg-primary);
  background: var(--hg-primary);
  color: #fff;
}

.hg-choice--primary:hover {
  border-color: var(--hg-primary-hover);
  background: var(--hg-primary-hover);
}

.hg-choice--primary .hg-choice__hint {
  color: var(--hg-primary-line);
}

.hg-choice--primary > .hg-icon {
  color: #fff;
}

.hg-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.hg-link {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--hg-primary);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.hg-back {
  justify-self: start;
  color: var(--hg-muted);
}

.hg-alert {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-left: 3px solid var(--hg-error);
  border-radius: 10px;
  background: var(--hg-error-soft);
}

.hg-alert__title {
  display: flex;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--hg-ink);
}

.hg-alert__title .hg-icon {
  margin-top: 1px;
  color: var(--hg-error);
}

.hg-alert ul {
  display: grid;
  gap: 4px;
  padding-left: 26px !important;
  list-style: disc;
  color: var(--hg-error);
}

.hg-alert .hg-link {
  color: var(--hg-ink);
}

.hg-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--hg-muted);
}

.hg-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--hg-border);
  border-top-color: var(--hg-primary);
  border-radius: 50%;
  animation: hg-turn 0.8s linear infinite;
}

.hg-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-top: 1px solid var(--hg-border);
  background: #fff;
}

.hg-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  margin: 0;
  padding: 0 13px;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.hg-btn .hg-icon {
  width: 16px;
  height: 16px;
}

.hg-btn--primary {
  margin-left: auto;
  border-color: var(--hg-primary);
  background: var(--hg-primary);
  color: #fff;
}

.hg-btn--primary:hover {
  background: var(--hg-primary-hover);
}

.hg-btn--ghost {
  border-color: var(--hg-border);
  background: #fff;
  color: var(--hg-ink);
}

.hg-btn--ghost:hover {
  border-color: var(--hg-primary);
}

.hg-btn--link {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
  padding: 0 4px;
  background: none;
  color: var(--hg-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Pages de l'application (formulaire, espace) : à droite, à côté du formulaire plutôt que dessus. */
@media (min-width: 768px) {
  .hg--end .hg-launcher,
  .hg--end .hg-panel {
    left: auto;
    right: var(--hg-end, var(--hg-edge));
  }

  /* Formulaire : la largeur de la colonne du récapitulatif (--hg-width, mesurée par guide.js). */
  .hg--end .hg-panel {
    width: var(--hg-width, min(400px, calc(100vw - 2 * var(--hg-edge))));
    min-width: 300px;
  }
}

/* ------------------------------------------- Élément montré sur la page */

[data-guide-spot] {
  outline: 3px solid var(--hg-signal, #ffc83d) !important;
  outline-offset: 5px !important;
  animation: hg-spot 1.2s ease-out 2;
}

/* ----------------------------------------------------------------- Mobile */

@media (max-width: 767.98px) {
  .hg {
    --hg-edge: 16px;
  }

  .hg-launcher {
    left: auto;
    right: var(--hg-edge);
    bottom: calc(var(--hg-lift) + max(var(--hg-edge), env(safe-area-inset-bottom)));
    min-height: 44px;
    gap: 8px;
    padding: 3px 14px 3px 3px;
  }

  .hg-launcher__mark {
    width: 38px;
    height: 38px;
  }

  /* Une seule ligne sur mobile : « Je vous guide », ou « Reprendre le guide » ; le reste reste lu par les
     lecteurs d'écran. */
  .hg-launcher:not(.is-resuming) .hg-launcher__label,
  .hg-launcher.is-resuming .hg-launcher__title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .hg-launcher__title,
  .hg-launcher.is-resuming .hg-launcher__label {
    font-size: 14px;
    font-weight: 650;
    color: #fff;
  }

  .hg-launcher.is-intro {
    align-items: center;
    padding-block: 4px;
    border-radius: 999px;
  }

  .hg-launcher.is-intro .hg-launcher__sub {
    display: none;
  }

  /* La fenêtre promo occupe le bas de l'écran : le bouton revient à sa fermeture. */
  body:has(.promo-pop.is-visible) .hg-launcher {
    visibility: hidden;
    opacity: 0;
  }

  .hg-panel {
    left: 0;
    right: 0;
    bottom: var(--hg-lift);
    width: 100%;
    max-height: min(78vh, calc(100vh - var(--hg-lift) - 56px));
    max-height: min(78dvh, calc(100dvh - var(--hg-lift) - 56px));
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    animation-name: hg-up;
  }

  .hg-head {
    padding-top: 18px;
  }

  .hg-head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 4px;
    background: rgb(255 255 255 / 0.28);
  }

  .hg-body {
    padding: 16px 16px 18px;
  }

  .hg-foot {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* Menu mobile de la vitrine ouvert : le bouton s'efface derrière lui. */
.nav-open .hg-launcher {
  display: none;
}

@keyframes hg-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes hg-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes hg-spot {
  from {
    outline-offset: 14px;
    outline-color: rgb(255 200 61 / 0);
  }
}

@keyframes hg-turn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hg-launcher,
  .hg-panel,
  .hg-choice,
  [data-guide-spot] {
    transition: none;
    animation: none;
  }

  .hg-spinner {
    animation-duration: 2.4s;
  }
}
