/* ============================================================
   THANOR.CSS — Design System Global
   Archives de Thanor · NovaCraft Works
   ============================================================
   Ce fichier est la SOURCE UNIQUE de vérité pour :
   - Variables (couleurs, typographie, espacements, animations)
   - Reset et base
   - Composants partagés (boutons, cartes, dividers, badges)
   - Utilitaires
   
   NE PAS mettre de logique de page ou de mini-jeu ici.
   ============================================================ */


/* ─────────────────────────────────────────────
   1. VARIABLES
───────────────────────────────────────────── */

:root {

  /* Couleurs principales */
  --ink:          #0a0805;   /* Fond principal — noir chaud */
  --ink-soft:     #110f0b;   /* Fond secondaire — légèrement plus clair */
  --ink-raised:   #1a1710;   /* Fond surélevé (cartes, panels) */
  --ink-border:   #2a2418;   /* Bordures subtiles */

  /* Or — couleur signature */
  --gold:         #c9a84c;   /* Or principal */
  --gold-bright:  #e8c97a;   /* Or lumineux (hover, accent fort) */
  --gold-dim:     #7a6030;   /* Or atténué (labels, lignes décoratives) */
  --gold-trace:   #3a2e1a;   /* Or fantôme (bordures de cartes) */

  /* Texte */
  --text:         #d4c4a0;   /* Corps de texte principal */
  --text-dim:     #7a6e58;   /* Texte secondaire, descriptifs */
  --text-muted:   #4a4438;   /* Texte très atténué, metadata */

  /* Accents narratifs */
  --cipher:       #6abf94;   /* Vert cryptique — confirmations, statuts actifs */
  --rune:         #8b7ed8;   /* Violet runique — éléments mystérieux, indications */
  --ember:        #c96b4c;   /* Brique — alertes, erreurs, interdits */

  /* Typographie */
  --font-display: 'Cinzel Decorative', 'Cinzel', serif;   /* Titres majeurs */
  --font-heading: 'Cinzel', serif;                         /* Titres de section */
  --font-body:    'EB Garamond', Georgia, serif;           /* Corps de texte */
  --font-mono:    'Courier New', 'Courier', monospace;     /* Codes, fragments chiffrés */

  /* Tailles de texte */
  --text-xs:    0.8rem;     /* 10-11px — labels, metadata */
  --text-sm:    0.95rem;    /* 13px — secondaire */
  --text-base:  1.15rem;    /* 16-17px — corps */
  --text-md:    1.3rem;     /* 18px — corps large */
  --text-lg:    1.55rem;    /* ~22px — sous-titre */
  --text-xl:    2.05rem;    /* ~30px — titre de section */
  --text-2xl:   2.95rem;    /* ~45px — titre de page */
  --text-3xl:   4.15rem;    /* ~64px — héros */

  /* Espacements */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Layout */
  --max-width:        860px;
  --max-width-wide:   1100px;
  --max-width-narrow: 640px;

  /* Rayons */
  --radius-sm:  2px;
  --radius-md:  4px;
  --radius-lg:  8px;

  /* Animations */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --ease-circ:  cubic-bezier(0.85, 0, 0.15, 1);
  --dur-fast:   180ms;
  --dur-base:   320ms;
  --dur-slow:   600ms;
  --dur-xslow:  1200ms;

  /* Z-index scale */
  --z-base:     1;
  --z-raised:   10;
  --z-overlay:  50;
  --z-modal:    100;
  --z-fx:       200;   /* Effets visuels (grain, vignette) */
}


/* ─────────────────────────────────────────────
   2. RESET & BASE
───────────────────────────────────────────── */

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

html {
  font-size: 21px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--dur-fast) ease;
}
a:hover { color: var(--gold-bright); }

img, svg { display: block; max-width: 100%; }

::selection {
  background: var(--gold);
  color: var(--ink);
}


/* ─────────────────────────────────────────────
   3. EFFETS GLOBAUX D'ATMOSPHÈRE
   (grain, vignette — appliqués via <body> ou .thanor-root)
───────────────────────────────────────────── */

/* Grain de texture */
.fx-grain::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='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: var(--z-fx);
  opacity: 0.55;
}

/* Vignette sombre sur les bords */
.fx-vignette::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(0,0,0,0.72) 100%);
  pointer-events: none;
  z-index: calc(var(--z-fx) - 1);
}

/* Motif hexagonal en filigrane */
.fx-hexgrid {
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='92' viewBox='0 0 80 92'%3E%3Cpolygon points='40,2 78,22 78,62 40,82 2,62 2,22' fill='none' stroke='%23c9a84c' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 80px 92px;
  pointer-events: none;
  z-index: 0;
}


/* ─────────────────────────────────────────────
   4. TYPOGRAPHIE
───────────────────────────────────────────── */

.t-display {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.t-heading {
  font-family: var(--font-heading);
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.t-body { font-family: var(--font-body); }

.t-label {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.t-cipher {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.25em;
  color: var(--cipher);
}

.t-gold        { color: var(--gold); }
.t-gold-dim    { color: var(--gold-dim); }
.t-cipher-c    { color: var(--cipher); }
.t-rune        { color: var(--rune); }
.t-dim         { color: var(--text-dim); }
.t-muted       { color: var(--text-muted); }


/* ─────────────────────────────────────────────
   5. LAYOUT
───────────────────────────────────────────── */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--wide {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.page-wrapper {
  position: relative;
  z-index: var(--z-base);
  padding: var(--space-16) 0 var(--space-24);
}


/* ─────────────────────────────────────────────
   6. COMPOSANTS PARTAGÉS
───────────────────────────────────────────── */

/* --- Boutons --- */

.btn {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: var(--space-3) var(--space-8);
  border: 1px solid currentColor;
  cursor: pointer;
  transition:
    background var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    letter-spacing var(--dur-base) var(--ease-out);
  text-decoration: none;
  background: transparent;
}

.btn--gold {
  color: var(--gold);
  border-color: var(--gold);
}
.btn--gold:hover {
  background: var(--gold);
  color: var(--ink);
  letter-spacing: 0.4em;
}

.btn--cipher {
  color: var(--cipher);
  border-color: var(--cipher);
}
.btn--cipher:hover {
  background: var(--cipher);
  color: var(--ink);
}

.btn--ghost {
  color: var(--text-dim);
  border-color: var(--ink-border);
}
.btn--ghost:hover {
  border-color: var(--gold-dim);
  color: var(--gold-dim);
}

/* --- Dividers --- */

.divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-12) 0;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.divider__glyph {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--gold-dim);
  letter-spacing: 0.2em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Divider simple (ligne seule) */
.divider--line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim) 30%, var(--gold-dim) 70%, transparent);
  border: none;
  margin: var(--space-8) 0;
}

/* --- Cartes --- */

.card {
  border: 1px solid var(--gold-trace);
  background: rgba(201, 168, 76, 0.025);
  padding: var(--space-6);
  position: relative;
  transition:
    border-color var(--dur-base) ease,
    background var(--dur-base) ease;
}
.card:hover {
  border-color: var(--gold-dim);
  background: rgba(201, 168, 76, 0.05);
}

/* Coins dorés sur les cartes */
.card--cornered::before,
.card--cornered::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
}
.card--cornered::before {
  top: -1px;
  left: -1px;
  border-top: 2px solid var(--gold);
  border-left: 2px solid var(--gold);
}
.card--cornered::after {
  bottom: -1px;
  right: -1px;
  border-bottom: 2px solid var(--gold);
  border-right: 2px solid var(--gold);
}

/* --- Badge de statut --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge--active  { color: var(--cipher); }
.badge--pending { color: var(--gold-dim); }
.badge--locked  { color: var(--text-muted); }

/* Dot pulsant pour badge actif */
.badge--pulse::before {
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.6); }
}

/* --- Label de section --- */

.section-label {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: var(--space-6);
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-dim), transparent);
}

/* --- Bloc de prophétie / citation narrative --- */

.prophecy {
  border-left: 2px solid var(--gold-dim);
  padding: var(--space-4) var(--space-6);
  font-style: italic;
  color: var(--text-dim);
  font-size: var(--text-md);
  line-height: 1.8;
  position: relative;
}
.prophecy::before {
  content: '"';
  position: absolute;
  top: -0.2em;
  left: var(--space-3);
  font-size: 3rem;
  color: var(--gold-dim);
  line-height: 1;
  font-family: var(--font-body);
  opacity: 0.4;
}

/* --- Champ de saisie de code --- */

.code-input {
  background: var(--ink-raised);
  border: 1px solid var(--gold-trace);
  color: var(--cipher);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  padding: var(--space-3) var(--space-6);
  text-align: center;
  width: 100%;
  max-width: 320px;
  outline: none;
  transition: border-color var(--dur-base) ease;
}
.code-input:focus {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.04);
}
.code-input::placeholder {
  color: var(--text-muted);
  letter-spacing: 0.3em;
}
.code-input.is-error {
  border-color: var(--ember);
  color: var(--ember);
  animation: shake 0.4s ease;
}
.code-input.is-valid {
  border-color: var(--cipher);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

/* --- Navigation --- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-overlay);
  padding: var(--space-4) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(10,8,5,0.95) 0%, transparent 100%);
}

.nav__brand {
  font-family: var(--font-heading);
  font-size: calc(var(--text-sm) + 0.15rem);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold);
  text-decoration: none;
}
.nav__brand:hover { color: var(--gold-bright); }

.nav__links {
  display: flex;
  gap: var(--space-8);
  list-style: none;
}

.nav__links a {
  font-family: var(--font-heading);
  font-size: calc(var(--text-xs) + 0.15rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color var(--dur-fast) ease;
}
.nav__links a:hover { color: var(--gold); }

/* --- Footer --- */

.site-footer {
  text-align: center;
  padding: var(--space-16) var(--space-6) var(--space-8);
  border-top: 1px solid var(--gold-trace);
  margin-top: var(--space-24);
}
.site-footer p {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.site-footer a {
  color: var(--gold-dim);
}
.site-footer a:hover {
  color: var(--gold);
}


/* ─────────────────────────────────────────────
   7. ANIMATIONS D'ENTRÉE PARTAGÉES
───────────────────────────────────────────── */

/* Éléments qui s'animent à l'entrée de page */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Délais d'entrée échelonnés */
.reveal--d1 { transition-delay: 0.1s; }
.reveal--d2 { transition-delay: 0.25s; }
.reveal--d3 { transition-delay: 0.4s; }
.reveal--d4 { transition-delay: 0.6s; }
.reveal--d5 { transition-delay: 0.85s; }
.reveal--d6 { transition-delay: 1.1s; }

/* Animation scan doré (intro signature Thanor) */
@keyframes gold-scan {
  0%   { top: -4px; opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.scan-line {
  position: fixed;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--gold-bright), var(--gold), transparent);
  box-shadow: 0 0 12px var(--gold), 0 0 40px rgba(201,168,76,0.3);
  z-index: var(--z-modal);
  pointer-events: none;
  animation: gold-scan var(--dur-xslow) var(--ease-circ) forwards;
}

/* Fade in simple */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fade-in {
  animation: fade-in var(--dur-slow) var(--ease-out) both;
}


/* ─────────────────────────────────────────────
   8. UTILITAIRES
───────────────────────────────────────────── */

.text-center  { text-align: center; }
.text-left    { text-align: left; }

.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mt-16 { margin-top: var(--space-16); }

.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }

.hidden { display: none !important; }
.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;
}

/* ─────────────────────────────────────────────
   9. RESPONSIVE
───────────────────────────────────────────── */

@media (max-width: 640px) {
  html { font-size: 15px; }

  .container,
  .container--wide,
  .container--narrow {
    padding: 0 var(--space-4);
  }

  .nav__links { display: none; }  /* Mobile : menu burger à implémenter par page */

  .page-wrapper {
    padding: var(--space-12) 0 var(--space-16);
  }
}
