/* Wishlist de Noël — sobre et chaleureux : papier crème, encre, vert sapin. Mobile d'abord. */

:root {
  --fond: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #f0ece5;
  --ligne: #e4dfd6;
  --ligne-forte: #cfc8bc;
  --encre: #1d1b18;
  --gris: #6e6960;
  --sapin: #1f4a3d;
  --sapin-fonce: #163629;
  --sapin-pale: #e6efe9;
  --baie: #b3262f;
  --rayon: 16px;
  --ombre: 0 1px 2px rgba(29, 27, 24, 0.04), 0 8px 24px rgba(29, 27, 24, 0.06);
  --texte: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --titre: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;

  /* Anciens noms encore utilisés par quelques styles en ligne */
  --vert-fonce: var(--sapin);
  --papier: var(--surface);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--texte);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--titre); line-height: 1.15; margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }

/* ---------- En-tête ---------- */

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.6rem 1rem 1.6rem;
}
.hero-small { max-width: 720px; padding-top: 1.2rem; padding-bottom: 1rem; }
.hero h1 {
  font-size: clamp(2rem, 7vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero-small h1 { font-size: clamp(1.6rem, 5.5vw, 2.3rem); }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gris);
}
.hero-kicker::before {
  content: "";
  width: 15px;
  height: 15px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23c9972f' d='M12 1.5l2.9 6.6 7.1.6-5.4 4.7 1.6 7-6.2-3.7-6.2 3.7 1.6-7L2 8.7l7.1-.6z'/%3E%3C/svg%3E");
}
.hero-sub { margin-top: 0.6rem; color: var(--gris); font-size: 1.05rem; min-height: 1.5em; }
.hero > :not(.snow) { position: relative; z-index: 1; }

/* Guirlande lumineuse en haut de page */
.garland {
  height: 30px;
  background: 0 0 / 120px 30px repeat-x url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 30'%3E%3Cpath d='M0 4Q30 16 60 4T120 4' fill='none' stroke='%237d7466' stroke-width='1'/%3E%3Ccircle cx='20' cy='16' r='8' fill='%23c2333b' opacity='.13'/%3E%3Crect x='18.4' y='8.6' width='3.2' height='3' rx='.6' fill='%237d7466'/%3E%3Cellipse cx='20' cy='15.5' rx='3.4' ry='4.4' fill='%23c2333b'/%3E%3Ccircle cx='60' cy='11' r='8' fill='%23d9a441' opacity='.15'/%3E%3Crect x='58.4' y='3.6' width='3.2' height='3' rx='.6' fill='%237d7466'/%3E%3Cellipse cx='60' cy='10.5' rx='3.4' ry='4.4' fill='%23d9a441'/%3E%3Ccircle cx='100' cy='16' r='8' fill='%232f6b55' opacity='.13'/%3E%3Crect x='98.4' y='8.6' width='3.2' height='3' rx='.6' fill='%237d7466'/%3E%3Cellipse cx='100' cy='15.5' rx='3.4' ry='4.4' fill='%232f6b55'/%3E%3C/svg%3E");
  animation: scintille 3.5s ease-in-out infinite alternate;
}
@keyframes scintille { from { opacity: 1; } to { opacity: 0.8; } }

/* Neige discrète sur toute la page, derrière le contenu (les cartes la cachent) */
body { background: linear-gradient(#e6ddcf, var(--fond) 380px) var(--fond) no-repeat; }
.snow {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.garland, .wrap { position: relative; z-index: 1; }
.flake {
  position: absolute;
  top: -10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 3px rgba(125, 105, 75, 0.5);
  animation: chute linear infinite;
}
@keyframes chute {
  to { transform: translateY(calc(100vh + 20px)); }
}

/* ---------- Mise en page ---------- */

.wrap { max-width: 1100px; margin: 0 auto; padding: 0.5rem 1rem 4rem; }
.wrap-narrow { max-width: 720px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.loading, .empty {
  text-align: center;
  color: var(--gris);
  padding: 3rem 1rem;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--sapin);
  outline-offset: 2px;
}
.btn-primary { background: var(--sapin); color: #fff; }
.btn-primary:hover { background: var(--sapin-fonce); }
.btn-red { background: var(--baie); color: #fff; }
.btn-red:hover { background: #962029; }
.btn-ghost { background: var(--surface); border-color: var(--ligne-forte); color: var(--encre); }
.btn-ghost:hover { border-color: var(--encre); }
.btn-danger { background: transparent; color: var(--baie); }
.btn-danger:hover { background: rgba(179, 38, 47, 0.07); }
.btn-small { min-height: 38px; padding: 0.35rem 0.85rem; font-size: 0.9rem; border-radius: 10px; }

/* ---------- Cartes cadeaux ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:not(.is-reserved):hover { box-shadow: var(--ombre); transform: translateY(-2px); }

.option { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}
@media (min-width: 640px) { .photo { aspect-ratio: 1 / 1; } }
.photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8%;
  mix-blend-mode: multiply; /* les fonds blancs des photos de boutique se fondent dans la carte */
}
.photo-empty {
  position: absolute;
  inset: 0;
  font-size: 0;
  background: center / 26% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8b1a5' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M12 8v13M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7M7.5 8a2.5 2.5 0 0 1 0-5C10 3 12 8 12 8s2-5 4.5-5a2.5 2.5 0 0 1 0 5'/%3E%3C/svg%3E");
}

.option-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.95rem 1rem 1rem;
  flex: 1;
}
.option-name { font-family: var(--titre); font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.price { font-size: 1rem; font-weight: 600; color: var(--gris); font-variant-numeric: tabular-nums; }
.shop-link {
  align-self: flex-start;
  margin-top: 0.15rem;
  color: var(--sapin);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(31, 74, 61, 0.3);
  text-underline-offset: 3px;
}
.shop-link:hover { text-decoration-color: currentColor; }
.option-actions {
  margin-top: auto;
  padding-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.option-actions .btn { width: 100%; }

.status { font-weight: 600; font-size: 0.92rem; color: var(--sapin); }
.status-muted { font-weight: 500; color: var(--gris); font-size: 0.88rem; }

.ribbon {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 0.22rem 0.65rem;
  background: var(--baie);
  color: #fff;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
}

.is-chosen .photo img { filter: grayscale(1); opacity: 0.45; }
.is-chosen .option-name { color: var(--gris); }
.is-dismissed { opacity: 0.45; }
.is-dismissed .photo img { filter: grayscale(1); }

/* Cadeau « l'un ou l'autre » */

.card-group { grid-column: 1 / -1; }
.group-head { padding: 1.1rem 1.1rem 0; }
.group-head h2 { font-size: 1.2rem; }
.group-head p { color: var(--gris); font-size: 0.9rem; margin-top: 0.2rem; }
.choices {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding: 1rem 1.1rem 1.1rem;
}
.choices .option {
  border: 1px solid var(--ligne);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.or {
  align-self: center;
  flex: none;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--gris);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (min-width: 640px) {
  .grid { grid-auto-flow: dense; }
  .card-group:not(.card-group-wide) { grid-column: span 2; }
  .choices { flex-direction: row; gap: 0.8rem; }
  .choices .option { flex: 1 1 0; }
}

/* ---------- Avertissement « surprise » ---------- */

.gate {
  max-width: 460px;
  margin: 1.5rem auto;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: 20px;
  box-shadow: var(--ombre);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gate h2 { font-size: 1.5rem; }
.gate p { color: var(--gris); }
.gate strong { color: var(--encre); }
.gate-icon {
  align-self: center;
  width: 54px;
  height: 64px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 54 64'%3E%3Cpath fill='%23c9972f' d='M27 1l2.3 5 5.4.5-4.1 3.6 1.2 5.3L27 12.6l-4.8 2.8 1.2-5.3-4.1-3.6 5.4-.5z'/%3E%3Cpath fill='%231f4a3d' d='M27 15l11 14h-5l10 12h-6l11 14H6l11-14h-6l10-12h-5z'/%3E%3Crect x='23' y='55' width='8' height='8' rx='1' fill='%237a5a3c'/%3E%3Ccircle cx='22' cy='34' r='2' fill='%23c2333b'/%3E%3Ccircle cx='33' cy='44' r='2' fill='%23d9a441'/%3E%3Ccircle cx='20' cy='50' r='2' fill='%23d9a441'/%3E%3Ccircle cx='36' cy='52' r='2' fill='%23c2333b'/%3E%3C/svg%3E");
}
.gate .btn { margin-top: 0.6rem; }

/* ---------- Formulaires ---------- */

.field { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; }
.field > span { font-weight: 600; font-size: 0.9rem; }

input[type="text"], input[type="url"], input[type="password"] {
  width: 100%;
  min-height: 46px;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--ligne-forte);
  border-radius: 12px;
  background: var(--surface);
  color: var(--encre);
  font: inherit;
  font-size: 1rem; /* 16px : évite le zoom automatique sur iPhone */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus, input[type="url"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--sapin);
  box-shadow: 0 0 0 3px var(--sapin-pale);
}
input[readonly] { background: var(--surface-2); color: var(--gris); }

.hint { color: var(--gris); font-size: 0.88rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.inline-form { display: flex; flex-direction: column; gap: 0.6rem; }
@media (min-width: 520px) {
  .inline-form { flex-direction: row; }
  .inline-form input { flex: 1; }
}

/* ---------- Fenêtres ---------- */

.modal {
  width: min(94vw, 440px);
  max-height: 92dvh;
  padding: 0;
  border: none;
  border-radius: 20px;
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}
.modal-wide { width: min(94vw, 560px); }
.modal::backdrop { background: rgba(29, 27, 24, 0.45); backdrop-filter: blur(3px); }
.modal-body { display: flex; flex-direction: column; gap: 0.9rem; padding: 1.4rem 1.3rem 1.3rem; }
.modal-body h2 { font-size: 1.35rem; }
.modal-what { font-weight: 600; color: var(--gris); }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 0.3rem; }
.modal-actions .btn { flex: 1 1 130px; }

.option-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}
.option-form:has(legend) {
  padding: 1rem;
  border: 1px solid var(--ligne);
  border-radius: 14px;
  background: var(--fond);
}
.option-form legend {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gris);
}
.option-form > .btn-danger { align-self: flex-start; }
.add-option { align-self: stretch; border-style: dashed; }

.photo-field { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; }
.photo-field > input[type="url"] { flex: 1 1 100%; }
.photo-preview {
  flex: none;
  width: 80px;
  height: 80px;
  object-fit: contain;
  padding: 6px;
  background: var(--surface-2);
  border-radius: 12px;
}
.photo-preview-empty { position: relative; font-size: 0; }
.photo-preview-empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: center / 45% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8b1a5' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M12 8v13M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7M7.5 8a2.5 2.5 0 0 1 0-5C10 3 12 8 12 8s2-5 4.5-5a2.5 2.5 0 0 1 0 5'/%3E%3C/svg%3E");
}
.photo-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1; min-width: 0; }
.photo-controls input[type="url"] { flex: 1 1 100%; }

/* ---------- Espace personnel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  padding: 1.15rem;
  margin-bottom: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.panel h2 { font-size: 1.05rem; }
.auth { max-width: 400px; margin: 1.5rem auto; gap: 0.9rem; padding: 1.5rem; box-shadow: var(--ombre); }
.auth h2 { font-size: 1.4rem; }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin: 2rem 0 0.9rem;
}
.section-head h2 { font-size: 1.35rem; }

.admin-gift-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.admin-gift-head h3 { font-size: 1.05rem; }
.badge {
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: var(--sapin-pale);
  color: var(--sapin);
  font-size: 0.75rem;
  font-weight: 600;
}
.admin-option { display: flex; gap: 0.9rem; align-items: center; min-width: 0; }
.admin-option .photo {
  flex: none;
  width: 76px;
  border-radius: 12px;
  overflow: hidden;
}
.admin-option .photo img { padding: 6px; }
.admin-option .photo-empty { background-size: 45%; }
.admin-option-text { min-width: 0; display: flex; flex-direction: column; gap: 0.05rem; }
.admin-option-text .option-name { font-size: 1rem; }
.admin-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  border-top: 1px solid var(--ligne);
  padding-top: 0.7rem;
}
.logout { text-align: center; margin-top: 2.5rem; }

/* ---------- Onglets et journal ---------- */

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.2rem;
  padding: 0.25rem;
  background: var(--surface-2);
  border-radius: 14px;
}
.tab {
  flex: 1;
  min-height: 40px;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--gris);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}
.tab.is-active { background: var(--surface); color: var(--encre); box-shadow: 0 1px 3px rgba(29, 27, 24, 0.1); }
.tab:focus-visible { outline: 2px solid var(--sapin); outline-offset: 2px; }

.journal-note { margin-bottom: 1rem; }
.journal-head { margin-top: 0; }
.journal-head h2 { font-size: 1.1rem; }
.journal-summary { line-height: 1.6; }
.journal-cols { display: grid; gap: 0.8rem; }
@media (min-width: 600px) { .journal-cols { grid-template-columns: 1fr 1fr; } }
.journal-col { min-width: 0; padding: 0.75rem 0.85rem; background: var(--fond); border-radius: 12px; }
.journal-col h4 { margin: 0 0 0.4rem; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gris); }
.journal-col dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.7rem; font-size: 0.88rem; }
.journal-col dt { color: var(--gris); }
.journal-col dd { margin: 0; overflow-wrap: anywhere; }
.journal-entry summary { cursor: pointer; color: var(--gris); font-size: 0.9rem; padding: 0.3rem 0; }
.journal-entry details p { font-weight: 600; padding-top: 0.2rem; }

/* ---------- Page des proches : aide, code, historique ---------- */

.help {
  margin-bottom: 1.4rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon);
  font-size: 0.93rem;
}
.help summary { cursor: pointer; font-weight: 600; list-style-position: outside; }
.help summary::marker { color: var(--gris); }
.help ol { margin: 0.7rem 0 0.1rem; padding-left: 1.3rem; display: grid; gap: 0.4rem; color: var(--gris); }
.help ol strong { color: var(--encre); font-weight: 600; }

.code-box {
  margin: 0;
  padding: 0.9rem;
  text-align: center;
  font: 600 1.9rem/1.2 var(--mono);
  letter-spacing: 0.18em;
  color: var(--encre);
  background: var(--fond);
  border: 1px solid var(--ligne);
  border-radius: 14px;
  user-select: all;
}
.code-inline { font-family: var(--mono); letter-spacing: 0.05em; color: var(--encre); }

.history { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--ligne); color: var(--gris); font-size: 0.9rem; }
.history h2 { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gris); margin-bottom: 0.5rem; }
.history ul { margin: 0; padding-left: 1.2rem; }

/* ---------- Message éphémère ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 2147483647;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 0.7rem 1.1rem;
  border-radius: 12px;
  background: var(--encre);
  color: #fff;
  font-weight: 500;
  font-size: 0.95rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.toast-error { background: var(--baie); }

@media (prefers-reduced-motion: reduce) {
  .btn, .card { transition: none; }
  .flake { display: none; }
  .garland { animation: none; }
}
