/* ==========================================================================
   Charte Graphique : Or et Charbon
   ========================================================================== */

:root {
    /* --- Couleurs de base --- */
    --background-color: #121212; /* Noir charbon profond */
    --text-color: #f0f0f0;       /* Blanc cassé pour le confort de lecture */
    --border-color: rgba(224, 182, 76, 0.3); /* Bordure dorée transparente */

    /* --- Palette Or --- */
    --gold-bright: #E0B64C;  /* Or vif pour les titres et accents */
    --gold-medium: #C8A440;  /* Or moyen pour les survols */
    --gold-dark: #A08230;   /* Or foncé */
    
    /* --- Palette pour l'interface (remplace le violet) --- */
    --component-bg: #222227;        /* Fond des composants (form, bulles de chat) */
    --component-bg-accent: #333338; /* Fond des boutons, bulles utilisateur */
    --component-bg-hover: #444449;  /* Survol des boutons */

    /* --- Polices --- */
    --primary-font: 'Lato', sans-serif;
    --title-font: 'Lora', serif;

    /* --- Colonne --- */
    --main-column-width: 1200px;

}


/* ==========================================================================
   Styles Généraux
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--primary-font);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


/* ==========================================================================
   Effet Doré pour les Titres
   ========================================================================== */
.site-title a,
.author-bio h1,
.homepage-header h1 {
    /* Dégradé pour simuler un reflet métallique */
    background-image: linear-gradient(135deg, #FDEEAB 0%, var(--gold-bright) 50%, var(--gold-dark) 100%);
    
    /* On clipse le fond à la forme du texte */
    -webkit-background-clip: text;
    background-clip: text;
    
    /* On rend la couleur du texte transparente pour voir le fond */
    color: transparent;
    -webkit-text-fill-color: transparent; /* Pour Safari */
}


/* ==========================================================================
   Header et Navigation
   ========================================================================== */
header {
    padding: 1.5rem 5%;
    border-bottom: 1px solid var(--border-color);
}

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

.site-title {
    margin-right: auto;
}

.site-title a {
    font-family: var(--title-font);
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--gold-medium);
}

.hamburger-menu { display: none; }

/* --- STYLE POUR LE SÉLECTEUR DE LANGUE --- */

.language-picker-dropdown {
    position: relative;
    margin-left: 2rem;
}

.current-language .flag-icon {
    width: 28px;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown-content {
    display: none; /* Caché par défaut */
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #222;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.5rem;
    min-width: 150px;
    z-index: 10;
}

/* On affiche le menu au survol du conteneur */
.language-picker-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

.dropdown-content a:hover {
    background-color: #333;
}

.dropdown-content .flag-icon {
    width: 24px;
}

/* ==========================================================================
   Contenu Principal (Pages Auteur)
   ========================================================================== */
main {
    flex-grow: 1;
    width: 100%;
}

.container {
    width: 100%;
    max-width: var(--main-column-width);
    margin-left: auto;
    margin-right: auto;
}

.author-section {
    display: flex;
    align-items: center;
    gap: 3rem;
    max-width: var(--main-column-width);
    margin: 3rem auto;
    padding: 0 5%;
}

.author-image {
    flex-basis: 40%;
    text-align: center;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.author-image video {
    width: 100%;
    height: 100%;
    display: block;
}

.author-bio {
    flex-basis: 60%;
}

.author-bio h1 {
    font-family: var(--title-font);
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.author-bio p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}


/* ==========================================================================
   Interface de Chat
   ========================================================================== */
.chatbot-form-container {
    max-width: var(--main-column-width);
    margin: 1rem auto;
    padding: 0 5%;
}

#chat-container {
    width: 100%;
    margin-bottom: 1.5rem;
    max-height: 40vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 1rem;
}

.chat-message {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.5;
}

.user-message {
    background-color: var(--component-bg-accent);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.bot-message {
    background-color: var(--component-bg);
    color: var(--text-color);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.chatbot-form {
    display: flex;
    background-color: var(--component-bg);
    border-radius: 10px;
    padding: 0.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.chatbot-form input {
    flex-grow: 1;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    outline: none;
}

.chatbot-form input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.chatbot-form button {
    background-color: var(--component-bg-accent);
    border: none;
    border-radius: 8px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
}

.chatbot-form button:hover {
    background-color: var(--component-bg-hover);
}

.chatbot-form button svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
}


/* ==========================================================================
   Page d'accueil
   ========================================================================== */
.homepage-header {
    text-align: center;
    margin: 2rem auto 4rem auto;
    max-width: 800px;
    padding: 0 1rem;
}

.homepage-header h1 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
}

.homepage-header h2 {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.8;
}

.author-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* ← 3 colonnes fixes */
    gap: 1.5rem;
    width: 100%;
    max-width: var(--main-column-width);
    margin: 0 auto;
    justify-content: center;
}

.author-card {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 4 / 5;
    text-decoration: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.author-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 25px var(--border-color);
}

/* Overlay transparent clickable sur toute la carte */
.author-link-overlay {
    position: absolute;
    inset: 0;  /* top: 0; right: 0; bottom: 0; left: 0; */
    z-index: 10;
    background: rgba(0,0,0,0.07); /* Léger assombrissement, ajuste l’opacité */
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
}

/* Effet au survol (plus visible) */
.author-card:hover .author-link-overlay {
    background: rgba(0,0,0,0.19); /* Plus sombre au hover */
}

.author-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.author-card:hover video {
    transform: scale(1.05);
}

.video-embed-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  }
  
  .video-embed-container iframe {
    position: absolute;
    top: 50%; left: 50%;
    width: 178%;  /* Pour remplir le carré en 9:16 */
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    transform: translate(-50%, -50%);
    border: none;
  }

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-color);
    background: linear-gradient(to top, rgba(0,0,0, 0.9) 0%, rgba(0,0,0, 0) 100%);
    pointer-events: none;
}

.card-overlay h3 {
    font-family: var(--title-font);
    font-size: 1.5rem;
    margin: 0;
    color: var(--gold-bright);
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

/* --- STYLES POUR LES MÉTADONNÉES DU PERSONNAGE --- */

/* Le conteneur pour toutes les métadonnées */
/* Le conteneur principal (titre + métas) */
.bio-header {
    display: flex; /* Aligne le titre et les métas sur la même ligne */
    align-items: center; /* Centre verticalement les éléments */
    gap: 1.5rem; /* Espace entre le titre et le bloc de métas */
    margin-bottom: 1rem; /* Espace avant la ligne des tags */
}

/* Le titre de l'auteur */
.bio-header h1 {
    margin: 0; /* On retire la marge par défaut du h1 pour un meilleur contrôle */
    flex-grow: 1; /* Permet au titre de prendre toute la place disponible */
}

/* Le conteneur pour le drapeau et les dates */
.identity-meta {
    display: flex;
    flex-direction: column; /* Place le drapeau et les dates l'un AU-DESSUS de l'autre */
    align-items: flex-start; /* Aligne les éléments à gauche dans leur colonne */
    font-size: 0.8em;
    color: #cccccc;
    flex-shrink: 0; /* Empêche ce bloc de se réduire si le titre est long */
}

/* On réduit la taille du drapeau, comme tu l'as demandé */
.identity-meta .flag-icon {
    width: 24px; /* Taille réduite */
    margin-bottom: 4px; /* Petit espace entre le drapeau et les dates */
}

/* Drapeau sur les pages [Country] */
.category-header .flag-icon {
    width: 28px;
    margin-right: 4px;
}

/* Le style pour l'icône du drapeau */
.flag-icon {
    /* Le display:flex et align-items:center du parent s'occupe déjà de bien le placer */
    /* On peut ajouter une ombre si on veut le faire ressortir */
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

.flag-row {
    display: flex;
    gap: 0.3em;
    align-items: center;
}

    .flag-row a {
        margin-right: 0.5em; 
      }

/* La ligne des tags (on s'assure qu'elle a sa propre marge) */
.tags {
    margin-bottom: 1rem; /* Espace avant le début de la biographie */
    display: flex;
    flex-wrap: wrap; /* Permet aux tags de passer à la ligne si besoin */
    gap: 0.5rem;
}

/* Le style de chaque tag individuel */
.tag {
    /* Style de la "pilule" */
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.3em 0.8em; /* J'utilise 'em' pour que le padding soit relatif à la taille de la police */
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: bold;
    white-space: nowrap;

    /* Style du lien */
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.2s ease-in-out;
    display: inline-block; /* Très important pour que les transformations et le padding fonctionnent */
}

.tag:hover {
    transform: translateY(-2px);
}

/* Base commune aux tags */
.era, .job, .movement {
  padding: 0.33em 1em;
  border-radius: 999px;
  font-size: 0.83em;
  font-weight: 700;
  text-decoration: none;
  transition: 
    background 0.22s cubic-bezier(.43,1.3,.64,1), 
    color 0.16s cubic-bezier(.43,1.3,.64,1),
    box-shadow 0.22s;
  display: inline-block;
  border: 1.5px solid transparent;
  cursor: pointer;
}

/* --- Era (Période) : fond transparent, contour doré, texte doré */
.era {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  background: rgba(224,182,76,0.08); /* léger fond doré */
}
.era:hover, .era:focus {
  background: linear-gradient(90deg, var(--gold-bright), var(--gold-dark) 80%);
  color: #222;
  border-color: var(--gold-dark);
  box-shadow: 0 2px 8px rgba(224,182,76,0.18);
  text-shadow: 0 1px 4px #fdeeab60;
}

/* --- Movement (mouvements) : fond charbon, contour or foncé, texte blanc */
.movement {
  color: #fff;
  border-color: var(--gold-dark);
  background: #1c1b15;
  letter-spacing: 0.04em;
}
.movement:hover, .movement:focus {
  background: linear-gradient(90deg, var(--gold-dark), #1c1b15 80%);
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  box-shadow: 0 2px 12px 0 rgba(224,182,76,0.13);
}

/* --- Job (métier) : fond or moyen, texte noir charbon */
.job {
  color: #18160a;
  background: var(--gold-medium);
  border-color: var(--gold-dark);
  letter-spacing: 0.01em;
}
.job:hover, .job:focus {
  background: var(--gold-bright);
  color: #1c1b15;
  border-color: #fffbe4;
  box-shadow: 0 3px 10px 0 var(--gold-medium);
}


/* ==========================================================================
   Pages de catégorie 
   ========================================================================== */

/* --- STYLE POUR L'EN-TÊTE DES PAGES DE CATÉGORIE --- */
.category-header {
    margin-bottom: 2rem; /* Ajoute un espace sous le titre avant la grille */
}

.category-header h1 {
    margin-bottom: 0.5rem; /* Espace entre le H1 et le paragraphe en dessous */
}

.no-results {
    text-align: center;
    padding: 4rem 1rem;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    margin-top: 2rem;
}

.no-results p {
    margin-bottom: 1rem;
    color: #cccccc;
}

/* Un style simple pour un bouton de retour */
.no-results .button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: #333;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.no-results .button:hover {
    background-color: #444;
}

.identity-meta a {
    text-decoration: none;
    color: inherit; /* Le lien prend la couleur de son parent */
    display: inline-block; /* Nécessaire pour que le lien se comporte bien */
}
.identity-meta a:hover .dates {
    text-decoration: underline; /* On souligne juste le texte au survol */
}

.page-header-with-image {
    display: flex;
    justify-content: space-between; /* Pousse le texte à gauche et l'image à droite */
    align-items: center; /* Centre verticalement */
    gap: 2rem;
    margin-bottom: 2rem;
}

.page-header-with-image .header-text {
    flex-grow: 1; /* Le texte prend toute la place disponible */
}

.page-header-with-image .header-image .flag-icon {
    display: block;
    width: 80px; /* Taille contrôlée et raisonnable */
    height: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Comportement sur les petits écrans (mobile) */
@media (max-width: 640px) {
    .page-header-with-image {
        flex-direction: column-reverse; /* Met l'image au-dessus du texte */
        text-align: center; /* Centre le texte */
    }
}

/* ==========================================================================
   Grille Publicitaire (Footer)
   ========================================================================== */
.ads-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Grille de 2 colonnes */
    gap: 1.5rem;
    max-width: var(--main-column-width);
    margin: 0 auto 2.5rem auto; /* Marge en bas pour séparer du copyright */
}

.ads-slot {
    border: 1px solid var(--border-color); /* Utilise la bordure dorée */
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.ads-slot:hover {
    background-color: rgba(224, 182, 76, 0.05); /* Léger fond doré au survol */
    border-color: var(--gold-medium);
    box-shadow: 0 0 15px rgba(224, 182, 76, 0.2); /* Effet de lueur dorée */
}

.ads-slot a {
    color: var(--text-color);
    opacity: 0.8;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.ads-slot:hover a {
    color: var(--gold-bright); /* Le texte devient doré au survol */
    opacity: 1;
}


/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    padding: 2rem 5%;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: bold;
}

.copyright {
    text-align: center;
    opacity: 0.7;
    font-size: 0.9rem;
}


/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .main-nav .nav-links { display: none; }
    .hamburger-menu { display: block; background: none; border: none; cursor: pointer; z-index: 1001; }
    .hamburger-menu .bar { display: block; width: 25px; height: 3px; margin: 5px auto; background-color: var(--text-color); transition: all 0.3s ease-in-out; }
    .nav-links.active { position: fixed; display: flex; top: 0; right: 0; flex-direction: column; justify-content: center; align-items: center; width: 70%; height: 100vh; background-color: var(--background-color); border-left: 1px solid var(--border-color); }
    .hamburger-menu.active .bar:nth-child(2) { opacity: 0; }
    .hamburger-menu.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger-menu.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .author-section { flex-direction: column; text-align: center; }
    .author-bio h1, .homepage-header h1 { font-size: 2.2rem; }
    
    .ads-grid { grid-template-columns: 1fr; } 

}