:root {
  --bg: #edf1ee;
  --surface: #ffffff;
  --tile: #dfe7e1;
  --ink: #16241d;
  --muted: #5d6e64;
  --line: #cfd9d2;
  --pine: #2f5d46;
  --holly: #b8322a;
  --radius-media: 18px;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1914;
    --surface: #17241d;
    --tile: #1c2b23;
    --ink: #e5ede7;
    --muted: #92a598;
    --line: #26372e;
    --pine: #86b99a;
    --holly: #e3584c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* En-tête */
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(28px, 6vw, 72px) var(--gutter) 20px;
  max-width: 1320px;
  margin: 0 auto;
}

h1 {
  margin: 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(2.6rem, 9vw, 6.5rem);
  line-height: .9;
  letter-spacing: -.035em;
}

.resume {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.compte {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.compte-nb {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
  color: var(--holly);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.compte-lbl {
  color: var(--muted);
  font-size: .85rem;
  margin-top: 4px;
}

/* Filtres */
.filtres {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 12px var(--gutter);
  max-width: 1320px;
  margin: 0 auto;
  background: var(--bg);
}
.filtres::-webkit-scrollbar { display: none; }

.filtre {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.filtre:hover { border-color: var(--muted); }
.filtre[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.filtre .n {
  margin-left: 6px;
  opacity: .55;
  font-variant-numeric: tabular-nums;
}

/* Grille */
main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px var(--gutter) 80px;
}

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 40px 24px;
}

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

.media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: var(--radius-media);
  background: var(--tile);
  overflow: hidden;
  color: var(--pine);
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10%;
  opacity: 0;
  transition: opacity .3s, transform .3s;
}
.media img.ok { opacity: 1; }
.media.photo { background: #fff; }
.media.photo.cover img { object-fit: cover; padding: 0; }
.media:hover img.ok { transform: scale(1.03); }

.media svg {
  width: 30%;
  height: 30%;
  stroke: currentColor;
  stroke-width: 1.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .8;
}

.infos {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 2px 0;
}

.cat {
  margin: 0;
  color: var(--pine);
  font-size: .82rem;
  font-weight: 600;
}

.nom {
  margin: 2px 0 0;
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.22rem;
  line-height: 1.2;
  letter-spacing: -.01em;
}

.note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .9rem;
}
.note:empty { display: none; }

.bas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
}

.prix {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.lien {
  margin-left: auto;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1.5px solid var(--line);
  padding-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: border-color .15s;
}
.lien:hover { border-color: var(--holly); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--holly);
  outline-offset: 3px;
}

.erreur {
  max-width: 60ch;
  padding: 18px 20px;
  border-left: 3px solid var(--holly);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
}
.erreur code {
  font-size: .9em;
  background: var(--tile);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Mobile : 2 colonnes */
@media (max-width: 560px) {
  .grille {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 14px;
  }
  .nom { font-size: 1.02rem; }
  .note { font-size: .84rem; }
  .bas { flex-wrap: wrap; gap: 6px; }
  .lien { margin-left: 0; }
  .media { border-radius: 14px; }
}

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

.erreur a { color: inherit; text-decoration-color: var(--holly); text-underline-offset: 3px; }
