/* ═══════════════════════════════════════════════
   VALORIA - Styles de base
   Thème médiéval-fantasy sombre avec accents dorés
   ═══════════════════════════════════════════════ */

:root {
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --gold-dark: #8a6e2a;
  --dark-bg: #0d0b08;
  --dark-surface: #141210;
  --dark-card: #1a1714;
  --dark-border: #2e2820;
  --stone: #3a3228;
  --text-primary: #f0e6cc;
  --text-muted: #9a8a6a;
  --red-accent: #8b2020;
  --emerald: #1a6b4a;
  --nav-h: 64px;
}

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

body {
  font-family: 'Crimson Pro', Georgia, serif;
  background: var(--dark-bg);
  color: var(--text-primary);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--dark-bg); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); }

/* ── NAVIGATION ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--nav-h);
  background: linear-gradient(180deg, rgba(30,22,12,0.65), rgba(20,15,8,0.55));
  border-bottom: 1px solid rgba(201,168,76,0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.4), 0 1px 0 rgba(201,168,76,0.1);
}

.nav-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0;
}
.nav-links li a {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  display: block;
  transition: color 0.2s;
}
.nav-links li a:hover,
.nav-links li a.active { color: var(--gold); }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.cart-btn {
  background: none;
  border: 1px solid var(--dark-border);
  color: var(--gold);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s;
}
.cart-btn:hover { border-color: var(--gold); }
#cart-count {
  display: inline-block;
  background: var(--gold);
  color: var(--dark-bg);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 20px;
  margin-left: 0.3rem;
}

.nav-cta {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dark-bg);
  background: var(--gold);
  border: none;
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}
.nav-cta:hover { background: var(--gold-light); }

.nav-user {
  display: none;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--dark-border);
  transition: border-color 0.2s;
}
.nav-user:hover { border-color: var(--gold-dark); }
.nav-user-avatar {
  width: 28px;
  height: 28px;
  background: var(--stone);
  border: 1px solid var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--gold);
  overflow: hidden;
}
.nav-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-user-name {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-transform: uppercase;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
}
.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--gold);
  display: block;
  transition: 0.3s;
}

/* ── MAIN ── */
main { padding-top: var(--nav-h); }

.page { display: none; min-height: calc(100vh - var(--nav-h)); }
.page.active { display: block; }

/* ── FOND PAGES INTÉRIEURES ── */
.page:not(#page-accueil) {
  position: relative;
  background-color: var(--dark-bg);
}

/* Image hero floutée en fond */
.page:not(#page-accueil)::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('../img/hero.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0.22;
  z-index: 0;
  pointer-events: none;
  filter: blur(2px) saturate(0.7);
}

/* Texture pierre par-dessus */
.page:not(#page-accueil)::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.025) 2px, rgba(0,0,0,0.025) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.015) 2px, rgba(0,0,0,0.015) 4px);
  opacity: 0.8;
  z-index: 0;
  pointer-events: none;
}

/* Contenu au-dessus du fond */
.page:not(#page-accueil) > * {
  position: relative;
  z-index: 1;
}

/* ── SCROLL REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(.22,1,.36,1), transform 0.8s cubic-bezier(.22,1,.36,1);
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ── ANIMATIONS GLOBALES ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(201,168,76,0.2); }
  50%       { box-shadow: 0 0 20px rgba(201,168,76,0.5); }
}

/* Animation d'apparition des pages */
.page.active .content,
.page.active .lore-chapter,
.page.active .news-card {
  animation: fadeInUp 0.5s ease both;
}
.page.active .lore-chapter:nth-child(2) { animation-delay: 0.05s; }
.page.active .lore-chapter:nth-child(3) { animation-delay: 0.10s; }
.page.active .lore-chapter:nth-child(4) { animation-delay: 0.15s; }
.page.active .lore-chapter:nth-child(5) { animation-delay: 0.20s; }

.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.page-title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 2.5rem;
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.page-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 3rem;
  font-style: italic;
}
.section-title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.8rem;
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 3rem 0 2rem;
}

/* ── HERO ── */
.hero {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 3rem 2rem;
  background: radial-gradient(ellipse at center, rgba(201, 168, 76, 0.08), transparent 70%);
}
.hero h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(3rem, 8vw, 6rem);
  color: var(--gold);
  letter-spacing: 0.2em;
  margin-bottom: 1rem;
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
}
.hero-tagline {
  font-size: 1.3rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 3rem;
  max-width: 600px;
}
.server-ip {
  background: var(--dark-card);
  border: 1px solid var(--gold-dark);
  padding: 1rem 2rem;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.server-ip:hover { border-color: var(--gold); }
.server-ip small { color: var(--text-muted); font-size: 0.75rem; }

.hero-stats {
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  margin-bottom: 2rem;
}
.hero-stats span { color: var(--gold); font-weight: 700; font-size: 1.2rem; }

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}
.hero-cta .btn-primary {
  width: auto;
  padding: 0.9rem 2rem;
}

/* ── CLASSES ── */
.classes-section { padding: 3rem 2rem; max-width: 1100px; margin: 0 auto; }
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.class-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s;
}
.class-card:hover {
  border-color: var(--gold-dark);
  transform: translateY(-4px);
}
.class-card h3 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
}
.class-card p { color: var(--text-muted); }

/* ── LORE ── */
.lore-chapter {
  background: linear-gradient(135deg, rgba(26,23,20,0.95), rgba(20,18,16,0.95));
  border-left: 3px solid var(--gold-dark);
  border-bottom: 1px solid rgba(138,110,42,0.15);
  padding: 2rem;
  margin-bottom: 2rem;
  transition: border-left-color 0.3s, box-shadow 0.3s;
  backdrop-filter: blur(4px);
}
.lore-chapter:hover {
  border-left-color: var(--gold);
  box-shadow: -4px 0 20px rgba(201,168,76,0.1), 0 4px 20px rgba(0,0,0,0.3);
}
.lore-chapter h2 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
}
.lore-chapter p { font-size: 1.1rem; color: var(--text-primary); line-height: 1.8; }

/* ── NEWS ── */
.news-card {
  background: linear-gradient(135deg, rgba(26,23,20,0.95), rgba(20,18,16,0.95));
  border: 1px solid var(--dark-border);
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
  backdrop-filter: blur(4px);
}
.news-card:hover {
  border-color: var(--gold-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.news-card h2 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.news-date {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* ── RÈGLES ── */
.rules-list {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  padding: 2rem 2rem 2rem 3.5rem;
}
.rules-list li {
  margin-bottom: 1rem;
  line-height: 1.7;
}
.rules-list strong { color: var(--gold); }

/* ═══════════════════════════════════════════════
   RESPONSIVE MOBILE
   ═══════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ── NAVIGATION ── */
  nav { padding: 0 1rem; }
  .nav-logo img { height: 36px; width: 36px; }
  .nav-logo { font-size: 0.9rem; }
  .nav-right .nav-cta { display: none; }

  /* Dropdown "Plus" en mobile */
  .nav-dropdown-menu {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    transform: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    min-width: 100%;
  }

  /* ── HERO ── */
  .hero-bg-img { height: 100% !important; }

  #page-accueil > div:first-child {
    min-height: 100svh;
    padding: 1rem;
  }

  #page-accueil img[alt="Valoria"] {
    width: 160px !important;
    height: 160px !important;
  }

  /* Statut serveur */
  #page-accueil [style*="border-radius:50px"] {
    flex-direction: column;
    gap: 0.5rem !important;
    padding: 0.8rem 1.2rem !important;
  }

  /* ── CONTENU ── */
  .content { padding: 2rem 1rem; }
  .page-title { font-size: 1.5rem !important; }

  /* ── CLASSES ── */
  #page-accueil > div:nth-child(2) {
    padding: 3rem 1rem !important;
  }
  #page-accueil > div:nth-child(2) > div:last-child {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.8rem !important;
  }

  /* Features section */
  #page-accueil > div:last-child > div {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* ── LORE ── */
  .lore-chapter { padding: 1.2rem; }
  .lore-chapter h2 { font-size: 1.1rem; }
  .lore-chapter p { font-size: 1rem; }

  /* ── BOUTIQUE PALIERS ── */
  #page-boutique > .content > div[style*="grid"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.8rem !important;
  }

  /* Champ montant */
  #don-input { width: 140px !important; }

  /* ── CLASSEMENT ── */
  .lb-filters { flex-wrap: wrap; gap: 0.4rem; }
  .lb-filter { font-size: 0.7rem; padding: 0.4rem 0.8rem; }
  .lb-table th, .lb-table td { padding: 0.5rem 0.4rem; font-size: 0.8rem; }

  /* ── STAFF ── */
  #page-staff .content > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
  #page-staff .content > div:nth-child(4) {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ── WIKI ── */
  #page-wiki table { font-size: 0.8rem; }
  #page-wiki td, #page-wiki th { padding: 0.4rem !important; }
  #page-wiki [style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* ── FAQ ── */
  .faq-question { font-size: 0.8rem; padding: 0.8rem 1rem; }
  .faq-answer p { padding: 0.8rem 1rem; font-size: 0.85rem; }

  /* ── CHANGELOG ── */
  .changelog-entry { padding-left: 36px !important; }

  /* ── BOUTON DISCORD ── */
  #discord-fab {
    width: 48px !important;
    height: 48px !important;
    bottom: 1.2rem !important;
    right: 1.2rem !important;
  }

  /* ── MODALE ── */
  .modal-content { margin: 1rem; max-width: calc(100% - 2rem) !important; }

  /* ── PANIER ── */
  .cart-panel { width: 100%; right: -100%; }

  /* ── NEWS ── */
  .news-card { padding: 1.2rem; }
  .news-card h2 { font-size: 1.1rem; }
}

@media (max-width: 480px) {
  /* Très petits écrans */
  #page-accueil > div:nth-child(2) > div:last-child {
    grid-template-columns: 1fr !important;
  }
  #page-boutique > .content > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
  #page-staff .content > div:nth-child(4) {
    grid-template-columns: 1fr !important;
  }
  .lb-table { font-size: 0.75rem; }
  .page-title { font-size: 1.3rem !important; }
}

/* ── CORRECTIONS MOBILE NAVBAR & CTA ── */
@media (max-width: 768px) {
  /* Bouton connexion plus petit sur mobile */
  .nav-cta { 
    display: block !important;
    font-size: 0.7rem !important;
    padding: 0.4rem 0.8rem !important;
    border-radius: 50px !important;
  }

  /* Cacher le panier dans la nav sur mobile aussi */
  .cart-btn { display: none !important; }

  /* Boutons CTA hero en colonne et pas pleine largeur */
  #page-accueil [style*="display:flex;gap:1rem;justify-content:center"] {
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.8rem !important;
  }
  #page-accueil [style*="display:flex;gap:1rem;justify-content:center"] button {
    width: 280px !important;
    max-width: 90vw !important;
  }

  /* Bouton Discord plus bas pour éviter chevauchement */
  #discord-fab {
    bottom: 1.5rem !important;
    right: 1rem !important;
  }

  /* Statut serveur moins large */
  #page-accueil [onclick="copyIP()"] small { display: none; }
}

/* ── MENU MOBILE COMPLET ── */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(13,11,8,0.98);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 0.5rem 0 1rem;
    display: none;
    border-bottom: 1px solid var(--gold-dark);
    z-index: 199;
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .nav-links.open { display: flex; }

  .nav-links > li > a {
    display: block;
    padding: 0.85rem 1.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(201,168,76,0.08);
    width: 100%;
  }

  /* Dropdown "Plus" en mobile — liste dépliée directement */
  .nav-dropdown { width: 100%; }
  .nav-dropdown-toggle {
    display: block;
    padding: 0.85rem 1.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(201,168,76,0.08);
    width: 100%;
  }
  .nav-dropdown-menu {
    position: static !important;
    transform: none !important;
    background: rgba(201,168,76,0.04);
    border: none;
    border-radius: 0;
    border-top: 1px solid rgba(201,168,76,0.08);
    box-shadow: none;
    min-width: 100%;
    padding: 0;
    animation: none;
  }
  .nav-dropdown.open .nav-dropdown-menu { display: block; }
  .nav-dropdown-menu a {
    padding: 0.75rem 2rem;
    border-bottom: 1px solid rgba(201,168,76,0.05);
    font-size: 0.85rem;
  }
  .nav-dropdown-menu a:hover { padding-left: 2.5rem; }
}

/* ── FIX NAV CONNECTÉ MOBILE ── */
@media (max-width: 768px) {
  .nav-user-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.75rem;
  }
  .nav-user-avatar {
    width: 28px !important;
    height: 28px !important;
  }
  .nav-user {
    gap: 0.3rem !important;
  }
  /* S'assurer que le hamburger reste visible */
  .hamburger {
    display: flex !important;
    flex-shrink: 0;
    margin-left: 0.3rem;
  }
  .nav-right {
    gap: 0.4rem !important;
    overflow: hidden;
    flex-wrap: nowrap;
    max-width: calc(100vw - 120px);
  }
}

/* ── PARALLAX MOBILE FIX ── */
@media (max-width: 768px) {
  .hero-bg-img {
    background-attachment: scroll !important;
    transform: none !important;
  }
}
