/* ==========================================================================
   1. IMPORTATIONS & VARIABLES
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=Roboto+Mono:wght@300;400;700&display=swap');

:root {
  /* --- Couleurs Globales --- */
  --bg-dark: #08090c;       /* Noir profond */
  --accent-purple: #8e44ad; /* Violet Principal */
  --accent-cyan: #a9cce3;   /* Cyan Secondaire */
  --text-white: #ecf0f1;    /* Blanc cassé */
  --glass: rgba(255, 255, 255, 0.05);
  
  /* --- Couleurs de Factions --- */
  --axiom-color: #e67e22;   /* Orange Rouille */
  --bravos-color: #e74c3c;  /* Rouge Sang */
  --lyra-color: #fd79a8;    /* Rose Corail */
  --muna-color: #1abc9c;    /* Turquoise Abysses */
  --ordis-color: #3498db;   /* Bleu Acier */
  --yzmir-color: #9b59b6;   /* Violet Néant */
}

/* ==========================================================================
   2. CONFIGURATION DE BASE (RESET)
   ========================================================================== */
* { box-sizing: border-box; }

body, html {
  margin: 0; padding: 0; width: 100%; min-height: 100vh;
  background-color: var(--bg-dark);
  font-family: 'Roboto Mono', monospace;
  color: var(--text-white);
  overflow-x: hidden;
}

/* Scrollbar Custom */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-purple); }

/* Flexbox centré par défaut (Accueil) */
body { display: flex; justify-content: center; align-items: center; }

/* Classe pour les pages longues (Factions, Lore) */
.faction-page-body { display: block; height: auto; padding-bottom: 50px; }

/* ==========================================================================
   3. FOND & PARTICULES
   ========================================================================== */
.ocean-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at center, #1a1025 0%, var(--bg-dark) 85%);
  z-index: -1;
}

.particles-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

.particle {
  position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  animation: rise linear infinite; bottom: -10px;
}

@keyframes rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-110vh) translateX(20px); opacity: 0; }
}

/* ==========================================================================
   4. PAGE D'ACCUEIL
   ========================================================================== */
.container {
  text-align: center; padding: 20px; width: 90%; max-width: 800px;
  position: relative; z-index: 10;
}

.logo-img {
  width: min(280px, 50vw); height: auto;
  filter: drop-shadow(0 0 20px rgba(142, 68, 173, 0.5));
  animation: float 6s ease-in-out infinite; margin-bottom: 1rem;
}
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0px); }
}

h1 {
  font-family: 'Cinzel', serif; font-size: clamp(2rem, 8vw, 3.5rem); margin: 0; line-height: 1.1;
  text-transform: uppercase; letter-spacing: 2px;
  background: -webkit-linear-gradient(var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0px 0px 30px rgba(142, 68, 173, 0.4);
}

.subtitle {
  font-size: clamp(0.75rem, 3vw, 1rem); margin-top: 0.5rem; margin-bottom: 2rem;
  opacity: 0.8; letter-spacing: 1px; color: var(--accent-cyan); text-transform: uppercase;
}

.lore-hook {
  background: var(--glass); border-left: 4px solid var(--accent-purple);
  padding: 1.5rem; margin-bottom: 2.5rem; text-align: left;
  border-radius: 0 12px 12px 0; backdrop-filter: blur(5px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}
.lore-hook p { font-size: clamp(0.9rem, 4vw, 1rem); line-height: 1.6; margin-bottom: 1rem; color: #dcdcdc; }

.final-hook {
  font-weight: 700; color: var(--accent-cyan); margin-bottom: 0 !important;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* Boutons Accueil */
.buttons-group { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; margin-top: 10px; }
.cta-button {
  display: inline-block; min-width: 200px; padding: 15px 25px;
  font-size: 1rem; text-decoration: none; font-family: 'Cinzel', serif;
  text-transform: uppercase; letter-spacing: 2px; transition: all 0.4s ease;
  cursor: pointer; border: 1px solid;
}
.primary-btn {
  color: var(--text-white); border-color: var(--accent-purple);
  background: linear-gradient(45deg, transparent 50%, var(--accent-purple) 50%);
  background-size: 250%; background-position: 0%;
}
.primary-btn:hover { background-position: 100%; box-shadow: 0 0 25px var(--accent-purple); border-color: var(--accent-cyan); transform: scale(1.05); }

.secondary-btn {
  color: var(--text-white); border-color: var(--accent-cyan);
  background: linear-gradient(45deg, transparent 50%, rgba(169, 204, 227, 0.3) 50%);
  background-size: 250%; background-position: 0%;
}
.secondary-btn:hover { background-position: 100%; box-shadow: 0 0 25px var(--accent-cyan); border-color: #fff; color: #fff; transform: scale(1.05); }

/* ==========================================================================
   5. PAGE FACTIONS (GRID)
   ========================================================================== */
.faction-page-container { max-width: 1000px; margin: 0 auto; padding-top: 40px; }

.back-link {
    color: var(--text-white); text-decoration: none; font-size: 0.9rem;
    opacity: 0.6; display: inline-block; margin-bottom: 20px;
    transition: opacity 0.3s; text-transform: uppercase; letter-spacing: 1px;
}
.back-link:hover { opacity: 1; color: var(--accent-cyan); }

.faction-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px; margin-top: 30px; padding-bottom: 50px;
}

.faction-card {
    background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; padding: 25px; text-align: left; transition: all 0.3s ease;
    display: flex; flex-direction: column; justify-content: space-between; min-height: 220px;
}
.faction-card:hover { transform: translateY(-5px); background: rgba(255, 255, 255, 0.07); }

.faction-card h2 { font-family: 'Cinzel', serif; font-size: 1.8rem; margin: 0 0 10px 0; text-transform: uppercase; }
.faction-lore { font-size: 0.9rem; color: #bbb; line-height: 1.4; margin-bottom: 20px; }

.faction-btn {
    display: inline-block; padding: 10px 20px; font-size: 0.8rem;
    text-decoration: none; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-white); border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: auto; text-align: center; transition: 0.3s;
}
.faction-btn:hover { background: var(--text-white); color: var(--bg-dark); font-weight: bold; }

/* ==========================================================================
   6. PAGE DÉTAIL (SPLIT LAYOUT)
   ========================================================================== */
.detail-container { max-width: 1100px; margin: 0 auto; padding: 40px 20px; }

.split-layout {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
    gap: 50px; margin-top: 20px; text-align: left;
}

/* Colonne Gauche : Carte */
.card-showcase {
    position: relative; /* IMPORTANT : Le bouton flottant se base sur ça */
    display: flex; flex-direction: column; align-items: center;
    width: 100%; max-width: 400px; /* Contraint la largeur pour que la carte soit belle */
}

/* Colonne Droite : Lore */
.lore-content { flex: 1.5; min-width: 300px; }
.lore-text-block p { font-size: 1.05rem; line-height: 1.8; margin-bottom: 20px; color: #dcdcdc; }

.ability-box {
    background: rgba(0, 0, 0, 0.4); border-left: 4px solid #fff;
    padding: 20px; border-radius: 0 10px 10px 0; margin-top: 30px;
}
.ability-box h3 { margin-top: 0; font-family: 'Cinzel', serif; font-size: 1.2rem; text-transform: uppercase; }

/* ==========================================================================
   7. SYSTÈME DE FLIP CARD 3D (CORRIGÉ)
   ========================================================================== */
.scene {
    width: 100%;
    height: 560px; /* Hauteur FIXE indispensable pour éviter la disparition */
    perspective: 1000px;
    display: flex; justify-content: center;
    margin-bottom: 20px;
    z-index: 1;
}

.card-object {
    width: 100%; height: 100%; position: relative;
    transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}
.card-object.is-flipped { transform: rotateY(180deg); }

.card-face {
    position: absolute; width: 100%; height: 100%;
    top: 0; left: 0;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
    border-radius: 15px;
    
    /* Centre l'image et le glow */
    display: flex; justify-content: center; align-items: center;
}

/* Les Faces */
.face-front { z-index: 2; transform: rotateY(0deg); }
.face-back { transform: rotateY(180deg); z-index: 1; }

/* L'image */
.tcg-card {
    width: 100%; height: 100%;
    object-fit: cover; /* Remplit sans déformer */
    border-radius: 15px;
    display: block;
    z-index: 2; /* Important: Devant le halo */
}

/* Le Halo Lumineux */
.card-glow {
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    position: relative; z-index: 1;
}
.card-glow::before {
    content: ''; position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%); width: 95%; height: 95%;
    border-radius: 50%; filter: blur(45px); opacity: 0.6;
    z-index: -1; /* Important: Derrière l'image */
}

/* Animation du texte */
.lore-hidden { display: none; opacity: 0; transition: opacity 0.5s ease; }
.lore-active { display: block; opacity: 1; animation: fadeInLore 0.8s ease; }
@keyframes fadeInLore { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================================
   8. BOUTON RPG FLOTTANT (STYLE FINAL)
   ========================================================================== */
.token-btn {
    /* Positionnement Flottant */
    position: absolute;
    bottom: 20px;  /* Décalage du bas */
    right: 10%;    /* Décalage de la droite */
    z-index: 10;   /* Au dessus de la carte */

    /* Style Rond */
    width: 60px; height: 60px;
    border-radius: 50%;
    
    /* Couleurs */
    background: rgba(8, 9, 12, 0.9);
    border: 2px solid var(--ordis-color); /* Par défaut (changera selon faction si besoin) */
    color: var(--ordis-color);
    font-size: 28px;
    cursor: pointer;
    
    /* Centrage Flèche */
    display: flex; align-items: center; justify-content: center;
    
    /* Animation */
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.4);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.token-btn:hover {
    background: var(--ordis-color);
    color: var(--bg-dark);
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 0 25px var(--ordis-color);
}

/* ==========================================================================
   9. STYLES SPÉCIFIQUES AUX FACTIONS
   ========================================================================== */

/* AXIOM */
.axiom-title { font-size: 3rem; color: var(--axiom-color); text-shadow: 0 0 20px rgba(230, 126, 34, 0.3); margin-bottom: 0.5rem; }
.axiom-glow::before { background: #d35400; }
.axiom-border { border-left-color: var(--axiom-color); }
.axiom-particle { background: rgba(230, 126, 34, 0.4); }
.faction-card.axiom:hover { border-color: #d35400; box-shadow: 0 0 15px rgba(211, 84, 0, 0.2); }
.faction-card.axiom h2 { color: var(--axiom-color); }

/* BRAVOS */
.bravos-title { font-size: 3rem; color: var(--bravos-color); text-shadow: 0 0 20px rgba(231, 76, 60, 0.4); margin-bottom: 0.5rem; }
.bravos-glow::before { background: #c0392b; }
.bravos-border { border-left-color: var(--bravos-color); }
.bravos-particle { background: rgba(231, 76, 60, 0.5); }
.faction-card.bravos:hover { border-color: #c0392b; box-shadow: 0 0 15px rgba(192, 57, 43, 0.2); }
.faction-card.bravos h2 { color: var(--bravos-color); }

/* LYRA */
.lyra-title { font-size: 3rem; color: var(--lyra-color); text-shadow: 0 0 20px rgba(232, 67, 147, 0.5); margin-bottom: 0.5rem; }
.lyra-glow::before { background: #e84393; }
.lyra-border { border-left-color: var(--lyra-color); }
.lyra-particle { background: rgba(253, 121, 168, 0.6); box-shadow: 0 0 5px rgba(232, 67, 147, 0.4); }
.faction-card.lyra:hover { border-color: #e84393; box-shadow: 0 0 15px rgba(232, 67, 147, 0.2); }
.faction-card.lyra h2 { color: var(--lyra-color); }

/* MUNA */
.muna-title { font-size: 3rem; color: var(--muna-color); text-shadow: 0 0 20px rgba(26, 188, 156, 0.4); margin-bottom: 0.5rem; }
.muna-glow::before { background: #16a085; }
.muna-border { border-left-color: var(--muna-color); }
.muna-particle { background: rgba(26, 188, 156, 0.6); box-shadow: 0 0 8px rgba(26, 188, 156, 0.4); }
.faction-card.muna:hover { border-color: #16a085; box-shadow: 0 0 15px rgba(22, 160, 133, 0.2); }
.faction-card.muna h2 { color: var(--muna-color); }

/* ORDIS */
.ordis-title { font-size: 3rem; color: var(--ordis-color); text-shadow: 0 0 20px rgba(52, 152, 219, 0.4); margin-bottom: 0.5rem; }
.ordis-glow::before { background: #2980b9; }
.ordis-border { border-left-color: var(--ordis-color); }
.ordis-particle { background: rgba(52, 152, 219, 0.6); border-radius: 2px; }
.faction-card.ordis:hover { border-color: #2980b9; box-shadow: 0 0 15px rgba(41, 128, 185, 0.2); }
.faction-card.ordis h2 { color: var(--ordis-color); }

/* YZMIR */
.yzmir-title { font-size: 3rem; color: var(--yzmir-color); text-shadow: 0 0 20px rgba(142, 68, 173, 0.5); margin-bottom: 0.5rem; }
.yzmir-glow::before { background: #8e44ad; }
.yzmir-border { border-left-color: var(--yzmir-color); }
.yzmir-particle { background: rgba(155, 89, 182, 0.6); box-shadow: 0 0 10px rgba(142, 68, 173, 0.4); }
.faction-card.yzmir:hover { border-color: #8e44ad; box-shadow: 0 0 15px rgba(142, 68, 173, 0.2); }
.faction-card.yzmir h2 { color: var(--yzmir-color); }

/* ==========================================================================
   10. COMPTE À REBOURS
   ========================================================================== */
.countdown-wrapper {
    margin: 30px auto; padding: 20px; background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(169, 204, 227, 0.2); border-radius: 10px;
    max-width: 600px; backdrop-filter: blur(5px);
}
.countdown-title {
    font-family: 'Cinzel', serif; color: var(--accent-cyan); text-transform: uppercase;
    letter-spacing: 2px; margin: 0 0 15px 0; font-size: 1rem;
}
.countdown-grid { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }
.time-box {
    display: flex; flex-direction: column; align-items: center;
    background: rgba(255, 255, 255, 0.05); padding: 10px; border-radius: 5px;
    min-width: 70px; border: 1px solid transparent; transition: 0.3s;
}
.time-box:hover { border-color: var(--accent-purple); box-shadow: 0 0 10px rgba(142, 68, 173, 0.3); }
.time-number {
    font-family: 'Cinzel', serif; font-size: 2rem; font-weight: bold;
    color: #fff; text-shadow: 0 0 10px var(--accent-cyan);
}
.time-label { font-family: 'Roboto Mono', monospace; font-size: 0.7rem; text-transform: uppercase; color: #aaa; margin-top: 5px; }
.hidden-message { display: none; color: var(--accent-purple); font-weight: bold; font-size: 1.2rem; animation: pulse 2s infinite; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; text-shadow: 0 0 15px var(--accent-purple); } 100% { opacity: 0.6; } }

/* ==========================================================================
   11. MEDIA QUERIES (MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
    /* Accueil */
    .buttons-group { flex-direction: column; align-items: center; }
    .cta-button { width: 100%; max-width: 300px; }

    /* Layout Détail */
    .split-layout { flex-direction: column; gap: 30px; }
    .lore-content { text-align: center; }
    .ability-box { text-align: left; }
    
    /* Contrainte carte mobile pour éviter qu'elle soit trop grande */
    .scene { height: 450px; } /* Un peu moins haut sur mobile */
    .card-showcase { width: 100%; }

    /* Polices */
    .axiom-title, .bravos-title, .lyra-title, .muna-title, .ordis-title, .yzmir-title { font-size: 2.2rem; }

    /* Bouton RPG (Adaptation mobile) */
    .token-btn {
        right: 0px; /* Collé au bord droit */
        bottom: 10px;
        width: 50px; height: 50px; font-size: 22px;
    }
}

/* =========================================
   1. PAGE LORE GLOBAL (LA BIBLIOTHÈQUE)
   ========================================= */
.lore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.chapter-card {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--accent-purple);
    padding: 30px;
    border-radius: 4px; /* Coins un peu plus carrés pour faire "Livre" */
    text-align: center;
    transition: 0.4s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.chapter-card:hover {
    border-color: var(--accent-cyan);
    transform: translateY(-10px);
    box-shadow: 0 0 30px rgba(142, 68, 173, 0.2);
}

.chapter-number {
    font-family: 'Cinzel', serif;
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.1);
    position: absolute;
    top: -10px;
    right: 20px;
    font-weight: bold;
}

.chapter-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--accent-cyan);
    margin-top: 20px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.chapter-desc {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* =========================================
   2. PAGE CHAPITRE (LA FRISE CHRONOLOGIQUE)
   ========================================= */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px 0;
}

/* La ligne verticale */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px; /* Position de la ligne à gauche */
    height: 100%;
    width: 2px;
    background: linear-gradient(to bottom, transparent, var(--accent-purple), transparent);
}

.timeline-item {
    position: relative;
    margin-bottom: 50px;
    padding-left: 60px; /* Espace pour la ligne et le point */
}

/* Le point sur la ligne */
.timeline-dot {
    position: absolute;
    left: 11px; /* Centré sur la ligne de 2px (20px - 9px) */
    top: 0;
    width: 20px;
    height: 20px;
    background: var(--bg-dark);
    border: 2px solid var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-cyan);
    z-index: 2;
}

.timeline-date {
    font-family: 'Cinzel', serif;
    color: var(--accent-purple);
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-weight: bold;
}

.timeline-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-purple);
    transition: 0.3s;
}

.timeline-content:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-cyan);
}

.timeline-content h3 {
    margin-top: 0;
    color: var(--text-white);
    font-family: 'Cinzel', serif;
}

/* =========================================
   3. PAGE RÉCIT (LECTURE)
   ========================================= */
.story-container {
    max-width: 700px; /* Plus étroit pour une meilleure lecture */
    margin: 0 auto;
    padding: 40px 20px;
    text-align: left; /* Texte aligné à gauche pour la lecture */
}

.story-header {
    text-align: center;
    margin-bottom: 50px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 30px;
}

.story-meta {
    color: var(--accent-purple);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.story-body {
    font-family: 'Georgia', serif; /* Police avec empattement pour la lecture */
    font-size: 1.15rem;
    line-height: 1.8;
    color: #e0e0e0;
}

.story-body p {
    margin-bottom: 25px;
}

/* Lettrine (Première lettre stylée) */
.story-body p:first-of-type::first-letter {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    color: var(--accent-cyan);
    float: left;
    margin-right: 10px;
    line-height: 0.8;
}