:root {
  --bg: #0b0d10;
  --fg: #e9eef5;
  --muted: rgba(233, 238, 245, 0.75);
  --cursor: rgba(233, 238, 245, 0.9);

  --bubble-bg: rgba(11, 13, 16, 0.72);
  --bubble-border: rgba(233, 238, 245, 0.12);
  --bubble-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  --bubble-button-bg: rgba(255, 255, 255, 0.14);
  --bubble-button-bg-open: rgba(255, 255, 255, 0.22);
  --bubble-button-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  --bubble-button-shadow-open: 0 22px 42px rgba(0, 0, 0, 0.45);

  /* même gouttière que header/panels */
  --gutter: clamp(24px, 10vw, 140px);

  /* Bottom-sheet motion */
  --sheet-radius: 28px;
  --sheet-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sheet-duration: 520ms;
  --sheet-lift: 14px;

  /* bandeau interne de la vidéo */
  --sig-pad: 27px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fb;
    --fg: #0b0d10;
    --muted: rgba(11, 13, 16, 0.72);
    --cursor: rgba(11, 13, 16, 0.85);

    --bubble-bg: rgba(247, 248, 251, 0.92);
    --bubble-border: rgba(11, 13, 16, 0.12);
    --bubble-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    --bubble-button-bg: rgba(255, 255, 255, 0.7);
    --bubble-button-bg-open: rgba(255, 255, 255, 0.85);
    --bubble-button-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
    --bubble-button-shadow-open: 0 22px 38px rgba(0, 0, 0, 0.22);
  }
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

::selection {
  background: rgba(127, 170, 255, 0.28);
}

/* Scroll container */
.scroller {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: none;
}

.scroller::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Panels */
.panel {
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(14px, 2.2vh, 22px);
  padding: 0 var(--gutter);
}

.panel:first-child {
  align-items: center;
}

.panel:first-child .intro-row {
  justify-content: flex-start;
}

.panel:first-child .frame {
  margin-inline: auto;
}

body.is-stacked {
  overflow: hidden;
}

body.is-stacked .scroller {
  height: 100vh;
  overflow: hidden;
  scroll-snap-type: none;
  padding: 0;
  position: relative;
}

/* Gradient haut puissant */
body.is-stacked .scroller::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;

  height: clamp(250px, 25vh, 420px);

  background: linear-gradient(
    180deg,
    var(--bg) 0%,
    var(--bg) 55%,
    rgba(0, 0, 0, 0) 100%
  );

  pointer-events: none;
  z-index: 2;
}

/* suppression gradient bas */
body.is-stacked .scroller::after {
  content: none;
}

body.is-stacked .panel {
  height: auto;
  scroll-snap-align: none;
  scroll-snap-stop: normal;
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  padding: 0 var(--gutter);
  transform: translateY(calc(-50% + var(--stack-offset, 0px)));
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition:
    transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 240ms ease,
    color 240ms ease;
}

body.is-stacked .panel.is-visible {
  opacity: var(--stack-opacity, 1);
}

body.is-stacked .panel.is-complete {
  color: var(--muted);
}

body.is-stacked .panel.is-centered {
  color: var(--fg);
  pointer-events: auto;
}

.frame {
  width: min(78ch, 100%);
}

.end-media {
  width: min(78ch, 100%);
  display: flex;
  justify-content: flex-end;
}

.end-media__button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
}

.end-media__media {
  width: clamp(220px, 70vw, 360px);
  max-width: 360px;
  height: auto;
  margin-top: clamp(10px, 2vh, 18px);
  display: block;
}

.intro-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.4vw, 20px);
}

.panel:first-child .intro-row {
  justify-content: flex-start;
  gap: clamp(16px, 3vw, 28px);
}

.panel:first-child .type {
  font-size: xxx-large;
  text-align: left;
}

.panel:first-child .intro-hand {
  transform: translateY(0.08em);
}

.panel:first-child .intro-hand__svg {
  width: clamp(56px, 7vw, 96px);
}

.intro-hand {
  color: var(--fg);
  flex: 0 0 auto;
  opacity: 0.92;
}

.intro-hand.is-waving {
  animation: none;
}

.intro-hand__svg {
  width: clamp(46px, 5.8vw, 74px);
  height: auto;
  color: var(--fg);
  opacity: 0.92;
  transform-box: fill-box;
  transform-origin: 28% 70%;
  transform: rotate(0deg);
}

.intro-hand.is-waving .intro-hand__svg {
  animation: handWave 1150ms cubic-bezier(0.2, 0.8, 0.2, 1) 1;
}

@keyframes handWave {
  0% {
    transform: rotate(0deg) translateX(0);
  }
  10% {
    transform: rotate(7deg) translateX(1px);
  }
  22% {
    transform: rotate(-6deg) translateX(-1px);
  }
  34% {
    transform: rotate(7deg) translateX(1px);
  }
  46% {
    transform: rotate(-4deg) translateX(-1px);
  }
  58% {
    transform: rotate(5deg) translateX(1px);
  }
  70% {
    transform: rotate(0deg) translateX(0);
  }
  74%,
  100% {
    transform: rotate(0deg) translateX(0);
  }
}

.panel:first-child .cursor {
  display: none;
}

.type {
  position: relative;
  font-size: clamp(22px, 2.6vw, 44px);
  line-height: 1.28;
  letter-spacing: -0.01em;
  font-weight: 460;
}

.ghost {
  visibility: hidden;
  display: block;
  white-space: pre-line;
}

.live {
  position: absolute;
  inset: 0;
  white-space: pre-line;
}

.reveal {
  white-space: pre-line;
}

.cursor {
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 0.12em;
  background: var(--cursor);
  transform: translateY(0.12em);
  opacity: 0;
  animation: none;
}

.cursor.is-active {
  opacity: 1;
  animation: cursorBlink 1.05s steps(1) infinite;
}

@keyframes cursorBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.12;
  }
}

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

.noscript {
  min-height: 100vh;
  padding: 48px var(--gutter);
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

/* ===========================
   Header
   =========================== */

.chrome {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 13;
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.chrome--top {
  top: 0;
  padding-top: calc(18px + env(safe-area-inset-top));
}

.brand {
  pointer-events: auto;
  font-family:
    "Snell Roundhand", "Apple Chancery", "Segoe Script", "Bradley Hand",
    "Zapfino", ui-serif, serif;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--muted);
  user-select: none;
  transition:
    color 240ms ease,
    opacity 240ms ease;
}

.brand__dev {
  font-family:
    "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.88em;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-left: 0.15em;
}

/* ===========================
   Contact row (brand + signature sur la même ligne)
   =========================== */

/* ✅ Le contactBubble devient la "ligne" fixe en haut, avec la même gouttière */
.contact-bubble {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 13;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  padding: 0 var(--gutter);
  pointer-events: none;
}

/* ✅ slot brand à gauche (toujours aligné) */
.contact-bubble__brand-slot {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: var(--brand-slot-width, 0px);
}

/* ✅ bouton signature à droite */
.contact-bubble__toggle {
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;

  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;

  overflow: hidden; /* crop vidéo */
  z-index: 1002;
}

/* quand ouvert, le container couvre l'écran mais garde le header row */
.contact-bubble.is-open {
  inset: 0;
  width: 100vw;
  height: 100vh;
}

/* backdrop */
.contact-bubble::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
  z-index: 1000;
}

@media (prefers-color-scheme: light) {
  .contact-bubble::before {
    background: rgba(0, 0, 0, 0.1);
  }
}

.contact-bubble.is-open::before {
  opacity: 1;
  pointer-events: auto;
}

/* ✅ quand open, on garde le bouton à sa place (droite, même ligne) */
.contact-bubble.is-open .contact-bubble__toggle {
  position: relative;
  transform: none !important;
  filter: none !important;
}

/* vidéo signature */
.contact-bubble__signature-media {
  height: clamp(80px, 7vw, 140px);
  width: auto;
  display: block;
  pointer-events: none;

  /* retire le bandeau interne 18px */
  transform: translate(0px, calc(var(--sig-pad) * -1));
}

/* enlever les contours/outline UA et focus ring chrome si besoin */
.contact-bubble__signature-media,
.contact-bubble__toggle-media {
  outline: none;
  border: 0;
}

/* icône close */
.contact-bubble__icon {
  display: inline-flex;
  color: var(--fg);
  opacity: 1;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
}

.contact-bubble__icon svg {
  position: absolute;
  inset: 0;
  transition:
    opacity 200ms ease,
    transform 200ms ease;
}

.contact-bubble__icon--close {
  opacity: 0;
  transform: scale(0.6) rotate(-90deg);
}

.contact-bubble.is-open .contact-bubble__icon--close {
  opacity: 1;
  transform: scale(1) rotate(0);
}

.contact-bubble__toggle:focus-visible {
  outline: none;
}

/* ===========================
   Sheet
   =========================== */

.contact-bubble__text {
  position: fixed;
  inset: 0;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: clamp(32px, 8vw, 96px);

  color: var(--fg);
  font-size: clamp(18px, 4.6vw, 30px);
  letter-spacing: 0.02em;

  background:
    linear-gradient(180deg, var(--bg) 0%, transparent 70%),
    radial-gradient(
      120% 120% at 20% 10%,
      rgba(255, 255, 255, 0.08),
      rgba(0, 0, 0, 0) 55%
    ),
    var(--bubble-bg);

  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);

  opacity: 0;
  transform: translate3d(0, 10vh, 0);
  pointer-events: none;

  z-index: 1001;

  border-top-left-radius: var(--sheet-radius);
  border-top-right-radius: var(--sheet-radius);

  clip-path: inset(12% 0 0 0 round var(--sheet-radius));

  transition:
    opacity 220ms ease,
    transform var(--sheet-duration) var(--sheet-ease),
    clip-path var(--sheet-duration) var(--sheet-ease);
  will-change: transform, opacity, clip-path;
}

.contact-bubble.is-open .contact-bubble__text {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  clip-path: inset(0 0 0 0 round var(--sheet-radius));
  pointer-events: auto;
}

/* Headline + details */
.contact-bubble__headline {
  position: absolute;
  top: calc(clamp(32px, 8vw, 96px) + env(safe-area-inset-top));
  left: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 16px);
  flex-wrap: nowrap;
  align-self: center;
  font-size: clamp(24px, 5vw, 32px);
  white-space: nowrap;
  padding: 0 clamp(32px, 8vw, 96px);
}

/* si tu as une brand dans le sheet (slot 2), on garde le style */
.contact-bubble__headline .brand {
  font-size: 1em;
  line-height: 1;
  color: var(--muted);
}

.contact-bubble__details {
  display: grid;
  gap: 18px;
  align-items: center;
  justify-items: center;
  text-align: center;
  width: min(520px, 100%);
}

.contact-bubble__item {
  display: grid;
  gap: 6px;
  max-width: min(520px, 100%);
  text-align: center;
}

.contact-bubble__label {
  font-size: 0.52em;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-bubble__link {
  color: inherit;
  text-decoration: none;
  font-size: 1em;
  font-weight: 500;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1.2;
}

/* Mobile tweak */
@media (max-width: 640px) {
  .contact-bubble__signature-media {
    height: clamp(84px, 14vw, 110px);
    transform: translate(0px, calc(var(--sig-pad) * -1));
  }
}

/* ===========================
   Nudge / Continue
   =========================== */

.nudge {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 14;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 240ms ease,
    transform 240ms ease;
}

.nudge.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.continue {
  pointer-events: auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 10px 12px;
  opacity: 0.55;
}

.continue.is-arrow {
  width: 44px;
  height: 44px;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
  display: grid;
  place-items: center;
}

.continue.is-arrow::before {
  content: "↓";
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  animation: arrowFloat 1.6s ease-in-out infinite;
}

.continue:hover {
  opacity: 1;
  color: var(--fg);
}

.continue.is-arrow:hover::before {
  color: var(--fg);
}

@keyframes arrowFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  60% {
    transform: translateY(6px);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .scroller {
    scroll-behavior: auto;
  }

  .cursor {
    animation: none;
    opacity: 0;
  }

  .nudge {
    transition: none;
  }

  .continue.is-arrow::before {
    animation: none;
  }

  .contact-bubble::before,
  .contact-bubble__text,
  .contact-bubble__toggle,
  .contact-bubble__signature-media {
    transition: none !important;
  }

  .contact-bubble__text {
    transform: none !important;
    clip-path: none !important;
  }
}
