/*
 * La page de démonstration publique.
 *
 * C'est le **mockup validé**, à la règle près : les styles de `.scene` sont
 * repris tels quels, parce que ce fichier est la référence de design et qu'un
 * « petit ajustement » au passage est exactement la façon dont une maquette
 * approuvée cesse d'être ce qu'on a approuvé.
 *
 * Deux écarts, tous deux exigés par le lot :
 *
 *  1. les polices sont **hébergées ici** et non chez Google. Le `@import` du
 *     mockup ferait partir l'adresse IP de chaque prospect chez un tiers depuis
 *     une page que Yelda lui a envoyée, et la CSP de cette page est fermée en
 *     `default-src 'none'`. Les deux familles sont sous licence OFL : les
 *     `.woff2` vivent sous `/demo/assets/fonts/`, la pile de repli reste
 *     complète, et le mockup prévoyait lui-même cette bascule ;
 *  2. la barre de pilotage `.mock` et son bloc de simulation n'existent pas —
 *     ici l'onde respire au repos, et ce qui l'anime vient d'un vrai appel.
 */

/* ---------- polices, servies par ce service ---------- */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('/demo/assets/fonts/bricolage-grotesque-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('/demo/assets/fonts/bricolage-grotesque-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/demo/assets/fonts/instrument-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 600;
  font-stretch: 100%;
  font-display: swap;
  src: url('/demo/assets/fonts/instrument-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --display: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
  --body: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0b0d10;
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid #7f9bff;
  outline-offset: 2px;
  border-radius: 6px;
}

/* =========================================================
   SCÈNE
   ========================================================= */
.scene {
  --ground: #f7f5f2;
  --ink: #14151f;
  --dim: #797a8a;
  --soft: #a9a6b4;
  --accent: #0b62d6;
  --auraA: rgba(120, 178, 255, 0.44);
  --auraB: rgba(150, 226, 255, 0.34);
  --auraC: rgba(96, 138, 240, 0.26);
  --orb: min(40vh, 340px);
  --r: calc(var(--orb) / 2);
  position: relative;
  flex: 1 1 auto;
  min-height: 600px;
  overflow: hidden;
  background: var(--ground);
  color: var(--ink);
  transition:
    background 0.6s ease,
    color 0.6s ease;
}

.scene[data-mode='night'] {
  --ground: #08070f;
  --ink: #f4f1fb;
  --dim: #8f8ca8;
  --soft: #615f7d;
  --accent: #7cc0ff;
  --auraA: rgba(30, 110, 240, 0.38);
  --auraB: rgba(0, 180, 255, 0.22);
  --auraC: rgba(60, 90, 220, 0.26);
}

.aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  mix-blend-mode: normal;
}
.aura--a {
  width: 70vmin;
  height: 70vmin;
  background: var(--auraA);
  top: -14%;
  left: 6%;
  animation: drift 26s ease-in-out infinite alternate;
}
.aura--b {
  width: 56vmin;
  height: 56vmin;
  background: var(--auraB);
  bottom: -16%;
  right: 2%;
  animation: drift 21s ease-in-out infinite alternate-reverse;
}
.aura--c {
  width: 48vmin;
  height: 48vmin;
  background: var(--auraC);
  bottom: 6%;
  left: -8%;
  animation: drift 31s ease-in-out infinite alternate;
}
@keyframes drift {
  to {
    transform: translate3d(6%, -5%, 0) scale(1.14);
  }
}

.stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

/* l'onde — pivot immuable de la composition */
.orbwrap {
  position: relative;
  width: var(--orb);
  height: var(--orb);
  z-index: 2;
}
.orbwrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* branding Yelda */
.mark {
  position: absolute;
  top: clamp(18px, 3.4vh, 38px);
  left: clamp(20px, 3vw, 44px);
  z-index: 4;
  display: block;
  height: clamp(24px, 2.9vh, 30px);
}
.mark img {
  height: 100%;
  width: auto;
  display: block;
}
.site {
  position: absolute;
  bottom: clamp(18px, 3.4vh, 38px);
  right: clamp(20px, 3vw, 44px);
  z-index: 4;
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  text-decoration: none;
}
.site:hover,
.site:focus-visible {
  color: var(--dim);
}
.tagline {
  position: absolute;
  bottom: clamp(18px, 3.4vh, 38px);
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
  margin: 0;
  font-size: clamp(13px, 1.05vw, 15.5px);
  letter-spacing: 0.02em;
  color: var(--dim);
}
.tagline b {
  color: var(--ink);
  font-weight: 600;
}

/* bandeau haut et bas, discrets */
.brand {
  position: absolute;
  top: clamp(20px, 4vh, 44px);
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
}
.brand strong {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand span {
  color: var(--dim);
  font-size: 17px;
  font-weight: 400;
}
.foot {
  position: absolute;
  bottom: clamp(18px, 3.6vh, 38px);
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.5s ease;
}
.foot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e0603a;
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

/* les deux moments, superposés autour de l'onde */
.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.layer[data-on='true'] {
  opacity: 1;
  transition: opacity 0.6s ease 0.25s;
}

.above,
.below {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(62ch, 84%);
  text-align: center;
}
.above {
  bottom: calc(50% + var(--r) + clamp(18px, 2.6vh, 32px));
}
.below {
  top: calc(50% + var(--r) + clamp(18px, 2.6vh, 32px));
}

/* — écran d'attente — */
.hello {
  font-family: var(--display);
  font-size: clamp(26px, 3.6vw, 50px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 0;
  text-wrap: balance;
}
.tel {
  font-family: var(--display);
  font-size: clamp(34px, 5.4vw, 74px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  display: inline-block;
  background: linear-gradient(96deg, #0a4fd6, #0f8ae8 52%, #3fc6ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.scene[data-mode='night'] .tel {
  background: linear-gradient(96deg, #5b9bff, #3fb8ff 52%, #8ee9ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Le numéro est un lien `tel:` — c'est un téléphone que le prospect tient. La
   couche d'attente est en `pointer-events:none` pour laisser passer les clics
   vers l'onde : le seul élément cliquable la reprend pour lui. */
.tel {
  pointer-events: auto;
}
.telnote {
  margin: 16px 0 0;
  color: var(--dim);
  font-size: 16px;
  line-height: 1.45;
}

/* — en appel — */
.speaker {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--soft);
  margin: 0 0 12px;
  transition: opacity 0.3s ease;
}
.ask {
  font-family: var(--display);
  font-size: clamp(16px, 1.7vw, 24px);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--dim);
  margin: 0;
  text-wrap: balance;
}

.say {
  font-family: var(--display);
  font-size: clamp(20px, 2.5vw, 36px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.035em;
  margin: 0;
  text-wrap: balance;
  color: var(--ink);
}
.bubbleIn {
  animation: bubbleIn 0.5s cubic-bezier(0.2, 0.85, 0.2, 1) both;
}
@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.fadeOut {
  animation: fadeOut 0.34s ease forwards;
}
@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-14px);
  }
}

/* — fin d'appel — */
.recap {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  background: color-mix(in srgb, var(--ground) 72%, transparent);
  backdrop-filter: blur(10px);
  transition: opacity 0.5s ease;
}
.recap[data-on='true'] {
  opacity: 1;
}
.recap p {
  margin: 0;
  text-align: center;
}
.recap .big {
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 54px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
  max-width: 18ch;
  text-wrap: balance;
}
.recap .small {
  margin-top: 16px;
  color: var(--dim);
  font-size: 16px;
}

/* — lien mort : même page, même sobriété — */
.gone {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}
.gone .big {
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
}
.gone .small {
  margin: 14px 0 0;
  color: var(--dim);
  font-size: 16px;
}

@media (max-width: 760px) {
  .scene {
    --orb: min(32vh, 240px);
  }
  .below {
    top: calc(50% + var(--r) + 26px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .aura {
    animation: none;
  }
  .bubbleIn,
  .fadeOut {
    animation: none;
  }
  .foot i {
    animation: none;
  }
}

/* Reserve room for the chooser and its shared-choice notice on short screens. */
.scene:has(.demo-voice-options button) { min-height: max(100vh, 840px); overflow: clip; }
.demo-voice-options { display: flex; gap: 10px; justify-content: center; margin-bottom: 12px; }
.demo-voice-options:empty { display: none; }
.demo-voice-options button { pointer-events: auto; max-width: calc((100% - 20px) / 3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: inherit; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: 24px; padding: 8px 12px; cursor: pointer; }
.layer:not([data-on='true']) .demo-voice-options button { pointer-events: none; }
.demo-voice-options button[aria-pressed="true"] { font-weight: 700; border-width: 3px; }
.demo-voice-options button:disabled { opacity: .5; cursor: wait; }
.demo-voice-note { font-size: 12px; opacity: .7; margin: 4px 0; }
@media (max-width: 760px) {
  .scene:has(.demo-voice-options button) { min-height: max(100vh, 900px); }
  .scene:has(.demo-voice-options button) .tagline { bottom: 48px; width: 84%; margin: 0 auto; }
  .scene:has(.demo-voice-options button) .site { bottom: 18px; }
}

/* ==========================================================================
   Lot DS3 — « je vous appelle » : la démo sortante. Des règles ajoutées et
   préfixées `.dial-` ; rien de `.scene`, `.tel`, `.hello` ni des couches
   existantes n'est retouché. Les couches sont en `pointer-events:none` pour
   laisser passer les clics vers l'onde : le formulaire les reprend pour lui.
   ========================================================================== */
.dial-note {
  color: var(--dim);
  font-weight: 500;
  font-size: 0.62em;
  letter-spacing: -0.01em;
}
.dial-form,
.dial-status,
.dial-link {
  pointer-events: auto;
}
.dial-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: flex-end;
  flex-wrap: wrap;
}
.dial-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}
.dial-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--soft);
}
.dial-tel {
  display: flex;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ground) 80%, transparent);
}
.dial-prefix {
  padding: 0 4px 0 14px;
  color: var(--dim);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}
.dial-input {
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 12px 14px;
  min-width: 0;
  outline: none;
}
.dial-field--name .dial-input {
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ground) 80%, transparent);
  width: 10ch;
}
.dial-tel .dial-input {
  padding-left: 4px;
  width: 15ch;
  font-variant-numeric: tabular-nums;
}
.dial-tel:focus-within,
.dial-field--name .dial-input:focus {
  border-color: var(--accent);
}
.dial-btn {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  padding: 13px 20px;
  cursor: pointer;
}
.dial-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.dial-btn:focus-visible,
.dial-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.dial-consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  max-width: 470px;
  margin: 14px auto 0;
  text-align: left;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--dim);
}
.dial-consent input {
  margin-top: 2px;
  accent-color: var(--accent);
}
.dial-err {
  margin: 10px 0 0;
  min-height: 1em;
  color: #c2410c;
  font-size: 14px;
}
.dial-err:empty {
  display: none;
}
.dial-or {
  margin: 14px 0 0;
  color: var(--dim);
  font-size: 14px;
}
.dial-or b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dial-link {
  font: inherit;
  font-size: 15px;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 4px;
  margin-top: 6px;
  cursor: pointer;
}
.dial-closed {
  margin: 0;
  color: var(--dim);
  font-size: 16px;
  line-height: 1.45;
}
.dial-dossier {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 4px 12px;
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--dim);
}
.dial-dossier-title {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--soft);
}
.dial-dossier dl {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin: 0;
}
.dial-dossier dl div {
  display: flex;
  gap: 6px;
}
.dial-dossier dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}
.dial-status {
  outline: none;
}
.dial-big {
  font-family: var(--display);
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0;
}
.dial-small {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-line;
}
.dial-small:empty,
.dial-actions:empty {
  display: none;
}
.dial-actions {
  margin: 16px 0 0;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.dial-actions .dial-btn {
  padding: 10px 18px;
  font-size: 15px;
}
@media (max-width: 760px) {
  .dial-dossier {
    display: block;
    text-align: left;
    margin: 0 auto 12px;
    max-width: 320px;
    padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--ground) 85%, transparent);
  }
  .dial-dossier dl {
    display: grid;
    grid-template-columns: auto 1fr;
    justify-content: start;
    gap: 3px 10px;
    margin-top: 6px;
  }
  .dial-dossier dl div {
    display: contents;
  }
  .dial-inputs {
    flex-direction: column;
    align-items: stretch;
  }
  .dial-field,
  .dial-tel,
  .dial-tel .dial-input,
  .dial-field--name .dial-input {
    width: 100%;
    box-sizing: border-box;
  }
}
/* Une couche éteinte (opacité nulle) ne prend ni le clic ni le focus : sans
   cela, le formulaire invisible capterait le lien « je préfère que… » posé au
   même endroit, et la tabulation entrerait dans des champs qu'on ne voit pas. */
.layer:not([data-on='true']) .dial-form,
.layer:not([data-on='true']) .dial-status,
.layer:not([data-on='true']) .dial-link {
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s linear 0.45s;
}
/* Sur un téléphone, la fiche et le formulaire tiennent sous l'onde : comme le
   prototype mobile, l'onde remonte et rapetisse tant que la couche « dial » est
   affichée, et la hauteur est réservée — sur le précédent du choix de voix. */
@media (max-width: 760px) {
  .scene:has([data-layer='dial'][data-on='true']) {
    --orb: 150px;
    min-height: max(100vh, 900px);
    overflow: clip;
  }
  .scene:has([data-layer='dial'][data-on='true']) .stage {
    place-items: start center;
  }
  .scene:has([data-layer='dial'][data-on='true']) .orbwrap {
    margin-top: 200px;
  }
  [data-layer='dial'] .above {
    bottom: auto;
    top: 92px;
  }
  [data-layer='dial'] .below {
    top: calc(200px + var(--orb) + 18px);
  }
}
