/* =====================================================================
   ZINA · DESIGN TOKENS
   Palette PULSE + Sansita One + Inter
   À importer en premier dans web/src/main.tsx : import './styles/design-tokens.css'
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sansita:wght@700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ---------- Couleurs de base ---------- */
  --zina-cream: #f7f2e9;
  --zina-ivoire: #e8dfcc;
  --zina-jaune: #ffd30a;
  --zina-ambre: #f4b942;
  --zina-foret: #1e3a2e;
  --zina-noir: #0f1a15;

  /* ---------- Couleurs sémantiques ---------- */
  --color-bg: var(--zina-cream);
  --color-surface: var(--zina-ivoire);
  /* Surface pleinement opaque, pour les popovers/menus qui doivent
     masquer ce qu'il y a derrière (contrairement à --color-surface,
     translucide en thème sombre pour un léger effet de carte). */
  --color-surface-solid: var(--zina-ivoire);
  --color-text: var(--zina-noir);
  --color-text-muted: rgba(15, 26, 21, 0.6);
  --color-text-subtle: rgba(15, 26, 21, 0.4);
  --color-border: rgba(15, 26, 21, 0.08);
  --color-border-strong: rgba(15, 26, 21, 0.15);

  /* Actions */
  --color-primary: var(--zina-foret);
  --color-primary-text: var(--zina-cream);
  --color-accent: var(--zina-jaune);
  --color-accent-text: var(--zina-noir);
  --color-secondary: var(--zina-ambre);

  /* États */
  --color-success: #4a7c59;
  --color-warning: var(--zina-ambre);
  --color-error: #b84a3f;
  --color-info: var(--zina-foret);

  /* ---------- Typographie ---------- */
  --font-display: 'Sansita', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Mobile-first: valeurs de base pour petits écrans, agrandies par la
     media query min-width plus bas pour les écrans larges. */
  --fs-display: 3rem; /* 48px, 64px à partir de 641px */
  --fs-h1: 1.75rem; /* 28px, 36px à partir de 641px */
  --fs-h2: 1.25rem; /* 20px, 24px à partir de 641px */
  --fs-h3: 1.125rem; /* 18px */
  --fs-body: 0.9375rem; /* 15px */
  --fs-small: 0.8125rem; /* 13px */
  --fs-micro: 0.6875rem; /* 11px */

  --lh-tight: 1;
  --lh-heading: 1.2;
  --lh-body: 1.6;

  --ls-display: -0.02em;
  --ls-heading: -0.015em;
  --ls-body: -0.005em;
  --ls-micro: 0.15em;

  /* ---------- Spacing (base 4px) ---------- */
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px */
  --space-5: 1.25rem; /* 20px */
  --space-6: 1.5rem; /* 24px */
  --space-8: 2rem; /* 32px */
  --space-10: 2.5rem; /* 40px */
  --space-12: 3rem; /* 48px */
  --space-16: 4rem; /* 64px */
  --space-20: 5rem; /* 80px */

  /* ---------- Rayons ---------- */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* ---------- Ombres ---------- */
  --shadow-sm: 0 1px 3px rgba(15, 26, 21, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 26, 21, 0.08);
  --shadow-lg: 0 8px 30px rgba(15, 26, 21, 0.12);
  --shadow-xl: 0 20px 60px rgba(15, 26, 21, 0.15);

  /* ---------- Animations ---------- */
  --easing-out: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.4s;
  --duration-breath: 3.2s;

  /* ---------- Z-index ---------- */
  --z-base: 1;
  --z-sticky: 100;
  --z-overlay: 500;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* Thème sombre (à activer via data-theme="dark" ou @media prefers-color-scheme) */
[data-theme='dark'] {
  --color-bg: var(--zina-noir);
  --color-surface: rgba(247, 242, 233, 0.06);
  --color-surface-solid: color-mix(in srgb, var(--zina-cream) 8%, var(--zina-noir));
  --color-text: var(--zina-cream);
  --color-text-muted: rgba(247, 242, 233, 0.65);
  --color-text-subtle: rgba(247, 242, 233, 0.4);
  --color-border: rgba(247, 242, 233, 0.1);
  --color-border-strong: rgba(247, 242, 233, 0.2);
  --color-primary: var(--zina-jaune);
  --color-primary-text: var(--zina-noir);
}

/* =====================================================================
   RESET & BASE
   ===================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
}

/* Surlignage de sélection identique en thème clair et sombre: on utilise
   les tokens bruts de palette et non les tokens sémantiques, qui eux
   s'inversent d'un thème à l'autre. Une règle ::selection sans sélecteur
   s'applique à toute la page, champs de formulaire compris. */
::selection {
  background: var(--zina-jaune);
  color: var(--zina-noir);
}

/* =====================================================================
   CLASSES UTILITAIRES TYPOGRAPHIE
   ===================================================================== */
.text-display {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-display);
}

.text-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h1);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
}

.text-h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
}

.text-h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-h3);
  line-height: var(--lh-heading);
}

.text-body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
}

.text-small {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-small);
  line-height: var(--lh-body);
}

.text-micro {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-micro);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-micro);
  text-transform: uppercase;
}

/* =====================================================================
   BOUTONS
   ===================================================================== */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-body);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition:
    transform 0.3s ease-in-out,
    background 0.3s ease-in-out,
    box-shadow 0.3s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
}

.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-text);
}
.btn-primary:hover {
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-accent-text);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-ghost:hover {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

/* =====================================================================
   INPUTS
   ===================================================================== */
.input {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-bg);
  color: var(--color-text);
  width: 100%;
  transition:
    border 0.3s ease-in-out,
    box-shadow 0.3s ease-in-out;
}

.input::placeholder {
  color: var(--color-text-subtle);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 46, 0.1);
}

/* =====================================================================
   CARDS
   ===================================================================== */
.card {
  background: var(--color-bg);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}

/* =====================================================================
   ANIMATIONS RÉUTILISABLES
   ===================================================================== */
@keyframes zina-breath {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes zina-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes zina-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-breath {
  animation: zina-breath var(--duration-breath) var(--easing-in-out) infinite;
}
.animate-fade-in {
  animation: zina-fade-in var(--duration-slow) var(--easing-out);
}
.animate-pulse {
  animation: zina-pulse 2s var(--easing-in-out) infinite;
}

/* =====================================================================
   RESPONSIVE HELPERS
   Mobile-first: :root porte déjà les valeurs mobiles, cette media query
   les agrandit à partir de 641px plutôt que l'inverse.
   ===================================================================== */
@media (min-width: 641px) {
  :root {
    --fs-display: 4rem;
    --fs-h1: 2.25rem;
    --fs-h2: 1.5rem;
  }
}
