/* ============================================================
 * IFLISS GAMES — sections communes des fiches de jeu (/jeux/:slug)
 * « Le journal de bord » (includes/game_lore.php) et « Questions fréquentes » (src/Views/game_detail.php)
 * au thème de l'accueil : blanc cassé, taupe, violet, bordeaux. Le haut de la fiche garde le style du jeu.
 * Chargé avec accueil.css (tokens .acc) pour les fiches listées dans game_detail.php ($fichesNouveauTheme).
 * Même rendu que la page /faq (infos.css, classes fq-*) pour les questions.
 * ============================================================ */

/* ============================================================
 * Haut de fiche au thème (fiches qui l'adoptent entièrement, ex. Motus) :
 * <main class="main-content acc acc-home jd-fiche"> + classes communes des pages games/<slug>/detail.php.
 * Le titre ou logo du jeu garde le style défini dans sa page.
 * ============================================================ */
.jd-fiche { padding: 34px 0 52px; }
.jd-fiche .game-detail-container { width: min(900px, calc(100% - 28px)); margin: 0 auto; }

.jd-fiche .game-description {
    margin: 0 0 18px;
    padding: 18px 22px;
    border: 1px solid #dccfbf;
    border-left: 5px solid var(--bordeaux);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 16px 32px -28px rgb(70 50 35 / 0.6);
    color: var(--ink-soft);
    font-size: 1rem;
    line-height: 1.75;
}

/* Chiffres clés : cartes crème */
.jd-fiche .game-info-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 22px; }
.jd-fiche .info-card {
    min-width: 0;
    padding: 16px 10px;
    border: 1px solid #dccfbf;
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 16px 32px -28px rgb(70 50 35 / 0.6);
    text-align: center;
    transition: border-color 0.18s, transform 0.18s;
}
.jd-fiche .info-card:hover { border-color: var(--violet-200); transform: translateY(-3px); }
.jd-fiche .info-label { margin: 0 0 6px; color: var(--taupe-700); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.jd-fiche .info-value { color: var(--ink); font-size: clamp(1rem, 2.2vw, 1.3rem); font-weight: 900; }
.jd-fiche .info-value.primary { color: var(--bordeaux); }

/* Bouton Jouer : bleu des boutons du site */
.jd-fiche .play-section { margin: 22px 0 30px; padding: 0; text-align: center; }
.jd-fiche .btn-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    padding: 14px 34px;
    border: 2px solid transparent;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.18s, transform 0.18s;
}
.jd-fiche .btn-play.available,
.jd-fiche .btn-play.login { background: var(--strip-blue); color: #fff; box-shadow: 0 12px 24px -14px rgb(28 25 72 / 0.9); }
.jd-fiche .btn-play.available:hover,
.jd-fiche .btn-play.login:hover { background: var(--strip-blue-hover); transform: translateY(-2px); }
.jd-fiche .btn-play.locked { border-color: var(--taupe-200); background: var(--taupe-100); color: var(--taupe-700); cursor: not-allowed; }
.jd-fiche .lock-message {
    max-width: 520px;
    margin: 14px auto 0;
    padding: 12px 16px;
    border: 1px solid var(--red-100);
    border-radius: 12px;
    background: var(--red-50);
    color: var(--bordeaux);
    font-size: 0.9rem;
}
/* Rappel « connecté(e) » ajouté par game_detail.php pour les visiteurs */
.jd-fiche .jd-connexion-note { margin: 14px 0 0; color: var(--ink-soft); font-size: 0.84rem; line-height: 1.6; }
.jd-fiche .jd-connexion-note .bi { color: var(--violet-600); }
.jd-fiche .jd-connexion-note a { color: var(--violet-800); font-weight: 700; text-decoration: underline; text-decoration-color: rgb(74 47 148 / 0.3); text-underline-offset: 3px; }
.jd-fiche .jd-connexion-note a:hover { color: var(--red); text-decoration-color: currentColor; }

/* Règles */
.jd-fiche .rules-section { margin: 34px 0 0; }
.jd-fiche .rules-title {
    display: flex;
    align-items: center;
    gap: 0.45em;
    margin: 0 0 18px;
    color: var(--ink);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 900;
    line-height: 1.15;
    text-align: left;
}
.jd-fiche .rules-title .bi { color: var(--bordeaux); font-size: 0.85em; }
.jd-fiche .rule-card {
    margin: 0 0 14px;
    padding: 20px 22px;
    border: 1px solid #dccfbf;
    border-left: 5px solid var(--violet-400);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 16px 32px -28px rgb(70 50 35 / 0.6);
}
.jd-fiche .rule-card:nth-of-type(even) { border-left-color: var(--bordeaux); }
.jd-fiche .rule-card h3 { display: flex; align-items: center; gap: 0.45em; margin: 0 0 10px; color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.jd-fiche .rule-card h3 .bi { color: var(--bordeaux); }
.jd-fiche .rule-card h4 { display: flex; align-items: center; gap: 0.45em; margin: 16px 0 6px; color: var(--bordeaux); font-size: 1rem; font-weight: 800; }
.jd-fiche .rule-card h4 .bi { color: var(--violet-600); }
.jd-fiche .rule-card p,
.jd-fiche .rule-card ul { color: var(--ink-soft); font-size: 0.95rem; line-height: 1.8; }
.jd-fiche .rule-card p { margin: 0 0 10px; }
.jd-fiche .rule-card ul { margin: 0 0 4px 1.3rem; padding: 0; }
.jd-fiche .rule-card li { margin-bottom: 6px; }
.jd-fiche .rule-card strong { color: var(--ink); }
.jd-fiche .highlight { padding: 1px 7px; border-radius: 6px; background: var(--violet-100); color: var(--violet-800); font-weight: 700; }
.jd-fiche .success { padding: 1px 7px; border-radius: 6px; background: var(--red-50); color: var(--bordeaux); font-weight: 800; }
.jd-fiche .jd-muted { color: var(--taupe-400); }

/* Liens bas de fiche : boutons clairs */
.jd-fiche .navigation-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.jd-fiche .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 20px;
    border: 2px solid rgb(42 33 115 / 0.45);
    border-radius: 999px;
    background: rgb(255 255 255 / 0.4);
    color: var(--strip-blue-solid);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.jd-fiche .nav-btn:hover { border-color: var(--strip-blue-solid); background: rgb(255 255 255 / 0.65); transform: translateY(-2px); }

@media (max-width: 768px) {
    .jd-fiche { padding: 18px 0 38px; }
    .jd-fiche .game-detail-container { width: calc(100% - 18px); }
    .jd-fiche .game-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .jd-fiche .game-description { padding: 15px; font-size: 0.92rem; }
    .jd-fiche .rule-card { padding: 17px 15px; }
    .jd-fiche .btn-play { padding: 13px 26px; font-size: 0.98rem; }
}

/* ============================================================
 * Bandeau d'en-tête avec photo (Famille en Or, Motus)
 * <main class="main-content acc acc-home jd-fiche jd-avec-hero"> puis
 * <section class="jd-hero"><div class="jd-hero-grille"> : .game-header (titre), .jd-hero-texte
 * (description + chiffres clés), .play-section (bouton), picture.jd-hero-photo.
 * PC : titre et textes à gauche, photo à droite jusqu'au bouton, bouton centré dessous.
 * ≤ 860 px : titre, textes, bouton, puis la photo posée sur le bas du bandeau.
 * Réglages par fiche (variables posées sur le main par la page) :
 *   --jd-hero-haut (marge au-dessus du titre), --jd-largeur, --jd-photo (largeur de la photo),
 *   --jd-fondu-bas (début du fondu en bas de photo sur PC ; 100% = pas de fondu),
 *   --jd-fondu-cotes (largeur du fondu à gauche et à droite ; 0% = pas de fondu).
 * ============================================================ */
.jd-fiche.jd-avec-hero { padding-top: 0; }
.jd-hero {
    padding: var(--jd-hero-haut, 34px) 0 0;
    background: linear-gradient(180deg, #e8dfd3, #d8cbbb);
    border-bottom: 1px solid #cdbfae;
}
.jd-hero-grille {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--jd-photo, 420px);
    grid-template-areas: "titre photo" "texte photo" "jouer jouer";
    column-gap: 28px;
    width: min(var(--jd-largeur, 1000px), calc(100% - 28px));
    margin: 0 auto;
}
.jd-hero .game-header { grid-area: titre; }
.jd-hero-texte { grid-area: texte; }
.jd-fiche .jd-hero .game-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.jd-fiche .jd-hero .play-section { grid-area: jouer; margin: 0; padding: 26px 0 34px; text-align: center; }

.jd-hero-photo { position: relative; grid-area: photo; align-self: end; display: block; line-height: 0; }
/* Bulle violet clair derrière les personnes, comme sur l'accueil */
.jd-hero-photo::before {
    content: "";
    position: absolute;
    top: 10%;
    left: 8%;
    right: 8%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 42%, #efe8fe, #d6c8fb 58%, #b9a2f6);
    opacity: 0.85;
}
/* Image plus large que haute (objets rognés) : bulle calée sur la hauteur, sans déborder dessous */
.jd-hero-photo.jd-photo-paysage::before { top: 4%; left: 50%; right: auto; height: 96%; transform: translateX(-50%); }
.jd-hero-photo img {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    /* Bras coupés sur les bords des photos : fondu à gauche et à droite */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--jd-fondu-cotes, 7%), #000 calc(100% - var(--jd-fondu-cotes, 7%)), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 var(--jd-fondu-cotes, 7%), #000 calc(100% - var(--jd-fondu-cotes, 7%)), transparent);
}
.jd-hero + .game-detail-container { padding-top: 34px; }

/* Bandeau sans photo (ex. Cap Musique en attendant une image) : titre, textes, puis bouton centré ;
   <section class="jd-hero jd-hero-sans-photo"> ; les chiffres clés restent sur une ligne de 4 */
.jd-hero-sans-photo .jd-hero-grille { grid-template-columns: minmax(0, 1fr); grid-template-areas: "titre" "texte" "jouer"; }
.jd-fiche .jd-hero-sans-photo .game-info-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (min-width: 861px) {
    .jd-hero-photo img {
        -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--jd-fondu-cotes, 7%), #000 calc(100% - var(--jd-fondu-cotes, 7%)), transparent), linear-gradient(180deg, #000 var(--jd-fondu-bas, 78%), transparent);
        -webkit-mask-composite: source-in;
        mask-image: linear-gradient(90deg, transparent, #000 var(--jd-fondu-cotes, 7%), #000 calc(100% - var(--jd-fondu-cotes, 7%)), transparent), linear-gradient(180deg, #000 var(--jd-fondu-bas, 78%), transparent);
        mask-composite: intersect;
    }
}
@media (max-width: 860px) {
    .jd-hero-grille { grid-template-columns: minmax(0, 1fr); grid-template-areas: "titre" "texte" "jouer" "photo"; }
    .jd-fiche .jd-hero .play-section { padding-bottom: 18px; }
    .jd-hero-photo { justify-self: center; width: min(340px, 86%); }
}
@media (max-width: 768px) {
    .jd-fiche .jd-hero-sans-photo .game-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .jd-hero { padding-top: 18px; }
    .jd-hero-grille { width: calc(100% - 18px); }
    .jd-hero + .game-detail-container { padding-top: 22px; }
}

/* ============================================================
 * Journal de bord et FAQ du jeu (toutes les fiches listées)
 * ============================================================ */
.jd-annexes .glore-wrap,
.jd-annexes .gfaq-wrap { width: min(860px, calc(100% - 32px)); margin: 0 auto; }

/* ── Le journal de bord ── */
.jd-annexes .glore-section { padding: 52px 0 50px; border-top: 1px solid var(--line); background: var(--card); }
.jd-annexes .glore-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--violet-800);
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.jd-annexes .glore-kicker .bi { color: var(--red); }
.jd-annexes .glore-title {
    display: flex;
    align-items: center;
    gap: 0.45em;
    margin: 16px 0 18px;
    color: var(--ink);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 900;
    line-height: 1.15;
}
.jd-annexes .glore-title .bi { flex-shrink: 0; color: var(--bordeaux); font-size: 0.85em; }
.jd-annexes .glore-body p { margin: 0 0 1rem; color: var(--ink-soft); font-size: 1rem; line-height: 1.85; }
.jd-annexes .glore-body strong { color: var(--ink); }
.jd-annexes .glore-tip {
    margin-top: 1.4rem;
    padding: 18px 22px;
    border: 1px solid var(--violet-200);
    border-radius: 16px;
    background: var(--violet-50);
    color: var(--ink-soft);
    font-size: 0.95rem;
    line-height: 1.75;
}
.jd-annexes .glore-tip > strong:first-child { color: var(--violet-800); }
.jd-annexes .glore-tip > strong:first-child .bi { color: var(--red); }

/* ── Questions fréquentes : fond taupe, cartes crème ── */
.jd-annexes .gfaq-section {
    --ink-soft: #5a4d43;
    padding: 48px 0 56px;
    background: linear-gradient(180deg, #e1d6c9, #d8cbbb);
    border-top: 1px solid #cdbfae;
}
.jd-annexes .gfaq-title { margin: 0 0 22px; color: var(--ink); font-size: clamp(1.5rem, 2.8vw, 2rem); font-weight: 900; line-height: 1.15; }
.jd-annexes .gfaq-list { display: grid; gap: 10px; }
.jd-annexes .gfaq-item details {
    overflow: hidden;
    border: 1px solid #dccfbf;
    border-radius: 18px;
    background: var(--card);
    box-shadow: 0 16px 32px -28px rgb(70 50 35 / 0.6);
    transition: border-color 0.18s, box-shadow 0.18s;
}
.jd-annexes .gfaq-item details[open] { border-color: var(--violet-200); box-shadow: 0 20px 38px -26px rgb(74 47 148 / 0.45); }
.jd-annexes .gfaq-item summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    list-style: none;
    cursor: pointer;
    transition: background-color 0.18s;
}
.jd-annexes .gfaq-item summary::-webkit-details-marker { display: none; }
.jd-annexes .gfaq-item summary:hover { background: var(--paper); }
.jd-annexes .gfaq-num {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--bordeaux), var(--bordeaux-dark));
    box-shadow: inset 0 0 0 3px rgb(251 243 230 / 0.25);
    color: var(--cream);
    font-size: 0.82rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.jd-annexes .gfaq-q { flex: 1; min-width: 0; }
.jd-annexes .gfaq-chevron { flex-shrink: 0; color: var(--violet-600); font-size: 0.9rem; transition: transform 0.2s; }
.jd-annexes .gfaq-item details[open] .gfaq-chevron { transform: rotate(180deg); }
.jd-annexes .gfaq-answer { padding: 0 18px 18px 66px; color: var(--ink-soft); font-size: 0.94rem; line-height: 1.8; }
.jd-annexes .gfaq-more { margin: 20px 0 0; color: var(--taupe-ink); font-size: 0.9rem; text-align: center; }

/* Liens des deux sections */
.jd-annexes .glore-body a,
.jd-annexes .gfaq-answer a,
.jd-annexes .gfaq-more a {
    color: var(--violet-800);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgb(74 47 148 / 0.3);
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}
.jd-annexes .glore-body a:hover,
.jd-annexes .gfaq-answer a:hover,
.jd-annexes .gfaq-more a:hover { color: var(--red); text-decoration-color: currentColor; }

@media (max-width: 600px) {
    .jd-annexes .glore-section { padding: 36px 0 34px; }
    .jd-annexes .glore-tip { padding: 14px 16px; }
    .jd-annexes .gfaq-section { padding: 34px 0 40px; }
    .jd-annexes .gfaq-item summary { gap: 10px; padding: 14px; font-size: 0.94rem; }
    .jd-annexes .gfaq-num { width: 30px; height: 30px; font-size: 0.76rem; }
    .jd-annexes .gfaq-answer { padding: 0 14px 16px; font-size: 0.92rem; }
}
