/* genie.paris — bleu Klein, papier blanc, or de lampe. */

@font-face {
  font-family: 'Shrikhand';
  src: url('/fonts/shrikhand-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Next';
  src: url('/fonts/atkinson-hyperlegible-next-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Next';
  src: url('/fonts/atkinson-hyperlegible-next-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --klein: #1b32c4;
  --klein-deep: #13248f;
  --ink: #0e1240;
  --ink-soft: #4a4f7a;
  --paper: #ffffff;
  --mist: #eef1ff;
  --line: #c9d0f5;
  --gold: #ffc53d;
  --gold-soft: #fff3cf;
  --flame: #ff3621;
  --smoke: #7fe0d4;

  --display: 'Shrikhand', 'Cooper Black', Georgia, serif;
  --text: 'Atkinson Next', 'Atkinson Hyperlegible', system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: 2.25rem;
  --step-4: 3rem;

  --r-sheet: 28px;
  --r-control: 14px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--klein);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 3px solid var(--flame);
  outline-offset: 3px;
  border-radius: 6px;
}

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

.wordmark {
  font-family: var(--display);
  font-size: var(--step-1);
  color: var(--paper);
  text-decoration: none;
  letter-spacing: 0.01em;
}

/* ---------- Structure ---------- */

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0;
  color: var(--paper);
}

.topbar__event {
  font-size: 0.8125rem;
  line-height: 1.3;
  max-width: 13rem;
  opacity: 0.85;
  text-align: right;
}

/* ---------- Accueil d'un compte ---------- */

.hero {
  flex: 1;
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem 2rem;
  color: var(--paper);
  align-content: start;
}

.hero__art {
  width: min(82%, 330px);
  justify-self: center;
  margin-bottom: 0.25rem;
}

.hero__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1.02;
  margin: 0;
  max-width: 12ch;
  text-wrap: balance;
}

.hero__lede {
  margin: 0.75rem 0 0;
  max-width: 34rem;
  font-size: var(--step-1);
  line-height: 1.45;
}

.hero__prize {
  margin: 0;
  max-width: 30rem;
  font-size: var(--step--1);
}

.hero__ctabar {
  margin-top: 1.25rem;
}

.hero__prize + .hero__legal,
.hero__ctabar + .hero__prize {
  margin-top: 0.9rem;
}

.fineprint {
  font-size: var(--step--1);
  opacity: 0.85;
  margin: 0;
}

.fineprint a + a {
  margin-left: 0.9rem;
}

/* ---------- Boutons ---------- */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: 700 1.1875rem/1 var(--text);
  padding: 1.05rem 1.6rem;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 4px 0 var(--flame);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--flame);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.btn--wish {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  font-size: 1.3125rem;
  padding: 1.15rem 1.9rem;
}

.btn--wish:active {
  box-shadow: 0 2px 0 var(--ink);
}

.btn--quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  padding-inline: 0.75rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font-weight: 400;
}

.btn--quiet:active {
  transform: none;
  box-shadow: none;
}

/* ---------- Parcours ---------- */

.flow {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.flow__art {
  display: none;
}

.flow__mascot {
  position: absolute;
  top: -3.6rem;
  right: 0.75rem;
  width: 96px;
  z-index: 1;
  pointer-events: none;
}

.sheet {
  position: relative;
  flex: 1;
  background: var(--paper);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  margin-top: 3.25rem;
  padding: 1.6rem 1.25rem 0;
  display: flex;
  flex-direction: column;
}

.progress {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
}

.progress li {
  width: 34px;
  height: 22px;
}

.progress svg {
  width: 100%;
  height: 100%;
  display: block;
}

.progress .p-fill {
  fill: var(--paper);
}

.progress .is-done .p-fill,
.progress .is-current .p-fill {
  fill: var(--gold);
}

.progress .is-todo {
  opacity: 0.35;
}

.progress__label {
  margin-left: 0.4rem;
  font-size: var(--step--1);
  color: var(--ink-soft);
  width: auto !important;
  height: auto !important;
}

.step__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}

.step__title:focus {
  outline: none;
}

.step__help {
  margin: 0.5rem 0 1.25rem;
  color: var(--ink-soft);
  max-width: 36rem;
}

.step__body {
  display: grid;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
}

.group__label,
.field__label {
  display: block;
  font-weight: 700;
  margin: 0 0 0.6rem;
}

.field__label small,
.group__label small {
  font-weight: 400;
  color: var(--ink-soft);
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

/* Pastilles à cocher : la lampe s'allume en or quand on choisit. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.chips--cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.chip {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.7rem 1rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  line-height: 1.25;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.chips--cards .chip {
  border-radius: 16px;
  padding: 0.8rem 2.6rem 0.8rem 1rem;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip__label {
  font-weight: 700;
}

.chip__hint {
  font-size: var(--step--1);
  color: var(--ink-soft);
}

.chip:hover {
  border-color: var(--klein);
}

.chip:has(input:checked) {
  background: var(--gold);
  border-color: var(--ink);
}

.chip:has(input:checked) .chip__hint {
  color: var(--ink);
}

.chips--cards .chip::after {
  content: '';
  position: absolute;
  right: 0.9rem;
  top: 0.95rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--paper);
}

.chips--cards .chip:has(input:checked)::after {
  border-color: var(--ink);
  background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 6.5' fill='none' stroke='%23FFC53D' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/80% no-repeat;
}

.chip:has(input:focus-visible) {
  outline: 3px solid var(--flame);
  outline-offset: 2px;
}

.chip--exclusive {
  border-style: dashed;
}

/* Champs texte */
.field {
  display: block;
}

.input,
.select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  padding: 0.85rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--r-control);
  background: var(--paper);
}

.select {
  appearance: none;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%230E1240' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 0.9rem center/1.1rem no-repeat;
  padding-right: 2.6rem;
}

.input::placeholder {
  color: #8a8fb3;
}

.input:focus,
.select:focus {
  border-color: var(--klein);
  outline: 3px solid rgba(27, 50, 196, 0.2);
  outline-offset: 0;
}

textarea.input {
  resize: vertical;
  min-height: 5.5rem;
  line-height: 1.4;
}

.row {
  display: grid;
  gap: 1rem;
}

.check {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  cursor: pointer;
}

.check input {
  width: 1.35rem;
  height: 1.35rem;
  margin: 0.12rem 0 0;
  accent-color: var(--klein);
  flex: none;
}

.check small {
  display: block;
  color: var(--ink-soft);
}

.honeypot {
  position: absolute;
  left: -9999px;
}

.error {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: var(--r-control);
  background: #fff0ee;
  border: 2px solid var(--flame);
  font-weight: 700;
}

.is-invalid {
  border-color: var(--flame) !important;
}

/* Barre d'actions collée en bas sur mobile */
.actions {
  position: sticky;
  bottom: 0;
  margin: auto -1.25rem 0;
  padding: 0.9rem 1.25rem calc(0.9rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--paper) 78%, rgba(255, 255, 255, 0));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.actions .btn:not(.btn--quiet) {
  flex: 1;
  max-width: 22rem;
  margin-left: auto;
}

/* ---------- Vœux exaucés ---------- */

.done {
  text-align: left;
}

.ticket {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin: 1.25rem 0;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--gold-soft);
  overflow: hidden;
  max-width: 26rem;
}

.ticket__main {
  padding: 0.9rem 1.1rem;
}

.ticket__main small {
  display: block;
  color: var(--ink-soft);
}

.ticket__id {
  font-family: var(--display);
  font-size: var(--step-2);
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.ticket__stub {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 1rem;
  border-left: 2px dashed var(--ink);
  background: var(--gold);
  font-family: var(--display);
  font-size: var(--step-1);
}

.done__next {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}

/* ---------- Pages simples (accueil, introuvable, mentions) ---------- */

.plain {
  flex: 1;
  display: grid;
  align-content: start;
  justify-items: start;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem 2.5rem;
  color: var(--paper);
  max-width: 44rem;
  margin: 0 auto;
  width: 100%;
}

.plain .hero__art {
  justify-self: center;
}

.legal {
  background: var(--klein);
  padding: 1rem;
}

.legal__sheet {
  max-width: 42rem;
  margin: 0 auto;
  background: var(--paper);
  border-radius: var(--r-sheet);
  padding: 1.5rem 1.5rem 2rem;
}

.legal__sheet .wordmark {
  color: var(--klein);
}

.legal h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--step-3);
  line-height: 1.1;
  margin: 1rem 0 1rem;
}

.legal h2 {
  font-size: var(--step-1);
  margin: 1.5rem 0 0.25rem;
}

.legal p,
.legal li {
  max-width: 38rem;
}

.noscript {
  color: var(--paper);
  padding: 2rem;
}

/* ---------- Illustration et animations ---------- */

.genie-art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.genie-art .g-wink {
  opacity: 0;
}

.genie-art .g-puff,
.genie-art .g-spark,
.genie-art .g-genie {
  transform-box: fill-box;
  transform-origin: center;
}

.genie-art .g-genie {
  transform-origin: 50% 100%;
}

.is-entering .g-puff {
  animation: puff 0.42s cubic-bezier(0.3, 1.6, 0.5, 1) both;
  animation-delay: calc(var(--i) * 45ms);
}

.is-entering .g-tail > g:first-child,
.is-entering .g-tail > g:last-child {
  animation: fade 0.3s ease both 0.55s;
}

.is-entering .g-genie {
  animation: rise 0.7s cubic-bezier(0.25, 1.4, 0.5, 1) both 0.55s;
}

.is-entering .g-spark {
  animation: twinkle 0.6s ease both;
  animation-delay: calc(1.1s + var(--i) * 120ms);
}

.is-granted .g-eye-r {
  opacity: 0;
}

.is-granted .g-wink {
  opacity: 1;
}

.is-granted .g-spark {
  animation: twinkle 0.7s ease both;
  animation-delay: calc(var(--i) * 110ms);
}

.is-granted .g-genie {
  animation: hop 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

@keyframes puff {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { transform: translateY(40px) scale(0.6); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes twinkle {
  0% { transform: scale(0) rotate(-40deg); }
  60% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes hop {
  0% { transform: none; }
  40% { transform: translateY(-16px) rotate(-3deg); }
  100% { transform: none; }
}

.step-enter {
  animation: step-in 0.28s ease both;
}

@keyframes step-in {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Écrans larges ---------- */

@media (min-width: 640px) {
  .hero__title {
    font-size: 3.75rem;
  }
  .row--2 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 960px) {
  .topbar {
    padding: 1.5rem 2.5rem 0;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: center;
    align-content: center;
    padding: 1rem 2.5rem 3rem;
    column-gap: 3rem;
    max-width: 82rem;
    margin: 0 auto;
    width: 100%;
  }

  .hero__art {
    grid-row: 1 / span 7;
    width: min(100%, 540px);
    margin: 0;
  }

  .topbar__event {
    max-width: none;
  }

  .hero__title {
    font-size: 4.5rem;
  }

  .flow {
    flex-direction: row;
    align-items: stretch;
    gap: 2.5rem;
    padding: 1.25rem 2.5rem 2.5rem;
    max-width: 82rem;
    margin: 0 auto;
    width: 100%;
  }

  .flow__art {
    display: block;
    flex: 0 0 34%;
    align-self: flex-start;
    position: sticky;
    top: 2rem;
  }

  .flow__mascot {
    display: none;
  }

  .sheet {
    margin-top: 0;
    border-radius: var(--r-sheet);
    padding: 2.25rem 2.5rem 0;
    box-shadow: 0 8px 0 var(--klein-deep);
    min-height: calc(100dvh - 7rem);
  }

  .actions {
    margin-inline: -2.5rem;
    padding-inline: 2.5rem;
    border-radius: 0 0 var(--r-sheet) var(--r-sheet);
  }

  .legal {
    padding: 2.5rem;
  }

  .legal__sheet {
    padding: 2.5rem 3rem 3rem;
  }
}

/* Co-branding Databricks × compte (logo client seulement après accord écrit) */
.cobrand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.5rem 0 0;
  color: var(--paper);
}
.cobrand img {
  height: 40px;
  width: auto;
}
.cobrand span[aria-hidden] {
  opacity: 0.7;
  font-size: var(--step-1);
}
.cobrand__name {
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: 0.02em;
}

.chips--rating .chip {
  min-width: 3.2rem;
  align-items: center;
}

@media (max-width: 959px) {
  .progress {
    padding-right: 5.75rem;
    gap: 0.25rem;
  }
  .progress li {
    width: 28px;
    height: 19px;
  }
  .progress__label {
    white-space: nowrap;
  }
}

/* ---------- Téléphone : le bouton reste toujours à portée de pouce ---------- */

@media (max-width: 959px) {
  .topbar--compact .topbar__event {
    display: none;
  }

  .hero {
    padding-bottom: 1.5rem;
    gap: 0.35rem;
  }

  .hero__art {
    width: auto;
    max-width: 100%;
    height: clamp(170px, 36svh, 340px);
    margin: 0 auto 0.25rem;
  }

  .hero__art > svg,
  .hero__art > img {
    height: 100%;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    object-fit: contain;
  }

  .hero__title {
    font-size: clamp(2rem, 9.6vw, 2.6rem);
    max-width: none;
  }

  .hero__lede {
    font-size: 1.0625rem;
    margin-top: 0.4rem;
  }

  .hero__ctabar {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 0.75rem -1.25rem 0;
    padding: 0.75rem 1.25rem calc(0.9rem + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--klein) 72%, rgba(27, 50, 196, 0));
  }

  .hero__ctabar .btn--wish {
    width: 100%;
  }

  .sheet {
    margin-top: 2.9rem;
    padding: 1.25rem 1.1rem 0;
  }

  .flow__mascot {
    width: 84px;
    top: -3.2rem;
    right: 0.6rem;
  }

  .progress {
    margin-bottom: 0.8rem;
  }

  .step__title {
    font-size: 1.95rem;
  }

  .step__help {
    font-size: 0.98rem;
    margin: 0.4rem 0 1rem;
  }

  .step__body {
    gap: 1.25rem;
  }

  .chips--cards .chip {
    padding: 0.65rem 2.4rem 0.65rem 0.9rem;
  }

  .actions {
    margin-inline: -1.1rem;
    padding-inline: 1.1rem;
  }
}

@media (max-width: 359px) {
  .wordmark {
    font-size: 1.15rem;
  }
  .topbar__event {
    max-width: 10rem;
  }
  .chips--cards {
    grid-template-columns: 1fr;
  }
}

/* Illustration fournie (image) : mêmes moments que le génie SVG */
.genie-img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 7px 0 rgba(14, 18, 64, 0.35));
}

.is-entering .genie-img {
  animation: rise-img 0.8s cubic-bezier(0.25, 1.35, 0.5, 1) both 0.1s;
}

.is-granted .genie-img {
  animation: hop 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) both;
  transform-origin: 50% 100%;
}

@keyframes rise-img {
  from { transform: translateY(28px) scale(0.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.topbar__short {
  display: none;
}

@media (max-width: 479px) {
  .topbar__long {
    display: none;
  }
  .topbar__short {
    display: inline;
  }
  .topbar__event {
    white-space: nowrap;
  }
}
