/* Les envies de Mathias — feuille de style */
:root {
  --bg: #f4eee3;
  --paper: #fbf8f2;
  --ink: #1c2520;
  --muted: #6a6e66;
  --line: rgba(28, 37, 32, .11);
  --forest: #16342a;
  --forest-2: #24503f;
  --gold: #c59a4f;
  --gold-soft: #e9d6ae;
  --berry: #a23a36;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(22, 40, 32, .05), 0 6px 18px -8px rgba(22, 40, 32, .16);
  --shadow-up: 0 2px 4px rgba(22, 40, 32, .06), 0 22px 40px -18px rgba(22, 40, 32, .32);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.locked { overflow: hidden; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- En-tête ---------- */
.hero {
  position: relative;
  overflow: hidden;
  color: #f4ecdc;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(197, 154, 79, .22), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(52, 110, 86, .55), transparent 60%),
    var(--forest);
  padding: clamp(56px, 9vw, 112px) 20px clamp(48px, 7vw, 88px);
}
.hero::after {
  content: "";
  position: absolute; inset: auto 0 -1px 0; height: 28px;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
}
.snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-inner { position: relative; max-width: 1120px; margin: 0 auto; }
.eyebrow {
  margin: 0 0 18px;
  font-size: .78rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold-soft);
}
.eyebrow.dark { color: var(--forest-2); margin-bottom: 6px; }
.star { color: var(--gold); margin-right: 4px; }
h1 {
  margin: 0;
  font: 500 clamp(2.9rem, 8.5vw, 6.2rem)/.95 var(--serif);
  font-variation-settings: "opsz" 144;
  letter-spacing: -.025em;
}
h1 em { display: block; font-style: italic; font-weight: 400; color: var(--gold-soft); }
.lede { max-width: 34rem; margin: 26px 0 0; font-size: clamp(1rem, 1.6vw, 1.12rem); color: rgba(244, 236, 220, .82); }
.steps {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  list-style: none; padding: 0; margin: 30px 0 0;
  font-size: .92rem; color: rgba(244, 236, 220, .9);
}
.steps li { display: flex; align-items: center; gap: 10px; }
.steps span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(233, 214, 174, .45); color: var(--gold-soft);
  font-size: .78rem; font-weight: 700;
}
.stats { margin: 30px 0 0; font-size: .9rem; color: rgba(244, 236, 220, .7); min-height: 1.5em; }
.stats b { color: #fff; font-weight: 700; }

/* Apparition de l'en-tête */
.hero-inner > * { animation: rise .9s var(--ease) both; }
.hero-inner > :nth-child(2) { animation-delay: .06s; }
.hero-inner > :nth-child(3) { animation-delay: .14s; }
.hero-inner > :nth-child(4) { animation-delay: .22s; }
.hero-inner > :nth-child(5) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Barre de filtres ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244, 238, 227, .82);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
.toolbar.stuck { border-color: var(--line); box-shadow: 0 8px 24px -20px rgba(22, 40, 32, .5); }
.toolbar-inner {
  max-width: 1160px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px;
}
.chips {
  flex: 1; min-width: 0;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px; margin: -2px;
  mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: .88rem; font-weight: 600; white-space: nowrap;
  transition: background .25s var(--ease), color .25s, border-color .25s, transform .2s var(--ease);
}
.chip:hover { border-color: rgba(28, 37, 32, .28); }
.chip:active { transform: scale(.96); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tint-strong, var(--gold)); }
.chip small { font-size: .75rem; color: var(--muted); font-weight: 600; }
.chip[aria-selected="true"] { background: var(--forest); border-color: var(--forest); color: #f6efe2; }
.chip[aria-selected="true"] small { color: rgba(246, 239, 226, .65); }
.controls { display: flex; align-items: center; gap: 12px; flex: none; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track {
  position: relative; width: 36px; height: 21px; border-radius: 999px;
  background: rgba(28, 37, 32, .18); transition: background .25s;
}
.track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .3s var(--ease);
}
.switch input:checked + .track { background: var(--forest-2); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }
.select select {
  appearance: none; -webkit-appearance: none;
  padding: 8px 32px 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%231c2520' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 13px center;
  font-size: .88rem; font-weight: 600; cursor: pointer;
}

/* ---------- Grille ---------- */
.shelf { max-width: 1160px; margin: 0 auto; padding: 28px 20px 140px; }
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
}
.skeleton {
  height: 360px; border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(255,255,255,.35) 30%, rgba(255,255,255,.75) 50%, rgba(255,255,255,.35) 70%) 0 0 / 300% 100%, rgba(28,37,32,.05);
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0, 0 0; } }
.status, .empty { text-align: center; color: var(--muted); margin: 8px 0 24px; }
.status.error { color: var(--berry); }

.card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  outline: 2px solid transparent; outline-offset: -2px;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), outline-color .25s;
}
.card.enter { animation: card-in .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.98); } }
@media (hover: hover) {
  .card:hover { transform: translateY(-4px); box-shadow: var(--shadow-up); }
  .card:hover .tile img { transform: scale(1.06) rotate(-1deg); }
}
.card.selected { outline-color: var(--forest-2); }

.open {
  all: unset; cursor: pointer; display: block;
  border-radius: var(--radius) var(--radius) 0 0;
}
.open:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
.tile {
  position: relative; aspect-ratio: 5 / 4;
  display: grid; place-items: center;
  margin: 8px 8px 0; border-radius: 14px; overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 42%, rgba(255, 255, 255, .75), transparent 70%),
    var(--tint, #ece5d6);
}
.tile img {
  max-width: 64%; max-height: 74%; object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform .6s var(--ease), filter .4s, opacity .4s;
}
.tile .illus {
  position: absolute; left: 10px; bottom: 9px;
  font-size: .68rem; font-weight: 600; letter-spacing: .02em; color: rgba(28, 37, 32, .5);
}
.tag {
  position: absolute; left: 10px; top: 10px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(251, 248, 242, .82);
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(28, 37, 32, .72);
}
.badge {
  position: absolute; right: 10px; top: 10px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
  background: var(--forest); color: #f6efe2;
}
.badge.multi { background: rgba(251, 248, 242, .92); color: var(--forest-2); }

.body { padding: 16px 18px 6px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.body h2 {
  margin: 0;
  font: 550 1.17rem/1.25 var(--serif);
  font-variation-settings: "opsz" 36;
  letter-spacing: -.005em;
}
.price { font-size: .95rem; font-weight: 700; color: var(--forest-2); font-variant-numeric: tabular-nums; }
.desc {
  margin: 2px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.booked { margin: 4px 0 0; font-size: .82rem; font-weight: 600; color: var(--berry); }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px 18px; }
.link {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink); font-size: .85rem; font-weight: 600; text-decoration: none;
  border-bottom: 1px solid rgba(28, 37, 32, .25); padding-bottom: 1px;
  transition: border-color .2s, color .2s;
}
.link:hover { color: var(--forest-2); border-color: var(--forest-2); }
.link svg { width: 12px; height: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px;
  padding: 10px 18px; font-size: .9rem; font-weight: 700;
  transition: transform .2s var(--ease), background .25s, color .25s, box-shadow .25s, opacity .2s;
}
.btn:active { transform: scale(.96); }
.btn svg { width: 16px; height: 16px; }
.btn-pick { margin-left: auto; background: rgba(36, 80, 63, .1); color: var(--forest); }
.btn-pick:hover { background: rgba(36, 80, 63, .17); }
.btn-pick[aria-pressed="true"] { background: var(--forest); color: #f6efe2; }
.btn-pick:disabled { background: transparent; color: var(--muted); cursor: default; padding-inline: 4px; }
.btn-primary { background: var(--forest); color: #f6efe2; }
.btn-primary:hover { background: var(--forest-2); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-gold { background: var(--gold); color: #1d1a12; }
.btn-gold:hover { background: #d4ab63; }
.btn.wide { width: 100%; padding: 14px 18px; font-size: .98rem; }

.card.taken .tile { filter: grayscale(.75); opacity: .55; }
.card.taken .body h2, .card.taken .price { opacity: .6; }

/* ---------- Pied de page ---------- */
.footer {
  max-width: 1160px; margin: 0 auto; padding: 0 20px 120px;
  text-align: center; color: var(--muted); font-size: .82rem;
}
.footer p { margin: 4px 0; }

/* ---------- Plateau de sélection ---------- */
.tray {
  position: fixed; z-index: 30; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 14px;
  padding: 8px 8px 8px 12px; border-radius: 999px;
  background: rgba(22, 52, 42, .94); color: #f6efe2;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px -14px rgba(10, 25, 19, .55);
  transform: translate(-50%, 0);
  animation: tray-in .5s var(--ease) both;
}
.tray[hidden] { display: none; }
@keyframes tray-in { from { opacity: 0; transform: translate(-50%, 24px) scale(.96); } }
.tray-thumbs { display: flex; }
.tray-thumbs span {
  width: 34px; height: 34px; border-radius: 50%; margin-left: -10px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--tint, #ece5d6); border: 2px solid var(--forest);
}
.tray-thumbs span:first-child { margin-left: 0; }
.tray-thumbs img { max-width: 70%; max-height: 70%; mix-blend-mode: multiply; }
.tray-count { margin: 0; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.tray.bump { animation: bump .4s var(--ease); }
@keyframes bump { 40% { transform: translate(-50%, 0) scale(1.06); } }

/* ---------- Fenêtres ---------- */
.sheet {
  position: fixed;
  width: min(560px, calc(100% - 32px)); max-height: min(88vh, 820px);
  padding: 0; border: 0; border-radius: 26px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(10, 25, 19, .5);
  overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(14, 30, 24, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet[open] { animation: sheet-in .45s var(--ease); }
.sheet[open]::backdrop { animation: fade .35s ease; }
.sheet.closing { animation: sheet-out .25s ease forwards; }
.sheet.closing::backdrop { animation: fade .25s ease reverse forwards; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(.98); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
.close {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: rgba(251, 248, 242, .85); font-size: 1.4rem; line-height: 1;
  box-shadow: 0 2px 8px rgba(22, 40, 32, .12);
  transition: background .2s, transform .2s var(--ease);
}
.close:hover { background: rgba(28, 37, 32, .13); transform: rotate(90deg); }

.detail .tile { aspect-ratio: 16 / 11; margin: 0; border-radius: 0; }
.detail .tile img { max-width: 52%; max-height: 72%; }
.detail-body { padding: 24px 28px 28px; }
.detail-body h2 { margin: 6px 0 4px; font: 550 1.75rem/1.15 var(--serif); letter-spacing: -.01em; }
.detail-body .price { font-size: 1.05rem; }
.detail-body p.full { margin: 14px 0 0; color: #3f4640; font-size: .97rem; }
.detail-body .booked { font-size: .9rem; margin-top: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 22px; }
.detail-actions .btn { padding: 12px 22px; margin-left: 0; }
.eyebrow-cat { font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.reserve { padding: 30px 28px 28px; }
.reserve h2 { margin: 0 0 18px; font: 550 1.7rem/1.15 var(--serif); }
.picked { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.picked li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 8px 8px; border-radius: 14px; background: rgba(28, 37, 32, .04);
  animation: card-in .4s var(--ease) both;
}
.picked .mini {
  flex: none; width: 48px; height: 48px; border-radius: 10px;
  display: grid; place-items: center; background: var(--tint, #ece5d6);
}
.picked .mini img { max-width: 76%; max-height: 76%; mix-blend-mode: multiply; }
.picked .info { flex: 1; min-width: 0; }
.picked .info b { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .info span { font-size: .8rem; color: var(--muted); }
.picked .remove {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent;
  color: var(--muted); font-size: 1.15rem; transition: background .2s, color .2s;
}
.picked .remove:hover { background: rgba(162, 58, 54, .1); color: var(--berry); }
.field { display: grid; gap: 6px; font-size: .85rem; font-weight: 700; }
.field input {
  padding: 14px 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff;
  font-size: 1rem; font-weight: 500;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--forest-2); box-shadow: 0 0 0 4px rgba(36, 80, 63, .12); }
.fine { margin: 10px 0 18px; font-size: .8rem; color: var(--muted); }
.form-error { margin: -6px 0 16px; padding: 10px 14px; border-radius: 12px; background: rgba(162, 58, 54, .08); color: var(--berry); font-size: .88rem; font-weight: 600; }

/* ---------- Notifications ---------- */
.toasts {
  position: fixed; z-index: 60; left: 50%; top: 18px; transform: translateX(-50%);
  display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none;
}
.toast {
  padding: 14px 18px; border-radius: 16px;
  background: var(--forest); color: #f6efe2; font-size: .92rem; font-weight: 600;
  box-shadow: 0 16px 40px -16px rgba(10, 25, 19, .6);
  animation: toast-in .5s var(--ease) both;
}
.toast.warn { background: var(--berry); }
.toast.out { animation: toast-out .35s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

.spark {
  position: fixed; z-index: 70; pointer-events: none;
  width: 8px; height: 8px; border-radius: 2px; background: var(--gold);
  animation: spark 1s var(--ease) forwards;
}
@keyframes spark {
  to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; }
}

/* ---------- Petits écrans ---------- */
@media (max-width: 720px) {
  .toolbar-inner { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 16px; }
  .chips { margin: -2px -16px; padding: 2px 16px; }
  .controls { justify-content: space-between; }
  .shelf { padding: 20px 16px 140px; }
  .grid { gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .body { padding: 12px 12px 4px; }
  .body h2 { font-size: 1rem; }
  .price { font-size: .86rem; }
  .desc { display: none; }
  .actions { padding: 8px 12px 12px; flex-wrap: wrap; }
  .actions .link { display: none; }
  .btn-pick { width: 100%; padding: 9px 12px; font-size: .85rem; }
  .tag { display: none; }
  .badge { font-size: .66rem; padding: 3px 8px; right: 8px; top: 8px; }
  .tile { margin: 6px 6px 0; border-radius: 12px; }
  .tile .illus { display: none; }
  .sheet {
    width: 100%; max-width: none; max-height: 92vh;
    margin: auto 0 0; border-radius: 26px 26px 0 0;
  }
  .sheet[open] { animation: sheet-up .45s var(--ease); }
  .sheet.closing { animation: sheet-down .28s ease forwards; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  @keyframes sheet-down { to { transform: translateY(100%); } }
  .detail-body, .reserve { padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); }
  .steps { flex-direction: column; }
}
@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
