/* Listes de Noël — thème festif
   Polices embarquées (aucune ressource externe, compatible avec la CSP stricte). */

@font-face {
  font-family: "Mountains of Christmas";
  src: url("/fonts/mountains-of-christmas-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url("/fonts/nunito-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --red: #c8102e;
  --red-dark: #9b0d23;
  --red-soft: #fde8eb;
  --green: #17734a;
  --green-dark: #0f5434;
  --green-soft: #e4f4ea;
  --gold: #f2b632;
  --gold-soft: #fff4d6;
  --night: #0e2a47;
  --cream: #fff9f0;
  --ink: #2a2421;
  --muted: #74685f;
  --line: #efe3d3;
  --radius: 18px;
  --shadow: 0 10px 30px -12px rgba(110, 40, 20, .25);
  --display: "Mountains of Christmas", "Comic Sans MS", cursive;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--cream); }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  line-height: 1.5;
  /* Petits flocons dorés en fond */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='none' stroke='%23f2b632' stroke-opacity='.18' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M30 18v24M18 30h24M21.5 21.5l17 17M38.5 21.5l-17 17'/%3E%3Cpath d='M90 78v16M82 86h16M84.3 80.3l11.4 11.4M95.7 80.3L84.3 91.7'/%3E%3C/g%3E%3C/svg%3E"),
    var(--cream);
}

a { color: var(--green); font-weight: 700; }
a:hover { color: var(--green-dark); }

/* ---------- Neige ---------- */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.flake {
  position: absolute;
  top: -5vh;
  color: #bcd7f0;
  text-shadow: 0 0 3px #fff;
  opacity: var(--o, .9);
  font-size: var(--s, 14px);
  left: var(--x, 50%);
  animation: fall var(--d, 12s) linear var(--delay, 0s) infinite;
}
@keyframes fall {
  0% { transform: translate3d(0, -5vh, 0) rotate(0deg); }
  50% { transform: translate3d(var(--drift, 30px), 50vh, 0) rotate(180deg); }
  100% { transform: translate3d(0, 108vh, 0) rotate(360deg); }
}

/* ---------- En-tête ---------- */
.hero {
  position: relative;
  background: radial-gradient(120% 140% at 50% 0%, #e0263f 0%, var(--red) 45%, var(--red-dark) 100%);
  color: #fff;
  padding: 2.2rem 1.25rem 3.2rem;
}
.hero-inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
}
.brand {
  font-family: var(--display);
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  color: #fff;
  text-decoration: none;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .18);
  line-height: 1.1;
}
.brand:hover { color: var(--gold-soft); }

.nav { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.nav a, .nav button {
  font: inherit; font-weight: 700; font-size: .95rem;
  color: #fff; text-decoration: none;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  padding: .4rem .85rem; border-radius: 999px; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--red); }
.nav .who { font-size: .9rem; color: #ffe3e7; padding: 0 .3rem; }

.hero-snowline { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 40px; }
.hero-snowline path { fill: var(--cream); }

/* Guirlande lumineuse */
.garland {
  list-style: none; margin: 0; padding: 0;
  position: absolute; top: 0; left: 0; right: 0; height: 30px;
  display: flex; justify-content: space-around;
  border-top: 2px solid rgba(0, 0, 0, .25);
  overflow: hidden;
}
.garland li {
  width: 12px; height: 18px; margin-top: 6px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--gold);
  box-shadow: 0 0 10px 2px var(--gold);
  animation: twinkle 1.6s ease-in-out infinite alternate;
  position: relative;
}
.garland li::before {
  content: ""; position: absolute; top: -5px; left: 3px; width: 6px; height: 5px;
  background: #444; border-radius: 2px;
}
.garland li:nth-child(4n+2) { background: #43d17a; box-shadow: 0 0 10px 2px #43d17a; animation-delay: .4s; }
.garland li:nth-child(4n+3) { background: #4fb3ff; box-shadow: 0 0 10px 2px #4fb3ff; animation-delay: .8s; }
.garland li:nth-child(4n) { background: #ff8fd0; box-shadow: 0 0 10px 2px #ff8fd0; animation-delay: 1.2s; }
.garland li:nth-child(odd) { margin-top: 10px; }
@keyframes twinkle { from { opacity: 1; } to { opacity: .35; box-shadow: none; } }

/* ---------- Mise en page ---------- */
.page { width: 100%; max-width: 980px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 1.5rem 1rem 2rem; }

h1, h2, h3 { line-height: 1.2; }
.title-display {
  font-family: var(--display);
  font-size: clamp(2.3rem, 6vw, 3.4rem);
  color: var(--red);
  margin: .2rem 0 .3rem;
  text-shadow: 0 2px 0 #fff, 0 4px 0 rgba(200, 16, 46, .12);
}
h2 { font-size: 1.3rem; margin: 2rem 0 .9rem; display: flex; align-items: center; gap: .5rem; }
h3 { margin: 0 0 .6rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.mt0 { margin-top: 0; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card.festive { border-top: 6px solid var(--green); }
.card.gold { background: var(--gold-soft); border-color: #f5dc9b; }

/* ---------- Formulaires ---------- */
form { display: grid; gap: .85rem; }
label { display: grid; gap: .3rem; font-weight: 700; font-size: .95rem; }
.hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
input, textarea {
  font: inherit; font-size: 1rem;
  padding: .7rem .85rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
  color: var(--ink);
  width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--red); }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: .85rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.end { justify-content: flex-end; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; }
.inline-form input { flex: 1 1 220px; width: auto; }
.error { color: var(--red); font-weight: 700; font-size: .92rem; min-height: 1.2em; margin: 0; }

/* ---------- Boutons ---------- */
.btn {
  font: inherit; font-weight: 800; font-size: .98rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.15rem;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff; color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .35); color: var(--ink); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-dark); }
.btn.primary:hover { background: #d9183a; color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn.green:hover { background: #1c8656; color: #fff; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #4a3200; box-shadow: 0 4px 0 #c78f12; }
.btn.small { padding: .4rem .8rem; font-size: .88rem; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--red-soft); color: var(--red); box-shadow: none; }
.btn.danger { color: var(--red); border-color: #f4c9d0; }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.icon-btn { padding: .35rem .6rem; min-width: 2.2rem; }

/* ---------- Accueil ---------- */
.welcome { text-align: center; padding: 1rem 0 0; }
.welcome .tree { font-size: 4.5rem; display: block; animation: sway 3s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }

/* ---------- Page de mot de passe (cadeau fermé) ---------- */
.unlock { max-width: 460px; margin: 0 auto; text-align: center; }
.unlock .gift-svg { width: 150px; height: 150px; margin: 0 auto .5rem; display: block; animation: wiggle 2.8s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes wiggle {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(-6deg); }
  80% { transform: rotate(6deg); }
  85% { transform: rotate(-4deg); }
  90% { transform: rotate(3deg); }
}
.unlock form { text-align: left; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- Liste vue par les visiteurs ---------- */
.list-head { text-align: center; margin-bottom: 1.5rem; }
.list-head .by {
  display: inline-block; background: var(--green); color: #fff; font-weight: 800;
  padding: .25rem .9rem; border-radius: 999px; font-size: .9rem; letter-spacing: .02em;
}
.list-head .desc { max-width: 620px; margin: .8rem auto 0; font-size: 1.08rem; white-space: pre-wrap; }

.gifts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.gift {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.2rem 1.1rem 1.6rem;
  overflow: hidden;
  display: flex; flex-direction: column; gap: .45rem;
  animation: pop .45s ease both;
}
/* Ruban vertical façon paquet cadeau */
.gift::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 8px;
  background: repeating-linear-gradient(180deg, var(--red) 0 14px, #fff 14px 20px, var(--green) 20px 34px, #fff 34px 40px);
}
.gift:nth-child(3n+2)::before { background: repeating-linear-gradient(180deg, var(--green) 0 14px, var(--gold) 14px 20px); }
.gift:nth-child(3n)::before { background: repeating-linear-gradient(180deg, var(--gold) 0 14px, var(--red) 14px 20px); }
.gift.favorite { border: 2px solid var(--gold); background: linear-gradient(180deg, #fffaf0, #fff 40%); }
.gift .t { font-weight: 800; font-size: 1.12rem; }
.gift .note { color: var(--muted); white-space: pre-wrap; font-size: .95rem; }
.gift .bottom { margin-top: auto; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; padding-top: .4rem; }
.price {
  font-weight: 800; color: var(--red-dark);
  background: var(--red-soft); padding: .2rem .7rem; border-radius: 999px; white-space: nowrap;
}
.badge-fav {
  align-self: flex-start;
  font-size: .78rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  background: var(--gold); color: #4a3200; padding: .15rem .6rem; border-radius: 999px;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.gift:nth-child(2) { animation-delay: .05s; } .gift:nth-child(3) { animation-delay: .1s; }
.gift:nth-child(4) { animation-delay: .15s; } .gift:nth-child(5) { animation-delay: .2s; }
.gift:nth-child(6) { animation-delay: .25s; }

.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty .big { font-size: 3rem; display: block; margin-bottom: .3rem; }

/* ---------- Espace éditeur ---------- */
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.list-card {
  display: flex; flex-direction: column; gap: .3rem;
  text-decoration: none; color: inherit; margin: 0;
  border-top: 6px solid var(--red);
  transition: transform .15s ease;
}
.list-card:nth-child(3n+2) { border-top-color: var(--green); }
.list-card:nth-child(3n) { border-top-color: var(--gold); }
.list-card:hover { transform: translateY(-3px) rotate(-.4deg); color: inherit; }
.list-card .title { font-weight: 800; font-size: 1.15rem; }

.back { display: inline-block; margin-bottom: .4rem; text-decoration: none; }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.head-row .title-display { margin-bottom: 0; }

.share { display: grid; gap: .7rem; }
.share-line {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  background: #fff; border: 2px dashed #f0cf7a; border-radius: 12px; padding: .55rem .75rem;
}
.share-line .label { font-weight: 800; min-width: 7.5rem; }
.share-line code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .98rem;
  word-break: break-all; flex: 1;
}

.items-admin { display: grid; gap: .7rem; }
.item-admin {
  display: grid; grid-template-columns: auto 1fr auto; gap: .5rem 1rem; align-items: start;
  padding: .9rem 1rem; margin: 0;
}
.item-admin.favorite { border-color: var(--gold); background: #fffbf1; }
.item-admin .moves { display: flex; flex-direction: column; gap: .25rem; }
.item-admin .t { font-weight: 800; }
.item-admin .note { color: var(--muted); font-size: .92rem; white-space: pre-wrap; }
.item-admin .actions { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: flex-end; }
.item-admin.editing { grid-template-columns: 1fr; }

table.users { width: 100%; border-collapse: collapse; }
table.users th, table.users td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users th { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tag {
  display: inline-block; font-size: .78rem; font-weight: 800; padding: .1rem .55rem; border-radius: 999px;
  background: var(--green-soft); color: var(--green-dark);
}
.tag.warn { background: var(--gold-soft); color: #7a5300; }

.secret {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 1.2rem; font-weight: 700;
  background: #fff; border: 2px dashed var(--gold); border-radius: 12px; padding: .5rem .8rem; display: inline-block;
}

.auth { max-width: 440px; margin: 0 auto; }
.auth .emoji { font-size: 3rem; text-align: center; display: block; }

/* ---------- Notification ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); z-index: 100;
  background: var(--night); color: #fff; font-weight: 700;
  padding: .7rem 1.2rem; border-radius: 999px; box-shadow: 0 10px 25px rgba(0, 0, 0, .25);
}

/* ---------- Petits écrans ---------- */
@media (max-width: 640px) {
  .hero { padding: 2rem 1rem 2.8rem; }
  .hero-inner { justify-content: center; text-align: center; }
  .nav { justify-content: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .item-admin { grid-template-columns: auto 1fr; }
  .item-admin .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .share-line .label { min-width: 0; width: 100%; }
}

/* Moins d'animations pour qui le demande */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .snow { display: none; }
}
