---
import { ClientRouter } from "astro:transitions";
import Footer from "../components/Footer.astro";

interface Props {
    title: string;
}

const { title } = Astro.props;
---

<!doctype html>
<html lang="fr">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>{title}</title>
        <ClientRouter />
        <script
            async
            src="https://www.googletagmanager.com/gtag/js?id=G-3E2HSZT0JD"
        ></script><script>
            window.dataLayer = window.dataLayer || [];
            function gtag() {
                dataLayer.push(arguments);
            }
            gtag("js", new Date());

            gtag("config", "G-3E2HSZT0JD");
        </script></head
    >

    <!-- Google tag (gtag.js) -->

    <body>
        <main>
            <slot />
        </main>
        <Footer />
    </body>
</html>

<style is:global>
    @import url("https://fonts.googleapis.com/css2?family=Mrs+Eaves&family=Playfair+Display:ital,wght@0,700;1,700&family=Roboto+Condensed:wght@700&display=swap");
    @import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@700&display=swap");

    :root {
        /* Encres (Classes) */
        --color-martial: rgba(230, 57, 70, 1);
        --color-arcane: rgba(147, 72, 255, 1);
        --color-divin: rgba(200, 155, 60, 1);
        --color-primal: rgba(42, 157, 143, 1);
        --color-hybride: rgba(100, 100, 100, 1);

        /* Spectres (Espèces) */
        --color-solaire: rgba(200, 155, 60, 0.4);
        --color-elementaire: rgba(0, 171, 255, 0.4);
        --color-terrestre: rgba(139, 69, 19, 0.4);
        --color-sylvestre: rgba(0, 128, 0, 0.4);
        --color-ombre: rgba(75, 0, 130, 0.4);

        /* Défaut */
        --color-default: #c89b3c;
        /* Palette de base */
        --color-parchment: #fdf6e8;
        --color-ink: #403a25;
        --color-gold: #c89b3c;
        --color-gold-dark: #b8860b;

        /* Nuancier des Callouts (Tes Surcharges) */
        --co-info: #3f51b5;
        --co-success: #2e7d32;
        --co-warning: #f57c00;
        --co-error: #8b0000;
        --co-todo: #455a64;
        --co-quote: #9e9e9e;
        --co-abstract: #0097a7;
    }

    /* --- BASE & STRUCTURE --- */
    * {
        box-sizing: border-box;
    }
    body {
        background-color: var(--color-parchment);
        color: var(--color-ink);
        font-family: "Calibri", "Segoe UI", sans-serif;
        margin: 0;
        overflow-x: hidden;
    }

    main {
        width: 100%;
        max-width: 1000px;
        margin: 0 auto;
        padding: 2rem 1.5rem;
    }

    hr {
        border: 0;
        height: 1px;
        background-image: linear-gradient(
            to right,
            transparent,
            #dcd0b9,
            transparent
        );
        margin: 2.5rem 0;
    }

    /* --- TYPOGRAPHIE & LIENS --- */
    main strong {
        color: var(--color-gold-dark);
        font-weight: 700;
    }

    main a[href] {
        color: var(--color-gold-dark);
        font-weight: bold;
        text-decoration: none;
        background-color: rgba(200, 155, 60, 0.08);
        padding: 0 4px;
        border-radius: 4px;
        border-bottom: 1px dashed var(--color-gold);
        transition: all 0.2s ease;
    }

    main a[href]:hover {
        background-color: var(--color-gold);
        color: white !important;
    }

    /* --- TABLEAUX (GFM) --- */
    main table {
        width: 100%;
        border-collapse: collapse;
        margin: 2.5rem 0;
        background-color: #ffffff;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        border-radius: 8px;
        overflow: hidden;
    }

    main th {
        background-color: var(--color-gold);
        color: white;
        font-family: "Cinzel", serif;
        text-transform: uppercase;
        font-size: 0.85rem;
        padding: 15px;
        text-align: left;
    }

    main td {
        padding: 12px 15px;
        border: 1px solid rgba(200, 155, 60, 0.1);
        font-size: 0.95rem;
    }
    main tr:nth-child(even) {
        background-color: rgba(200, 155, 60, 0.04);
    }
    main tr:hover {
        background-color: rgba(200, 155, 60, 0.08);
    }

    /* --- SYSTEME DE CALLOUTS (FORCE BRUTE) --- */

    /* 1. Squelette commun : On cible très précisément */
    main blockquote,
    main [data-callout] {
        --c-accent: var(--color-gold) !important; /* Valeur de secours */
        margin: 2rem 0 !important;
        padding: 1.5rem !important;
        border-left: 5px solid var(--c-accent) !important;
        background-color: color-mix(
            in srgb,
            var(--c-accent),
            transparent 92%
        ) !important;
        border-radius: 0 8px 8px 0 !important;
        color: var(--color-ink) !important;
    }

    /* Titre : On force la couleur de l'accent ici aussi */
    main [data-callout] .callout-title {
        display: flex !important;
        align-items: center !important;
        font-family: "Cinzel", serif !important;
        font-weight: bold !important;
        text-transform: uppercase !important;
        color: var(--c-accent) !important;
        margin-bottom: 0.5rem !important;
    }

    /* Nettoyage radical des icônes SVG/Éclair */
    main [data-callout] .callout-icon,
    main [data-callout] svg {
        display: none !important;
    }

    /* Ajout de l'icône personnalisée */
    main [data-callout] .callout-title::before {
        margin-right: 12px;
        font-size: 1.2rem;
    }

    /* 2. SURCHARGES DES NUANCIERS (L'ordre est crucial) */

    /* ERROR : On redéfinit la variable pivot */
    main [data-callout="error"],
    main [data-callout="fail"] {
        --c-accent: var(--co-error) !important;
    }
    main [data-callout="error"] .callout-title::before,
    main [data-callout="fail"] .callout-title::before {
        content: "🎲";
    }

    /* SUCCESS */
    main [data-callout="success"],
    main [data-callout="done"] {
        --c-accent: var(--co-success) !important;
    }
    main [data-callout="success"] .callout-title::before {
        content: "✨";
    }

    /* INFO */
    main [data-callout="info"],
    main [data-callout="note"] {
        --c-accent: var(--co-info) !important;
    }
    main [data-callout="info"] .callout-title::before {
        content: "📜";
    }

    /* Application aux textes gras internes */
    main [data-callout] strong {
        color: var(--c-accent) !important;
    }

    /* --- GRILLE & CARTES --- */
    .card-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        justify-content: center;
        padding: 20px 0;
    }

    /* LE STYLE DES CARTES (FORCE LE LOOK D'INDEX) */
    .gold-button {
        flex: 1 1 300px;
        max-width: 400px;
        min-height: 120px;
        background: white !important;
        border-radius: 12px;
        padding: 20px;
        text-decoration: none !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        transition: transform 0.2s ease;
    }

    .gold-button:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    }
    .gold-button .title {
        font-family: "Cinzel", serif;
        color: var(--color-gold-dark);
        text-transform: uppercase;
        margin-bottom: 8px;
        text-align: center;
    }

    .gold-button .body {
        font-family: "Calibri", sans-serif !important;
        color: var(--color-ink) !important;
        font-size: 0.9rem !important;
        margin: 0;
        opacity: 0.8;
    }

    /* TAGS PROPRES SANS PRÉFIXE */
    .js-tag-filter,
    .tag-link {
        display: inline-block;
        background: white;
        border: 1px solid var(--color-gold);
        padding: 4px 12px;
        border-radius: 20px;
        font-family: "Cinzel", serif;
        font-size: 0.7rem;
        color: var(--color-ink);
        cursor: pointer;
        margin: 4px;
        text-decoration: none;
    }

    .active-tag,
    .js-tag-filter:hover {
        background: var(--color-gold) !important;
        color: white !important;
    }

    /* --- MOBILE --- */
    @media (max-width: 640px) {
        .card-grid {
            padding: 10px;
        }
        main table {
            display: block;
            overflow-x: auto;
        }
        .gold-button {
            flex: 1 1 100%;
        }
    }
</style>
