/* ============================================
   STOVAKOR - Livre dont vous êtes le héros
   Thème : Livre Ancien Moderne
   ============================================ */

/* ====================
   VARIABLES CSS
   ==================== */
:root {
    /* Palette de couleurs chaleureuses - parchemin et cuir */
    --color-parchment-light: #fdf8f0;
    --color-parchment: #f5eee0;
    --color-parchment-dark: #e8dcc8;
    --color-leather-light: #8b6f47;
    --color-leather: #6b563f;
    --color-leather-dark: #3d2817;
    --color-ink: #1a1410;
    --color-ink-faded: #4a3a28;
    --color-gold: #b8974d;
    --color-gold-dark: #8f7338;
    --color-red-wax: #a63d40;
    --color-success-leaf: #5a7247;

    /* Ombres et profondeur */
    --shadow-soft: 0 2px 8px rgba(74, 56, 41, 0.15);
    --shadow-medium: 0 4px 16px rgba(74, 56, 41, 0.25);
    --shadow-hard: 0 8px 32px rgba(74, 56, 41, 0.35);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.4s ease;
    --transition-slow: 0.6s ease;

    /* Border radius moderne mais subtil */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

/* ====================
   TYPOGRAPHIE
   ==================== */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&family=Cinzel:wght@400;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&display=swap');

html, body {
    font-family: 'Crimson Text', 'Georgia', serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-ink);
    background-color: #ffffff;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: var(--color-leather-dark);
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.75rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }

/* Lettrines pour débuts de paragraphes importants - Désactivé pour meilleure lisibilité
.card-body p:first-of-type::first-letter {
    font-family: 'Cinzel', serif;
    font-size: 3.5em;
    line-height: 0.8;
    float: left;
    margin: 0.1em 0.1em 0 0;
    color: var(--color-red-wax);
    font-weight: 700;
}
*/

/* ====================
   STRUCTURE GÉNÉRALE
   ==================== */
#wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Effet de livre ouvert */
#main {
    max-width: 1400px;
    margin: 1.5rem auto;
    padding: 2rem;
    background: #ffffff;
    box-shadow:
            var(--shadow-hard),
            inset 0 0 100px rgba(245, 238, 224, 0.5);
    border-radius: var(--radius-lg);
    position: relative;
    animation: pageOpen 0.8s ease-out;
    flex: 1;
}

/* Animation d'ouverture de page */
@keyframes pageOpen {
    from {
        opacity: 0;
        transform: perspective(1000px) rotateY(-15deg);
    }
    to {
        opacity: 1;
        transform: perspective(1000px) rotateY(0deg);
    }
}

/* Garantir que l'animation ne se répète pas */
#main {
    animation-fill-mode: forwards;
    animation-iteration-count: 1;
}

/* Effet de pliure au centre (livre ouvert) */
/* Désactivé par défaut pour une meilleure lisibilité */
#main::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
            to right,
            rgba(74, 56, 41, 0.1),
            rgba(74, 56, 41, 0.2),
            rgba(74, 56, 41, 0.1)
    );
    pointer-events: none;
    z-index: 10;
    display: none; /* Désactivé par défaut */
}

/* Classe optionnelle pour activer l'effet de livre ouvert sur des pages spécifiques */
#main.book-spread::before {
    display: block;
}

/* ====================
   NAVBAR - Style reliure de livre
   ==================== */
.navbar {
    background: linear-gradient(135deg, var(--color-leather) 0%, var(--color-leather-dark) 100%);
    box-shadow: var(--shadow-medium);
    padding: 0.65rem 2rem;
    border-bottom: 3px solid var(--color-gold);
    position: relative;
}

/* Effet de parchemin qui se déroule sous la navbar */
.navbar::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 2%;
    right: 2%;
    height: 30px;
    background:
            linear-gradient(to bottom,
            #e8d7b8 0%,
            #dccaa8 20%,
            #d4c4a8 40%,
            rgba(212, 196, 168, 0.7) 70%,
            rgba(232, 215, 184, 0.3) 100%
            );
    box-shadow:
            inset 0 5px 10px rgba(74, 56, 41, 0.15),
            inset 0 -2px 4px rgba(255, 255, 255, 0.3),
            0 5px 10px rgba(74, 56, 41, 0.25);
    clip-path: polygon(
            0% 0%,
            2% 15%, 4% 5%, 6% 18%, 8% 8%, 10% 20%, 12% 10%, 14% 22%, 16% 12%, 18% 20%,
            20% 8%, 22% 18%, 24% 10%, 26% 20%, 28% 12%, 30% 22%, 32% 10%, 34% 20%, 36% 8%,
            38% 18%, 40% 10%, 42% 20%, 44% 12%, 46% 22%, 48% 10%, 50% 20%, 52% 8%, 54% 18%,
            56% 10%, 58% 20%, 60% 12%, 62% 22%, 64% 10%, 66% 20%, 68% 8%, 70% 18%, 72% 10%,
            74% 20%, 76% 12%, 78% 22%, 80% 10%, 82% 20%, 84% 8%, 86% 18%, 88% 10%, 90% 20%,
            92% 12%, 94% 22%, 96% 10%, 98% 20%, 100% 0%,
            100% 100%, 0% 100%
    );
    z-index: -1;
}

/* Animation subtile de déroulement au chargement */
@keyframes scrollUnroll {
    from {
        height: 0;
        opacity: 0;
    }
    to {
        height: 30px;
        opacity: 1;
    }
}

.navbar::after {
    animation: scrollUnroll 0.6s ease-out;
}

.navbar-brand {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gold) !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1.5px;
    transition: var(--transition-fast);
}

.navbar-brand:hover {
    color: var(--color-parchment-light) !important;
    transform: scale(1.05);
}

.navbar .nav-link {
    color: #f5eee0 !important;
    font-family: 'Crimson Text', serif;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 0.6rem 2rem;
    transition: var(--transition-fast);
    position: relative;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.navbar .nav-link:hover {
    background: rgba(232, 215, 184, 0.15);
    border-radius: var(--radius-sm);
}

.navbar .nav-link::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-gold);
    transition: var(--transition-fast);
    transform: translateX(-50%);
}

.navbar .nav-link:hover::after {
    width: 85%;
}

.navbar .nav-link i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

/* Espacement entre les items de navigation */
.navbar-nav .nav-item {
    margin: 0 0.25rem;
}

/* Sur grand écran, logo à gauche et liens à droite */
@media (min-width: 992px) {
    .navbar .container-fluid {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .navbar-brand {
        order: 1;
    }

    .navbar-toggler {
        order: 2;
    }

    .navbar-collapse {
        order: 3;
        flex-grow: 0;
        justify-content: flex-end;
    }

    .navbar-collapse.row {
        margin: 0;
    }

    .navbar-nav {
        gap: 0;
        flex-direction: row;
        margin-left: auto;
    }

    .navbar .nav-link {
        padding: 0.6rem 1.75rem;
        min-width: auto;
    }

    /* Supprimer les marges inutiles des colonnes vides */
    .navbar-collapse .d-none.d-lg-block {
        display: none !important;
    }
}

/* ====================
   CARTES - Style pages de livre
   ==================== */
.card {
    background: #ffffff;
    border: 2px solid var(--color-leather-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-medium);
    transition: var(--transition-medium);
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* Effet de texture papier */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
            radial-gradient(circle at 20% 30%, rgba(74, 56, 41, 0.01) 0%, transparent 50%),
            radial-gradient(circle at 80% 70%, rgba(74, 56, 41, 0.01) 0%, transparent 50%);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-hard);
    border-color: var(--color-gold);
}

.card-header {
    background: linear-gradient(135deg, var(--color-leather-light) 0%, var(--color-leather) 100%);
    border-bottom: 2px solid var(--color-gold);
    padding: 1rem 1.5rem;
    position: relative;
    width: 100%;
    margin: 0;
}

.card-header h3 {
    color: #ffffff;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Coins décoratifs style enluminure */
.card-header::before,
.card-header::after {
    content: '❦';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gold);
    font-size: 1.5rem;
    opacity: 0.7;
    z-index: 0; /* Placer derrière le texte */
}

.card-header::before { left: 1rem; }
.card-header::after { right: 1rem; }

/* S'assurer que le titre est au-dessus des décorations */
.card-header h3,
.card-header h5 {
    position: relative;
    z-index: 1;
    padding: 0 3rem; /* Ajouter du padding pour éviter le chevauchement */
}

.card-body {
    padding: 1.5rem;
    position: relative;
    z-index: 1;
    color: var(--color-ink);
    font-size: 1rem;
}

.card-body p {
    color: var(--color-ink);
    margin-bottom: 1rem;
}

.card-body img {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    border: 3px solid var(--color-leather-light);
    transition: var(--transition-medium);
    width: 100%;
    height: auto;
}

.card-body img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-medium);
}

.card-footer {
    background: linear-gradient(135deg, #f8f5f0 0%, #f0ebe0 100%);
    border-top: 2px solid var(--color-leather-light);
    padding: 1rem 1.5rem;
    color: var(--color-ink);
    width: 100%;
    margin: 0;
}

.card-footer label,
.card-footer span {
    color: var(--color-ink-faded);
    font-weight: 600;
}

/* ====================
   BOUTONS - Style sceaux et cachets
   ==================== */
.btn {
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition-medium);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-red-wax) 0%, #8b3234 100%);
    border-color: var(--color-red-wax);
    color: var(--color-parchment-light);
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #8b3234 0%, var(--color-red-wax) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--color-leather);
    color: var(--color-leather-dark);
}

.btn-outline-secondary:hover {
    background: var(--color-leather);
    border-color: var(--color-leather-dark);
    color: var(--color-parchment-light);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-gold-dark) 100%);
    border-color: var(--color-gold-dark);
    color: var(--color-ink);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--color-gold-dark) 0%, var(--color-gold) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* ====================
   LISTES - Style choix de l'histoire
   ==================== */
.list-group {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.list-group-item {
    background: #ffffff;
    border: 1px solid var(--color-leather-light);
    padding: 1.25rem 1.5rem;
    transition: var(--transition-fast);
    position: relative;
    cursor: pointer;
}

.list-group-item::before {
    content: '▸';
    position: absolute;
    left: 0.75rem;
    color: var(--color-red-wax);
    font-size: 1.2rem;
    transition: var(--transition-fast);
}

.list-group-item:hover {
    background: #faf7f2;
    border-color: var(--color-gold);
    transform: translateX(8px);
    padding-left: 2rem;
}

.list-group-item:hover::before {
    left: 1.25rem;
}

.list-group-item-primary {
    background: rgba(201, 169, 97, 0.1);
    border-left: 4px solid var(--color-gold);
}

.list-group-item a {
    color: var(--color-ink);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
    transition: var(--transition-fast);
}

.list-group-item:hover a {
    color: var(--color-red-wax);
}

/* ====================
   ÉTATS DU JEU
   ==================== */
.bg-success {
    background: linear-gradient(135deg, var(--color-success-leaf) 0%, #4a5c3a 100%) !important;
    border: 3px solid var(--color-gold);
}

.bg-warning {
    background: linear-gradient(135deg, #b8860b 0%, #8b6914 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, var(--color-red-wax) 0%, #8b3234 100%) !important;
}

/* ====================
   BANNIÈRES D'ÉTAT DE JEU (Victoire / Game Over)
   ==================== */
.game-state-banner {
    position: relative;
    padding: 2.5rem 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hard);
    text-align: center;
    overflow: hidden;
    animation: bannerAppear 0.8s ease-out;
}

@keyframes bannerAppear {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Bannière Victoire */
.victory-banner {
    background: linear-gradient(135deg,
    var(--color-success-leaf) 0%,
    #4a5c3a 50%,
    var(--color-success-leaf) 100%);
    border: 4px solid var(--color-gold);
    position: relative;
}

.victory-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
            radial-gradient(circle at 30% 40%, rgba(255, 215, 0, 0.15) 0%, transparent 50%),
            radial-gradient(circle at 70% 60%, rgba(255, 215, 0, 0.15) 0%, transparent 50%);
    pointer-events: none;
    animation: victoryGlow 2s ease-in-out infinite;
}

@keyframes victoryGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Bannière Game Over */
.gameover-banner {
    background: linear-gradient(135deg,
    #5a4a3a 0%,
    var(--color-leather-dark) 50%,
    #2a1a0a 100%);
    border: 4px solid var(--color-ink-faded);
    position: relative;
}

.gameover-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
            radial-gradient(circle at 50% 50%, rgba(139, 50, 52, 0.2) 0%, transparent 70%);
    pointer-events: none;
    animation: gameoverPulse 3s ease-in-out infinite;
}

@keyframes gameoverPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Contenu des bannières */
.banner-content {
    position: relative;
    z-index: 2;
}

.banner-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: iconFloat 3s ease-in-out infinite;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.banner-title {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-parchment-light);
    text-shadow:
            3px 3px 6px rgba(0, 0, 0, 0.7),
            0 0 20px rgba(255, 255, 255, 0.3);
    margin: 0.5rem 0;
    letter-spacing: 4px;
    animation: titlePulse 2s ease-in-out infinite;
}

/* Style amélioré pour le titre VICTOIRE */
.victory-banner .banner-title {
    color: #ffffff;
    text-shadow:
            4px 4px 8px rgba(0, 0, 0, 0.9),
            -1px -1px 2px rgba(0, 0, 0, 0.8),
            0 0 30px rgba(255, 255, 255, 0.5),
            0 0 50px rgba(184, 151, 77, 0.4);
}

/* Style amélioré pour le titre GAME OVER uniquement */
.gameover-banner .banner-title {
    color: #ffffff;
    text-shadow:
            4px 4px 8px rgba(0, 0, 0, 0.9),
            -1px -1px 2px rgba(0, 0, 0, 0.8),
            0 0 30px rgba(255, 255, 255, 0.6),
            0 0 50px rgba(255, 100, 100, 0.4);
}

@keyframes titlePulse {
    0%, 100% {
        transform: scale(1);
        text-shadow:
                3px 3px 6px rgba(0, 0, 0, 0.7),
                0 0 20px rgba(255, 255, 255, 0.3);
    }
    50% {
        transform: scale(1.05);
        text-shadow:
                3px 3px 6px rgba(0, 0, 0, 0.7),
                0 0 30px rgba(255, 255, 255, 0.5);
    }
}

/* Animation spécifique pour le titre GAME OVER */
@keyframes gameoverTitlePulse {
    0%, 100% {
        transform: scale(1);
        text-shadow:
                4px 4px 8px rgba(0, 0, 0, 0.9),
                -1px -1px 2px rgba(0, 0, 0, 0.8),
                0 0 30px rgba(255, 255, 255, 0.6),
                0 0 50px rgba(255, 100, 100, 0.4);
    }
    50% {
        transform: scale(1.05);
        text-shadow:
                4px 4px 8px rgba(0, 0, 0, 0.9),
                -1px -1px 2px rgba(0, 0, 0, 0.8),
                0 0 40px rgba(255, 255, 255, 0.8),
                0 0 70px rgba(255, 100, 100, 0.6);
    }
}

.gameover-banner .banner-title {
    animation: gameoverTitlePulse 2s ease-in-out infinite;
}

.banner-subtitle {
    font-family: 'Crimson Text', serif;
    font-size: 1.3rem;
    color: var(--color-parchment);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
    margin: 0;
    font-style: italic;
}

/* Style amélioré pour le sous-titre VICTOIRE */
.victory-banner .banner-subtitle {
    color: #ffffff;
    text-shadow:
            3px 3px 6px rgba(0, 0, 0, 0.9),
            -1px -1px 2px rgba(0, 0, 0, 0.7),
            0 0 20px rgba(255, 255, 255, 0.3);
    font-weight: 600;
}

/* Style amélioré pour le sous-titre GAME OVER uniquement */
.gameover-banner .banner-subtitle {
    color: #f5f5f5;
    text-shadow:
            3px 3px 6px rgba(0, 0, 0, 0.9),
            -1px -1px 2px rgba(0, 0, 0, 0.7),
            0 0 20px rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

/* Ornements dorés */
.banner-ornament {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: var(--color-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 1;
    opacity: 0.8;
    animation: ornamentShine 3s ease-in-out infinite;
}

.banner-ornament.left { left: 1.5rem; }
.banner-ornament.right { right: 1.5rem; }

@keyframes ornamentShine {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Responsive design pour les bannières */
@media (max-width: 768px) {
    .game-state-banner {
        padding: 2rem 1.5rem;
    }

    .banner-icon {
        font-size: 3rem;
    }

    .banner-title {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .banner-subtitle {
        font-size: 1.1rem;
    }

    .banner-ornament {
        font-size: 2rem;
    }

    .banner-ornament.left { left: 0.75rem; }
    .banner-ornament.right { right: 0.75rem; }
}

@media (max-width: 576px) {
    .game-state-banner {
        padding: 1.5rem 1rem;
    }

    .banner-icon {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }

    .banner-title {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }

    .banner-subtitle {
        font-size: 1rem;
    }

    .banner-ornament {
        font-size: 1.5rem;
    }

    .banner-ornament.left { left: 0.5rem; }
    .banner-ornament.right { right: 0.5rem; }
}

/* ====================
   FORMULAIRES
   ==================== */
.form-control, .form-select {
    background: #ffffff;
    border: 2px solid var(--color-leather-light);
    color: var(--color-ink);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-gold);
    box-shadow: 0 0 0 0.2rem rgba(201, 169, 97, 0.25);
    background: #fff;
}

.form-label {
    font-weight: 600;
    color: var(--color-leather-dark);
    margin-bottom: 0.5rem;
}

/* ====================
   MODALES - Style grimoire
   ==================== */

/* S'assurer que la modale et le backdrop ont les bons z-index */
.modal {
    z-index: 1055;
}

.modal-backdrop {
    z-index: 1050;
    background-color: rgba(26, 20, 16, 0.7); /* Couleur d'encre avec transparence */
}

.modal-backdrop.show {
    opacity: 1;
}

.modal-content {
    background: #ffffff;
    border: 3px solid var(--color-leather);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.modal-header {
    background: linear-gradient(135deg, var(--color-leather-light) 0%, var(--color-leather) 100%);
    border-bottom: 2px solid var(--color-gold);
    color: var(--color-parchment-light);
}

.modal-title {
    font-family: 'Cinzel', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    background: #f8f5f0;
    border-top: 1px solid var(--color-leather-light);
}

/* ====================
   ANIMATIONS DE PAGE TURNING
   ==================== */
@keyframes pageTurn {
    0% {
        transform: perspective(1000px) rotateY(0deg);
        transform-origin: left center;
    }
    50% {
        transform: perspective(1000px) rotateY(-90deg);
        transform-origin: left center;
    }
    100% {
        transform: perspective(1000px) rotateY(0deg);
        transform-origin: left center;
    }
}

.page-transition {
    animation: pageTurn 0.8s ease-in-out;
}

/* ====================
   EFFETS DE SURVOL ET INTERACTIONS
   ==================== */
a {
    color: var(--color-leather-dark);
    text-decoration: none;
    transition: var(--transition-fast);
    position: relative;
    font-weight: 600;
}

a:hover {
    color: var(--color-red-wax);
    text-decoration: underline;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-red-wax);
    transition: var(--transition-fast);
}

a:hover::after {
    width: 100%;
}

/* Curseur personnalisé */
* {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="%234a3829" d="M7 2l10 10-4 1-2 5-4-4z"/></svg>'), auto;
}

button, a, .btn, .pointer {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="%23a63d40" d="M8 2l8 8-3 1-1 4-4-4 1-3z"/></svg>'), pointer !important;
}

/* ====================
   EFFETS DE COINS CORNÉS
   ==================== */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 25px 25px 0;
    border-color: transparent var(--color-leather-light) transparent transparent;
    opacity: 0;
    transition: var(--transition-medium);
}

.card:hover::after {
    opacity: 1;
}

/* ====================
   SCROLLBAR PERSONNALISÉE
   ==================== */
::-webkit-scrollbar {
    width: 18px;
}

::-webkit-scrollbar-track {
    background: #f0ebe0;
    border-left: 1px solid var(--color-leather-light);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-leather-light) 0%, var(--color-leather) 100%);
    border-radius: 9px;
    border: 3px solid var(--color-parchment-dark);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--color-leather) 0%, var(--color-leather-dark) 100%);
}

/* ====================
   RESPONSIVE DESIGN
   ==================== */

/* Tablette */
@media (max-width: 991px) {
    .navbar-brand {
        font-size: 1.5rem;
    }

    #main {
        padding: 2rem;
        margin: 1rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    html, body {
        font-size: 16px;
        line-height: 1.6;
    }

    #main {
        padding: 1rem;
        margin: 0.5rem;
        border-radius: var(--radius-md);
    }

    #main::before {
        display: none; /* Pas de pliure centrale sur mobile */
    }

    /* Navbar mobile */
    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar-brand {
        font-size: 1.3rem;
        letter-spacing: 1px;
    }

    .navbar::after {
        bottom: -10px;
        height: 20px;
    }

    /* Menu hamburger stylisé */
    .navbar-toggler {
        border: 2px solid var(--color-gold);
        background: rgba(232, 215, 184, 0.2);
        padding: 0.5rem 0.75rem;
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 0.2rem rgba(201, 169, 97, 0.5);
    }

    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23c9a961' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
        width: 1.5rem;
        height: 1.5rem;
    }

    /* Menu déroulant mobile */
    .navbar-collapse {
        background: linear-gradient(135deg, var(--color-leather-light) 0%, var(--color-leather) 100%);
        margin-top: 1rem;
        border-radius: var(--radius-md);
        padding: 1rem;
        box-shadow: var(--shadow-medium);
    }

    .navbar-nav {
        align-items: stretch;
    }

    .navbar .nav-link {
        padding: 1rem 1.25rem;
        margin: 0.25rem 0;
        border-radius: var(--radius-sm);
        font-size: 1.1rem;
    }

    .navbar .nav-link:hover {
        background: rgba(232, 215, 184, 0.25);
    }

    .navbar .nav-link::after {
        display: none; /* Pas de ligne sous les liens en mobile */
    }

    /* Cartes mobile */
    .card {
        margin-bottom: 1.5rem;
    }

    .card-header {
        padding: 1rem;
    }

    .card-header h3 {
        font-size: 1.25rem;
    }

    .card-header::before,
    .card-header::after {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 1.25rem;
        font-size: 1rem;
    }

    .card-body img {
        margin-bottom: 1rem;
        width: 100%;
    }

    .card-footer {
        padding: 1rem;
    }

    /* Boutons mobile - tactile friendly */
    .btn {
        font-size: 1rem;
        padding: 0.75rem 1.25rem;
        margin: 0.25rem 0;
        width: 100%;
        display: block;
    }

    .btn i {
        margin-right: 0.5rem;
    }

    /* Liste de choix mobile */
    .list-group-item {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    .list-group-item a {
        font-size: 1rem;
    }

    /* Titres mobile */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    /* En-tête de page */
    .book-page-header h1 {
        font-size: 1.75rem;
    }

    .book-page-header .lead {
        font-size: 1rem;
    }
}

/* Petit mobile */
@media (max-width: 576px) {
    html, body {
        font-size: 15px;
    }

    #main {
        padding: 0.75rem;
        margin: 0.25rem;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header h3 {
        font-size: 1.1rem;
    }

    .btn {
        font-size: 0.95rem;
        padding: 0.65rem 1rem;
    }

    /* Images en pleine largeur sur petit écran */
    .card-body img {
        width: 100%;
        height: auto;
    }

    /* Ajustement des choix */
    .list-group-item {
        padding-left: 2.5rem;
    }

    .list-group-item::before {
        left: 1rem !important;
        font-size: 1rem;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #main {
        margin: 0.25rem;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* ====================
   UTILITAIRES
   ==================== */
.text-muted {
    color: var(--color-ink-faded) !important;
}

.pointer {
    cursor: pointer;
}

/* Mode haute lisibilité - désactive certains effets décoratifs */
.high-contrast {
    --color-parchment-light: #ffffff;
    --color-parchment: #ffffff;
    --color-ink: #000000;
}

.high-contrast .card::before,
.high-contrast #main::before {
    display: none;
}

.high-contrast body {
    background-image: none !important;
}

/* Validation messages */
.validation-message {
    color: var(--color-red-wax);
    font-style: italic;
    font-size: 0.9rem;
}

.invalid {
    border-color: var(--color-red-wax) !important;
}

.valid {
    border-color: var(--color-success-leaf) !important;
}

/* ====================
   EFFET D'ENCRE QUI SÈCHE (loading)
   ==================== */
@keyframes inkDrying {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.loading {
    animation: inkDrying 1.5s ease-in-out infinite;
}

/* ====================
   MARQUE-PAGES DÉCORATIFS
   ==================== */
.bookmark {
    position: absolute;
    top: 0;
    right: 2rem;
    width: 40px;
    height: 60px;
    background: linear-gradient(135deg, var(--color-red-wax) 0%, #6b2224 100%);
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
    box-shadow: var(--shadow-soft);
}

/* ====================
   NOTES DE VERSION
   ==================== */
.release-note-card {
    font-family: 'Crimson Text', serif;
    line-height: 1.8;
    margin-bottom: 2rem;
    border: 1px solid #d4c5a9;
    background: #fdfbf7;
}

.version-header {
    font-family: 'Cinzel', serif;
    color: var(--color-leather-dark);
    border-bottom: 2px solid #d4c5a9;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.version-number {
    font-size: 1.75rem;
    font-weight: 600;
    display: inline-block;
    margin-right: 1rem;
}

.version-date {
    font-size: 1rem;
    color: #8b7355;
    font-style: italic;
}

.change-category {
    margin-bottom: 1.5rem;
}

.category-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--color-leather-dark);
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.category-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.category-feature { background-color: #e8f4f8; color: #0066a1; }
.category-improvement { background-color: #fff3cd; color: #856404; }
.category-technical { background-color: #e7e7e7; color: #495057; }
.category-compliance { background-color: #d4edda; color: #155724; }

.change-list {
    list-style: none;
    padding-left: 2.5rem;
    margin-bottom: 0;
}

.change-list li {
    position: relative;
    padding-left: 0.5rem;
    margin-bottom: 0.5rem;
}

.change-list li:before {
    content: "•";
    position: absolute;
    left: -1rem;
    color: var(--color-leather-dark);
    font-weight: bold;
}

/* Ajout : ruban "Accès anticipé" pour les cards */
.card.ribbon-card { position: relative; overflow: visible; }

.ribbon-top-right {
    position: absolute;
    right: -12px;
    top: 12px;
    z-index: 10;
    transform: rotate(45deg);
    background: linear-gradient(180deg, rgba(255,238,179,0.98), rgba(255,221,105,0.98));
    color: var(--color-leather-dark);
    font-weight: 700;
    font-family: 'Cinzel', serif;
    padding: 4px 10px;
    font-size: 0.7rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    border-radius: 2px;
    pointer-events: none; /* évite d'interférer avec les clics sur la carte */
}

/* taille réduite sur petits écrans */
@media (max-width: 576px) {
    .ribbon-top-right {
        right: -8px;
        top: 8px;
        padding: 3px 8px;
        font-size: 0.6rem;
    }
}

