:root {
  --bg: #0e0e10;
  --surface: #1a1a1e;
  --text: #f2f2f5;
  --muted: #9a9aa3;
  --border: #2c2c33;
  --chip-bg: #2c2c33;
  --shadow: rgba(0, 0, 0, 0.35);
  --backdrop: rgba(0, 0, 0, 0.6);
  --radius: 22px;
  --accent: #5b8cff;
}

/* Mode clair automatique (suit le réglage système). */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #1d1d1f;
    --muted: #6e6e73;
    --border: #d2d2d7;
    --chip-bg: #e8e8ed;
    --shadow: rgba(0, 0, 0, 0.12);
    --backdrop: rgba(0, 0, 0, 0.35);
    --accent: #2563eb;
  }
}

/* L'attribut HTML `hidden` doit toujours l'emporter sur un `display` explicite
   (sinon le bouton « Load more » reste visible même quand .hidden est posé). */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

main { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem 4rem; }

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

.card {
  margin: 0;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); outline: none; }
.card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  clip-path: url(#squircle);
  background: var(--surface);
  /* drop-shadow (et non box-shadow) pour que l'ombre épouse la forme clippée. */
  filter: drop-shadow(0 8px 24px var(--shadow));
}
.more {
  display: block;
  margin: 3rem auto 0;
  padding: 0.7rem 1.6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
}
.more:hover { border-color: var(--accent); }

/* Dialog détail */
dialog {
  border: none;
  border-radius: 28px;
  background: var(--surface);
  color: var(--text);
  max-width: 420px;
  width: calc(100% - 2rem);
  padding: 2rem;
  text-align: center;
}
dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(4px); }
dialog img {
  width: 180px;
  height: 180px;
  clip-path: url(#squircle);
  filter: drop-shadow(0 8px 24px var(--shadow));
}
dialog h2 { margin: 1.2rem 0 0.2rem; }
.close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin: 0.8rem 0; }
.tag {
  font-size: 0.78rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
}

.actions { display: flex; gap: 0.8rem; justify-content: center; margin-top: 1rem; }
.btn {
  display: inline-block;
  padding: 0.65rem 1.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }

.site-footer { text-align: center; padding: 2rem; }
.site-footer a { color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
