/* Wishlist de Noël — rouge profond, vert sapin, crème et or. Mobile d'abord. */

:root {
  --rouge: #a3192e;
  --rouge-fonce: #7a1022;
  --vert: #1e5a41;
  --vert-fonce: #143d2c;
  --creme: #fbf4e6;
  --papier: #fffdf8;
  --sable: #eadfca;
  --or: #b98a2f;
  --or-clair: #e9cf8f;
  --encre: #33221b;
  --gris: #74655b;
  --ombre: 0 6px 22px rgba(74, 38, 20, 0.12);
  --titre: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

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

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

body {
  margin: 0;
  background: var(--creme);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--titre); line-height: 1.2; margin: 0; }
p { margin: 0; }
img { max-width: 100%; display: block; }

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

.hero {
  position: relative;
  overflow: hidden;
  padding: 2.2rem 1rem 2.4rem;
  text-align: center;
  color: var(--creme);
  background:
    radial-gradient(ellipse at 50% -20%, rgba(255, 220, 160, 0.28), transparent 60%),
    linear-gradient(165deg, var(--rouge), var(--rouge-fonce));
  border-bottom: 5px solid var(--or);
  box-shadow: 0 3px 0 var(--vert-fonce);
}
.hero-small { padding: 1.4rem 1rem 1.6rem; }
.hero h1 { position: relative; font-size: clamp(1.8rem, 7vw, 3rem); text-wrap: balance; }
.hero-small h1 { font-size: clamp(1.5rem, 5.5vw, 2.2rem); }
.hero-kicker {
  position: relative;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--or-clair);
}
.hero-sub { position: relative; margin-top: 0.6rem; color: #f6e3c4; min-height: 1.5em; }

.snow { position: absolute; inset: 0; pointer-events: none; }
.flake {
  position: absolute;
  top: -2rem;
  color: #fff;
  opacity: 0.55;
  animation: chute linear infinite;
}
@keyframes chute {
  to { transform: translateY(420px) rotate(300deg); }
}

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

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

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

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

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1.15rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  text-align: center;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--or);
  outline-offset: 2px;
}
.btn-primary { background: var(--vert); color: #fff; }
.btn-primary:hover { background: var(--vert-fonce); }
.btn-red { background: var(--rouge); color: #fff; }
.btn-red:hover { background: var(--rouge-fonce); }
.btn-ghost { background: transparent; border-color: var(--vert); color: var(--vert); }
.btn-ghost:hover { background: rgba(30, 90, 65, 0.08); }
.btn-danger { background: transparent; border-color: transparent; color: var(--rouge); }
.btn-danger:hover { background: rgba(163, 25, 46, 0.08); }
.btn-small { min-height: 40px; padding: 0.35rem 0.9rem; font-size: 0.92rem; }

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

.card {
  background: var(--papier);
  border: 1px solid var(--sable);
  border-radius: 18px;
  box-shadow: var(--ombre);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #fff;
  border-bottom: 1px solid var(--sable);
}
.photo img { width: 100%; height: 100%; object-fit: contain; }
.photo-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.2rem;
  background: repeating-linear-gradient(45deg, #f3ead6, #f3ead6 14px, #f8f1e1 14px, #f8f1e1 28px);
}

.option-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem 1rem;
  flex: 1;
}
.option-name { font-family: var(--titre); font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.price { font-size: 1.1rem; font-weight: 700; color: var(--rouge); }
.shop-link { color: var(--vert); font-weight: 600; align-self: flex-start; padding: 0.2rem 0; }
.option-actions {
  margin-top: auto;
  padding-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.option-actions .btn { width: 100%; }

.status { font-weight: 650; color: var(--vert-fonce); }
.status-muted { font-weight: 500; color: var(--gris); font-size: 0.92rem; }

.ribbon {
  position: absolute;
  top: 14px;
  left: 0;
  padding: 0.3rem 0.9rem 0.3rem 0.7rem;
  background: var(--rouge);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 0 999px 999px 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.is-chosen .photo img { filter: grayscale(0.7); opacity: 0.55; }
.is-chosen .option-name, .is-chosen .price { color: var(--gris); }
.is-dismissed { opacity: 0.5; }
.is-dismissed .photo img { filter: grayscale(1); }

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

.card-group { grid-column: 1 / -1; border: 2px dashed var(--or); }
.group-head { padding: 1rem 1rem 0.2rem; text-align: center; }
.group-head h2 { font-size: 1.35rem; }
.group-head p { color: var(--gris); font-size: 0.95rem; margin-top: 0.25rem; }
.choices {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  padding: 0.9rem;
}
.choices .option {
  border: 1px solid var(--sable);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.or {
  align-self: center;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: var(--or);
  color: #fff;
  font-family: var(--titre);
  font-style: italic;
  font-weight: 700;
}

@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.9rem; padding: 1.1rem; }
  .choices .option { flex: 1 1 0; }
}

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

.gate {
  max-width: 480px;
  margin: 1.5rem auto;
  padding: 2rem 1.4rem;
  text-align: center;
  background: var(--papier);
  border: 2px solid var(--or);
  border-radius: 20px;
  box-shadow: var(--ombre);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.gate-icon { font-size: 3.5rem; line-height: 1; }
.gate .btn { margin-top: 0.6rem; }

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

.field { display: flex; flex-direction: column; gap: 0.3rem; margin: 0; }
.field > span { font-weight: 650; font-size: 0.95rem; }

input[type="text"], input[type="url"], input[type="password"] {
  width: 100%;
  min-height: 46px;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid #cdbfa5;
  border-radius: 12px;
  background: #fff;
  color: var(--encre);
  font: inherit;
  font-size: 1rem; /* 16px : évite le zoom automatique sur iPhone */
}
input[readonly] { background: #f6efdf; }

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

.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, 460px);
  max-height: 92dvh;
  padding: 0;
  border: none;
  border-radius: 20px;
  background: var(--papier);
  color: var(--encre);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  border-top: 6px solid var(--rouge);
}
.modal-wide { width: min(94vw, 560px); }
.modal::backdrop { background: rgba(40, 12, 16, 0.6); }
.modal-body { display: flex; flex-direction: column; gap: 0.9rem; padding: 1.3rem 1.2rem 1.2rem; }
.modal-body h2 { font-size: 1.4rem; }
.modal-what { font-weight: 650; color: var(--rouge); }
.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: 0.9rem;
  border: 1.5px dashed var(--or);
  border-radius: 14px;
}
.option-form legend { padding: 0 0.5rem; font-family: var(--titre); font-weight: 700; color: var(--or); }
.option-form > .btn-danger { align-self: flex-start; }
.add-option { align-self: stretch; }

.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: 84px;
  height: 84px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--sable);
  border-radius: 12px;
}
.photo-preview-empty { display: grid; place-items: center; font-size: 2rem; background: #f3ead6; }
.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(--papier);
  border: 1px solid var(--sable);
  border-radius: 18px;
  box-shadow: var(--ombre);
  padding: 1.1rem;
  margin-bottom: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.panel h2 { font-size: 1.2rem; }
.auth { max-width: 420px; margin: 1.5rem auto; gap: 0.9rem; }

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

.admin-gift-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.admin-gift-head h3 { font-size: 1.15rem; }
.badge {
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  background: var(--or);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
.admin-option { display: flex; gap: 0.9rem; align-items: center; min-width: 0; }
.admin-option .photo {
  flex: none;
  width: 84px;
  aspect-ratio: 1;
  border: 1px solid var(--sable);
  border-radius: 12px;
  overflow: hidden;
}
.admin-option .photo-empty { font-size: 2rem; }
.admin-option-text { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.admin-option-text .option-name { font-size: 1.05rem; }
.admin-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  border-top: 1px solid var(--sable);
  padding-top: 0.6rem;
}
.logout { text-align: center; margin-top: 2rem; }

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

.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.1rem; }
.tab {
  flex: 1;
  min-height: 44px;
  padding: 0.5rem 0.6rem;
  border: 2px solid var(--sable);
  border-radius: 14px;
  background: var(--papier);
  color: var(--gris);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.tab.is-active { border-color: var(--rouge); background: var(--rouge); color: #fff; }
.tab:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }

.journal-note { margin-bottom: 1rem; }
.journal-head { margin-top: 0; }
.journal-head h2 { font-size: 1.2rem; }
.journal-head .btn-danger { border-color: var(--rouge); }
.journal-summary { line-height: 1.55; }
.journal-cols { display: grid; gap: 0.9rem; }
@media (min-width: 600px) { .journal-cols { grid-template-columns: 1fr 1fr; } }
.journal-col { min-width: 0; padding: 0.7rem 0.8rem; background: #fff; border: 1px solid var(--sable); border-radius: 12px; }
.journal-col h4 { margin: 0 0 0.4rem; font-family: var(--titre); color: var(--rouge); }
.journal-col dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.7rem; font-size: 0.9rem; }
.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.92rem; padding: 0.3rem 0; }
.journal-entry details p { font-weight: 650; padding-top: 0.2rem; }

.history { margin-top: 2rem; color: var(--gris); font-size: 0.92rem; }
.history h2 { font-size: 1.05rem; color: var(--encre); margin-bottom: 0.4rem; }
.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.75rem 1.1rem;
  border-radius: 14px;
  background: var(--vert-fonce);
  color: #fff;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.toast-error { background: var(--rouge-fonce); }

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