/* ========== RESET ========= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ========== OPTIMISATIONS ANTI-TREMBLOTE GPU ========= */
html {
  /* Force smooth scrolling sans tremblote */
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  /* Optimisation GPU pour body */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
  -webkit-perspective: 1000px;
}

/* Tous les éléments avec hover ou transition */
*[style*="transform"],
*[style*="transition"],
.card,
.btn-primary,
.btn-secondary,
.nav-btn,
.character-photo img {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* Fix backgrounds fixed */
*[style*="background-attachment: fixed"] {
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ========== BASE ========= */
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: #05060a;
  color: #f4f4f4;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ========== HERO ACCUEIL ========= */

.hero {
  position: relative;
  min-height: 70vh;
  background: #000 url("images/bg-city.jpg") center/cover no-repeat fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  box-shadow: inset 0 -120px 180px rgba(0,0,0,0.9);
  /* Fix tremblote background fixed */
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 900px;
  transform: translateY(-30px); /* remonte le bloc */
}

.venator-logo {
  width: min(95%, 900px);
  height: auto;
  margin: 0.3rem auto 1.2rem;
  display: block;
}

.subtitle {
  font-size: 1.1rem;
  color: #ddd;
  margin-bottom: 0.6rem;
}

/* Blason Venatores sous le titre */
.venator-blazon {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  margin: 0 auto 1.2rem;
  border: 2px solid rgba(241, 209, 138, 0.7);
  box-shadow: 0 0 18px rgba(0,0,0,0.9);
}

/* Boutons */
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.6rem;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  background: radial-gradient(circle at top, #f1d18a 0%, #b27a30 75%);
  color: #101010;
  box-shadow: 0 8px 20px rgba(0,0,0,0.8);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.btn-primary:hover {
  background: radial-gradient(circle at top, #ffe2a7 0%, #c48a3a 75%);
  box-shadow: 0 0 18px rgba(255,215,0,0.45);
  transform: translateY(-1px) translateZ(0);
}

.btn-secondary {
  background: radial-gradient(circle at top, #252525 0%, #101010 75%);
  color: #f7f3de;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.btn-secondary:hover,
.btn-secondary-active {
  border-color: #ffd86a;
  box-shadow: 0 0 15px rgba(255,215,0,0.35);
  transform: translateY(-1px) translateZ(0);
}

/* ========== NAV ========= */

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  justify-content: center;
  padding: 0.8rem 1.2rem;
  background: rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.main-nav a {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #ddd;
}

.main-nav a:hover {
  color: #f1d18a;
}

/* ========== SECTIONS ========= */

.section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.section h2 {
  font-family: "Cinzel", serif;
  font-size: 1.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  border-bottom: 1px solid #333;
  padding-bottom: 0.5rem;
}

.section p {
  margin-bottom: 0.7rem;
  color: #ddd;
}

.section-music {
  background: radial-gradient(circle at top, rgba(255,255,255,0.03), transparent 60%);
  border-radius: 0.8rem;
  border: 1px solid #222;
}

.section-music .music-note {
  margin-top: 0.7rem;
  font-style: italic;
  color: #f1d18a;
}

/* ========== CARTES PERSONNAGES (HOME) ========= */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.card {
  background: #101119;
  border-radius: 0.9rem;
  border: 1px solid #24263a;
  padding: 1.4rem 1.1rem 1.3rem;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  cursor: pointer;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
}

.card:hover {
  transform: translateY(-4px) translateZ(0);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.9);
  border-color: rgba(241, 209, 138, 0.6);
}

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

/* Blasons dans les cartes */
.char-images {
  margin-bottom: 0.7rem;
  display: flex;
  justify-content: center;
}

/* >>> BLASONS PAGE D'ACCUEIL <<< */
.portrait-blason {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 2px solid rgba(241, 209, 138, 0.85);
  box-shadow: 0 0 16px rgba(0,0,0,0.9);
  background-color: #000;
  padding: 0;
  display: block;
  margin: 0 auto;
  /* Forcer découpe circulaire parfaite */
  clip-path: circle(50% at center);
}

/* Container pour éviter débordement */
.char-images {
  margin-bottom: 0.7rem;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

/* Titres cartes */
.char-name {
  font-family: "Cinzel", serif;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.char-subtitle {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #aaa;
  margin-bottom: 0.6rem;
}

/* ========== UNIVERS LIENS ========= */

.universe-links {
  list-style: none;
  margin-top: 0.7rem;
}

.universe-links li {
  margin-bottom: 0.4rem;
}

.universe-links a {
  color: #f1d18a;
  border-bottom: 1px dashed rgba(241,209,138,0.5);
}

.universe-links a:hover {
  border-bottom-style: solid;
}

/* ========== FOOTER ========= */

.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  color: #777;
  border-top: 1px solid #222;
  background: rgba(0, 0, 0, 0.9);
}

/* ========== PAGES PERSONNAGES ========= */

body.page-character {
  background: #05060a;
  color: #f5f5f5;
}

.character-main {
  min-height: 100vh;
}

/* Bandeau haut personnage */
.character-hero {
  position: relative;
  min-height: 240px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.85);
}

.character-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.45), rgba(0,0,0,0.9));
}

.character-hero-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 680px;
}

/* Blason perso dans le hero */
.character-blazon {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  border: 3px solid rgba(241,209,138,0.9);
  box-shadow: 0 0 24px rgba(0,0,0,0.95);
  background-color: #000;
  margin: 0 auto 0.9rem;
  display: block;
  padding: 0;
  /* Forcer découpe circulaire parfaite */
  clip-path: circle(50% at center);
}

/* Phrase traduite */
.character-quote-fr {
  font-family: "Cinzel", serif;
  font-size: 1rem;
  color: #f5e3b0;
  margin-bottom: 0.6rem;
}

/* Nom + rôle */
.character-name-title {
  font-family: "Cinzel", serif;
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 0.3rem;
}

.character-role {
  font-size: 0.9rem;
  color: #d6c59a;
}

/* Contenu de la fiche perso */
.section-character {
  max-width: 1600px; /* Réduit de 1800px */
  margin: 0 auto;
  padding: 2.2rem 1.5rem 3rem;
}

.character-layout {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 50-50 au lieu de 60-40 */
  gap: 2.5rem;
  align-items: flex-start;
}

/* Photos personnages (8 images) - RÉDUITES D'UN TIERS */
.character-photos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem; /* Réduit de 1.8rem */
  justify-content: center;
}

.character-photo {
  width: 100%;
}

.character-photo img {
  width: 100%;
  height: auto; /* Hauteur automatique selon ratio */
  border-radius: 0.7rem;
  object-fit: cover; /* COVER pour miniatures (pas contain) */
  background: #000;
  border: 1px solid rgba(241,209,138,0.6);
  box-shadow: 0 0 16px rgba(0,0,0,0.85);
  display: block;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.character-photo img:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: 0 0 24px rgba(241,209,138,0.4);
}

.character-photo figcaption {
  font-size: 0.8rem;
  margin-top: 0.4rem;
  color: #ccc;
  text-align: center;
}

/* Texte bio */
.character-bio {
  /* Prend toute la largeur de sa colonne */
}

.character-bio h2 {
  font-family: "Cinzel", serif;
  font-size: 1.4rem;
  margin-bottom: 0.8rem;
}

.character-bio p {
  margin-bottom: 0.8rem;
  line-height: 1.55;
}

/* Nav bas de fiche perso */
.character-nav {
  margin: 2rem -1.5rem 0; /* Marge négative pour annuler padding parent */
  padding: 1.5rem; /* Son propre padding */
  width: calc(100% + 3rem); /* Compense margin négative */
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  align-items: center;
}

.nav-btn {
  background: #111;
  border: 1px solid #d4af37;
  padding: 0.5rem 1.3rem;
  border-radius: 0.7rem;
  color: #f1d18a;
  cursor: pointer;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  transition: 0.2s;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.nav-btn:hover {
  background: #222;
  box-shadow: 0 0 14px rgba(212,175,55,0.4);
  transform: translateZ(0);
}

/* ========== LIGHTBOX PHOTOS ========= */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  display: none;
  text-align: center; /* Centre horizontalement */
  overflow: auto; /* Permet scroll */
  /* Astuce pour centrage vertical avec text-align */
  white-space: nowrap;
}

/* Pseudo-element pour centrage vertical */
.lightbox-overlay::before {
  content: '';
  display: inline-block;
  height: 100%;
  vertical-align: middle;
}

.lightbox-overlay.visible {
  display: block;
}

.lightbox-image {
  display: inline-block;
  vertical-align: middle;
  white-space: normal;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 0 30px rgba(0,0,0,0.9);
  border: 1px solid rgba(241,209,138,0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: #f1d18a;
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox-close:hover {
  color: #ffffff;
}

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

/* Sections auteur et mentions légales */
.author-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.author-content p:first-of-type {
  font-size: 1.05rem;
}

.section-legal {
  background: rgba(15, 15, 25, 0.6);
  border: 1px solid #2a2a3a;
  border-radius: 0.8rem;
  margin-top: 3rem;
}

.legal-content h3 {
  font-family: "Cinzel", serif;
  font-size: 1.1rem;
  color: #f1d18a;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  letter-spacing: 0.08em;
}

.legal-content h3:first-of-type {
  margin-top: 0;
}

.legal-content p {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: #ddd;
}

.legal-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #333;
  text-align: center;
  color: #f1d18a !important;
}

/* Marcus utilise Cinzel pour son nom uniquement */
.card-marcus .char-name,
.card-marcus h3 {
  font-family: "Cinzel", serif;
  letter-spacing: 0.08em;
}

.card-marcus .char-subtitle {
  font-family: "Cinzel", serif;
  font-style: italic;
}

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

@media (max-width: 900px) {
  .hero {
    min-height: 60vh;
    background-attachment: scroll;
  }

  .venator-logo {
    width: min(95%, 420px);
  }

  .section {
    padding-inline: 1.2rem;
  }

  .cards {
    grid-template-columns: 1fr;
  }

  .character-hero {
    padding-inline: 1.2rem;
  }

  /* Sur mobile: tout en 1 colonne */
  .character-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  /* 8 photos sur mobile: 2 colonnes */
  .character-photos {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }
  
  .character-bio {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  /* 8 photos sur très petit écran: 1 colonne pour taille optimale */
  .character-photos {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (min-width: 901px) and (max-width: 1400px) {
  /* Tablette: garder 2 colonnes mais réduire gap */
  .character-layout {
    gap: 2rem;
  }
  
  .character-photos {
    gap: 1.3rem;
  }
}
