/* Échange de cadeaux 2026 — nuit d'hiver québécoise + ceinture fléchée */
:root {
  --nuit: #16233f;
  --nuit-haut: #0f1a33;
  --nuit-bas: #2a3d68;
  --neige: #f4f7fa;
  --givre: #dfe7f0;
  --encre: #16233f;
  --encre-douce: #4b5b78;
  --canneberge: #c8102e;
  --canneberge-fonce: #9e0c24;
  --sapin: #1f5c45;
  --or: #e8b33a;

  --display: "Shrikhand", "Georgia", serif;
  --texte: "Atkinson Hyperlegible", system-ui, sans-serif;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --nav-h: 68px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--texte);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--neige);
  background:
    radial-gradient(120% 60% at 50% 115%, #3b5488 0%, transparent 60%),
    linear-gradient(180deg, var(--nuit-haut) 0%, var(--nuit) 45%, var(--nuit-bas) 100%) fixed;
  background-color: var(--nuit);
}
body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); }

#neige { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* La signature : une bande de ceinture fléchée en haut */
.sash {
  position: relative;
  z-index: 1;
  height: 22px;
  background: url("/static/sash.svg") repeat-x center / 22px auto;
  box-shadow: 0 2px 0 var(--or), 0 6px 18px rgb(0 0 0 / .35);
}

.page {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

/* ---------- Typographie ---------- */
.display {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.25rem, 9vw, 3rem);
  line-height: 1.05;
  margin: 8px 0 12px;
  color: var(--neige);
  text-shadow: 0 3px 0 var(--canneberge-fonce);
  letter-spacing: .005em;
}
.lede { font-size: 1.125rem; color: var(--givre); margin: 0 0 24px; max-width: 32ch; }
.section-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.375rem;
  margin: 32px 0 12px;
}
.card .section-title { margin: 0; color: var(--encre); }
.muted { color: var(--encre-douce); }
.page > .muted, .page > p .muted { color: #a9b7d0; }
.small { font-size: .9375rem; }
.block { display: block; }
a { color: inherit; }

.back {
  display: inline-block;
  color: var(--givre);
  text-decoration: none;
  padding: 8px 0;
  font-size: 1rem;
}

/* ---------- Accueil ---------- */
.hero { padding-top: 12vh; }
.hero-kicker { color: var(--or); font-weight: 700; margin: 0; }
.hero .display { font-size: clamp(3rem, 14vw, 4.5rem); }

/* ---------- Cartes & formulaires ---------- */
.card {
  background: var(--neige);
  color: var(--encre);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgb(5 10 25 / .35);
  color-scheme: light;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-weight: 700; }
.field-hint { font-size: .9rem; color: var(--encre-douce); }
input[type="text"], input[type="password"], input[type="url"], input:not([type]), select {
  font: inherit;
  font-size: 1.125rem;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--givre);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--encre);
}
input:focus-visible, select:focus-visible { outline: none; border-color: var(--sapin); box-shadow: 0 0 0 3px rgb(31 92 69 / .25); }
input[inputmode="numeric"][type="password"] { letter-spacing: .5em; font-size: 1.5rem; max-width: 12rem; }
::placeholder { color: #9aa6ba; }

.error {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: #fde8eb;
  color: var(--canneberge-fonce);
  font-weight: 700;
}
.flash {
  background: var(--sapin);
  color: var(--neige);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin: 0 0 16px;
  font-weight: 700;
}
.empty { color: #a9b7d0; font-style: italic; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 1.0625rem;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:active { transform: translateY(2px); }
.btn:focus-visible, .link:focus-visible, a:focus-visible, .chip input:focus-visible + span {
  outline: 3px solid var(--or);
  outline-offset: 3px;
}
.btn-primary { background: var(--canneberge); color: #fff; box-shadow: 0 4px 0 var(--canneberge-fonce); }
.btn-primary:active { box-shadow: 0 2px 0 var(--canneberge-fonce); }
.btn-ghost { background: transparent; color: inherit; border: 2px solid currentColor; }
.hero .btn-ghost { color: var(--neige); }
.btn-danger { background: transparent; color: var(--canneberge); border: 2px solid var(--canneberge); }
.btn-big { min-height: 64px; font-size: 1.25rem; }
.link {
  background: none; border: 0; padding: 8px 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer;
}
.link.danger { color: var(--canneberge); }
.logout { text-align: center; margin-top: 32px; color: #a9b7d0; }

/* ---------- Ma pige : le cadeau ---------- */
.greet .display { margin-bottom: 20px; }
.gift {
  position: relative;
  background: var(--neige);
  color: var(--encre);
  border-radius: var(--r-lg);
  padding: 28px 20px 24px;
  text-align: center;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgb(5 10 25 / .45);
}
.gift-box { width: 132px; height: 120px; margin: 0 auto 20px; position: relative; }
.gift-body {
  position: absolute; bottom: 0; left: 8px; right: 8px; height: 78px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 43%, var(--or) 43% 57%, transparent 57%),
    var(--canneberge);
}
.gift-lid {
  position: absolute; top: 18px; left: 0; right: 0; height: 30px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 43%, var(--or) 43% 57%, transparent 57%),
    #e01e3c;
  transform-origin: 10% 100%;
  transition: transform .6s cubic-bezier(.3, 1.6, .5, 1);
  z-index: 1;
}
.gift-lid::before, .gift-lid::after {
  content: ""; position: absolute; bottom: 100%; width: 30px; height: 22px;
  border: 6px solid var(--or); border-radius: 50% 50% 0 50%;
}
.gift-lid::before { right: 50%; }
.gift-lid::after { left: 50%; transform: scaleX(-1); }
.gift[data-state="closed"] .gift-box { animation: wiggle 3.2s ease-in-out infinite; }
.gift[data-state="open"] .gift-lid { transform: translate(-4px, -10px) rotate(-20deg); }
.gift-title { font-family: var(--display); font-size: 1.625rem; margin: 0 0 4px; }
.gift-closed, .gift-open { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.gift-closed p, .gift-open p { margin: 0; }
.gift-name {
  font-family: var(--display);
  font-size: clamp(2.5rem, 13vw, 3.5rem);
  line-height: 1.1;
  color: var(--canneberge);
  word-break: break-word;
  margin: 4px 0 8px !important;
  animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) both;
}
.waiting .gift-title { color: var(--encre); }
.confetti {
  position: absolute; top: 90px; left: 50%; width: 8px; height: 12px; border-radius: 2px; pointer-events: none;
  animation: burst 1.1s ease-out forwards;
}

@keyframes wiggle {
  0%, 82%, 100% { transform: rotate(0); }
  86% { transform: rotate(-5deg); }
  90% { transform: rotate(5deg); }
  94% { transform: rotate(-3deg); }
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes burst {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

/* ---------- Raccourcis ---------- */
.todo { margin-top: 8px; }
.todo-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-bottom: 12px;
  border-radius: var(--r-md);
  background: rgb(255 255 255 / .08);
  border: 1px solid rgb(255 255 255 / .14);
  text-decoration: none;
}
.todo-item .muted { color: #b8c5dc; }
.todo-icon { font-size: 1.75rem; }

/* ---------- Souhaits ---------- */
.wish-list { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; }
.wish {
  background: var(--neige); color: var(--encre);
  border-radius: var(--r-md); padding: 14px 16px;
  border-left: 6px solid var(--sapin);
}
.wish:nth-child(3n+2) { border-left-color: var(--canneberge); }
.wish:nth-child(3n) { border-left-color: var(--or); }
.wish-view p { margin: 0; }
.wish-title { font-weight: 700; font-size: 1.125rem; }
.wish-note { color: var(--encre-douce); margin-top: 2px !important; }
.wish-link { display: inline-block; margin-top: 6px; color: var(--sapin); font-weight: 700; padding: 4px 0; }
.wish-edit summary { cursor: pointer; color: var(--encre-douce); padding: 8px 0 0; font-size: .95rem; }
.wish-edit form { margin-top: 12px; }

/* ---------- Questionnaire ---------- */
.question {
  color-scheme: light;
  border: 0; margin: 0; padding: 16px;
  background: var(--neige); color: var(--encre);
  border-radius: var(--r-md);
}
.question legend { float: left; width: 100%; font-weight: 700; font-size: 1.0625rem; margin-bottom: 12px; }
.chips { clear: both; display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 10px 14px; min-height: 44px;
  border-radius: 999px; border: 2px solid var(--givre); background: #fff;
  cursor: pointer; user-select: none;
}
.chip input:checked + span { background: var(--sapin); border-color: var(--sapin); color: #fff; }
.question .text { clear: both; }
.sticky-submit {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  padding-top: 8px;
}
.sticky-submit .btn { width: 100%; box-shadow: 0 4px 0 var(--canneberge-fonce), 0 10px 24px rgb(0 0 0 / .4); }

/* ---------- Listes ---------- */
.people { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.person {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: var(--r-md);
  background: var(--neige); color: var(--encre); text-decoration: none;
}
.person-main { flex: 1; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display); font-size: 1.375rem; color: #fff;
  background: var(--sapin);
}
.people li:nth-child(3n+2) .avatar { background: var(--canneberge); }
.people li:nth-child(3n) .avatar { background: #b07d10; }
.chev { font-size: 1.75rem; color: var(--encre-douce); }
.answers { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.answer { background: rgb(255 255 255 / .08); border-radius: var(--r-md); padding: 12px 16px; }
.answer dt { color: #b8c5dc; font-size: .95rem; }
.answer dd { margin: 4px 0 0; font-weight: 700; font-size: 1.125rem; }

/* ---------- Nav du bas ---------- */
.bottom-nav {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: rgb(15 26 51 / .94);
  backdrop-filter: blur(8px);
  border-top: 2px solid var(--or);
}
.bottom-nav a {
  flex: 1; max-width: 160px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; gap: 2px;
  color: #a9b7d0; text-decoration: none; font-size: .875rem; font-weight: 700;
  border-radius: var(--r-sm);
}
.bottom-nav .icon { font-size: 1.375rem; filter: grayscale(.7); }
.bottom-nav a.active { color: var(--neige); }
.bottom-nav a.active .icon { filter: none; }

/* ---------- Admin ---------- */
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--sapin); flex: none; }
.check-ok, .check-bad { border-radius: var(--r-sm); padding: 12px 14px; }
.check-ok { background: #e2f1ea; color: var(--sapin); }
.check-bad { background: #fde8eb; color: var(--canneberge-fonce); }
.check-ok p, .check-bad ul { margin: 0; }
.check-bad ul { padding-left: 20px; }
.excl-list, .admin-people { list-style: none; padding: 0; margin: 0; }
.excl-list li { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--givre); }
.admin-people li { border-bottom: 1px solid var(--givre); }
.admin-people summary { padding: 12px 0; font-weight: 700; cursor: pointer; }
.admin-people form { margin-bottom: 12px; }
.hold { position: relative; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hold-fill { position: absolute; inset: 0; background: var(--canneberge); transform: scaleX(0); transform-origin: left; }
.hold.holding .hold-fill { transform: scaleX(1); transition: transform 1.5s linear; }
.hold-label { position: relative; }
.hold.holding .hold-label { color: #fff; }
.peek-result {
  margin: 0; text-align: center;
  font-family: var(--display); font-size: 2rem; color: var(--canneberge);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
