/* Secret Santa famille 2026 — feuille unique.
   Crème, encre, un seul vert sapin. Grille de 12, filets de 1 px, aucun ornement. */

:root {
  --creme: #f4ebe1;
  --encre: #2a2926;
  --sapin: #1f3b2d;
  --sapin-nuit: #16301f;
  --sourdine: #5f594e;
  --creux: #eee1d3;
  --filet: rgba(42, 41, 38, 0.16);
  --filet-fort: rgba(42, 41, 38, 0.42);
  --serif: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --marge: clamp(1.25rem, 5.5vw, 6.5rem);
  --largeur: 78rem;
  --ligne-roue: 70px;
  --corps-roue: 50px;
}

@media (min-width: 40rem) {
  :root { --ligne-roue: 82px; --corps-roue: 58px; }
}
@media (min-width: 64rem) {
  :root { --ligne-roue: 106px; --corps-roue: 74px; }
}
@media (min-width: 90rem) {
  :root { --ligne-roue: 126px; --corps-roue: 86px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--filet-fort) transparent;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--creme);
  color: var(--encre);
  font-family: var(--sans);
  font-size: clamp(1.0625rem, 0.55vw + 0.95rem, 1.1875rem);
  line-height: 1.55;
  letter-spacing: 0.002em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--sapin);
  color: var(--creme);
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--sapin);
  outline-offset: 3px;
  border-radius: 1px;
}

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

/* ------------------------------------------------------------------ pages */

.page {
  min-height: 100svh;
  max-width: var(--largeur);
  margin: 0 auto;
  padding: clamp(1.5rem, 3.5vw, 2.75rem) var(--marge);
  display: flex;
  flex-direction: column;
}

.page--nu {
  justify-content: center;
  align-content: center;
}

.bandeau {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--filet);
}

.bandeau__date {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sourdine);
  font-variant-numeric: tabular-nums;
}

.feuille {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(0.75rem, 1.5vw, 1.6rem);
  row-gap: clamp(1.25rem, 3vw, 2.25rem);
  align-content: center;
  padding: clamp(2rem, 6vh, 4.5rem) 0;
}

.feuille--admin { align-content: start; }

.note {
  flex: 0 0 auto;
  margin: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--filet);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--sourdine);
}

/* --------------------------------------------------------------- couverture */

.couverture {
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(2rem, 7vh, 5rem) 0 clamp(1.5rem, 4vh, 2.5rem);
}

.titre-accueil {
  margin: 0;
  margin-left: -0.068em;
  align-self: center;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 16vw, 12rem);
  line-height: 0.88;
  letter-spacing: -0.038em;
}

.phrase {
  margin: 0;
  max-width: 34ch;
  text-wrap: pretty;
}

/* ------------------------------------------------------------- typographie */

.titre-page {
  grid-column: 1 / span 7;
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.intro {
  grid-column: 8 / span 5;
  align-self: end;
  margin: 0;
  max-width: 38ch;
  color: var(--sourdine);
  text-wrap: pretty;
}

.soustitre {
  margin: 0 0 0.9rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.4vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.attente {
  margin: 0;
  color: var(--sourdine);
}

/* -------------------------------------------------------------------- voile */

.voile {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--sapin);
  pointer-events: none;
  animation: lever 700ms cubic-bezier(0.22, 0.8, 0.18, 1) both;
}

@keyframes lever {
  0%   { transform: translateY(0); visibility: visible; }
  100% { transform: translateY(-100%); visibility: hidden; }
}

/* -------------------------------------------------------------- formulaire */

.idees {
  grid-column: 1 / span 6;
  display: grid;
  margin-top: clamp(0.25rem, 1.5vw, 1rem);
  border-top: 1px solid var(--filet-fort);
}

.champ {
  display: grid;
  gap: 0.1rem;
  padding: 0.8rem 0 0.5rem;
  border-bottom: 1px solid var(--filet);
}

.champ label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sourdine);
}

.champ input {
  width: 100%;
  min-height: 44px;
  padding: 0.3rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 1.125rem;
  color: var(--encre);
  caret-color: var(--sapin);
  transition: background-color 160ms ease;
}

.champ input:hover { background: rgba(31, 59, 45, 0.035); }

.champ input[aria-invalid="true"] {
  box-shadow: inset 0 -2px 0 var(--sapin);
}

.champ__erreur {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--sapin);
}

.bouton {
  justify-self: start;
  margin-top: 1.75rem;
  min-height: 52px;
  padding: 0 2.1rem;
  border: 0;
  border-radius: 1px;
  background: var(--sapin);
  color: var(--creme);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 180ms ease, transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bouton:hover { background: var(--sapin-nuit); }
.bouton:active { transform: translateY(1px); }

.erreur {
  margin: 1rem 0 0.25rem;
  padding: 0.9rem 1.05rem;
  max-width: 44ch;
  border: 1px solid var(--filet-fort);
  border-radius: 1px;
  background: var(--creux);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------- révélation */

.titre-revelation {
  grid-column: 1 / -1;
  margin: 0;
}

.chapeau {
  display: block;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.roue {
  grid-column: 1 / -1;
  position: relative;
  height: var(--ligne-roue);
  overflow: hidden;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--corps-roue);
  letter-spacing: -0.02em;
  color: var(--sapin);
}

.roue::before,
.roue::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--filet);
  z-index: 1;
}

.roue::before { top: 0; }
.roue::after { bottom: 0; }

.roue__bande {
  margin: 0;
  padding: 0;
  list-style: none;
  animation: defile 2.2s cubic-bezier(0.17, 0.72, 0.14, 1) both;
}

.roue__bande li {
  height: var(--ligne-roue);
  line-height: var(--ligne-roue);
  white-space: nowrap;
}

/* Le défilement part du premier nom et s'arrête sur le dernier, quel que soit
   le nombre de noms : -100% + une ligne = la dernière ligne dans la fenêtre.
   Le dernier nom de la bande est le nom tiré, donc l'arrêt est exact. */
@keyframes defile {
  0%   { transform: translateY(0); filter: blur(0.4px); }
  26%  { filter: blur(1.5px); }
  70%  { transform: translateY(calc(-100% + var(--ligne-roue) - 0.1em)); filter: blur(0.6px); }
  88%  { transform: translateY(calc(-100% + var(--ligne-roue) + 0.045em)); }
  100% { transform: translateY(calc(-100% + var(--ligne-roue))); filter: blur(0); }
}

.feuille--revelation { row-gap: clamp(0.5rem, 1.6vw, 1.1rem); }

.relance-ligne {
  grid-column: 1 / -1;
  margin: 0.6rem 0 0;
}

.relance {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--filet-fort);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--sapin);
  text-decoration: none;
  transition: border-color 180ms ease;
}

.relance:hover { border-color: var(--sapin); }

.idees-revelees {
  grid-column: 1 / span 8;
  margin-top: clamp(1.25rem, 3vw, 2rem);
  padding-top: 1.15rem;
  border-top: 1px solid var(--filet-fort);
  /* Les idées n'apparaissent qu'une fois la roue arrêtée. */
  animation: apparaitre 500ms ease 2.15s both;
}

@keyframes apparaitre {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: none; }
}

.liste-idees {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: idee;
}

.liste-idees li {
  counter-increment: idee;
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--filet);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.liste-idees li:first-child { border-top: 0; }

.liste-idees li::before {
  content: counter(idee) ".";
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--sapin);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ administration */

.tableau {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: clamp(0.75rem, 2vw, 1.5rem);
  border-collapse: collapse;
  text-align: left;
}

.tableau th {
  padding: 0.55rem 1rem 0.55rem 0;
  border-bottom: 1px solid var(--filet-fort);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--sourdine);
}

.tableau td {
  padding: 0.8rem 1rem 0.8rem 0;
  border-bottom: 1px solid var(--filet);
  vertical-align: middle;
  font-size: 1.0625rem;
}

.tableau td.nom {
  font-weight: 500;
  white-space: nowrap;
}

.etat {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.etat--ok { color: var(--sapin); }
.etat--attente { color: var(--sourdine); }

.cellule-lien { width: 60%; }

.lien {
  display: inline-block;
  min-height: 44px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--sapin);
  word-break: break-all;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28em;
  text-decoration-color: var(--filet-fort);
  transition: text-decoration-color 160ms ease;
}

.lien:hover { text-decoration-color: var(--sapin); }

/* ------------------------------------------------------------- adaptation */

@media (max-width: 62rem) {
  .titre-page,
  .intro,
  .idees,
  .idees-revelees {
    grid-column: 1 / -1;
  }

  .intro { max-width: 44ch; }

  .tableau td,
  .tableau th { padding-right: 0.75rem; }
}

@media (max-width: 46rem) {
  .phrase { max-width: none; }

  .tableau,
  .tableau tbody,
  .tableau tr,
  .tableau td { display: block; width: 100%; }

  .tableau thead { display: none; }

  .tableau tr {
    padding: 1rem 0 1.1rem;
    border-bottom: 1px solid var(--filet);
  }

  .tableau td {
    padding: 0 0 0.5rem;
    border: 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
  }

  .tableau td:last-child {
    display: block;
    padding-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .voile { display: none; }

  .roue__bande {
    animation: none;
    transform: none;
    filter: none;
  }

  /* Une seule ligne : le nom tiré, posé dans la fenêtre. */
  .roue__bande li:not(:last-child) { display: none; }

  .idees-revelees {
    animation: none;
    opacity: 1;
    transform: none;
    margin-top: 2.25rem;
  }

  .relance-ligne { display: none; }

  .bouton,
  .relance,
  .lien,
  .champ input { transition: none; }
}
