
/* ---------- Tokens (design.md §2) ---------- */
:root {
  --bg: #ffffff;
  --text: #111111;
  --text-2: #5f5f5f;
  --text-3: #8e8e8e;
  --accent: #e60023;
  --accent-hover: #ad081b;
  --pill: #efefef;
  --pill-hover: #e2e2e2;
  --line: #e9e9e9;
  --overlay: rgba(0, 0, 0, 0.4);
  --scrim: rgba(0, 0, 0, 0.6);

  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-hero: clamp(1.75rem, 4vw, 2.5rem);
  --fs-h1: 1.75rem;
  --fs-h2: 1.25rem;
  --fs-body: 1rem;
  --fs-ui: 0.875rem;
  --fs-small: 0.75rem;

  --r-card: 16px;
  --r-pill: 9999px;
  --r-modal: 32px;
  --r-input: 24px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-6: 24px; --sp-8: 32px; --sp-12: 48px; --sp-16: 64px;

  --container: 1200px;
  --gutter: 16px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1 { font-size: var(--fs-h1); line-height: 1.2; letter-spacing: -0.02em; font-weight: 600; }
h2 { font-size: var(--fs-h2); line-height: 1.3; letter-spacing: -0.02em; font-weight: 600; }
h3 { font-size: var(--fs-body); line-height: 1.4; font-weight: 600; }
p.lead { color: var(--text-2); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--sp-4); }
.section { padding: var(--sp-8) 0; }
.stack > * + * { margin-top: var(--sp-4); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); font-size: var(--fs-small); }

:focus-visible { outline: 2px solid #111; outline-offset: 1px; border-radius: 4px; }

/* ---------- Header (design.md §3.1) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--line);
}
.site-header .container {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 64px; flex-wrap: wrap; padding-top: var(--sp-2); padding-bottom: var(--sp-2);
}
.logo { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; padding: 0 var(--sp-2); }
.logo span { color: var(--text-3); font-weight: 600; }
.nav { display: flex; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-pill {
  display: inline-flex; align-items: center; white-space: nowrap;
  height: 40px; padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  font-size: var(--fs-ui); font-weight: 600; color: var(--text);
  transition: background 0.15s;
}
.nav-pill:hover { background: var(--pill); }
.nav-pill.active { background: #111; color: #fff; }
.search-form { flex: 1 1 220px; min-width: 160px; }
.search-input {
  width: 100%; height: 40px;
  border: none; border-radius: var(--r-pill);
  background: var(--pill);
  padding: 0 var(--sp-4) 0 40px;
  font-size: var(--fs-ui); color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235f5f5f' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
[dir='rtl'] .search-input { padding: 0 40px 0 var(--sp-4); background-position: calc(100% - 14px) center; }
.search-input::placeholder { color: var(--text-2); }
.search-input:focus { outline: 2px solid #111; outline-offset: 1px; }
.header-actions { display: flex; align-items: center; gap: var(--sp-2); }
.avatar-sm {
  width: 40px; height: 40px; border-radius: 50%;
  background: #111; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-ui); font-weight: 700; text-transform: uppercase;
}

/* ---------- Boutons (design.md §3.4) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-4);
  border: none; border-radius: var(--r-pill);
  background: var(--pill); color: var(--text);
  font-size: var(--fs-ui); font-weight: 600;
  cursor: pointer; transition: background 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--pill-hover); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-lg { height: 48px; padding: 0 var(--sp-6); font-size: var(--fs-body); }
.btn-danger { color: #b91c1c; }
.btn-danger:hover { background: #fde8e8; }

/* ---------- Champs (design.md §3.6) ---------- */
.input, .select {
  width: 100%; height: 48px;
  padding: 0 var(--sp-4);
  border: none; border-radius: var(--r-pill);
  font-size: var(--fs-ui); font-family: inherit;
  background: var(--pill); color: var(--text);
}
.input:focus, .select:focus { outline: 2px solid #111; outline-offset: 1px; }
.label { display: block; font-size: var(--fs-ui); font-weight: 600; margin-bottom: var(--sp-2); }
.field { margin-bottom: var(--sp-4); }

.radio-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.radio-group label {
  display: inline-flex; align-items: center; height: 40px;
  border-radius: var(--r-pill); background: var(--pill);
  padding: 0 var(--sp-4); cursor: pointer;
  font-size: var(--fs-ui); font-weight: 600; color: var(--text);
  transition: background 0.15s;
}
.radio-group label:hover { background: var(--pill-hover); }
.radio-group input { position: absolute; opacity: 0; pointer-events: none; }
.radio-group label:has(input:checked) { background: #111; color: #fff; }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--r-input);
  padding: var(--sp-12) var(--sp-6);
  text-align: center; color: var(--text-2); font-size: var(--fs-ui);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.dropzone:hover, .dropzone.drag { background: var(--pill); border-color: var(--text-3); }
.upload-log { margin-top: var(--sp-4); font-size: var(--fs-ui); }
.upload-log li { list-style: none; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }

/* ---------- Cartes + masonry (design.md §3.2, §3.3) ---------- */
.masonry { columns: 5 236px; column-gap: var(--gutter); }
.masonry-pfp { columns: 6 180px; }
.card { break-inside: avoid; margin-bottom: var(--gutter); display: block; position: relative; }
.card-media { position: relative; border-radius: var(--r-card); overflow: hidden; background: var(--pill); }
.card-media .thumb { width: 100%; height: auto; display: block; }
.card-media::after {
  content: ''; position: absolute; inset: 0;
  background: var(--overlay); opacity: 0; transition: opacity 0.15s;
  pointer-events: none;
}
.card:hover .card-media::after { opacity: 1; }
.card .card-dl {
  position: absolute; top: var(--sp-3); inset-inline-end: var(--sp-3); z-index: 2;
  opacity: 0; transition: opacity 0.15s;
}
.card:hover .card-dl { opacity: 1; }
.card .card-title {
  margin-top: var(--sp-2);
  font-size: var(--fs-ui); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .card-sub { font-size: var(--fs-small); color: var(--text-3); }
.badge-anim {
  position: absolute; bottom: var(--sp-3); inset-inline-start: var(--sp-3); z-index: 2;
  background: rgba(0, 0, 0, 0.65); color: #fff;
  font-size: var(--fs-small); font-weight: 600;
  padding: 2px 10px; border-radius: var(--r-pill);
}

/* ---------- Chips / tags (design.md §3.5) ---------- */
.chip {
  display: inline-flex; align-items: center; height: 32px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--pill); color: var(--text);
  font-size: var(--fs-ui); font-weight: 500;
  transition: background 0.15s;
}
.chip:hover { background: var(--pill-hover); }
.chip.active { background: #111; color: #fff; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* ---------- Hero ---------- */
.hero { padding: var(--sp-12) 0 var(--sp-8); text-align: center; }
.hero h1 { font-size: var(--fs-hero); }
.hero p { max-width: 560px; margin: var(--sp-4) auto 0; color: var(--text-2); }
.hero .actions { margin-top: var(--sp-6); display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; }

/* ---------- Détail (design.md §3.8) ---------- */
.detail-img { border-radius: var(--r-card); overflow: hidden; background: var(--pill); }
.detail-img img, .detail-img video { width: 100%; }
.detail-meta { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; margin-top: var(--sp-4); }

/* ---------- Modal (design.md §3.7) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--scrim);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: var(--sp-4);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg); border-radius: var(--r-modal);
  padding: var(--sp-8); max-width: 400px; width: 100%;
  text-align: center; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.countdown { font-size: 3rem; font-weight: 700; letter-spacing: -0.02em; margin: var(--sp-4) 0; }

/* ---------- Profil (design.md §3.9) ---------- */
.avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: #111; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.25rem; font-weight: 700; text-transform: uppercase;
}
.profile-head { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.code-input { font-size: 1.5rem; letter-spacing: 0.5em; text-align: center; font-variant-numeric: tabular-nums; }
.alert { background: var(--pill); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-card); font-size: var(--fs-ui); }
.alert-error { background: #fde8e8; color: #b91c1c; }

/* ---------- FAQ (design.md §3.10) ---------- */
details.faq { border-bottom: 1px solid var(--line); padding: var(--sp-3) 0; }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin-top: var(--sp-2); color: var(--text-2); }

/* ---------- Footer ---------- */
.site-footer { margin-top: var(--sp-16); padding: var(--sp-8) 0; color: var(--text-2); font-size: var(--fs-ui); }
.site-footer .container { display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between; align-items: center; }
.lang-switch { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.lang-switch .chip { height: 28px; font-size: var(--fs-small); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-8); }

/* ---------- Admin ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
.admin-table th, .admin-table td { text-align: start; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th { color: var(--text-3); font-weight: 600; font-size: var(--fs-small); text-transform: uppercase; letter-spacing: 0.04em; }
.admin-thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 8px; }

/* ---------- Design system showcase ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--sp-3); }
.swatch { border-radius: var(--r-card); overflow: hidden; background: var(--neutral-50); }
.swatch .color { height: 56px; }
.swatch .info { padding: var(--sp-2); font-size: var(--fs-small); color: var(--text-2); }
.ds-block { border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--sp-6); margin-top: var(--sp-4); }

/* ---------- Responsive (design.md §4) ---------- */
@media (max-width: 640px) {
  :root { --gutter: 8px; }
  .container { padding: 0 var(--sp-3); }
  .hero { padding: var(--sp-8) 0 var(--sp-6); }
  .section { padding: var(--sp-6) 0; }
  .btn-lg { height: 40px; padding: 0 var(--sp-4); font-size: var(--fs-ui); }
  h1 { font-size: 1.375rem; }
  .avatar { width: 72px; height: 72px; font-size: 1.75rem; }
  .card .card-dl { opacity: 1; }
}

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