/* ============================================================
   Posthum.ai — Design System & Global Styles
   Palette « dark luxury » alignée sur l'app authentifiée
   (Cormorant Garamond / DM Mono / Outfit, accent or)
   ============================================================ */

/* ── POLICES (auto-hébergées, licence SIL OFL — /fonts/OFL.txt) ──
   Sous-ensemble latin, limité aux graisses réellement utilisées.
   Auto-hébergement : aucune requête vers Google (RGPD), pas d'origine
   tierce bloquante. Cormorant (droit) et Outfit sont des fontes variables. */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
  src: url('/fonts/cormorant-garamond-v21-latin-var.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;
  font-display: swap;
  src: url('/fonts/cormorant-garamond-v21-latin-300italic.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: 'DM Mono';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/fonts/dm-mono-v16-latin-300.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: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/dm-mono-v16-latin-400.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: 'Outfit';
  font-style: normal;
  font-weight: 300 400;
  font-display: swap;
  src: url('/fonts/outfit-v15-latin-var.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;
}

/* ── VARIABLES ────────────────────────────────────────────── */
:root {
  /* Fonds */
  --void:       #050508;
  --ink:        #0a0a0f;
  --ash:        #1a1a2e;

  /* Accent */
  --gold:       #c9a96e;
  --gold-light: #e8d5b0;
  --accent:     #8b7fb0;

  /* Texte — échelle contrastée (AA sur fond --void) */
  --white:      #f2f1f7;   /* titres / emphase */
  --silver:     #cdcddb;   /* corps fort */
  --mist:       #9c9cb2;   /* corps courant — contraste ≈ 7:1 */
  --muted:      #86869c;   /* méta / notes — contraste ≈ 5:1 */

  /* Typo */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --font-body:    'Outfit', system-ui, sans-serif;

  /* Layout */
  --nav-height: 72px;
  --max-width:  1180px;
  --gutter:     clamp(1.5rem, 5vw, 4rem);

  /* Motion */
  --transition-fast:   0.2s ease;
  --transition-medium: 0.35s ease;
}

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

html {
  scroll-behavior: smooth;
  /* Ancres et focus jamais masqués par la nav fixe (WCAG 2.4.11) */
  scroll-padding-top: calc(var(--nav-height) + 1rem);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--void);
  color: var(--silver);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; height: auto; display: block; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }

/* Focus visible — accessibilité clavier */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Lien d'évitement */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 1000;
  background: var(--gold);
  color: var(--void);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.7rem 1.2rem;
  transition: top var(--transition-fast);
}
.skip-link:focus { top: 1rem; }
/* Cible du lien d'évitement : focusable sans contour parasite */
main:focus { outline: none; }

/* ── GRAIN OVERLAY (discret) ──────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.3;
  pointer-events: none;
  z-index: 9000;
}

/* ── TYPOGRAPHIE ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 300;
  line-height: 1.1;
  color: var(--white);
  text-wrap: balance;
}

p { text-wrap: pretty; }

.label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.36em;
  color: var(--gold);
  text-transform: uppercase;
  display: block;
  margin-bottom: 1.1rem;
}

.section-title {
  font-size: clamp(2rem, 4vw, 3.4rem);
  margin-bottom: 2rem;
}
.section-title em { font-style: italic; color: var(--gold); }
.text-center { text-align: center; }

/* ── LAYOUT ───────────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── BOUTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 1rem 2.4rem;
  transition: transform var(--transition-medium), background var(--transition-medium),
              box-shadow var(--transition-medium), border-color var(--transition-medium),
              color var(--transition-medium);
  position: relative;
}

.btn-primary {
  background: var(--gold);
  color: var(--void);
}
.btn-primary:hover {
  background: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(201, 169, 110, 0.26);
}

.btn-ghost {
  background: transparent;
  color: var(--silver);
  border: 1px solid rgba(200, 200, 216, 0.24);
}
.btn-ghost:hover {
  border-color: rgba(201, 169, 110, 0.6);
  color: var(--white);
}

/* ── NAVIGATION ───────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  background: linear-gradient(to bottom, rgba(5, 5, 8, 0.94) 0%, transparent 100%);
  transition: background var(--transition-medium), border-color var(--transition-medium);
  border-bottom: 1px solid transparent;
}

/* Le flou est porté par un pseudo-élément : un backdrop-filter sur .nav
   en ferait le bloc conteneur du menu mobile (position: fixed), qui serait
   alors écrasé à la hauteur de la barre au lieu de couvrir l'écran. */
.nav::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

.nav.scrolled {
  background: rgba(5, 5, 8, 0.96);
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--white);
}
.nav-logo span { color: var(--gold); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.4rem;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mist);
  transition: color var(--transition-fast);
}
.nav-links a:hover,
.nav-links a:focus-visible { color: var(--gold); }

.nav-cta {
  color: var(--gold) !important;
  border: 1px solid rgba(201, 169, 110, 0.4);
  padding: 0.6rem 1.3rem;
  transition: background var(--transition-fast), border-color var(--transition-fast) !important;
}
.nav-cta:hover {
  background: rgba(201, 169, 110, 0.1);
  border-color: var(--gold) !important;
}

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--silver);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav-burger { display: flex; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: var(--nav-height) 0 0 0;
    background: rgba(5, 5, 8, 0.98);
    align-items: center;
    justify-content: center;
    justify-content: safe center;
    overflow-y: auto;
    padding-block: 2rem;
    gap: 2.4rem;
    z-index: 400;
  }
  .nav-links.open a { font-size: 1.05rem; }
}

/* ── SCROLL REVEAL ────────────────────────────────────────── */
/* Masqué seulement si le JS tourne (classe posée par main.js) :
   sans JS, tout le contenu reste visible. */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.js .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }

/* ── WAVEFORM ─────────────────────────────────────────────── */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 64px;
}
.wave-bar {
  width: 3px;
  height: var(--h, 30px);
  background: var(--gold);
  border-radius: 2px;
  opacity: 0.6;
  transform-origin: center;
  /* transform (compositeur) plutôt que height : pas de recalcul de mise en page */
  animation: waveDance var(--dur, 1.2s) ease-in-out infinite var(--delay, 0s) alternate;
}
.waveform.is-paused .wave-bar { animation-play-state: paused; }
@keyframes waveDance {
  from { transform: scaleY(var(--s, 0.2)); opacity: 0.25; }
  to   { transform: scaleY(1);             opacity: 0.85; }
}

/* ── CORNER BRACKETS ──────────────────────────────────────── */
.bracketed { position: relative; }
.bracketed::before,
.bracketed::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-color: rgba(201, 169, 110, 0.4);
  border-style: solid;
}
.bracketed::before { top: -1px; left: -1px;  border-width: 1px 0 0 1px; }
.bracketed::after  { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

/* ── FOOTER ───────────────────────────────────────────────── */
.footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2.6rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  color: var(--white);
}
.footer-logo span { color: var(--gold); }

.footer-links {
  display: flex;
  gap: 1.8rem;
  flex-wrap: wrap;
}
.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--mist);
  letter-spacing: 0.08em;
  transition: color var(--transition-fast);
}
.footer-links a:hover { color: var(--gold); }

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  width: 100%;
}

@media (max-width: 720px) {
  .footer { flex-direction: column; align-items: flex-start; }
}

/* ── PAGES LÉGALES (mentions, confidentialité, RGPD) ─────── */
.legal-page { padding: calc(var(--nav-height) + 4rem) 0 6rem; }
.legal-content { max-width: 720px; margin: 0 auto; }
.legal-content h1 {
  font-size: clamp(2.2rem, 5vw, 2.9rem);
  margin-bottom: 0.6rem;
}
.legal-content h2 {
  font-size: 1.45rem;
  color: var(--gold-light);
  margin: 2.6rem 0 0.8rem;
}
.legal-content p,
.legal-content li {
  font-size: 0.92rem;
  color: var(--mist);
  line-height: 1.85;
  margin-bottom: 0.8rem;
}
.legal-content strong { color: var(--silver); font-weight: 400; }
.legal-content ul { padding-left: 1.4rem; }
.legal-content ul li { list-style: disc; }
.legal-content a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.legal-content a:hover { color: var(--gold-light); }
.legal-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin-bottom: 3rem;
  display: block;
}
.highlight-box {
  border-left: 2px solid rgba(201, 169, 110, 0.45);
  padding: 1.1rem 1.5rem;
  background: rgba(201, 169, 110, 0.05);
  margin: 1.5rem 0;
}
.highlight-box p { margin-bottom: 0; }
.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--mist);
}
.legal-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(201, 169, 110, 0.25);
  font-weight: 400;
}
.legal-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: top;
}
.legal-table-scroll { overflow-x: auto; }
.legal-table-scroll:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.legal-table caption {
  text-align: left;
  font-size: 0.85rem;
  color: var(--muted);
  padding-bottom: 0.6rem;
}
/* Texte réservé aux lecteurs d'écran */
.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;
}

/* ── PAGE 404 ─────────────────────────────────────────────── */
.page-404 {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.page-404-code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 18vw, 12rem);
  font-weight: 300;
  color: rgba(201, 169, 110, 0.14);
  line-height: 1;
  margin-bottom: 1.2rem;
}
.page-404-title {
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  margin-bottom: 1rem;
}
.page-404-text {
  color: var(--mist);
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
  max-width: 380px;
}

/* ── PRÉFÉRENCE : MOUVEMENT RÉDUIT ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }
  /* Le contenu révélé au scroll reste visible sans animation */
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ── Badge de version (recette uniquement, cf. main.js) ── */
.version-badge {
  position: fixed;
  bottom: 6px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  pointer-events: none;
  z-index: 9999;
}
