:root {
  /* Type scale fluide */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --text-3xl: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);
  --text-hero: clamp(2.5rem, 1rem + 4.8vw, 5.25rem);

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

  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --radius-full: 9999px;

  --transition-interactive: 220ms cubic-bezier(0.16, 1, 0.3, 1);

  --content-narrow: 720px;
  --content-default: 1080px;
  --content-wide: 1280px;

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Geist', 'Inter', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
}

/* LIGHT — base moderne lumineuse, accent indigo électrique + menthe */
:root,
[data-theme='light'] {
  --color-bg: #f7f5f0;
  --color-bg-deep: #efece4;
  --color-surface: #ffffff;
  --color-surface-2: #faf8f3;
  --color-surface-offset: #efece4;
  --color-surface-dynamic: #e8e4d8;
  --color-divider: #e3dfd3;
  --color-border: #d6d1c2;

  --color-text: #1a1915;
  --color-text-muted: #6b6a60;
  --color-text-faint: #a8a69a;
  --color-text-inverse: #faf8f3;

  /* Ink — primary button surface (inverts between modes). */
  --color-ink: #0f0e16;
  --color-ink-text: #faf8f3;
  /* Panel — always-dark block used for Pack hero & final CTA. */
  --color-panel: #0f0e16;
  --color-panel-text: #faf8f3;

  /* Indigo électrique — primary */
  --color-primary: #4a3aff;
  --color-primary-hover: #3d2de6;
  --color-primary-active: #2d1fb8;
  --color-primary-highlight: #e3dfff;

  /* Menthe vive — accent secondaire */
  --color-accent: #9cf95b;
  --color-accent-hover: #84e43a;
  --color-accent-ink: #0e2a0a;

  /* Corail chaleureux */
  --color-warm: #ff6b47;

  --shadow-sm: 0 1px 2px rgba(26, 25, 21, 0.06);
  --shadow-md: 0 8px 24px rgba(26, 25, 21, 0.08);
  --shadow-lg: 0 20px 60px rgba(74, 58, 255, 0.15);
  --shadow-glow: 0 0 0 1px rgba(74, 58, 255, 0.15), 0 20px 60px rgba(74, 58, 255, 0.2);
}

[data-theme='dark'] {
  --color-bg: #0e0d12;
  --color-bg-deep: #07060a;
  --color-surface: #17161d;
  --color-surface-2: #1c1b24;
  --color-surface-offset: #232230;
  --color-surface-dynamic: #2a2937;
  --color-divider: #262533;
  --color-border: #363544;

  --color-text: #eeecf5;
  --color-text-muted: #9a99a8;
  --color-text-faint: #6b6a7a;
  --color-text-inverse: #0e0d12;

  /* In dark mode ink is inverted (light) for buttons, but pack/CTA blocks
     that need a dark panel use --color-panel below. */
  --color-ink: #f7f5f0;
  --color-ink-text: #0e0d12;
  --color-panel: #1a1826;
  --color-panel-text: #faf8f3;

  --color-primary: #8a7eff;
  --color-primary-hover: #a399ff;
  --color-primary-active: #6d5eff;
  --color-primary-highlight: #2a2550;

  --color-accent: #c0ff7a;
  --color-accent-hover: #d0ff92;
  --color-accent-ink: #0e2a0a;

  --color-warm: #ff8568;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 60px rgba(138, 126, 255, 0.25);
  --shadow-glow: 0 0 0 1px rgba(138, 126, 255, 0.3), 0 20px 60px rgba(138, 126, 255, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0e0d12;
    --color-bg-deep: #07060a;
    --color-surface: #17161d;
    --color-surface-2: #1c1b24;
    --color-surface-offset: #232230;
    --color-surface-dynamic: #2a2937;
    --color-divider: #262533;
    --color-border: #363544;
    --color-text: #eeecf5;
    --color-text-muted: #9a99a8;
    --color-text-faint: #6b6a7a;
    --color-text-inverse: #0e0d12;
    --color-ink: #f7f5f0;
    --color-ink-text: #0e0d12;
    --color-panel: #1a1826;
    --color-panel-text: #faf8f3;
    --color-primary: #8a7eff;
    --color-primary-hover: #a399ff;
    --color-primary-highlight: #2a2550;
    --color-accent: #c0ff7a;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}
ul[role='list'],
ol[role='list'] {
  list-style: none;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
  font-weight: 400;
}
h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-xl); }

p, li {
  text-wrap: pretty;
  max-width: 65ch;
}

a { color: inherit; text-decoration: none; }

::selection {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

a, button, [role='button'] {
  transition:
    color var(--transition-interactive),
    background var(--transition-interactive),
    border-color var(--transition-interactive),
    transform var(--transition-interactive),
    box-shadow var(--transition-interactive);
}

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