/*
  Signature projet : site developpe par phomsay pour zaki.
  Contact Discord : @phomsay671.
  Dev web : phomsay. Admin : sauci.
  Travail de recherche et edition : Zaki & B.
  Ne pas supprimer cette signature pour les prochains devs qui travaillent sur le projet.
*/

:root {
  /* Meme base visuelle que l'index Histoire, mais avec moins d'effets de scroll. */
  --gold: #c9a84c;
  --gold-light: #e8c97a;
  --wakfu-teal: #2ecfb0;
  --dark-bg: #080810;
  --card-bg: #0d0d1a;
  --text-main: #e8e0d0;
  --text-muted: #a99d88;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--dark-bg);
  color: var(--text-main);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
}

/* Quelques etoiles fixes pour garder le fond vivant sous les panneaux. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 15%, rgba(255,255,255,0.55) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 50%, rgba(255,255,255,0.32) 0%, transparent 100%),
    radial-gradient(1px 1px at 78% 22%, rgba(255,255,255,0.46) 0%, transparent 100%),
    radial-gradient(2px 2px at 72% 72%, rgba(46,207,176,0.25) 0%, transparent 100%),
    radial-gradient(2px 2px at 24% 78%, rgba(201,168,76,0.26) 0%, transparent 100%);
}

header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid rgba(201,168,76,0.15);
}

/* Navigation partagee, volontairement proche des autres sections du site. */
.site-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  background: rgba(7, 7, 12, 0.94);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  color: #f6f2e7;
  text-decoration: none;
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand span { line-height: 1; }

.top-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-item { position: relative; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.85rem;
  border: 0;
  background: transparent;
  color: #f3efe4;
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.active,
.nav-item:focus-within > .nav-link {
  color: var(--gold-light);
  background: rgba(201,168,76,0.08);
  outline: none;
}

.nav-caret {
  font-size: 0.8em;
  opacity: 0.8;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 240px;
  padding: 0.45rem;
  border: 1px solid rgba(201,168,76,0.16);
  background: rgba(12, 12, 18, 0.97);
  box-shadow: 0 16px 35px rgba(0,0,0,0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.nav-dropdown:hover .nav-menu,
.nav-dropdown:focus-within .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-menu-item {
  width: 100%;
  display: block;
  padding: 0.7rem 0.8rem;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
  text-decoration: none;
}

.nav-menu-item:hover,
.nav-menu-item:focus-visible {
  background: rgba(201,168,76,0.08);
  color: var(--gold-light);
  outline: none;
}

/* Heros des pages detail: l'image change via la variable inline --hero-image dans le HTML. */
.history-detail-hero {
  position: relative;
  z-index: 1;
  min-height: 72vh;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-bottom: 1px solid rgba(201,168,76,0.16);
  background: #080810;
}

.history-detail-hero::before,
/* Double voile pour garder la scene lisible, peu importe la luminosite de l'image source. */
.history-detail-hero::after {
  content: '';
  position: absolute;
  inset: 0;
}

.history-detail-hero::before {
  background-image: var(--hero-image);
  background-position: center;
  background-size: cover;
  filter: saturate(0.95) contrast(1.06);
  transform: scale(1.02);
}

.history-detail-hero::after {
  background:
    linear-gradient(to bottom, rgba(8,8,16,0.08), rgba(8,8,16,0.38) 44%, rgba(8,8,16,0.98) 100%),
    linear-gradient(to right, rgba(8,8,16,0.92), rgba(8,8,16,0.38) 45%, rgba(8,8,16,0.82));
}

.history-detail-hero-content {
  position: relative;
  z-index: 2;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(5rem, 11vw, 8rem) 0 clamp(3rem, 8vw, 5rem);
}

.history-eyebrow {
  color: var(--gold-light);
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.history-detail-hero h1 {
  max-width: 960px;
  margin-top: 0.7rem;
  color: #fff7df;
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(2.5rem, 8vw, 6.2rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: 0;
  text-shadow: 0 14px 42px rgba(0,0,0,0.9), 0 0 26px rgba(201,168,76,0.18);
}

.history-detail-lead {
  width: min(780px, 100%);
  margin-top: 1.2rem;
  color: #f3ead8;
  font-size: clamp(1.08rem, 1.8vw, 1.3rem);
  line-height: 1.7;
  text-shadow: 0 6px 24px rgba(0,0,0,0.92);
}

/* Mise en page principale: texte long a gauche, repère rapide a droite. */
.history-detail-main {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 4rem 0 6rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 2rem;
}

.history-detail-panel,
.history-detail-side {
  border: 1px solid rgba(201,168,76,0.18);
  background: linear-gradient(180deg, rgba(13,13,26,0.86), rgba(8,8,16,0.72));
  box-shadow: 0 24px 60px rgba(0,0,0,0.32);
  backdrop-filter: blur(6px);
}

/* Le panneau de lecture reste sobre: le decor est deja porte par le hero. */
.history-detail-panel {
  padding: clamp(1.45rem, 4vw, 3rem);
}

.history-section-title {
  margin-bottom: 1.1rem;
  color: var(--gold-light);
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.history-detail-panel p {
  margin-bottom: 1.2rem;
  color: #d7ccba;
  text-align: justify;
}

.history-detail-panel > p:first-of-type::first-letter {
  float: left;
  padding: 0.1rem 0.55rem 0.08rem 0;
  color: var(--gold-light);
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: 4.4rem;
  line-height: 0.82;
  text-shadow: 0 0 16px rgba(232,201,122,0.34);
}

.history-script-illustration {
  position: relative;
  width: min(420px, 100%);
  margin: 2.75rem auto 2.95rem;
  padding: 1.15rem 0;
}

.history-script-illustration::before,
.history-script-illustration::after {
  content: '';
  position: absolute;
  left: 50%;
  width: min(560px, 112%);
  height: 1px;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg,
      transparent,
      rgba(232,201,122,0.28) 15%,
      rgba(255,247,223,0.82) 50%,
      rgba(232,201,122,0.28) 85%,
      transparent);
  box-shadow: 0 0 12px rgba(232,201,122,0.16);
}

.history-script-illustration::before {
  top: 0;
}

.history-script-illustration::after {
  bottom: 0;
}

.history-script-illustration button {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(232,201,122,0.32);
  border-radius: 6px;
  background: rgba(4,4,12,0.5);
  box-shadow: 0 18px 42px rgba(0,0,0,0.32);
  cursor: zoom-in;
  overflow: hidden;
}

.history-script-illustration button:hover,
.history-script-illustration button:focus-visible {
  border-color: rgba(255,239,180,0.68);
  outline: none;
}

.history-script-illustration img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: rgba(5,6,14,0.82);
}

.history-image-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1120px, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100vh - 2rem);
  margin: 0;
  padding: 0;
  border: 1px solid rgba(232,201,122,0.38);
  border-radius: 8px;
  background: rgba(5,6,14,0.96);
  box-shadow: 0 34px 100px rgba(0,0,0,0.68);
  overflow: hidden;
}

.history-image-dialog::backdrop {
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(4px);
}

.history-image-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 2rem);
  object-fit: contain;
}

.history-image-dialog-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.15rem;
  height: 2.15rem;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 50%;
  background: rgba(0,0,0,0.56);
  color: #fff7df;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.history-detail-panel ul {
  list-style: none;
  display: grid;
  gap: 0.65rem;
  margin: 0 0 1.5rem;
}

.history-detail-panel li {
  position: relative;
  padding-left: 1.05rem;
  color: #d7ccba;
}

/* La puce doree remplace les bullets natives pour rester dans le ton Krosmoz. */
.history-detail-panel li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.78rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-light);
  box-shadow: 0 0 10px rgba(232,201,122,0.44);
}

.history-detail-side {
  align-self: start;
  position: sticky;
  top: 5.8rem;
  padding: 1.4rem;
}

.history-info-title {
  margin-bottom: 1.2rem;
  color: #fff7df;
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.history-info-block {
  padding: 1rem 0;
  border-top: 1px solid rgba(201,168,76,0.14);
}

.history-info-label {
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.history-info-value {
  color: var(--gold-light);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Le lien retour ferme la page sans forcer une navigation lourde. */
.history-back-link {
  display: inline-flex;
  margin-top: 1rem;
  color: var(--gold-light);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}

.history-back-link:hover,
.history-back-link:focus-visible {
  color: #fff7df;
  outline: none;
}

/* Sur tablette/mobile, le repère passe naturellement sous le texte. */
@media (max-width: 900px) {
  .site-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
  }

  .history-detail-main {
    grid-template-columns: 1fr;
  }

  .history-detail-side {
    position: static;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 17px;
  }

  .top-nav {
    width: 100%;
    gap: 0.15rem;
  }

  .nav-link {
    padding: 0.55rem 0.65rem;
    font-size: 0.68rem;
  }

  .history-detail-hero {
    min-height: 68vh;
  }

  .history-detail-panel p {
    text-align: left;
  }
}

.back-to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 60;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(232,201,122,0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(46,207,176,0.14), transparent 38%),
    radial-gradient(circle at 36% 28%, rgba(255,247,223,0.16), transparent 30%),
    linear-gradient(145deg, rgba(18,18,30,0.98), rgba(6,6,12,0.96) 66%);
  color: var(--gold-light);
  font-size: 0;
  clip-path: none;
  box-shadow:
    0 18px 42px rgba(0,0,0,0.56),
    inset 0 0 0 4px rgba(8,8,16,0.78),
    0 0 0 1px rgba(255,247,223,0.08),
    0 0 28px rgba(46,207,176,0.12);
  transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease, color 0.22s ease;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  cursor: pointer;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  color: transparent;
}

.back-to-top::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 28px;
  background: currentColor;
  clip-path: polygon(12% 0, 100% 50%, 12% 100%);
  transform: translate(-50%, -54%) rotate(-90deg);
  filter: drop-shadow(0 0 6px rgba(232,201,122,0.34));
}

.back-to-top:hover,
.back-to-top:focus-visible {
  border-color: rgba(255,239,178,0.92);
  background:
    radial-gradient(circle at 50% 50%, rgba(46,207,176,0.2), transparent 42%),
    radial-gradient(circle at 36% 28%, rgba(255,247,223,0.22), transparent 32%),
    linear-gradient(145deg, rgba(30,26,32,0.98), rgba(9,9,16,0.98) 66%);
  color: #fff7df;
  box-shadow:
    0 22px 50px rgba(0,0,0,0.64),
    inset 0 0 0 4px rgba(8,8,16,0.7),
    inset 0 0 0 6px rgba(232,201,122,0.56),
    0 0 0 1px rgba(255,247,223,0.14),
    0 0 30px rgba(201,168,76,0.2),
    0 0 38px rgba(46,207,176,0.14);
  transform: translateY(0) scale(1.1);
}

/* Place le lien Contactez-nous a droite de la navigation principale. */
.top-nav { flex: 1; }
.top-nav > a[href$="contact.html"],
.top-nav > a[href$="contact-html/contact.html"] { margin-left: auto; }

/* mobile-nav:start */
.mobile-nav-toggle {
  display: none;
}

@media (max-width: 720px) {
  .site-topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center !important;
    gap: 0.55rem !important;
    padding: 0.55rem 0.85rem !important;
  }

  .brand {
    min-width: 0;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .brand span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.46rem;
    min-height: 36px;
    padding: 0.46rem 0.68rem;
    border: 1px solid rgba(201, 168, 76, 0.34);
    border-radius: 3px;
    background: rgba(12, 10, 8, 0.72);
    color: #f3df9b;
    font: inherit;
    font-family: 'Cinzel', Georgia, serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: inset 0 0 0 1px rgba(255, 247, 223, 0.05), 0 8px 22px rgba(0, 0, 0, 0.24);
    cursor: pointer;
  }

  .mobile-nav-icon,
  .mobile-nav-icon::before,
  .mobile-nav-icon::after {
    display: block;
    width: 16px;
    height: 1px;
    background: currentColor;
    content: "";
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .mobile-nav-icon {
    position: relative;
  }

  .mobile-nav-icon::before,
  .mobile-nav-icon::after {
    position: absolute;
    left: 0;
  }

  .mobile-nav-icon::before {
    top: -5px;
  }

  .mobile-nav-icon::after {
    top: 5px;
  }

  .site-topbar.is-mobile-nav-open .mobile-nav-icon {
    background: transparent;
  }

  .site-topbar.is-mobile-nav-open .mobile-nav-icon::before {
    transform: translateY(5px) rotate(45deg);
  }

  .site-topbar.is-mobile-nav-open .mobile-nav-icon::after {
    transform: translateY(-5px) rotate(-45deg);
  }

  .top-nav {
    grid-column: 1 / -1;
    width: 100% !important;
    max-height: 0;
    display: grid !important;
    gap: 0.26rem !important;
    flex: unset !important;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.24s ease, opacity 0.2s ease, padding-top 0.2s ease;
  }

  .site-topbar.is-mobile-nav-open .top-nav {
    max-height: 72vh;
    padding-top: 0.34rem;
    opacity: 1;
  }

  .top-nav .nav-link {
    width: 100%;
    justify-content: space-between;
    padding: 0.62rem 0.72rem;
    font-size: 0.68rem;
  }

  .top-nav > a[href$="contact.html"],
  .top-nav > a[href$="contact-html/contact.html"] {
    margin-left: 0 !important;
  }

  .nav-item,
  .nav-dropdown {
    width: 100%;
  }

  .nav-menu {
    position: static !important;
    display: none;
    width: 100%;
    min-width: 0 !important;
    margin: 0.2rem 0 0;
    padding: 0.25rem;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    box-shadow: none;
  }

  .nav-dropdown:focus-within .nav-menu,
  .nav-dropdown:hover .nav-menu {
    display: grid;
  }

  .site-topbar > .krosmoz-top-social-links,
  .site-topbar > .krosmoz-header-contact {
    display: none !important;
    grid-column: 1 / -1;
  }

  .site-topbar.is-mobile-nav-open > .krosmoz-top-social-links {
    display: inline-flex !important;
    justify-self: end;
    margin-left: 0;
    padding-top: 0.15rem;
  }

  .site-topbar.is-mobile-nav-open > .krosmoz-header-contact {
    display: inline-flex !important;
    width: 100%;
    justify-content: center;
    margin-left: 0 !important;
  }
}
/* mobile-nav:end */

/* mobile-menu-icon:start */
@media (max-width: 720px) {
  .mobile-nav-icon,
  .mobile-nav-icon::before,
  .mobile-nav-icon::after {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: none !important;
    opacity: 1;
  }

  .mobile-nav-icon::before {
    top: -6px;
  }

  .mobile-nav-icon::after {
    top: 6px;
  }

  .site-topbar.is-mobile-nav-open .mobile-nav-icon {
    background: currentColor;
  }
}
/* mobile-menu-icon:end */
