/* ==========================================================================
   Charte commune — Mariage d'Adgenia & Nicodem
   Tokens en trois couches : primitives → sémantiques → composants.
   Règle : aucun code hexadécimal en dehors de la section « Primitives ».
   Contrastes vérifiés (WCAG 2.2 AA) : voir docs/invitation.md.
   ========================================================================== */

/* --- Polices auto-hébergées (variables, SIL Open Font License) -------------- */
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/playfair-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/playfair-display-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/playfair-display-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Playfair Display";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/playfair-display-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;   /* identité « papier » : thème clair unique, assumé */

  /* --- Primitives --------------------------------------------------------- */
  --blanc:    #ffffff;
  --rose-50:  #fffaf6;
  --rose-75:  #fbf5f1;
  --rose-100: #f7ede6;
  --rose-200: #efdfd5;
  --rose-300: #e6d0c4;
  --rose-400: #d9c2b6;
  --rose-500: #cdb3a6;
  --or-400:   #b8957a;   /* ornements uniquement (2.4:1) : jamais pour du texte */
  --or-500:   #a07c68;   /* grand texte décoratif ≥ 24 px (3.3:1) */
  --brun-450: #8a7166;   /* texte indicatif, placeholder (4.2:1 sur un champ) */
  --brun-500: #9a7562;   /* bordures de champs (≥ 3:1 sur la carte) */
  --brun-600: #7a5a4c;   /* grand texte secondaire (5.4:1) */
  --brun-700: #6e5044;   /* texte secondaire, libellés, bouton principal (6.3:1) */
  --brun-800: #5a4038;   /* texte principal (8.2:1) */
  --brun-900: #3f2c26;
  --rouge-700: #9b3d33;  /* erreurs (5.9:1) */
  --vert-700: #3f6b4f;   /* confirmations */
  --porte-clair: #f2e6d2;
  --porte-moyen: #ead6ca;
  --porte-fonce: #e9d4c8;
  --sceau-clair: #faf2e2;
  --sceau-fonce: #dfcdb1;
  --sceau-anneau: #efe2cb;

  /* --- Sémantiques -------------------------------------------------------- */
  --couleur-fond-page: var(--rose-400);
  --couleur-surface: var(--rose-100);
  --couleur-surface-claire: var(--rose-50);
  --couleur-surface-champ: var(--rose-75);
  --couleur-texte: var(--brun-800);
  --couleur-texte-doux: var(--brun-700);
  --couleur-texte-large: var(--brun-600);
  --couleur-libelle: var(--brun-700);
  --couleur-indication: var(--brun-450);
  --couleur-ornement: var(--or-400);
  --couleur-accent: var(--or-500);
  --couleur-bordure: var(--brun-500);
  --couleur-bordure-douce: color-mix(in srgb, var(--or-500) 40%, transparent);
  --couleur-bordure-legere: color-mix(in srgb, var(--or-500) 22%, transparent);
  --couleur-voile: color-mix(in srgb, var(--or-500) 12%, transparent);
  --couleur-primaire: var(--brun-700);
  --couleur-primaire-survol: var(--brun-800);
  --couleur-sur-primaire: var(--rose-100);
  --couleur-focus: var(--brun-900);
  --couleur-erreur: var(--rouge-700);
  --couleur-erreur-fond: color-mix(in srgb, var(--rouge-700) 7%, transparent);
  --couleur-succes: var(--vert-700);
  --couleur-succes-fond: color-mix(in srgb, var(--vert-700) 10%, transparent);

  /* --- Typographie (échelle modulaire, unités rem pour respecter le zoom) -- */
  --police-titre: "Playfair Display", "Times New Roman", Georgia, serif;
  --police-texte: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --taille-xs: 0.8125rem;   /* 13 px : libellés en capitales espacées */
  --taille-s: 1rem;         /* 16 px */
  --taille-m: 1.1875rem;    /* 19 px : texte courant (Cormorant a un petit œil) */
  --taille-l: 1.375rem;     /* 22 px */
  --taille-xl: 1.75rem;     /* 28 px */
  --taille-2xl: 2.25rem;    /* 36 px */
  --taille-3xl: clamp(2.6rem, 11vw, 3.25rem);   /* noms des mariés */
  --interligne-serre: 1.1;
  --interligne: 1.5;
  --espacement-capitales: 0.28em;

  /* --- Espacements (rythme de 4/8 px) ------------------------------------- */
  --espace-1: 0.25rem;   /*  4 */
  --espace-2: 0.5rem;    /*  8 */
  --espace-3: 0.75rem;   /* 12 */
  --espace-4: 1rem;      /* 16 */
  --espace-5: 1.5rem;    /* 24 */
  --espace-6: 2rem;      /* 32 */
  --espace-7: 3rem;      /* 48 */
  --espace-8: 4rem;      /* 64 */

  /* --- Formes, élévations ------------------------------------------------- */
  --rayon-s: 0.625rem;
  --rayon-m: 1rem;
  --rayon-pilule: 999px;
  --rayon-arche: 200px;
  --ombre-1: 0 4px 14px color-mix(in srgb, var(--brun-800) 10%, transparent);
  --ombre-2: 0 8px 22px color-mix(in srgb, var(--brun-800) 20%, transparent);
  --ombre-sceau: 2px 5px 4px color-mix(in srgb, var(--brun-800) 24%, transparent);
  --ombre-carte: 0 0 60px color-mix(in srgb, var(--brun-800) 18%, transparent),
                 0 30px 80px color-mix(in srgb, var(--brun-800) 16%, transparent);

  /* --- Mouvement ---------------------------------------------------------- */
  --duree-retour: 150ms;     /* retour visuel d'un geste */
  --duree-courte: 250ms;     /* survol, apparition d'un message */
  --duree-sortie: 450ms;     /* étape qui s'efface (plus rapide que l'entrée) */
  --duree-entree: 800ms;     /* étape qui apparaît */
  --duree-portes: 2200ms;    /* ouverture des portes : moment signature */
  --courbe-sortie: cubic-bezier(0.4, 0, 1, 1);
  --courbe-entree: cubic-bezier(0.16, 1, 0.3, 1);
  --courbe-portes: cubic-bezier(0.6, 0.05, 0.25, 1);

  /* --- Superpositions ----------------------------------------------------- */
  --plan-cadre: 1;
  --plan-etape: 2;
  --plan-progression: 3;
  --plan-portes: 20;
  --plan-controles: 30;

  /* --- Composants --------------------------------------------------------- */
  --cible-tactile: 44px;
  --hauteur-champ: 3rem;
  --largeur-carte: 27.5rem;   /* 440 px */
  --largeur-texte: 20rem;
}

/* --- Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--couleur-fond-page);
  color: var(--couleur-texte);
  font-family: var(--police-texte);
  font-size: var(--taille-m);
  line-height: var(--interligne);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, dl, dd, ol, ul, figure, blockquote { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
address { font-style: normal; }

h1, h2 {
  font-family: var(--police-titre);
  font-weight: 400;
  line-height: var(--interligne-serre);
  text-wrap: balance;
}
p { text-wrap: pretty; }

a {
  color: var(--couleur-texte-doux);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: color var(--duree-courte) ease;
}
a:hover { color: var(--couleur-texte); }

/* Focus visible au clavier sur tout élément interactif (2 px, contraste ≥ 3:1) */
:focus-visible {
  outline: 2px solid var(--couleur-focus);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Les titres reçoivent le focus par script (changement d'étape) : pas d'anneau à la souris */
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--rose-300); color: var(--brun-900); }

/* --- Boutons ---------------------------------------------------------------- */
.bouton {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--espace-2);
  min-height: var(--cible-tactile);
  padding: var(--espace-3) var(--espace-2);
  border: 0;
  border-radius: 0;
  background: none;
  font-family: var(--police-texte);
  font-size: var(--taille-m);
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--duree-courte) ease, box-shadow var(--duree-courte) ease,
              transform var(--duree-retour) ease, color var(--duree-courte) ease;
}
.bouton::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 22%;
  right: 22%;
  height: 1px;
  background: var(--couleur-bordure-douce);
  transition: left var(--duree-courte) ease, right var(--duree-courte) ease,
              background-color var(--duree-courte) ease;
}
.bouton:hover::after,
.bouton:focus-visible::after { left: var(--espace-2); right: var(--espace-2); background: var(--couleur-accent); }
.bouton:active { transform: scale(0.97); }
.bouton svg { width: 0.9em; height: 0.9em; flex: none; }

.bouton--primaire {
  color: var(--couleur-texte);
  font-weight: 600;
}
.bouton--primaire:hover { color: var(--couleur-texte); }

.bouton--secondaire {
  color: var(--couleur-texte-doux);
}
.bouton--secondaire:hover { color: var(--couleur-texte); }

.bouton--large { width: 100%; min-height: 3.25rem; }

.bouton[aria-busy="true"] { cursor: progress; }
.bouton:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Lien discret (actions tertiaires) */
.lien-discret {
  display: inline-flex;
  align-items: center;
  min-height: var(--cible-tactile);
  padding: 0 var(--espace-2);
  border: 0;
  background: none;
  color: var(--couleur-texte-doux);
  font-size: var(--taille-s);
  font-weight: 400;
  font-style: italic;
  text-decoration: none;
  text-underline-offset: 0.3em;
}
.lien-discret:hover,
.lien-discret:focus-visible { color: var(--couleur-texte); text-decoration: underline; }

/* --- Utilitaires ------------------------------------------------------------ */
.visuellement-cache {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Mouvement réduit : aucune animation non essentielle -------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .bouton:active { transform: none; }
}
