/* Cagnotte — thème « jazz club de La Nouvelle-Orléans, la nuit ».
   Nuit bleu-vert, ivoire, un seul accent laiton, cadres art déco à double
   filet, ornements ⚜. Zéro JavaScript client, CSP stricte (aucun style
   inline). Polices auto-hébergées (SIL OFL) : Fraunces + Outfit. */

/* --- Polices ---------------------------------------------------------------- */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fraunces-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/fraunces-latin-700-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/fraunces-latin-900-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/fraunces-latin-400-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/outfit-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/outfit-latin-500-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/outfit-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/outfit-latin-700-normal.woff2') format('woff2');
}

/* --- Système ------------------------------------------------------------------ */

:root {
  /* Nuit bleu-vert du Vieux Carré */
  --nuit: #131a1f;
  --scene: #1a232a;
  --scene-haute: #212c34;
  --creuse: #2a3741;

  /* Ivoire chaud, une seule famille de gris (teintée sépia) */
  --ivoire: #f0e5cd;
  --ivoire-doux: #a3987f;

  /* Un seul accent : laiton de trompette, désaturé */
  --laiton: #cfa350;
  --laiton-clair: #e2bd74;
  --laiton-fonce: #a97f35;
  --laiton-voile: rgba(207, 163, 80, 0.14);
  --laiton-filet: rgba(207, 163, 80, 0.45);

  /* Jaune vif du saxo — réservé aux boutons d'action pour qu'ils ressortent */
  --saxo: #ffc23c;
  --saxo-clair: #ffd76e;
  --saxo-fonce: #f0a91c;

  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Outfit', 'Segoe UI', system-ui, sans-serif;

  /* Ombres de nuit, teintées bleu profond, lumière tombant du lustre */
  --ombre-carte: 0 1px 0 rgba(240, 229, 205, 0.06) inset, 0 18px 44px -16px rgba(4, 8, 12, 0.8);
  --ombre-bouton: 0 4px 14px -4px rgba(207, 163, 80, 0.55);
}

* { box-sizing: border-box; }

::selection { background: var(--laiton); color: var(--nuit); }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16.5px;
  background:
    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.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' fill='%23ffffff' filter='url(%23n)' opacity='0.028'/%3E%3C/svg%3E"),
    radial-gradient(860px 520px at 82% -10%, rgba(207, 163, 80, 0.13), transparent 62%),
    radial-gradient(700px 460px at -14% 24%, rgba(63, 96, 110, 0.20), transparent 60%),
    radial-gradient(1200px 800px at 50% 118%, rgba(20, 32, 40, 0.9), transparent 70%),
    var(--nuit);
  color: var(--ivoire);
  line-height: 1.6;
  min-height: 100dvh;
  /* le ruban incliné déborde volontairement : on rogne sans créer de
     conteneur de défilement (clip ne casse pas position: sticky) */
  overflow-x: clip;
}

/* --- Animations d'entrée (CSS pur) ------------------------------------------------ */

@keyframes lever {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes defiler {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 26px 84px;
}

.page-narrow { max-width: 720px; }

/* --- Hero « affiche de concert » --------------------------------------------------------- */

.affiche {
  position: relative;
  padding: 58px 0 30px;
  animation: lever 500ms ease-out both;
}

/* réserve l'angle droit au sticker, à toutes les tailles */
.affiche .surtitre { max-width: calc(100% - clamp(70px, 14vw, 160px)); }

.surtitre {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.38em;
  color: var(--laiton);
}

.affiche h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(46px, 9.6vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 11em;
  color: var(--ivoire);
  text-shadow: 0 2px 0 rgba(4, 8, 12, 0.6), 0 0 46px rgba(207, 163, 80, 0.18);
}

.affiche .sous-titre {
  margin: 20px 0 0 clamp(0px, 12vw, 150px);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(18px, 2.6vw, 24px);
  color: var(--ivoire-doux);
  max-width: 26em;
}

/* Saxo qui chevauche le titre, dans le halo du projecteur */
.sticker {
  position: absolute;
  /* aligné sur le bloc du titre : descend avec la taille de l'écran */
  top: clamp(30px, 6.5vw, 116px);
  right: clamp(0px, 6vw, 80px);
  line-height: 1;
  transform: rotate(12deg);
  filter: drop-shadow(0 0 34px rgba(207, 163, 80, 0.5));
  user-select: none;
}

.sticker img {
  display: block;
  width: clamp(84px, 13vw, 168px);
  height: auto;
}

/* Variante du sticker pour les pages intérieures (titre plus petit) */
.sticker-page {
  top: clamp(14px, 3.4vw, 40px);
  right: clamp(6px, 4vw, 44px);
}

.sticker-page img { width: clamp(96px, 15vw, 150px); }

/* en-tête court et centré (Merci, etc.) : titre réellement centré,
   petit saxo collé à sa droite */
.entete-page.centre:has(.sticker-page) h1,
.entete-page.centre:has(.sticker-page) .surtitre { max-width: none; }

.entete-page.centre .sticker-page {
  top: 42px;
  right: auto;
  left: calc(50% + clamp(88px, 11.5vw, 142px));
}

.entete-page.centre .sticker-page img { width: clamp(46px, 6vw, 60px); }

.btn-hero {
  width: auto;
  margin-top: 30px;
  padding: 16px 44px;
  font-size: 19px;
  transform: rotate(-1deg);
}

/* --- Ruban défilant façon enseigne ---------------------------------------------------------- */

.ruban {
  overflow: hidden;
  border-top: 1.5px solid var(--laiton);
  border-bottom: 1.5px solid var(--laiton);
  background: var(--laiton);
  color: var(--nuit);
  margin: 30px -26px 50px;
  transform: rotate(-1.1deg);
  box-shadow: 0 8px 30px -10px rgba(207, 163, 80, 0.35);
}

.ruban-piste {
  display: flex;
  white-space: nowrap;
  width: max-content;
  animation: defiler 26s linear infinite;
}

.ruban-piste span {
  display: inline-block;
  padding: 9px 0;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

/* --- Grille principale asymétrique ------------------------------------------------------------ */

.duo {
  display: grid;
  grid-template-columns: 370px 1fr;
  gap: 56px;
  align-items: start;
}

/* en Grid, min-width:auto empêche les colonnes de rétrécir sous la largeur
   de leur contenu : on l'annule pour un mobile sans débordement */
.duo > * { min-width: 0; }

.colonne-total { position: sticky; top: 28px; }

/* --- Bloc total : cadre art déco à double filet -------------------------------------------------- */

.bloc-total {
  position: relative;
  background: linear-gradient(175deg, var(--scene-haute), var(--scene));
  border: 1.5px solid var(--laiton);
  border-radius: 6px;
  outline: 1px solid var(--laiton-filet);
  outline-offset: -8px;
  box-shadow: var(--ombre-carte);
  padding: 34px 32px 34px;
  animation: lever 500ms 120ms ease-out both;
}

/* fleur de lys posée sur le filet supérieur, sans cache (aucun raccord) */
.bloc-total::before {
  content: '⚜';
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--laiton);
  font-size: 20px;
  line-height: 1.6;
  text-shadow: 0 0 6px var(--nuit), 0 0 6px var(--nuit);
}

.total-label {
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--ivoire-doux);
}

.total-amount {
  margin: 10px 0 0;
  text-align: center;
  font-family: var(--serif);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: clamp(54px, 6vw, 74px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--laiton-clair);
  text-shadow: 0 0 38px rgba(207, 163, 80, 0.35);
}

.total-count {
  margin: 12px 0 26px;
  text-align: center;
  color: var(--ivoire-doux);
  font-size: 15.5px;
}

progress.progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 10px;
  margin: 0 0 8px;
  border: 1px solid var(--laiton-filet);
  border-radius: 999px;
  overflow: hidden;
  background: var(--nuit);
}

progress.progress::-webkit-progress-bar { background: var(--nuit); }
progress.progress::-webkit-progress-value { background: var(--laiton); }
progress.progress::-moz-progress-bar { background: var(--laiton); }

.progress-label {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--ivoire-doux);
  text-align: center;
}

.note-secu {
  margin: 18px 4px 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ivoire-doux);
  text-wrap: pretty;
  text-align: center;
}

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

.btn {
  display: inline-block;
  text-align: center;
  padding: 15px 30px;
  border: none;
  border-radius: 4px;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, background-color 200ms ease;
}

.bloc-total .btn,
.form .btn,
.carte .btn { width: 100%; }

.btn-primary {
  background: linear-gradient(180deg, var(--saxo-clair), var(--saxo) 55%, var(--saxo-fonce));
  color: var(--nuit);
  box-shadow: 0 4px 18px -4px rgba(255, 194, 60, 0.6);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ffe291, var(--saxo-clair) 55%, var(--saxo));
  transform: translateY(-2px);
  box-shadow: 0 8px 28px -6px rgba(255, 194, 60, 0.75);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 2px 8px -2px rgba(255, 194, 60, 0.5);
}

.btn:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid var(--laiton);
  outline-offset: 3px;
}

/* --- Le mur des invités ------------------------------------------------------------------------------- */

.mur h2 {
  margin: 4px 0 28px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: -0.01em;
  color: var(--ivoire);
}

.mur h2 em {
  font-style: italic;
  font-weight: 400;
  color: var(--laiton);
}

.notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 18px;
  align-items: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Chaque mot d'invité : petit programme de concert */
.note {
  position: relative;
  background: linear-gradient(178deg, var(--scene-haute), var(--scene));
  border: 1px solid var(--laiton-filet);
  border-radius: 5px;
  box-shadow: var(--ombre-carte);
  padding: 24px 22px 18px;
  margin: 0;
  animation: lever 480ms ease-out both;
  transition: transform 220ms ease, border-color 220ms ease;
}

.note:hover {
  transform: translateY(-3px) rotate(0deg) !important;
  border-color: var(--laiton);
}

.note:nth-child(4n + 1) { transform: rotate(-0.7deg); animation-delay: 80ms; }
.note:nth-child(4n + 2) { transform: rotate(0.6deg); animation-delay: 160ms; }
.note:nth-child(4n + 3) { transform: rotate(-0.4deg); animation-delay: 240ms; }
.note:nth-child(4n + 4) { transform: rotate(0.8deg); animation-delay: 320ms; }

.note-entete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.note-nom {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ivoire);
}

/* note de musique à la place du montant (jamais affiché publiquement) */
.note-montant {
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  white-space: nowrap;
  color: var(--laiton);
}

.note-message {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ivoire-doux);
  overflow-wrap: anywhere;
}

.note-vide {
  border-style: dashed;
  box-shadow: none;
  background: transparent;
  text-align: center;
  color: var(--ivoire-doux);
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  padding: 36px 22px;
}

.note-cta {
  border-style: dashed;
  box-shadow: none;
  background: transparent;
  text-align: center;
  padding: 26px 22px;
}

.note-cta a {
  color: var(--laiton);
  font-weight: 600;
  font-size: 16.5px;
  text-decoration-color: var(--laiton-filet);
  text-underline-offset: 5px;
  transition: color 180ms ease;
}

.note-cta a:hover { color: var(--laiton-clair); }

/* --- Pied de page --------------------------------------------------------------------------------------- */

.footer {
  margin-top: 68px;
  padding-top: 24px;
  border-top: 1px solid var(--laiton-filet);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--ivoire-doux);
  font-size: 14px;
}

.footer p { margin: 0; }

/* --- Pages intérieures ------------------------------------------------------------------------------------ */

.entete-page {
  position: relative;
  padding: 50px 0 8px;
  animation: lever 450ms ease-out both;
}

/* réserve le flanc droit au saxo quand il est présent */
.entete-page:has(.sticker-page) h1,
.entete-page:has(.sticker-page) .surtitre {
  max-width: calc(100% - clamp(100px, 17vw, 170px));
}

.entete-page h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(38px, 7vw, 62px);
  letter-spacing: -0.02em;
  line-height: 1;
  text-wrap: balance;
  color: var(--ivoire);
  text-shadow: 0 0 40px rgba(207, 163, 80, 0.16);
}

.entete-page .sous-titre {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ivoire-doux);
  font-size: 18px;
}

.carte {
  position: relative;
  background: linear-gradient(175deg, var(--scene-haute), var(--scene));
  border: 1.5px solid var(--laiton);
  border-radius: 6px;
  outline: 1px solid var(--laiton-filet);
  outline-offset: -8px;
  box-shadow: var(--ombre-carte);
  padding: 34px 36px 38px;
  margin: 32px 0 26px;
  animation: lever 500ms 100ms ease-out both;
}

.carte::before {
  content: '⚜';
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--laiton);
  font-size: 20px;
  line-height: 1.6;
  text-shadow: 0 0 6px var(--nuit), 0 0 6px var(--nuit);
}

.carte.penche { transform: rotate(-0.4deg); }

.centre { text-align: center; }
.grand { font-size: 19px; }

.montant-affiche {
  font-family: var(--serif);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  font-size: 54px;
  line-height: 1.1;
  color: var(--laiton-clair);
  text-shadow: 0 0 34px rgba(207, 163, 80, 0.3);
  margin: 6px 0 10px;
}

/* --- Formulaire --------------------------------------------------------------------------------------------- */

.form label {
  display: block;
  font-weight: 600;
  font-size: 15.5px;
  margin: 22px 0 8px;
  color: var(--ivoire);
}

.form label:first-child { margin-top: 0; }

.form input[type="text"],
.form textarea {
  width: 100%;
  padding: 13px 16px;
  font-family: var(--sans);
  font-size: 16.5px;
  border: 1px solid var(--laiton-filet);
  border-radius: 4px;
  background: var(--nuit);
  color: var(--ivoire);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.form input::placeholder,
.form textarea::placeholder { color: #6d6350; }

.form input:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--laiton);
  box-shadow: 0 0 0 3px var(--laiton-voile);
}

.form textarea { resize: vertical; }

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 11px;
  font-weight: 500 !important;
}

.checkbox input {
  width: 19px;
  height: 19px;
  accent-color: var(--laiton);
}

.form .btn { margin-top: 28px; }

.hint {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--ivoire-doux);
}

.alert {
  background: var(--laiton-voile);
  border: 1px solid var(--laiton);
  border-radius: 4px;
  color: var(--laiton-clair);
  font-weight: 500;
  padding: 13px 17px;
  margin: 0 0 22px;
}

.secure-note {
  margin: 22px 0 0;
  font-size: 14px;
  color: var(--ivoire-doux);
  text-align: center;
  text-wrap: balance;
}

/* Pot de miel : invisible pour les humains. */
.hp { position: absolute; left: -9999px; top: -9999px; }

.back {
  text-align: center;
  margin-top: 8px;
}

.back a {
  color: var(--ivoire-doux);
  font-weight: 500;
  text-decoration-color: var(--laiton-filet);
  text-underline-offset: 4px;
  transition: color 180ms ease;
}

.back a:hover { color: var(--laiton-clair); }

/* --- Table admin ------------------------------------------------------------------------------------------------ */

.table-wrap { overflow-x: auto; margin-top: 18px; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--ivoire);
}

.admin-table th {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--laiton);
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--creuse);
  white-space: nowrap;
}

.admin-table .cell-message {
  white-space: normal;
  min-width: 160px;
  max-width: 280px;
}

.row-pending { color: var(--ivoire-doux); background: rgba(42, 55, 65, 0.35); }

.btn-danger {
  background: none;
  border: 1px solid var(--laiton-filet);
  border-radius: 4px;
  color: var(--laiton);
  cursor: pointer;
  padding: 4px 9px;
  font-size: 14px;
  transition: background-color 160ms ease, transform 120ms ease;
}

.btn-danger:hover { background: var(--laiton-voile); }
.btn-danger:active { transform: scale(0.93); }

/* --- Responsive --------------------------------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .duo { grid-template-columns: 1fr; gap: 42px; }
  .colonne-total { position: static; max-width: 470px; }
}

@media (max-width: 640px) {
  .page { padding: 0 18px 60px; }
  /* hero compacté : moins d'air en haut, sous-titre sans retrait */
  .affiche { padding: 28px 0 14px; }
  .affiche .sous-titre { margin-left: 0; }
  .btn-hero { margin-top: 22px; }
  /* bandeau plus fin et moins penché : mieux proportionné à l'écran */
  .ruban { margin: 18px -18px 32px; transform: rotate(-0.7deg); }
  .ruban-piste span { font-size: 12.5px; padding: 7px 0; letter-spacing: 0.17em; }
  .notes { grid-template-columns: 1fr; }
  .sticker { top: 88px; right: 8px; }
  .sticker img { width: 68px; }
  /* En-tête de page intérieure : texte et saxo côte à côte, alignés
     verticalement quel que soit le nombre de lignes du surtitre.
     (le positionnement absolu à hauteur fixe se décalait dès que le
     surtitre passait sur 2 ou 3 lignes) */
  .entete-page:has(.sticker-page):not(.centre) {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 14px;
    align-items: center;
  }

  .entete-page:has(.sticker-page):not(.centre) > .surtitre,
  .entete-page:has(.sticker-page):not(.centre) > h1,
  .entete-page:has(.sticker-page):not(.centre) > .sous-titre {
    grid-column: 1;
    max-width: none;
  }

  /* span 3 (surtitre + titre + sous-titre) et non "1 / -1" : sans grille
     explicite, -1 designe la ligne 1 et le saxo ne couvrirait qu'une ligne */
  .entete-page:has(.sticker-page):not(.centre) > .sticker-page {
    position: static;
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }

  .entete-page:has(.sticker-page):not(.centre) > .sticker-page img { width: 74px; }
  .carte { padding: 26px 20px 30px; }
  .footer { flex-direction: column; align-items: center; text-align: center; }
}
