/* ============================================================
   Le Registre — mur des pièces versées au dossier
   Lisible sur un téléphone de 360 px comme projeté sur un écran.
   ============================================================ */

:root {
  --navy: #141f38;
  --paper: #fffdf8;
  --ink: #1b2742;
  --ink-soft: #4a5876;
  --gold: #a8842c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Teintes neutres tant que le résultat n'est pas connu de la page */
  --c-mid: #8e9bb5;
  --c-deep: #3a465f;
  --c-abyss: #141f38;
}

body[data-result="fille"] {
  --c-mid: #ff86b6;
  --c-deep: #cf2068;
  --c-abyss: #4b0a28;
}

body[data-result="garcon"] {
  --c-mid: #74aaff;
  --c-deep: #1c5cce;
  --c-abyss: #06203f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 30px) 18px
    calc(env(safe-area-inset-bottom, 0px) + 48px);
  background: var(--c-abyss);
  color: #fff;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 900ms ease;
}

/* ------------------------------------------------------------- décor */

.aurora,
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.aurora {
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.blob-1 {
  width: 70vmax;
  height: 70vmax;
  top: -32vmax;
  left: -22vmax;
  background: radial-gradient(circle, var(--c-deep) 0%, transparent 62%);
  opacity: 0.75;
  animation: drift-a 17s ease-in-out infinite alternate;
}

.blob-2 {
  width: 58vmax;
  height: 58vmax;
  right: -24vmax;
  bottom: -26vmax;
  background: radial-gradient(circle, var(--c-mid) 0%, transparent 58%);
  opacity: 0.4;
  animation: drift-b 21s ease-in-out infinite alternate;
}

@keyframes drift-a {
  to {
    transform: translate3d(16vmax, 12vmax, 0) scale(1.22);
  }
}

@keyframes drift-b {
  to {
    transform: translate3d(-14vmax, -11vmax, 0) scale(1.18);
  }
}

.grain {
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ en-tête */

.masthead,
main {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
}

.masthead {
  text-align: center;
  margin-bottom: 34px;
}

.kicker {
  margin: 0 0 6px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.04;
}

.tagline {
  margin: 0 0 16px;
  font-size: 0.98rem;
  color: rgba(255, 255, 255, 0.82);
}

.back {
  display: inline-block;
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.placeholder {
  margin: 48px auto;
  max-width: 34ch;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
}

body[data-state="ready"] .placeholder {
  display: none;
}

/* --------------------------------------------------------------- le mur */

/* Colonnes CSS : une maçonnerie sans script, qui se réduit naturellement
   à une seule colonne sur un téléphone. */
.wall {
  columns: 320px;
  column-gap: 16px;
}

@media (min-width: 1100px) {
  .wall {
    column-gap: 20px;
  }
}

.note {
  break-inside: avoid;
  margin: 0 0 16px;
  padding: 18px 18px 15px;
  color: var(--ink);
  background: var(--paper);
  border-radius: 3px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 18px 34px -22px rgba(0, 0, 0, 0.55);
  /* Chaque fiche est très légèrement de travers, comme posée à la main. */
  transform: rotate(var(--tilt));
}

.note::before {
  content: "";
  display: block;
  width: 34px;
  height: 2px;
  margin-bottom: 13px;
  background: linear-gradient(90deg, var(--gold), rgba(168, 132, 44, 0.25));
}

.note-body {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.52;
  /* Le texte est inséré via textContent : les retours à la ligne de
     l'auteur sont conservés, sans qu'aucun balisage ne soit interprété. */
  white-space: pre-wrap;
  overflow-wrap: break-word;
  text-wrap: pretty;
}

.note-foot {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.note-name {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.note-badge {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  transform: rotate(-3deg);
  white-space: nowrap;
}

.note-badge.exact {
  color: #1d7a52;
}

.note-badge.rate {
  color: #a33a2d;
}

.note.mine {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

/* Entrée en fondu des fiches, échelonnée et seulement à leur arrivée */
.note.fresh {
  animation: note-in 700ms var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 70ms);
}

@keyframes note-in {
  from {
    opacity: 0;
    transform: translateY(14px) rotate(var(--tilt)) scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob {
    animation: none;
  }

  .note {
    transform: none;
  }

  .note.fresh {
    animation: none;
  }

  body {
    transition: none;
  }
}
