/* ═══════════════════════════════════════════ VARIABLES & RESET ═══════════════════════════════════════════ */
:root {
  --bg:          #f5f2ed;
  --surface:     #faf8f4;
  --border:      #e2ddd5;
  --text:        #1c1814;
  --muted:       #8a8278;
  --accent:      #b5854a;
  --accent-dark: #8c6235;
  --radius:      4px;
  --shadow:      0 2px 18px rgba(0,0,0,.07);
  --shadow-lg:   0 10px 52px rgba(0,0,0,.18);
  --trans:       all .22s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ═══════════════════════════════════════════
   EN-TÊTE═══════════════════════════════════════════ */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.4rem 2.4rem;
  display: flex;
  align-items: baseline;
  gap: .9rem;
  position: sticky; top: 0; z-index: 10;
}
header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  font-weight: 300;
  letter-spacing: .04em;
}
header span {
  font-size: .75rem;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════
   GRILLE 5×5
═══════════════════════════════════════════ */
main {
  max-width: 1340px;
  margin: 0 auto;
  padding: 2.2rem 1.4rem 3.2rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.1rem;
}

/* Cellule */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--trans);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  position: relative;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 36px rgba(0,0,0,.12);
  border-color: var(--accent);
}
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Badge statut */
.card-badge {
  position: absolute;
  top: .5rem; left: .5rem;
  z-index: 2;
  padding: .22rem .55rem;
  border-radius: 2px;
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  pointer-events: none;
}

/* Image */
.card-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 78%;
  overflow: hidden;
  background: var(--bg);
}
.card-img-wrap img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .36s ease;
}
.card:hover .card-img-wrap img { transform: scale(1.06); }
.card-img-wrap::after {
  content: '＋';
  font-size: 1.5rem;
  color: #fff;
  position: absolute; inset: 0;
  background: rgba(28,24,20,.36);
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .22s;
}
.card:hover .card-img-wrap::after { opacity: 1; }

/* Corps */
.card-body {
  padding: .8rem .85rem .7rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .22rem;
}
.card-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: .98rem;
  font-weight: 600;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-vendor {
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .03em;
}
.card-desc {
  font-size: .7rem;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.card-price {
  font-size: .92rem;
  font-weight: 500;
  color: var(--accent-dark);
  margin-top: .3rem;
}

/* ═══════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  margin-top: 3rem;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0 .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .8rem;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  transition: var(--trans);
}
.pagination a:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination span.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.pagination span.dots { border: none; background: transparent; color: var(--muted); }

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28, 24, 20, .7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .26s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  max-width: 760px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 42% 58%;
  transform: translateY(20px) scale(.97);
  transition: transform .28s cubic-bezier(.22,1,.36,1);
  position: relative;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

/* Image */
.modal-img-wrap {
  min-height: 340px;
  background: var(--bg);
  overflow: hidden;
  position: relative;
}
.modal-img-wrap img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Contenu */
.modal-content {
  padding: 2rem 1.8rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

/* Bouton fermeture */
.modal-close {
  position: absolute;
  top: .7rem; right: .7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2.1rem; height: 2.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--muted);
  transition: var(--trans);
  z-index: 2;
}
.modal-close:hover { background: #f0e8e0; color: var(--text); }

/* Éléments du modal */
.modal-statut {
  display: inline-block;
  padding: .22rem .65rem;
  border-radius: 2px;
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  align-self: flex-start;
}
.modal-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.15;
}
.modal-price {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--accent-dark);
}
.modal-sep { border: none; border-top: 1px solid var(--border); margin: .15rem 0; }
.modal-desc {
  font-size: .82rem;
  line-height: 1.68;
  color: #4a4540;
  flex: 1;
}

/* Bloc vendeur */
.modal-vendor {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.modal-vendor-label {
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: .1rem;
}
.modal-vendor-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 600;
}
.modal-vendor-info {
  font-size: .74rem;
  color: var(--muted);
  line-height: 1.55;
}

/* Bouton SMS */
.btn-sms {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-top: .4rem;
  padding: .72rem 1.3rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: .83rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: var(--trans);
  align-self: flex-start;
}
.btn-sms:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* Spinner */
.modal-loader {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: center;
  padding: 4rem;
}
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 860px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  {
  .grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .modal { grid-template-columns: 1fr; }
  .modal-img-wrap { min-height: 200px; }
}
@media (max-width: 400px) { .grid { grid-template-columns: 1fr; } }

.prix-ancien {
  font-size: 0.8em;
  color: var(--muted);
  text-decoration: line-through;
  margin-left: 0.5rem;
}

.cp-form {
  text-align: center;
  padding: 1rem 1rem 0;
}
.cp-form input {
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  width: 160px;
}
.cp-form button {
  padding: 0.5rem 1rem;
  margin-left: 0.4rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
.cp-reset {
  margin-left: 0.6rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}
.cp-error { color: #c0392b; font-size: 0.85rem; margin-top: 0.4rem; }
.cp-ok    { color: #27ae60; font-size: 0.85rem; margin-top: 0.4rem; }