/* ==========================================================================
   Lore — « L'Histoire de Mysthale »
   Lecture narrative au scroll : typographie soignée, révélations douces,
   accents par Maison. Aucune dépendance hors app.css (variables réutilisées).
   Tout est préfixé .lx- et scopé via body[data-page="lore"].
   ========================================================================== */

body[data-page="lore"] {
  --lx-gold:   #d8b36a;
  --lx-gold-l: #f0d9a8;
  --lx-ink:    #dfe7f2;
  --lx-dim:    #93a5c0;
  --lx-accent: var(--lx-gold);
}

/* Halo d'ambiance fixe derrière le texte (au-dessus du canvas étoilé #bg) */
#lx-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% 12%, rgba(216, 179, 106, .07), transparent 70%),
    radial-gradient(ellipse 90% 60% at 50% 110%, rgba(37, 99, 235, .08), transparent 70%);
}

/* ==========================================================================
   Barre de progression de lecture
   ========================================================================== */
#lx-progress {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  height: 2px;
  width: 100%;
  z-index: 510;
  pointer-events: none;
}
#lx-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8a6a33, var(--lx-gold), var(--lx-gold-l));
  box-shadow: 0 0 12px rgba(216, 179, 106, .7);
}

/* ==========================================================================
   Rail de chapitres (desktop)
   ========================================================================== */
#lx-rail {
  position: fixed;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
.lx-rail-dot {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--lx-dim);
}
.lx-rail-dot i {
  width: 7px; height: 7px;
  border-radius: 1px;
  background: rgba(147, 165, 192, .3);
  border: 1px solid rgba(147, 165, 192, .35);
  transition: all .35s ease;
  flex-shrink: 0;
  transform: rotate(45deg);
}
.lx-rail-dot span {
  font-family: 'Cinzel', serif;
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .3s, transform .3s, color .3s;
  white-space: nowrap;
  pointer-events: none;
}
.lx-rail-dot:hover span { opacity: .85; transform: translateX(0); }
.lx-rail-dot.active i {
  background: var(--lx-accent);
  border-color: var(--lx-accent);
  box-shadow: 0 0 10px var(--lx-accent);
  transform: rotate(45deg) scale(1.35);
}
.lx-rail-dot.active span { opacity: 1; transform: translateX(0); color: var(--lx-accent); }

/* ==========================================================================
   Structure des chapitres
   ========================================================================== */
#lx-main {
  position: relative;
  z-index: 2;
}
.lx-chapter {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 16vh 24px;
}
.lx-panel {
  max-width: 680px;
  width: 100%;
}

/* Numéro de chapitre */
.lx-num {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .5em;
  color: var(--lx-accent);
  opacity: .8;
  margin-bottom: 18px;
  text-transform: uppercase;
}

/* Titre de chapitre */
.lx-title {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: clamp(1.9rem, 5vw, 3.1rem);
  line-height: 1.12;
  letter-spacing: .04em;
  margin-bottom: 26px;
  background: linear-gradient(180deg, #fff 10%, var(--lx-gold-l) 55%, #a8905e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-wrap: balance;
}

/* Ornement sous le titre */
.lx-orn {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}
.lx-orn::before,
.lx-orn::after {
  content: '';
  height: 1px;
  flex: 0 1 120px;
  background: linear-gradient(90deg, transparent, var(--lx-accent));
  opacity: .6;
}
.lx-orn::after {
  background: linear-gradient(90deg, var(--lx-accent), transparent);
}
.lx-orn svg {
  width: 18px; height: 18px;
  color: var(--lx-accent);
  opacity: .9;
  flex-shrink: 0;
  transform: rotate(45deg);
}

/* Corps de texte */
.lx-body p {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.14rem, 1.5vw, 1.3rem);
  font-weight: 500;
  line-height: 1.95;
  color: var(--lx-ink);
  margin-bottom: 1.5em;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
.lx-body p:last-child { margin-bottom: 0; }

/* Lettrine sur le premier paragraphe */
.lx-body p.lx-dropcap::first-letter {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: 3.6em;
  float: left;
  line-height: .82;
  padding: .08em .12em 0 0;
  color: var(--lx-accent);
  text-shadow: 0 0 24px color-mix(in srgb, var(--lx-accent) 55%, transparent);
}

/* Emphase dorée */
.lx-body em {
  font-style: normal;
  color: var(--lx-accent);
  font-weight: 600;
}

/* Liste (âge d'or) */
.lx-body ul {
  list-style: none;
  margin: 0 0 1.5em;
  padding: 0;
}
.lx-body ul li {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.14rem, 1.5vw, 1.3rem);
  font-weight: 500;
  line-height: 1.9;
  color: var(--lx-ink);
  padding-left: 30px;
  position: relative;
  margin-bottom: .4em;
}
.lx-body ul li::before {
  content: '◆';
  position: absolute;
  left: 4px;
  top: .65em;
  font-size: .6em;
  color: var(--lx-accent);
}

/* Citation / encart */
.lx-quote {
  margin: 2.2em 0 0;
  padding: 22px 28px;
  border-left: 2px solid var(--lx-accent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--lx-accent) 8%, transparent), transparent 80%);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(1.2rem, 1.7vw, 1.4rem);
  line-height: 1.8;
  color: var(--lx-gold-l);
}

/* ==========================================================================
   Héros (prologue)
   ========================================================================== */
#lx-hero {
  min-height: calc(100vh - var(--navbar-h));
  align-items: center;
  text-align: center;
  flex-direction: column;
  justify-content: center;
  padding-top: calc(var(--navbar-h) + 6vh);
}
.lx-hero-sur {
  font-family: 'Cinzel', serif;
  font-size: clamp(.68rem, 1.4vw, .85rem);
  font-weight: 600;
  letter-spacing: .55em;
  text-transform: uppercase;
  color: var(--lx-dim);
  margin-bottom: 28px;
}
.lx-hero-title {
  font-family: 'Cinzel', serif;
  font-weight: 800;
  font-size: clamp(2.5rem, 8vw, 5.6rem);
  line-height: 1.08;
  letter-spacing: .05em;
  filter: drop-shadow(0 6px 40px rgba(216, 179, 106, .25));
  margin-bottom: 32px;
  text-wrap: balance;
}
/* Le dégradé est porté par CHAQUE lettre (et non par le h1) : un descendant
   animé devient une couche de composition isolée et un background-clip:text
   posé sur le parent ne le peint plus (texte invisible sous Chromium). */
.lx-hero-title .lx-l {
  display: inline-block;
  background: linear-gradient(180deg, #fff 5%, var(--lx-gold-l) 50%, #8a6a33 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0;
  transform: translateY(.45em) rotateX(60deg);
  animation: lxLetter 1.1s cubic-bezier(.16, 1, .3, 1) forwards;
  animation-delay: calc(var(--i) * 55ms + 250ms);
}
@keyframes lxLetter {
  to { opacity: 1; transform: none; }
}
.lx-hero-sub {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--lx-dim);
  max-width: 560px;
  margin: 0 auto 60px;
  line-height: 1.7;
  opacity: 0;
  animation: lxFadeUp 1.4s ease 1.3s forwards;
}
@keyframes lxFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* Indice de scroll */
.lx-scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--lx-dim);
  font-family: 'Cinzel', serif;
  font-size: .62rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  opacity: 0;
  animation: lxFadeUp 1.2s ease 2s forwards;
}
.lx-scroll-hint::after {
  content: '';
  width: 1px;
  height: 44px;
  background: linear-gradient(180deg, var(--lx-gold), transparent);
  animation: lxHint 2s ease-in-out infinite;
}
@keyframes lxHint {
  0%, 100% { transform: scaleY(.3); transform-origin: top; opacity: .3; }
  50%      { transform: scaleY(1);  transform-origin: top; opacity: 1; }
}

/* ==========================================================================
   Maisons — accent par élément + emblème
   ========================================================================== */
.lx-chapter[data-house="solarius"] { --lx-accent: #ff9a4d; }
.lx-chapter[data-house="hydralis"] { --lx-accent: #5ec4ff; }
.lx-chapter[data-house="tellurik"] { --lx-accent: #7ddc8f; }
.lx-chapter[data-house="aeris"]    { --lx-accent: #c9a0ff; }

.lx-chapter[data-house] .lx-title {
  background: linear-gradient(180deg, #fff 10%, var(--lx-accent) 65%, color-mix(in srgb, var(--lx-accent) 55%, #000) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Lueur d'ambiance propre à chaque Maison derrière son panneau */
.lx-chapter[data-house]::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 50% at 50% 40%, color-mix(in srgb, var(--lx-accent) 7%, transparent), transparent 70%);
}

/* Bandeau élément */
.lx-house-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Cinzel', serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--lx-accent);
  border: 1px solid color-mix(in srgb, var(--lx-accent) 45%, transparent);
  background: color-mix(in srgb, var(--lx-accent) 10%, transparent);
  border-radius: 100px;
  padding: 8px 20px;
  margin-bottom: 22px;
}
.lx-house-tag i {
  width: 6px; height: 6px;
  background: var(--lx-accent);
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--lx-accent);
}

/* Emblème de Maison (glyphe emoji dans un sceau) */
.lx-house-emblem {
  float: right;
  width: 84px; height: 84px;
  margin: 0 0 12px 20px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--lx-accent) 45%, transparent);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--lx-accent) 30%, transparent), color-mix(in srgb, var(--lx-accent) 6%, transparent));
  box-shadow: 0 0 30px color-mix(in srgb, var(--lx-accent) 25%, transparent), inset 0 0 18px color-mix(in srgb, var(--lx-accent) 20%, transparent);
  display: grid;
  place-items: center;
  font-size: 2rem;
  user-select: none;
}

/* Traits / vertus de maison */
.lx-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}
.lx-trait {
  font-family: 'Cinzel', serif;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--lx-accent) 80%, #fff);
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--lx-accent) 30%, transparent);
  background: color-mix(in srgb, var(--lx-accent) 7%, transparent);
}

/* Chapitres sombres (Guerre / Silence) : accent inline sur la section */
.lx-chapter[data-mood="war"]     { --lx-accent: #ff6a5a; }
.lx-chapter[data-mood="silence"] { --lx-accent: #8fa2be; }

/* ==========================================================================
   Révélations au scroll
   ========================================================================== */
.lx-reveal {
  opacity: 0;
  transform: translateY(38px);
  transition: opacity 1.1s cubic-bezier(.16, 1, .3, 1), transform 1.1s cubic-bezier(.16, 1, .3, 1);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
.lx-chapter.in .lx-reveal {
  opacity: 1;
  transform: none;
}

/* ==========================================================================
   Épilogue / CTA
   ========================================================================== */
#lx-epilogue { text-align: center; padding-bottom: 22vh; }
#lx-epilogue .lx-panel { max-width: 760px; }
#lx-epilogue .lx-body p { text-align: center; }
.lx-cta-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 44px;
}
.lx-cta {
  font-family: 'Cinzel', serif;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 15px 34px;
  border-radius: 10px;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.lx-cta.primary {
  color: #120c02;
  background: linear-gradient(135deg, var(--lx-gold-l), var(--lx-gold) 60%, #a8823f);
  box-shadow: 0 8px 30px rgba(216, 179, 106, .35);
}
.lx-cta.primary:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(216, 179, 106, .5); }
.lx-cta.ghost {
  color: var(--lx-gold-l);
  border: 1px solid rgba(216, 179, 106, .4);
  background: rgba(216, 179, 106, .06);
}
.lx-cta.ghost:hover { background: rgba(216, 179, 106, .14); transform: translateY(-3px); }

/* Sceaux des quatre maisons dans l'épilogue */
.lx-seals {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 4vw, 40px);
  margin: 40px 0 10px;
  flex-wrap: wrap;
}
.lx-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.lx-seal i {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 35%, transparent), color-mix(in srgb, var(--c) 8%, transparent));
  box-shadow: 0 0 24px color-mix(in srgb, var(--c) 30%, transparent), inset 0 0 14px color-mix(in srgb, var(--c) 25%, transparent);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-style: normal;
}
.lx-seal span {
  font-family: 'Cinzel', serif;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--c);
}

/* ==========================================================================
   Responsive & accessibilité
   ========================================================================== */
@media (max-width: 900px) {
  #lx-rail { display: none; }
  .lx-chapter { padding: 12vh 20px; }
  .lx-body p, .lx-body ul li { text-align: left; }
  .lx-house-emblem { width: 64px; height: 64px; font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lx-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .lx-hero-title .lx-l { animation: none; opacity: 1; transform: none; }
  .lx-hero-sub, .lx-scroll-hint { animation: none; opacity: 1; }
  .lx-scroll-hint::after { animation: none; }
}
