/* ==========================================================================
   PIX — Socle commun (tokens, reset, typo, header, composants)
   Chargé par toutes les pages, avant la feuille spécifique de la page.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Couleurs */
  --cream: #E6E7E4;
  --cream-light: #F1F1EE;
  --cream-deep: #D9DAD6;
  --ink: #0D1B2B;
  --ink-soft: rgba(13, 27, 43, 0.64);
  --ink-faint: rgba(13, 27, 43, 0.14);
  --blue: #435B7B;
  --blue-soft: #7C90AD;
  --blue-mist: #C9D1DC;
  --success: #3E7358;
  --danger: #A2433B;

  /* Verre (glassmorphism) */
  --glass-bg: rgba(255, 255, 255, 0.42);
  --glass-bg-strong: rgba(255, 255, 255, 0.66);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-blur: blur(24px) saturate(140%);
  --shadow-soft: 0 1px 2px rgba(13, 27, 43, 0.06), 0 12px 32px rgba(13, 27, 43, 0.08);
  --shadow-lift: 0 2px 4px rgba(13, 27, 43, 0.08), 0 24px 60px rgba(13, 27, 43, 0.16);

  /* Typographie */
  --font-title: 'DM Serif Display', Georgia, serif;
  --font-nav: 'Open Sauce Sans', 'Open Sauce', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Abhaya Libre', Georgia, serif;

  /* Formes */
  --radius-s: 14px;
  --radius-m: 22px;
  --radius-l: 32px;
  --radius-pill: 999px;

  /* Mouvement */
  --ease: cubic-bezier(0.25, 1, 0.5, 1);
  --t-fast: 0.2s var(--ease);
  --t: 0.4s var(--ease);

  /* Mise en page */
  --page-max: 1440px;
  --gutter: clamp(16px, 4vw, 48px);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background-color: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

img, svg, video { display: block; max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; background: none; border: none; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Typographie ---------- */
.title-xl, .title-l, .title-m, .title-s { font-family: var(--font-title); font-weight: 400; line-height: 1.02; letter-spacing: -0.01em; }
.title-xl { font-size: clamp(52px, 8vw, 120px); }
.title-l  { font-size: clamp(40px, 5.5vw, 76px); }
.title-m  { font-size: clamp(30px, 3.4vw, 44px); }
.title-s  { font-size: 26px; }

.muted { color: var(--ink-soft); }

.eyebrow {
  font-family: var(--font-nav);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
}

.lead { font-size: clamp(20px, 1.6vw, 24px); line-height: 1.45; color: var(--ink-soft); max-width: 46ch; }

/* ---------- 4. Layout ---------- */
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 0 var(--gutter) 96px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 56px 0 36px;
}

.page-head .lead { margin-top: 14px; }

.section { padding: 72px 0 0; }

.stack > * + * { margin-top: 16px; }

/* ---------- 5. Header (grille croisée) ---------- */
.header-container {
  width: 100%;
  padding: 50px 20px;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.header-container > nav { display: flex; justify-content: center; width: 100%; }

.nav-grid {
  display: flex;
  align-items: stretch;            /* tous les blocs prennent la hauteur du logo */
  list-style: none;
  position: relative;
}

/* Ligne horizontale basse */
.nav-grid::after {
  content: '';
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 0;
  height: 2px;
  background-color: var(--ink);
  z-index: 1;
}

.nav-item {
  display: flex;
  align-items: center;             /* centres des mots alignés sur le même axe */
  position: relative;
  padding: 0 35px;
}

/* Séparateurs verticaux qui croisent la ligne basse */
.nav-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: -10px;
  bottom: -15px;
  width: 2px;
  background-color: var(--ink);
  z-index: 2;
}

.nav-link {
  position: relative;
  z-index: 3;
  font-family: var(--font-nav);
  font-size: 35px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity var(--t-fast), color var(--t-fast);
}

.nav-link:hover { opacity: 0.55; }

.nav-link[aria-current="page"] { color: var(--blue); }

.nav-item.logo .nav-link {
  font-family: var(--font-title);
  font-size: 70px;
  letter-spacing: 0;
}

@media (max-width: 1260px) {
  .header-container { padding: 24px 16px; }

  .nav-grid { flex-direction: column; width: 100%; max-width: 420px; }
  .nav-grid::after { display: none; }

  .nav-item { justify-content: center; padding: 12px 0; border-bottom: 2px solid var(--ink); }
  .nav-item:last-child { border-bottom: none; }
  .nav-item:not(:last-child)::after { display: none; }
  .nav-item.logo { order: -1; }

  .nav-link { font-size: 24px; }
  .nav-item.logo .nav-link { font-size: 56px; }
}

/* ---------- 6. Pastille compte flottante (panier + jetons) ---------- */
.account-pill {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: var(--radius-pill);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: var(--shadow-lift);
  font-family: var(--font-nav);
  font-size: 14px;
}

.account-pill__chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: background var(--t-fast);
}

.account-pill__chip:hover { background: rgba(13, 27, 43, 0.06); }

.account-pill__chip svg { width: 18px; height: 18px; }

.account-pill__count {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: var(--radius-pill);
  background: var(--ink); color: var(--cream);
  font-size: 12px;
}

.account-pill.is-bumped { animation: bump 0.45s var(--ease); }
.account-pill__count--hot { background: var(--danger); color: #fff; }

/* ---------- Barre admin (site public, compte admin connecté) ---------- */
.admin-strip {
  position: sticky; top: 0; z-index: 950;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px var(--gutter);
  background: var(--ink); color: var(--cream);
  font-family: var(--font-nav); font-size: 13px;
}
.admin-strip__who { display: inline-flex; align-items: center; gap: 8px; opacity: 0.85; }
.admin-strip svg { width: 15px; height: 15px; }
.admin-strip nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-strip a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  color: var(--cream); text-decoration: none;
  transition: background var(--t-fast);
}
.admin-strip a:hover { background: rgba(230, 231, 228, 0.12); }
.admin-strip a b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: rgba(230, 231, 228, 0.16); font-weight: 400; }
.admin-strip a.is-hot b { background: var(--danger); color: #fff; }
.admin-strip__open { background: var(--cream); color: var(--ink) !important; }
.admin-strip__open:hover { background: #fff !important; }

@keyframes bump { 40% { transform: scale(1.08); } }

/* ---------- 7. Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  font-family: var(--font-nav);
  font-size: 15px;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--t-fast), background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}

.btn:active { transform: scale(0.97); }

.btn svg { width: 18px; height: 18px; }

.btn--primary { background: var(--ink); color: var(--cream); }
.btn--primary:hover { background: var(--blue); }

.btn--soft { background: var(--blue-soft); color: var(--ink); }
.btn--soft:hover { background: var(--blue); color: var(--cream); }

.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink-faint); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }

.btn--glass {
  background: var(--glass-bg); color: var(--ink);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: blur(24px) saturate(140%);
}
.btn--glass:hover { background: var(--glass-bg-strong); }

.btn--block { width: 100%; }

.btn--xl { padding: 22px 40px; font-family: var(--font-title); font-size: 34px; letter-spacing: 0.01em; }

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* État de chargement générique : data-state="loading" */
.btn[data-state="loading"] { pointer-events: none; color: transparent !important; position: relative; }
.btn[data-state="loading"]::after {
  content: '';
  position: absolute; inset: 0; margin: auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--cream);
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn--ghost[data-state="loading"]::after,
.btn--glass[data-state="loading"]::after,
.btn--soft[data-state="loading"]::after { border-color: var(--ink); border-right-color: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Bouton icône rond */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  transition: background var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: rgba(13, 27, 43, 0.07); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- 8. Cartes verre ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-soft);
}

.card { padding: clamp(24px, 3vw, 40px); }

.card--link { text-decoration: none; display: block; transition: transform var(--t), box-shadow var(--t); }
.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }

/* Fond ambiant (halos doux sur crème) */
.ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient::before, .ambient::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(90px);
}
.ambient::before { width: 60vw; height: 60vw; top: -20vw; left: -10vw; background: rgba(124, 144, 173, 0.28); }
.ambient::after  { width: 50vw; height: 50vw; bottom: -20vw; right: -10vw; background: rgba(255, 255, 255, 0.7); }

/* ---------- 9. Formulaires ---------- */
.form { display: grid; gap: 18px; }
.form-row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.field { display: grid; gap: 8px; }

.field label, .field .label {
  font-family: var(--font-nav);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.input {
  width: 100%;
  padding: 15px 18px;
  border-radius: var(--radius-s);
  border: 1.5px solid transparent;
  background: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: 19px;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: rgba(13, 27, 43, 0.36); text-transform: none; letter-spacing: normal; }
.input:focus { outline: none; border-color: var(--blue-soft); background: #fff; box-shadow: 0 0 0 4px rgba(124, 144, 173, 0.2); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { min-height: 150px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230D1B2B' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 18px center; padding-right: 44px; }

.field-hint { font-size: 16px; color: var(--ink-soft); }
.field-error { font-size: 16px; color: var(--danger); }

/* Segmented control façon iOS */
.segmented {
  display: inline-flex; gap: 4px; padding: 4px;
  border-radius: var(--radius-pill);
  background: rgba(13, 27, 43, 0.06);
  font-family: var(--font-nav); font-size: 14px;
  overflow-x: auto; max-width: 100%; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button, .segmented a {
  padding: 10px 18px; border-radius: var(--radius-pill);
  white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.segmented [aria-selected="true"], .segmented [aria-current="page"] { background: #fff; box-shadow: var(--shadow-soft); }

/* ---------- 10. Badges & états ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-nav); font-size: 12px; letter-spacing: 0.04em;
  background: rgba(13, 27, 43, 0.07);
}
.badge svg { width: 14px; height: 14px; }
.badge--blue { background: var(--blue-mist); color: var(--ink); }
.badge--ink { background: var(--ink); color: var(--cream); }
.badge--success { background: rgba(62, 115, 88, 0.14); color: var(--success); }

/* Squelette de chargement */
.skeleton {
  background: linear-gradient(100deg, var(--cream-deep) 30%, var(--cream-light) 50%, var(--cream-deep) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.empty-state { padding: 64px 24px; text-align: center; color: var(--ink-soft); }
.empty-state .title-s { color: var(--ink); margin-bottom: 8px; }

/* ---------- 11. Toasts ---------- */
.toast-region {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 3000; display: grid; gap: 8px; justify-items: center;
  pointer-events: none; width: min(92vw, 440px);
}
.toast {
  padding: 13px 22px;
  border-radius: var(--radius-pill);
  background: rgba(13, 27, 43, 0.9);
  color: var(--cream);
  font-family: var(--font-nav); font-size: 14px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.35s var(--ease);
}
.toast.is-leaving { animation: toast-out 0.3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

.fatal-bar {
  position: fixed; left: 16px; right: 16px; top: 16px; z-index: 5000;
  display: grid; gap: 4px;
  padding: 16px 20px; border-radius: var(--radius-m);
  background: var(--danger); color: #fff;
  font-family: var(--font-nav); font-size: 15px; line-height: 1.4;
  box-shadow: var(--shadow-lift);
}
.fatal-bar a { color: #fff; font-weight: 700; }

/* ---------- 12. Dialogue générique (verre flouté) ---------- */
.dialog {
  position: fixed; inset: 0; z-index: 2000;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(230, 231, 228, 0.35);
  backdrop-filter: blur(30px) saturate(120%);
  -webkit-backdrop-filter: blur(30px) saturate(120%);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t), visibility var(--t);
}
.dialog.is-open { opacity: 1; visibility: visible; }
.dialog__panel {
  width: min(100%, 480px);
  max-height: calc(100vh - 32px); overflow: auto;
  background: var(--cream-light);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-lift);
  padding: clamp(24px, 4vw, 40px);
  position: relative;
  transform: translateY(16px) scale(0.98);
  transition: transform var(--t);
}
.dialog.is-open .dialog__panel { transform: none; }
.dialog__close { position: absolute; top: 14px; right: 14px; z-index: 1; background: var(--glass-bg-strong); }

/* ---------- 13. Footer ---------- */
.site-footer {
  max-width: var(--page-max); margin: 0 auto;
  padding: 40px var(--gutter) 110px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  border-top: 2px solid var(--ink);
  font-family: var(--font-nav); font-size: 14px;
}
.site-footer__logo { font-family: var(--font-title); font-size: 34px; text-decoration: none; }
.site-footer nav { display: flex; gap: 22px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; color: var(--ink-soft); }
.site-footer a:hover { color: var(--ink); }

/* ---------- 14. Accessibilité mouvement ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
