/* ==========================================================================
   /assets/css/core.css
   LE CŒUR VISUEL DES ARCANES
========================================================================== */

/* --------------------------------------------------------------------------
   1. LES VARIABLES MAGIQUES (THÈMES)
-------------------------------------------------------------------------- */

/* THÈME SOMBRE (Défaut) 🌙 */
:root, [data-theme="dark"] {
  --ac-bg: #0d0d12;          /* Fond principal (très sombre) */
  --ac-bg2: #16161e;         /* Fond secondaire */
  --ac-card: #1a1a24;        /* Fond des cartes */
  --ac-text: #e2e2e2;        /* Texte lisible clair */
  --ac-muted: #9595a5;       /* Texte secondaire */
  --ac-border: #2a2a35;      /* Bordures discrètes */
  --ac-line: #383848;        /* Lignes de séparation */
  
  --ac-accent1: #d4af37;     /* Or (Boutons, titres importants) */
  --ac-accent2: #8a2be2;     /* Violet arcanique (Liens, magie) */
  
  --ac-success: #2ecc71;
  --ac-warning: #f1c40f;
  --ac-danger: #e74c3c;

  --ac-font-h1: 'Cinzel', serif;
  --ac-font-h2: 'Almendra', serif;
  --ac-font-h3: 'Uncial Antiqua', cursive;
  --ac-font-body: 'Merriweather', serif;
}

/* THÈME CLAIR - LAGON AZUR / TURQUOISE MYSTIQUE 🌊✨ */
[data-theme="light"] {
  --ac-bg: #6eb5c0;        /* Fond principal : bleu azur / turquoise doux */
  --ac-bg2: #569ca7;       /* Fond secondaire : azur plus soutenu pour contraster les marges */
  --ac-card: #84c7d2;      /* Cartes : turquoise lumineux, 0% de blanc ! */
  
  --ac-text: #000000;      /* Texte principal : noir pur, comme demandé */
  --ac-muted: #222222;     /* Texte secondaire : gris très très sombre / noir adouci */
  --ac-border: #458591;    /* Bordures : turquoise très foncé / bleu canard */
  --ac-line: #346b75;      /* Lignes de séparation : bleu des abysses */
  
  --ac-accent1: #54626f;   /* Argent Foncé / Acier Forgé (Lisible et très élégant sur le turquoise) */
  --ac-accent2: #5c0099;   /* Violet profond (Se marie parfaitement avec l'azur) */
}

/* THÈME ÉVÉNEMENT : HIVER ❄️ */
[data-theme="hiver"] {
  --ac-bg: #0b1320;
  --ac-card: #152238;
  --ac-accent1: #82c4fa;     /* Bleu glace */
  --ac-accent2: #e0f7fa;     /* Blanc neige */
}

/* THÈME ÉVÉNEMENT : SAINT VALENTIN 🌹 */
[data-theme="valentin"] {
  --ac-bg: #1a0b10;
  --ac-card: #28111a;
  --ac-accent1: #ff4d6d;     /* Rose passion */
  --ac-accent2: #c9184a;     /* Rouge profond */
}

/* THÈME ÉVÉNEMENT : NOUVEL AN LUNAIRE 🐉 */
[data-theme="lunaire"] {
  --ac-bg: #1a0505;
  --ac-card: #2b0a0a;
  --ac-accent1: #ffd700;     /* Or pur */
  --ac-accent2: #ff0000;     /* Rouge dragon */
}


/* --------------------------------------------------------------------------
   2. RESET & TYPOGRAPHIE GLOBALE
-------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--ac-bg);
  color: var(--ac-text);
  font-family: var(--ac-font-body);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4 {
  font-weight: normal;
  margin-bottom: 0.5em;
  color: var(--ac-text);
}

h1 { font-family: var(--ac-font-h1); font-size: 2.2rem; color: var(--ac-accent1); }
h2 { font-family: var(--ac-font-h2); font-size: 1.8rem; }
h3 { font-family: var(--ac-font-h3); font-size: 1.4rem; }

a {
  color: var(--ac-accent2);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.8; }

/* --------------------------------------------------------------------------
   3. STRUCTURE (CONTENEURS)
-------------------------------------------------------------------------- */
.ac-main {
  min-height: 80vh;
  padding: 40px 20px;
}

.ac-container {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* --------------------------------------------------------------------------
   4. LES COMPOSANTS (CARTES, BOUTONS, BADGES)
-------------------------------------------------------------------------- */

/* Les Cartes Magiques */
.ac-card {
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
}

/* Les Boutons */
.ac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-family: var(--ac-font-h2);
  font-size: 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  background: var(--ac-bg2);
  color: var(--ac-text);
  border: 1px solid var(--ac-border);
}
.ac-btn:hover {
  background: var(--ac-border);
}

.ac-btn--primary {
  background: var(--ac-accent2);
  color: #fff;
  border: none;
  box-shadow: 0 0 10px rgba(138, 43, 226, 0.4);
}
.ac-btn--primary:hover {
  background: var(--ac-accent1);
  color: #fff;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
}

.ac-btn--ghost {
  background: transparent;
  border: 1px solid var(--ac-accent2);
  color: var(--ac-accent2);
}
.ac-btn--ghost:hover {
  background: rgba(138, 43, 226, 0.1);
}

/* Les Badges (Petites étiquettes) */
.ac-badge {
  display: inline-block;
  padding: 3px 8px;
  background: var(--ac-bg2);
  border: 1px solid var(--ac-border);
  border-radius: 20px;
  font-size: 0.8rem;
  font-family: sans-serif;
  color: var(--ac-muted);
}

/* --------------------------------------------------------------------------
   5. FORMULAIRES & INPUTS
-------------------------------------------------------------------------- */
.ac-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.ac-label {
  font-family: var(--ac-font-h2);
  font-size: 1.1rem;
  margin-bottom: 6px;
  color: var(--ac-text);
}

.ac-input, .ac-select, .ac-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--ac-bg);
  border: 1px solid var(--ac-border);
  color: var(--ac-text);
  border-radius: 6px;
  font-family: var(--ac-font-body);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ac-input:focus, .ac-select:focus, .ac-textarea:focus {
  outline: none;
  border-color: var(--ac-accent2);
  box-shadow: 0 0 0 2px rgba(138, 43, 226, 0.2);
}

.ac-hint {
  font-size: 0.85rem;
  color: var(--ac-muted);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   6. LES MESSAGES FLASH (Alertes)
-------------------------------------------------------------------------- */
.ac-flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease-out;
}

.ac-flash--success { background: rgba(46, 204, 113, 0.1); border: 1px solid var(--ac-success); color: var(--ac-success); }
.ac-flash--warning { background: rgba(241, 196, 15, 0.1); border: 1px solid var(--ac-warning); color: var(--ac-warning); }
.ac-flash--danger  { background: rgba(231, 76, 60, 0.1);  border: 1px solid var(--ac-danger);  color: var(--ac-danger); }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Utilitaires */
.d-none { display: none !important; }

/* --------------------------------------------------------------------------
   7. GRILLES & UTILITAIRES (LAYOUT)
-------------------------------------------------------------------------- */
.ac-grid {
  display: grid;
  gap: 24px;
}
.ac-grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ac-grid--3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.ac-grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.ac-text-center { text-align: center; }
.ac-mt-2 { margin-top: 20px; }
.ac-mb-2 { margin-bottom: 20px; }
.ac-mb-4 { margin-bottom: 40px; }

/* --------------------------------------------------------------------------
   8. PAGES LORE / ENCYCLOPÉDIE (SANG-SATŌ)
-------------------------------------------------------------------------- */
.ac-hero {
  padding: 60px 20px;
  border-radius: 12px;
  background: var(--ac-bg2);
  border: 1px solid var(--ac-border);
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Effet de brume/magie en fond du Hero */
.ac-hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(circle, rgba(138, 43, 226, 0.05) 0%, transparent 60%);
  z-index: 0;
}

.ac-hero > * {
  position: relative;
  z-index: 1;
}

.ac-hero-title {
  font-family: var(--ac-font-h1);
  font-size: 3.5rem;
  color: var(--ac-accent1);
  margin-bottom: 10px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.ac-hero-subtitle {
  color: var(--ac-muted);
  font-size: 1.2rem;
  font-family: var(--ac-font-h2);
}

/* Cartes interactives de l'Encyclopédie */
.ac-lore-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
}
.ac-lore-card:hover {
  transform: translateY(-8px);
  border-color: var(--ac-accent1);
  box-shadow: 0 10px 30px rgba(212, 175, 55, 0.15);
}

.ac-lore-icon {
  font-size: 3.5rem;
  margin-bottom: 15px;
  color: var(--ac-text);
  transition: transform 0.3s ease;
}

.ac-lore-card:hover .ac-lore-icon {
  transform: scale(1.1);
}

.ac-lore-title {
  font-family: var(--ac-font-h2);
  font-size: 1.5rem;
  color: var(--ac-accent1);
  margin-bottom: 10px;
}

.ac-lore-desc {
  color: var(--ac-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   9. ARBRES GÉNÉALOGIQUES & FICHES PERSONNAGES
-------------------------------------------------------------------------- */
/* L'Arbre (Design avec des lignes de liaison CSS pures) */
.ac-tree-wrapper {
  overflow-x: auto; /* Permet de scroller sur téléphone si l'arbre est très large */
  padding: 20px 0;
  text-align: center;
}

.ac-tree ul {
  padding-top: 20px; position: relative;
  display: flex; justify-content: center;
  list-style-type: none; padding-left: 0;
}

.ac-tree li {
  float: left; text-align: center;
  list-style-type: none;
  position: relative;
  padding: 20px 5px 0 5px;
}

/* Les lignes horizontales et verticales */
.ac-tree li::before, .ac-tree li::after {
  content: ''; position: absolute; top: 0; right: 50%;
  border-top: 2px solid var(--ac-line);
  width: 50%; height: 20px;
}
.ac-tree li::after { right: auto; left: 50%; border-left: 2px solid var(--ac-line); }

/* Nettoyage des lignes inutiles aux extrémités */
.ac-tree li:only-child::after, .ac-tree li:only-child::before { display: none; }
.ac-tree li:only-child { padding-top: 0; }
.ac-tree li:first-child::before, .ac-tree li:last-child::after { border: 0 none; }
.ac-tree li:last-child::before { border-right: 2px solid var(--ac-line); border-radius: 0 5px 0 0; }
.ac-tree li:first-child::after { border-radius: 5px 0 0 0; }

/* Ligne descendante vers les enfants */
.ac-tree ul ul::before {
  content: ''; position: absolute; top: 0; left: 50%;
  border-left: 2px solid var(--ac-line);
  width: 0; height: 20px;
}

/* La Carte d'un Personnage dans l'arbre */
.ac-tree-node {
  text-decoration: none; color: var(--ac-text);
  display: inline-flex; flex-direction: column; align-items: center;
  padding: 10px 15px; min-width: 120px;
  border-radius: 8px; border: 1px solid var(--ac-border);
  background: var(--ac-card);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.ac-tree-node:hover {
  background: var(--ac-bg2);
  border-color: var(--ac-accent1);
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.ac-tree-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  object-fit: cover; margin-bottom: 8px;
  border: 2px solid var(--ac-accent2);
}

/* Fiche Personnage Détaillée */
.ac-char-profile {
  display: flex; gap: 30px; align-items: flex-start;
}
.ac-char-portrait {
  width: 250px; height: 350px; object-fit: cover;
  border-radius: 12px; border: 2px solid var(--ac-accent1);
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
  .ac-char-profile { flex-direction: column; align-items: center; text-align: center; }
}
/* --------------------------------------------------------------------------
   10. FENÊTRE INTERACTIVE (PAN & ZOOM)
-------------------------------------------------------------------------- */
.ac-tree-viewport {
  width: 100%;
  height: 75vh;             /* L'arbre prend 75% de l'écran en hauteur */
  min-height: 500px;
  overflow: hidden;         /* Cache ce qui dépasse de la fenêtre */
  background: var(--ac-bg2);
  border: 1px solid var(--ac-border);
  border-radius: 12px;
  position: relative;
  cursor: grab;             /* Curseur "petite main" */
  box-shadow: inset 0 0 20px rgba(0,0,0,0.1); /* Ombre interne pour l'effet "fenêtre" */
}

.ac-tree-viewport:active {
  cursor: grabbing;         /* Main fermée quand on clique/glisse */
}

/* Les boutons de contrôle du Zoom */
.ac-zoom-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
}

.ac-zoom-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--ac-card);
  border: 1px solid var(--ac-border);
  color: var(--ac-text);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: all 0.2s;
}

.ac-zoom-btn:hover {
  background: var(--ac-accent2);
  color: #fff;
  border-color: var(--ac-accent2);
  transform: scale(1.1);
}
/* Les Couples dans l'Arbre Généalogique */
.ac-tree-couple {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  position: relative;
  background: rgba(0, 0, 0, 0.05); /* Léger fond pour lier le couple */
  padding: 5px;
  border-radius: 12px;
  border: 1px dashed var(--ac-border);
}

.ac-tree-node--spouse {
  border-color: var(--ac-muted);
  background: transparent;
}
.ac-tree-node--spouse .ac-tree-avatar {
  border-color: var(--ac-muted);
}
/* --------------------------------------------------------------------------
   11. FRISE CHRONOLOGIQUE (TIMELINE)
-------------------------------------------------------------------------- */
.ac-timeline {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 0;
}

/* La ligne centrale (ou latérale) */
.ac-timeline::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 20px;
  width: 4px;
  background: var(--ac-line);
  border-radius: 4px;
}

/* Les Séparateurs d'Ères Historiques */
.ac-timeline-era {
  text-align: center;
  margin: 60px 0 40px 0;
  position: relative;
  z-index: 2;
  width: 100%;
}
.ac-timeline-era span {
  display: inline-block;
  background: var(--ac-bg2);
  color: var(--ac-accent1);
  padding: 10px 30px;
  border-radius: 30px;
  font-family: var(--ac-font-h2);
  font-size: 1.5rem;
  border: 2px solid var(--ac-accent1);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}
.ac-timeline-era-desc {
  color: var(--ac-muted);
  margin: 15px auto 0 auto;
  font-size: 0.95rem;
  max-width: 500px;
  line-height: 1.5;
}

/* Les Événements */
.ac-timeline-item {
  position: relative;
  margin-bottom: 40px;
  padding-left: 60px;
  opacity: 0.9;
  transition: opacity 0.3s, transform 0.3s;
}
.ac-timeline-item:hover { opacity: 1; transform: translateX(5px); }

/* Le marqueur (point) sur la ligne */
.ac-timeline-marker {
  position: absolute;
  left: 10px; top: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ac-bg);
  border: 4px solid var(--ac-accent1);
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; padding: 20px;
}

/* Couleurs selon le type d'événement */
.ac-timeline-item[data-type="naissance"] .ac-timeline-marker { border-color: var(--ac-success); }
.ac-timeline-item[data-type="bataille"] .ac-timeline-marker { border-color: var(--ac-danger); }
.ac-timeline-item[data-type="fondation"] .ac-timeline-marker { border-color: var(--ac-accent2); }
.ac-timeline-item[data-type="lore"] .ac-timeline-marker { border-color: var(--ac-accent1); }

.ac-timeline-date { font-family: var(--ac-font-h2); font-size: 1.4rem; font-weight: bold; color: var(--ac-accent1); margin-bottom: 5px; }
.ac-timeline-title { font-family: var(--ac-font-h3); font-size: 1.3rem; color: var(--ac-text); margin-bottom: 10px; }
.ac-timeline-desc { background: var(--ac-card); padding: 20px; border-radius: 8px; border: 1px solid var(--ac-border); color: var(--ac-muted); line-height: 1.6; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }

@media (min-width: 768px) {
  .ac-timeline::before { left: 50%; margin-left: -2px; }
  
  .ac-timeline-item { width: 50%; padding-left: 0; padding-right: 40px; margin-left: 0; text-align: right; }
  /* La classe dynamique pour alterner la position */
  .ac-timeline-item.right-side { margin-left: 50%; padding-left: 40px; padding-right: 0; text-align: left; }
  
  .ac-timeline-item .ac-timeline-marker { left: auto; right: -24px; top: 10px; }
  .ac-timeline-item.right-side .ac-timeline-marker { right: auto; left: -24px; }
}