/* ========================================================================
   AUDYT — Design System Premium 2026
   Editorial · Warm · Minimalist · Sources: Mercury · Linear · NYT Magazine
   ========================================================================== */

/* ---- Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

/* ---- Tokens ---- */
:root {
  /* Couleurs */
  --cream: #FDFBF3;
  --cream-deep: #F5F1E4;
  --paper: #FAF7EC;
  --ink: #1A1815;
  --ink-soft: #3D3A33;
  --ink-muted: #6B655B;
  --ink-faint: #A8A293;
  --stamp: #A4243B;
  --stamp-soft: #C9596F;
  --stamp-tint: rgba(164, 36, 59, 0.08);
  --success: #1F5128;
  --success-tint: rgba(31, 81, 40, 0.08);
  --warning: #A16207;
  --warning-tint: rgba(161, 98, 7, 0.10);
  --critical: #7F1D1D;
  --critical-tint: rgba(127, 29, 29, 0.08);
  --border: rgba(26, 24, 21, 0.08);
  --border-strong: rgba(26, 24, 21, 0.16);
  --border-stamp: rgba(164, 36, 59, 0.30);

  /* Typo */
  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', monospace;

  /* Tailles */
  --t-xs: 11px;
  --t-sm: 13px;
  --t-md: 15px;
  --t-base: 16px;
  --t-lg: 18px;
  --t-xl: 22px;
  --t-2xl: 28px;
  --t-3xl: 36px;
  --t-4xl: 48px;
  --t-5xl: 60px;
  --t-6xl: 72px;

  /* Espacements (base 4) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;

  /* Radius */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 9999px;

  /* Shadows */
  --shadow-paper: 0 1px 2px rgba(26, 24, 21, 0.04), 0 8px 24px -8px rgba(26, 24, 21, 0.08);
  --shadow-card: 0 1px 3px rgba(26, 24, 21, 0.06), 0 12px 32px -12px rgba(26, 24, 21, 0.12);
  --shadow-card-hover: 0 2px 4px rgba(26, 24, 21, 0.08), 0 24px 48px -16px rgba(26, 24, 21, 0.16);
  --shadow-modal: 0 4px 8px rgba(26, 24, 21, 0.08), 0 32px 80px -16px rgba(26, 24, 21, 0.24);

  /* Easing */
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--t-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  /* Texture papier ultra subtile */
  background-image:
    radial-gradient(circle at 15% 25%, rgba(164, 36, 59, 0.018) 0%, transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(164, 36, 59, 0.012) 0%, transparent 50%);
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font: inherit; color: inherit; }

/* ---- Typo ---- */
.serif { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
.serif em, .serif i { font-style: italic; }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.1; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: clamp(40px, 9vw, var(--t-6xl)); line-height: 1.02; }
h2 { font-size: clamp(28px, 6vw, var(--t-4xl)); line-height: 1.05; }
h3 { font-size: clamp(22px, 4vw, var(--t-2xl)); line-height: 1.15; }
p { color: var(--ink-soft); }

.lead { font-size: var(--t-lg); line-height: 1.55; color: var(--ink-soft); }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--s-5);
  padding-right: var(--s-5);
}
@media (min-width: 768px) {
  .container { padding-left: var(--s-8); padding-right: var(--s-8); }
}

.container-narrow { max-width: 720px; }
.container-prose { max-width: 640px; }

/* ---- Sections ---- */
.section {
  padding: var(--s-16) 0;
}
@media (min-width: 768px) {
  .section { padding: var(--s-24) 0; }
}
.section--tight { padding: var(--s-10) 0; }
.section--deep { background: var(--paper); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0 var(--s-5);
  height: 48px;
  min-height: 48px;
  font-family: var(--font-sans);
  font-size: var(--t-md);
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: var(--r-md);
  transition: all 0.25s var(--ease-out);
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn--full { width: 100%; }
.btn--lg { height: 56px; min-height: 56px; padding: 0 var(--s-6); font-size: var(--t-md); }
.btn--xl { height: 64px; min-height: 64px; padding: 0 var(--s-8); font-size: var(--t-lg); }
.btn--sm { height: 36px; min-height: 36px; padding: 0 var(--s-3); font-size: var(--t-sm); }

.btn--primary {
  background: var(--ink);
  color: var(--cream);
}
.btn--primary:hover {
  background: var(--ink-soft);
  box-shadow: var(--shadow-card);
}

.btn--accent {
  background: var(--stamp);
  color: #fff;
}
.btn--accent:hover {
  background: #8E1D32;
  box-shadow: 0 4px 12px rgba(164, 36, 59, 0.25);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
.btn--ghost:hover {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

.btn--soft {
  background: rgba(26, 24, 21, 0.06);
  color: var(--ink);
}
.btn--soft:hover {
  background: rgba(26, 24, 21, 0.10);
}

/* ---- Inputs ---- */
.input {
  width: 100%;
  height: 52px;
  padding: 0 var(--s-4);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--t-md);
  color: var(--ink);
  transition: all 0.2s var(--ease-out);
}
.input::placeholder { color: var(--ink-faint); }
.input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(26, 24, 21, 0.04);
}
.input--mono { font-family: var(--font-mono); letter-spacing: 0.04em; }

/* ---- Cards ---- */
.card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  box-shadow: var(--shadow-paper);
  transition: all 0.3s var(--ease-out);
}
.card--paper { background: var(--paper); }
.card--ink { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.card--hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

/* ---- Pills / Badges ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-3);
  font-size: var(--t-sm);
  font-weight: 500;
  background: var(--cream);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  color: var(--ink-soft);
}
.pill--stamp {
  background: var(--stamp-tint);
  border-color: var(--border-stamp);
  color: var(--stamp);
}
.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2.5s ease-in-out infinite;
}
.pill__dot--stamp { background: var(--stamp); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* ---- Source pill (signature Audyt) ---- */
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px var(--s-3);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--stamp-tint);
  border: 1px solid var(--border-stamp);
  border-radius: var(--r-pill);
  color: var(--stamp);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.source-pill:hover {
  background: rgba(164, 36, 59, 0.12);
}
.source-pill::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--stamp);
}

/* ---- Stamp mark (signature Audyt) ---- */
.stamp-mark {
  width: 88px;
  height: 88px;
  border: 2px solid var(--stamp);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--stamp);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  line-height: 1.1;
  transform: rotate(-8deg);
  opacity: 0.85;
}
.stamp-mark::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid var(--stamp);
  border-radius: 50%;
  opacity: 0.4;
}

/* ---- Risk levels ---- */
.risk-low    { color: var(--success); background: var(--success-tint); }
.risk-med    { color: var(--warning); background: var(--warning-tint); }
.risk-high   { color: var(--stamp);   background: var(--stamp-tint); }
.risk-crit   { color: var(--critical); background: var(--critical-tint); }

/* ---- Nav (sticky) ---- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(253, 251, 243, 0.72);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: var(--s-4);
}
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-display);
  font-size: var(--t-xl);
  letter-spacing: -0.02em;
}
.nav__brand-mark {
  width: 28px;
  height: 28px;
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-style: italic;
}
.nav__links {
  display: none;
  gap: var(--s-6);
  font-size: var(--t-sm);
  color: var(--ink-soft);
}
.nav__links a:hover { color: var(--ink); }
@media (min-width: 768px) {
  .nav__links { display: flex; }
}

/* ---- Halo background ---- */
.halo {
  position: absolute;
  pointer-events: none;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--stamp-tint) 0%, transparent 65%);
  filter: blur(40px);
  z-index: 0;
}

/* ---- Animations ---- */
.fade-up {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s var(--ease-premium), transform 0.8s var(--ease-premium);
}
.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-up[data-delay="100"] { transition-delay: 0.10s; }
.fade-up[data-delay="200"] { transition-delay: 0.20s; }
.fade-up[data-delay="300"] { transition-delay: 0.30s; }
.fade-up[data-delay="400"] { transition-delay: 0.40s; }
.fade-up[data-delay="500"] { transition-delay: 0.50s; }
.fade-up[data-delay="600"] { transition-delay: 0.60s; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(253, 251, 243, 0.3);
  border-top-color: var(--cream);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* ---- Conversation bubbles (assistant) ---- */
.bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: var(--t-md);
  line-height: 1.5;
}
.bubble--user {
  margin-left: auto;
  background: rgba(26, 24, 21, 0.04);
  border-top-right-radius: var(--r-sm);
}
.bubble--ai {
  background: var(--paper);
  border: 1px solid var(--border);
  border-top-left-radius: var(--r-sm);
}

/* ---- Voice button (signature copilot) ---- */
.voice-btn {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--stamp);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--ease-out);
}
.voice-btn:hover { transform: scale(1.05); box-shadow: 0 8px 24px rgba(164, 36, 59, 0.35); }
.voice-btn--active {
  animation: voice-pulse 1.4s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(164, 36, 59, 0.5); }
  50% { box-shadow: 0 0 0 16px rgba(164, 36, 59, 0); }
}

.voice-orb {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--stamp-soft), var(--stamp));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 48px rgba(164, 36, 59, 0.30), inset 0 0 60px rgba(255, 255, 255, 0.15);
}
.voice-orb::before, .voice-orb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--stamp);
  opacity: 0;
}
.voice-orb--active::before { animation: orb-ring 2s ease-out infinite; }
.voice-orb--active::after  { animation: orb-ring 2s ease-out 1s infinite; }
@keyframes orb-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---- Sticky bottom CTA mobile ---- */
.sticky-cta {
  position: sticky;
  bottom: 0;
  background: rgba(253, 251, 243, 0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  padding: var(--s-3) var(--s-5) calc(var(--s-3) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  z-index: 40;
}

/* ---- Utilities ---- */
.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;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.text-center { text-align: center; }

.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--s-6); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--s-6); }
}
@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .fade-up { opacity: 1; transform: none; }
}
