/* === POLICES === */

/* Fraunces (Titres) */
@font-face {
    font-family: 'Fraunces';
    src: url('fontes/fraunces-v38-latin-300.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'Fraunces';
    src: url('fontes/fraunces-v38-latin-300italic.woff2') format('woff2');
    font-weight: 300;
    font-style: italic;
}
@font-face {
    font-family: 'Fraunces';
    src: url('fontes/fraunces-v38-latin-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'Fraunces';
    src: url('fontes/fraunces-v38-latin-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
}
@font-face {
    font-family: 'Fraunces';
    src: url('fontes/fraunces-v38-latin-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'Fraunces';
    src: url('fontes/fraunces-v38-latin-800.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
}
@font-face {
    font-family: 'Fraunces';
    src: url('fontes/fraunces-v38-latin-900.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
}

/* Karla (Texte) */
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-300.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
}
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-300italic.woff2') format('woff2');
    font-weight: 300;
    font-style: italic;
}
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
}
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
}
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'Karla';
    src: url('fontes/karla-v33-latin_latin-ext-800.woff2') format('woff2');
    font-weight: 800;
    font-style: normal;
}

/* === VARIABLES === */
:root {
    --orange: #f66b06;
    --noir: #111;
    --gris-sombre: #1a1a1a;
    --gris: #ccc;
    --blanc: #ffffff;
    --max-width: 800px;
    --card-ratio: 744 / 1039;
}

/* === BASE & TYPOGRAPHIE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--noir);
    color: var(--blanc);
    font-family: 'Karla', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .logo, .game-title, .carte-titre {
    font-family: 'Fraunces', serif;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === HEADER === */
header {
    background: var(--gris-sombre);
    border-bottom: 1px solid #333;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--blanc);
    text-transform: lowercase;
}
.logo::after { content: ".php"; color: var(--orange); font-size: 0.8em; font-family: 'Karla', sans-serif;}

.game-title {
    font-size: 0.9rem;
    color: #888;
}

/* === LAYOUT GENERAL === */
main {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

/* === MENU ACCUEIL === */
.menu-container h1 { margin-bottom: 2rem; }
.games-list {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.game-card-link { text-decoration: none; color: inherit; }

.game-card-item {
    background: var(--gris-sombre);
    border: 1px solid #333;
    padding: 2rem;
    border-radius: 12px;
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
}

.game-card-item:hover {
    transform: translateY(-5px);
    border-color: var(--orange);
}

.game-card-item h2 { color: var(--orange); margin-bottom: 0.5rem; }
.btn-start {
    display: inline-block;
    margin-top: 1.5rem;
    background: var(--orange);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    font-family: 'Karla', sans-serif;
}

/* === NAVIGATION JEU === */
.game-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 1rem 0 2rem;
}

.game-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--orange);
    transition: background 0.3s;
}
.game-nav-btn:hover { background: rgba(255, 255, 255, 0.2); }
.game-nav-btn.disabled { opacity: 0.3; cursor: default; }
.game-nav-btn svg { width: 20px; height: 20px; }

.instruction { margin-bottom: 1rem; color: #888; font-size: 0.9rem; }

/* === FLIP CARD 3D (JEU UNIQUEMENT) === */
.flip-card {
    width: 100%;
    max-width: 450px;
    aspect-ratio: var(--card-ratio);
    margin: 0 auto;
    perspective: 1000px;
    cursor: pointer;
    position: relative;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

/* Faces superposées */
.flip-card-front,
.flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* RECTO */
.flip-card-front {
    background-color: #000;
    transform: rotateY(0deg);
    display: flex;
    flex-direction: column;
}

.flip-card-front img {
    width: 100%;
    flex-grow: 1;
    min-height: 0;
    object-fit: contain;
}

/* VERSO */
.flip-card-back {
    background: #fdfbf7;
    color: #222;
    transform: rotateY(180deg);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    text-align: left;
}

/* === ÉLÉMENTS INTERNES DE LA CARTE === */

.carte-numero {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--orange);
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    padding: 0.5rem 1rem;
    border-bottom-left-radius: 10px;
    font-family: 'Fraunces', serif;
}

/* TITRE DE LA CARTE */
.carte-titre {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--noir);
    margin-bottom: 1rem;
    margin-top: 1rem;
    line-height: 1.2;
    text-align: left;
    border-bottom: 1px solid var(--noir);
    padding-bottom: 0.4rem;
}


/* ENCADRÉ */
.carte-encadre {
    border: 2px solid var(--orange);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    margin-top: 1rem;
    font-style: italic;
    background: transparent;
    font-family: 'Karla', sans-serif;
    font-size: 1.05rem;
    line-height: 1.1;
    text-align: justify;
    hyphens: auto;
}
.carte-encadre::before { content: none; }


/* TEXTE COURANT AJUSTÉ */
.carte-texte {
    flex-grow: 1;
    margin-bottom: 2rem;
    white-space: pre-wrap;
    font-family: 'Karla', sans-serif;
    font-size: 1.05rem;
    line-height: 1.1;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}

/* Styles spécifiques pour les liens Markdown dans le texte (gras, orange, sans souligné au survol) */
.carte-texte a,
.carte-encadre a {
    color: var(--orange);
    font-weight: 700; /* Gras */
    text-decoration: none;
}

.carte-texte a:hover,
.carte-encadre a:hover {
    text-decoration: none; /* Pas de soulignement au survol */
}

.carte-choix ul { list-style: none; }
.carte-choix li { margin-bottom: 0.8rem; }

.btn-choice {
    display: block;
    background: #222;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    transition: background 0.2s;
    font-family: 'Karla', sans-serif;
    line-height: 1.1;
}
.btn-choice:hover { background: var(--orange); text-decoration: none; }
.btn-choice.restart { background: #d32f2f; }

.manual-input {
    background: #eee;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}
.input-card-num {
    padding: 8px;
    font-size: 1.2rem;
    width: 80px;
    text-align: center;
    margin-right: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Fraunces', serif;
}
.btn-ok {
    padding: 8px 16px;
    font-size: 1rem;
    background: var(--orange);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Karla', sans-serif;
    font-weight: 700;
}
.error { color: red; font-size: 0.9rem; margin-bottom: 0.5rem; }

/* === NOUVEAU STYLE POUR L'INTERLUDE DE DÉPLACEMENT === */
.interlude-card {
    background: #fdfbf7;
    color: #222;
    border-radius: 15px;
    padding: 2.5rem;
    max-width: 450px;
    margin: 2rem auto;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 300px;
}

.interlude-title {
    font-family: 'Fraunces', serif;
    font-size: 1.6rem;
    margin-bottom: 2rem;
    color: var(--noir); /* Modification : titre en noir */
}

.interlude-content p {
    font-family: 'Karla', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
}

/* Style spécifique pour l'indication */
.interlude-indication {
    font-style: italic;
    font-size: 1.1rem;
    color: #444;
}

.interlude-content a {
    color: var(--orange);
    font-weight: 800;
    text-decoration: none;
    font-size: 1.3rem;
}

.interlude-content a:hover {
    text-decoration: underline;
}

footer {
    margin-top: auto;
    padding: 2rem;
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    border-top: 1px solid #333;
}
