/* style.css
   Direction artistique : poster de fête foraine + humour de CE2.
   Couleurs qui claquent, contours épais, ombres dures, typo massive. */

:root {
  --bg: #1e5cff;
  --ink: #14110f;
  --accent-1: #ffd400;
  --accent-2: #ff3d9a;
  --card: #fff8e8;
  --shadow: var(--ink);

  --font-display: "Anton", "Arial Black", "Helvetica Neue", Impact, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

::selection {
  background: var(--accent-1);
  color: var(--ink);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fond graphique : un grain façon papier imprimé, par-dessus deux flaques
   de couleur et une trame de points. */
body {
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(circle at 8% 12%, color-mix(in srgb, var(--accent-2) 45%, transparent), transparent 60%),
    radial-gradient(circle at 92% 85%, color-mix(in srgb, var(--accent-1) 40%, transparent), transparent 58%),
    radial-gradient(var(--ink) 1.4px, transparent 1.4px);
  background-repeat: repeat, no-repeat, no-repeat, repeat;
  background-size: 140px 140px, 75vmax 75vmax, 70vmax 70vmax, 26px 26px;
  background-position: 0 0, 0 0, 100% 100%, -6px -6px;
}

/* En-tête : un badge autocollant */

.masthead {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(14px, 3.5vw, 28px);
}

.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 0.45em;
  max-width: min(92vw, 540px);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 0.75em 1em;
  box-shadow: 5px 5px 0 var(--shadow);
  transform: rotate(-2deg);
  cursor: default;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: clamp(30px, 5vw, 40px);
  height: clamp(30px, 5vw, 40px);
  background: var(--accent-2);
  color: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 7px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(17px, 2.8vw, 23px);
  box-shadow: 3px 3px 0 var(--shadow);
  transform: rotate(5deg);
}

.brand-mark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(22px, 3.8vw, 32px);
  letter-spacing: 0.03em;
  line-height: 1;
  color: var(--ink);
}

.brand-legend {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.35em 0.9em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brand-legend li {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.9vw, 15px);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 78%, var(--card));
  white-space: nowrap;
}

.brand-legend .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 2.5px solid var(--ink);
  background: var(--accent-1);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 14px;
}

.brand-legend li:nth-child(2n) .chip {
  background: var(--accent-2);
}

@media (max-width: 420px) {
  .brand-legend {
    grid-template-columns: auto;
  }
}

/* Décor flottant, en fond de scène : plein de petites formes qui vivent */

.stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  overflow: hidden;
}

.scenery {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  display: block;
}

.shape--ring {
  top: 11%;
  left: 7%;
  width: clamp(60px, 9vw, 120px);
  height: clamp(60px, 9vw, 120px);
  border: 6px solid var(--accent-1);
  border-radius: 50%;
  animation: float 7s ease-in-out infinite;
}

.shape--star {
  top: 64%;
  left: 5%;
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 72px);
  color: var(--accent-2);
  animation: float 6s ease-in-out infinite 0.4s, spin 16s linear infinite;
}
.shape--star::before {
  content: "✺";
}

.shape--dot {
  top: 18%;
  right: 9%;
  width: clamp(24px, 3vw, 40px);
  height: clamp(24px, 3vw, 40px);
  background: var(--accent-2);
  border-radius: 50%;
  animation: float 5s ease-in-out infinite 0.2s;
}

.shape--zigzag {
  bottom: 11%;
  right: 7%;
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 88px);
  color: var(--card);
  opacity: 0.9;
  animation: float 8s ease-in-out infinite 0.6s;
}
.shape--zigzag::before {
  content: "✷";
}

.shape--plus {
  top: 6%;
  left: 42%;
  font-size: clamp(30px, 4.5vw, 52px);
  color: var(--accent-1);
  opacity: 0.9;
  animation: float 5.5s ease-in-out infinite 0.3s;
}
.shape--plus::before {
  content: "✛";
}

.shape--diamond {
  top: 45%;
  right: 4%;
  font-size: clamp(26px, 4vw, 44px);
  color: var(--card);
  opacity: 0.8;
  animation: float 6.5s ease-in-out infinite 0.5s;
}
.shape--diamond::before {
  content: "◆";
}

.shape--ring2 {
  bottom: 20%;
  left: 16%;
  width: clamp(20px, 2.6vw, 34px);
  height: clamp(20px, 2.6vw, 34px);
  border: 5px solid var(--card);
  border-radius: 50%;
  animation: float 5.2s ease-in-out infinite 0.7s;
}

.shape--spark {
  bottom: 6%;
  left: 44%;
  font-size: clamp(28px, 4vw, 48px);
  color: var(--accent-2);
  opacity: 0.85;
  animation: float 7.5s ease-in-out infinite 0.15s, spin 20s linear infinite reverse;
}
.shape--spark::before {
  content: "✳";
}

.shape--squiggle {
  top: 34%;
  left: 22%;
  font-family: var(--font-display);
  font-size: clamp(24px, 3.4vw, 38px);
  color: var(--accent-1);
  opacity: 0.75;
  animation: float 6.2s ease-in-out infinite 0.35s;
}
.shape--squiggle::before {
  content: "〜〜";
}

.shape--stamp {
  top: 9%;
  right: 25%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(64px, 8vw, 104px);
  height: clamp(64px, 8vw, 104px);
  border: 4px solid var(--card);
  border-radius: 50%;
  opacity: 0.5;
  transform: rotate(-14deg);
  animation: float 6.8s ease-in-out infinite 0.25s;
}

.shape--stamp::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 2px solid var(--card);
  border-radius: 50%;
}

.shape--stamp::after {
  content: "Officiel";
  font-family: var(--font-mono);
  font-size: clamp(9px, 1vw, 11px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-16px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .shape--ring,
  .shape--dot,
  .shape--plus,
  .shape--diamond,
  .shape--ring2,
  .shape--squiggle,
  .shape--stamp {
    display: none;
  }
}

/* Intro : la page reste quasi vide, juste la question et un bouton costaud */

.intro {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(32px, 6vw, 56px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.intro.is-leaving {
  opacity: 0;
  transform: translateY(-18px) scale(0.96);
}

.intro[hidden],
.result[hidden] {
  display: none;
}

.question {
  margin: 0;
  max-width: 23ch;
  font-weight: 400;
  font-size: clamp(30px, 6vw, 60px);
  line-height: 1.08;
  letter-spacing: 0.02em;
  color: var(--card);
  transform: rotate(-1.5deg);
}

.pop {
  display: inline-block;
  background: var(--accent-1);
  color: var(--ink);
  padding: 0 0.18em;
  box-shadow: 5px 5px 0 var(--shadow);
}

.btn-primary {
  appearance: none;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--accent-2);
  color: var(--card);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.9em 2em;
  cursor: pointer;
  box-shadow: 7px 7px 0 var(--shadow);
  transform: rotate(1deg);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: invite-pulse 2.4s ease-in-out infinite;
}

.btn-primary:hover {
  animation: none;
  transform: rotate(1deg) translate(-3px, -3px);
  box-shadow: 10px 10px 0 var(--shadow);
}

.btn-primary:active {
  animation: none;
  transform: rotate(1deg) translate(4px, 4px);
  box-shadow: 3px 3px 0 var(--shadow);
}

@keyframes invite-pulse {
  0%,
  100% {
    transform: rotate(1deg) scale(1);
  }
  50% {
    transform: rotate(1deg) scale(1.045);
  }
}

.btn-primary:focus-visible,
.action-btn:focus-visible {
  outline: 3px solid var(--accent-1);
  outline-offset: 4px;
}

/* Résultat : le carton de foire qui claque */

.result {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.4vw, 28px);
  width: min(90vw, 640px);
  min-height: clamp(360px, 52vw, 480px);
  background-color: var(--card);
  background-image:
    repeating-linear-gradient(90deg, var(--ink) 0 9px, transparent 9px 16px),
    repeating-linear-gradient(90deg, var(--ink) 0 9px, transparent 9px 16px);
  background-repeat: repeat-x, repeat-x;
  background-size: 100% 2.5px, 100% 2.5px;
  background-position: 0 10px, 0 calc(100% - 10px);
  border: 4px solid var(--ink);
  border-radius: 18px;
  padding: clamp(28px, 5vw, 52px) clamp(20px, 6vw, 64px);
  box-shadow: 12px 12px 0 var(--shadow);
  transform: rotate(-1.1deg) scale(0.94);
  opacity: 0;
}

.result::before {
  content: "✺";
  position: absolute;
  top: -0.55em;
  right: -0.35em;
  font-size: clamp(48px, 9vw, 96px);
  color: var(--accent-2);
  line-height: 1;
  z-index: -1;
  transform: rotate(8deg);
}

.ticket-notch {
  position: absolute;
  top: 50%;
  width: clamp(20px, 3.4vw, 32px);
  height: clamp(20px, 3.4vw, 32px);
  background: var(--bg);
  border: 4px solid var(--ink);
  border-radius: 50%;
  z-index: 1;
}

.ticket-notch--left {
  left: 0;
  transform: translate(-50%, -50%);
}

.ticket-notch--right {
  right: 0;
  transform: translate(50%, -50%);
}

.result::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    -150px -70px 0 6px var(--accent-1),
    130px -95px 0 5px var(--accent-2),
    -100px 85px 0 5px var(--ink),
    155px 65px 0 6px var(--accent-1),
    5px -140px 0 5px var(--accent-2),
    -175px 15px 0 4px var(--ink),
    175px -5px 0 5px var(--accent-1),
    -10px 145px 0 5px var(--accent-2),
    -210px 40px 0 4px var(--accent-2),
    210px 30px 0 5px var(--ink),
    -60px -190px 0 4px var(--accent-1),
    70px 185px 0 4px var(--accent-2),
    -135px 150px 0 5px var(--accent-1),
    140px -150px 0 4px var(--ink),
    -220px -60px 0 5px var(--ink),
    225px -110px 0 4px var(--accent-1);
  opacity: 0;
  z-index: -1;
  pointer-events: none;
}

.result.is-visible {
  animation: pop-in 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) forwards;
}

.result.is-visible::after {
  animation: confetti 0.8s cubic-bezier(0.2, 1, 0.4, 1) forwards;
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: rotate(-1.1deg) scale(0.82) translateY(18px);
  }
  100% {
    opacity: 1;
    transform: rotate(-1.1deg) scale(1) translateY(0);
  }
}

@keyframes confetti {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2) rotate(0deg);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.75) rotate(24deg);
  }
}

.result-name {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.02em;
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.result-firstname {
  color: var(--accent-2);
  font-size: clamp(30px, 7vw, 60px);
  text-shadow: 2px 2px 0 var(--shadow);
}

.result-lastname {
  color: var(--ink);
  font-size: clamp(42px, 12vw, 132px);
  text-shadow: 4px 4px 0 var(--accent-1);
  transform: rotate(-1.2deg);
}

.result-tagline {
  position: relative;
  margin: 0;
  max-width: 32ch;
  display: inline-block;
  background: var(--accent-1);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-align: center;
  padding: 0.75em 1.3em;
  border: 2.5px dashed var(--ink);
  border-radius: 8px;
  transform: rotate(-1.4deg);
}

.result-tagline::before {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  width: 17px;
  height: 17px;
  background: var(--accent-2);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
}

.result-tagline::after {
  content: "”";
  position: absolute;
  bottom: -0.62em;
  right: 0.35em;
  font-family: var(--font-display);
  font-size: 2.6em;
  font-weight: 400;
  line-height: 1;
  color: var(--accent-2);
  -webkit-text-stroke: 1.5px var(--ink);
  paint-order: stroke fill;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
}

.action-btn {
  appearance: none;
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.65em 1.1em;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.action-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--shadow);
}

.action-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.action-btn--again {
  background: var(--accent-2);
  color: var(--card);
}

/* Pied de page */

/* Tampon encreur : contour irrégulier façon cachet, encre unique,
   légèrement de travers comme apposé à la main. */
.legal {
  position: relative;
  z-index: 2;
  align-self: center;
  margin: clamp(16px, 3vw, 28px) 0 clamp(20px, 4vw, 32px);
  padding: 0.65em 1.4em;
  text-align: center;
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.4vw, 11.5px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-1);
  background: transparent;
  border: 2.5px solid currentColor;
  border-radius: 3px 12px 4px 14px / 12px 4px 14px 3px;
  transform: rotate(-2.5deg);
}

.legal-sep {
  margin: 0 0.5em;
  opacity: 0.5;
}

.legal-credit {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1.5px dashed currentColor;
}

.legal-credit:hover,
.legal-credit:focus-visible {
  color: var(--bg);
  background: var(--accent-1);
  border-bottom-color: transparent;
  border-radius: 3px;
}

@media (max-width: 480px) {
  .question {
    transform: rotate(-1deg);
  }
}
