/*
 Theme Name:   Morpheus Livre Ouvert
 Theme URI:    https://www.morpheusavocats.fr
 Description:  Thème enfant Astra – Livre NRF Collection Blanche pour Morpheus Avocats SELAS
 Author:       François Vannesson
 Author URI:   https://www.morpheusavocats.fr
 Template:     astra
 Version:      4.0.0
 License:      Proprietary
 Text Domain:  morpheus-livre-ouvert
*/

/* ═══════════════════════════════════════════════════════════
   MORPHEUS AVOCATS – LIVRE NRF v4.0
   Collection Blanche Gallimard · Retournement 3D de pages
   ═══════════════════════════════════════════════════════════ */

/* ── Imports typographiques ── */
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Cormorant+SC:wght@300;400;500;600;700&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

/* ── Variables ── */
:root {
  --nrf-creme:       #F5F1E8;
  --nrf-creme-clair: #FDFBF6;
  --nrf-creme-fonce: #EDE8DA;
  --nrf-rouge:       #8B2D2D;
  --nrf-rouge-clair: rgba(139, 45, 45, 0.6);
  --nrf-noir:        #1A1814;
  --nrf-noir-doux:   rgba(26, 24, 20, 0.7);
  --nrf-garamond:    'EB Garamond', 'Cormorant Garamond', Georgia, serif;
  --nrf-petites-cap: 'Cormorant SC', Georgia, serif;
  --nrf-anim:        800ms;
  --nrf-easing:      cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ── Reset global ── */
html, body {
  overflow: hidden !important;
  height: 100vh !important;
  margin: 0; padding: 0;
}

/* ═══════════════════════════════════════════
   1. SCÈNE PRINCIPALE
   ═══════════════════════════════════════════ */
.nrf-scene {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 80%, rgba(80, 50, 25, 0.12) 0%, transparent 60%),
    linear-gradient(180deg,
      #6B4423 0%,
      #8B6340 15%,
      #7A5533 30%,
      #6B4423 50%,
      #8B6340 70%,
      #7A5533 85%,
      #6B4423 100%
    );
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 9990;
}

/* Texture bois subtile */
.nrf-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    2deg,
    transparent 0px,
    rgba(0,0,0,0.03) 1px,
    transparent 2px,
    transparent 8px
  );
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   2. PREMIÈRE DE COUVERTURE
   ═══════════════════════════════════════════ */
.nrf-couverture {
  width: 420px;
  max-width: 85vw;
  aspect-ratio: 120 / 200;
  background: var(--nrf-creme);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-shadow:
    4px 6px 20px rgba(0,0,0,0.35),
    1px 1px 3px rgba(0,0,0,0.15),
    inset 0 0 40px rgba(0,0,0,0.03);
  transition: transform var(--nrf-anim) var(--nrf-easing),
              opacity var(--nrf-anim) var(--nrf-easing);
  transform-origin: left center;
}

/* Animation d'ouverture de la couverture */
.nrf-couverture.couv-ouvrant {
  transform: perspective(1200px) rotateY(-160deg);
  opacity: 0;
}

/* Bordure extérieure rouge (double filet NRF) */
.couv-bordure-ext {
  position: absolute;
  inset: 12px;
  border: 2px solid var(--nrf-rouge);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Bordure intérieure noire */
.couv-bordure-int {
  position: absolute;
  inset: 4px;
  border: 0.5px solid var(--nrf-noir);
  display: flex;
  align-items: center;
  justify-content: center;
}

.couv-contenu {
  text-align: center;
  padding: 20px;
}

.couv-logo {
  margin-bottom: 24px;
}

.couv-auteur {
  font-family: var(--nrf-garamond);
  font-size: 16px;
  font-weight: 400;
  color: var(--nrf-noir);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.couv-titre {
  font-family: var(--nrf-petites-cap);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--nrf-noir);
  line-height: 1.2;
  margin-bottom: 16px;
}

.couv-devise {
  font-family: var(--nrf-garamond);
  font-size: 13px;
  color: var(--nrf-noir-doux);
  line-height: 1.7;
  margin-bottom: 28px;
}

.couv-editeur {
  font-family: var(--nrf-petites-cap);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(26, 24, 20, 0.45);
}

/* Indication de scroll */
.couv-scroll-hint {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--nrf-petites-cap);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(245, 241, 232, 0.6);
  animation: pulse-hint 2s infinite ease-in-out;
  white-space: nowrap;
}

.scroll-chevron {
  display: inline-block;
  animation: chevron-bounce 2s infinite ease-in-out;
}

@keyframes pulse-hint {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

@keyframes chevron-bounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

/* ═══════════════════════════════════════════
   3. LIVRE OUVERT
   ═══════════════════════════════════════════ */
.nrf-livre {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100vh - 80px);
}

.livre-3d {
  position: relative;
  width: 920px;
  max-width: 94vw;
  height: 600px;
  max-height: 75vh;
  perspective: 2000px;
  transform-style: preserve-3d;
}

/* ═══════════════════════════════════════════
   4. PAGES DU LIVRE (3D)
   ═══════════════════════════════════════════ */

/* Page fixe (gauche ou droite, toujours visible) */
.page-fixe {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
}

.page-gauche {
  left: 0;
  border-radius: 3px 0 0 3px;
}

.page-droite {
  right: 0;
  border-radius: 0 3px 3px 0;
}

/* Papier (fond de page) */
.page-papier {
  width: 100%;
  height: 100%;
  background: var(--nrf-creme);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,45,45,0.25) transparent;
}

.page-papier::-webkit-scrollbar { width: 5px; }
.page-papier::-webkit-scrollbar-track { background: transparent; }
.page-papier::-webkit-scrollbar-thumb {
  background: rgba(139,45,45,0.25);
  border-radius: 3px;
}

/* Nuance gauche/droite */
.page-gauche .page-papier {
  background: var(--nrf-creme-fonce);
  box-shadow: inset -8px 0 16px -8px rgba(0,0,0,0.06);
}

.page-droite .page-papier {
  background: var(--nrf-creme-clair);
  box-shadow: inset 8px 0 16px -8px rgba(0,0,0,0.04);
}

/* ── Page tournante (animation 3D) ── */
.page-tournante {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: left center;
  z-index: 10;
  display: none;
}

.page-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.page-face-recto {
  transform: rotateY(0deg);
}

.page-face-recto .page-papier {
  background: var(--nrf-creme-clair);
  box-shadow: inset 8px 0 16px -8px rgba(0,0,0,0.04);
}

.page-face-verso {
  transform: rotateY(180deg);
}

.page-face-verso .page-papier {
  background: var(--nrf-creme-fonce);
  box-shadow: inset -8px 0 16px -8px rgba(0,0,0,0.06);
}

/* Ombre pendant le retournement */
.page-tournante::after {
  content: '';
  position: absolute;
  top: 0;
  left: -30px;
  width: 30px;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.08));
  pointer-events: none;
}

/* Reliure (ombre au centre) */
.livre-reliure-ombre {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 100%;
  background: linear-gradient(to right,
    rgba(0,0,0,0.10) 0%,
    rgba(0,0,0,0.03) 30%,
    rgba(0,0,0,0.00) 50%,
    rgba(0,0,0,0.03) 70%,
    rgba(0,0,0,0.10) 100%
  );
  z-index: 20;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   5. TYPOGRAPHIE DES PAGES INTÉRIEURES
   ═══════════════════════════════════════════ */

.page-inner {
  padding: 36px 32px 40px;
  font-family: var(--nrf-garamond);
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--nrf-noir);
  height: 100%;
  box-sizing: border-box;
}

/* Page centrée (faux-titre, belle-page, dédicace, 4e) */
.page-centree {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Page vide */
.page-vide {
  background: var(--nrf-creme);
}

/* ── Faux-titre ── */
.faux-titre-texte,
.page-faux-titre .faux-titre-texte {
  font-family: var(--nrf-petites-cap);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--nrf-noir);
}

/* ── Du même auteur ── */
.dma-titre {
  font-family: var(--nrf-petites-cap);
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--nrf-noir-doux);
  margin-bottom: 16px;
}

.dma-filet {
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--nrf-rouge), transparent);
  margin: 0 auto 20px;
}

.dma-item {
  font-family: var(--nrf-garamond);
  font-size: 13px;
  color: var(--nrf-noir-doux);
  margin: 6px 0;
  line-height: 1.6;
}

/* ── Page de titre ── */
.pt-auteur {
  font-family: var(--nrf-petites-cap);
  font-size: 14px;
  letter-spacing: 0.18em;
  color: rgba(26,24,20,0.55);
  margin-bottom: 20px;
}

.pt-titre {
  font-family: var(--nrf-petites-cap);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--nrf-rouge);
  line-height: 1.15;
  margin-bottom: 16px;
}

.pt-filet {
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--nrf-rouge), transparent);
  margin: 8px auto;
}

.pt-devise {
  font-family: var(--nrf-garamond);
  font-size: 14px;
  color: var(--nrf-noir-doux);
  line-height: 1.7;
  margin: 12px 0;
}

.pt-logo { margin: 20px 0 8px; }

.pt-editeur {
  font-family: var(--nrf-petites-cap);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(26,24,20,0.4);
  margin-top: 12px;
}

/* ── Copyright ── */
.page-copyright-inner {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 48px;
}

.cp-texte p {
  font-family: var(--nrf-garamond);
  font-size: 12px;
  line-height: 1.7;
  color: var(--nrf-noir-doux);
  margin: 0 0 4px;
  text-align: center;
}

.cp-petit { font-size: 11px; color: rgba(26,24,20,0.5); }

.cp-filet {
  width: 30%;
  height: 0.5px;
  background: rgba(139,45,45,0.3);
  margin: 16px auto;
}

.cp-acheve {
  margin-top: 20px;
  font-size: 11px;
  color: rgba(26,24,20,0.4);
}

/* ── Dédicace ── */
.ded-texte {
  font-family: var(--nrf-garamond);
  font-size: 15px;
  color: var(--nrf-noir-doux);
  line-height: 1.8;
  max-width: 320px;
  text-align: center;
}

.ded-auteur {
  font-family: var(--nrf-petites-cap);
  font-size: 12px;
  letter-spacing: 0.15em;
  color: rgba(26,24,20,0.45);
  margin-top: 16px;
}

/* ── Sommaire ── */
.som-titre {
  font-family: var(--nrf-petites-cap);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--nrf-rouge);
  margin: 0 0 4px;
}

.som-sous-titre {
  font-family: var(--nrf-garamond);
  font-size: 12px;
  font-style: italic;
  color: rgba(26,24,20,0.5);
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}

.som-ornement {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  width: 80%;
}

.som-filet-g, .som-filet-d {
  flex: 1;
  height: 1px;
}
.som-filet-g { background: linear-gradient(90deg, transparent, var(--nrf-rouge)); }
.som-filet-d { background: linear-gradient(90deg, var(--nrf-rouge), transparent); }
.som-fleuron { color: var(--nrf-rouge); font-size: 14px; }

.som-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 85%;
}

.som-item {
  display: flex;
  align-items: baseline;
  padding: 7px 0;
  cursor: pointer;
  transition: color 0.2s;
}

.som-item:hover { color: var(--nrf-rouge); }
.som-item:hover .som-label { color: var(--nrf-rouge); }

.som-num {
  font-family: var(--nrf-petites-cap);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: rgba(26,24,20,0.5);
  width: 36px;
  flex-shrink: 0;
}

.som-label {
  font-family: var(--nrf-garamond);
  font-size: 14px;
  color: var(--nrf-noir);
  transition: color 0.2s;
}

.som-pointilles {
  flex: 1;
  border-bottom: 1px dotted rgba(26,24,20,0.2);
  margin: 0 8px;
  min-width: 20px;
  position: relative;
  top: -3px;
}

/* ── Belle-page (titre de chapitre) ── */
.bp-num {
  font-family: var(--nrf-petites-cap);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--nrf-rouge-clair);
  margin-bottom: 8px;
}

.bp-titre {
  font-family: var(--nrf-petites-cap);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--nrf-rouge);
  margin-bottom: 12px;
}

.bp-filet {
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--nrf-rouge), transparent);
}

/* ── Contenu de chapitre ── */
.page-contenu-inner {
  padding: 28px 28px 36px;
}

.contenu-entete {
  text-align: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 0.5px solid rgba(139,45,45,0.15);
}

.entete-rom {
  font-family: var(--nrf-petites-cap);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--nrf-rouge-clair);
}

.entete-sep { color: var(--nrf-rouge-clair); }

.entete-tit {
  font-family: var(--nrf-petites-cap);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(26,24,20,0.5);
}

.contenu-corps {
  font-family: var(--nrf-garamond);
  font-size: 14px;
  line-height: 1.72;
  color: var(--nrf-noir);
}

.contenu-corps h2, .contenu-corps h3, .contenu-corps h4 {
  font-family: var(--nrf-petites-cap);
  color: var(--nrf-rouge);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 1.4em;
  margin-bottom: 0.6em;
}

.contenu-corps h2 { font-size: 16px; }
.contenu-corps h3 { font-size: 14px; }
.contenu-corps h4 { font-size: 13px; }

.contenu-corps p {
  margin: 0 0 0.8em;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.contenu-corps a {
  color: var(--nrf-rouge);
  text-decoration: none;
  border-bottom: 1px solid rgba(139,45,45,0.25);
  transition: border-color 0.25s;
}

.contenu-corps a:hover {
  border-bottom-color: var(--nrf-rouge);
}

/* ── 4e de couverture ── */
.q4-cabinet {
  font-family: var(--nrf-petites-cap);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--nrf-rouge);
  margin: 20px 0 16px;
}

.q4-adresse, .q4-contact {
  font-family: var(--nrf-garamond);
  font-size: 13px;
  color: rgba(26,24,20,0.65);
  line-height: 1.6;
  margin: 0 0 10px;
}

.q4-barreau {
  font-family: var(--nrf-petites-cap);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(26,24,20,0.45);
  margin-top: 20px;
}

/* ── Placeholder de chargement ── */
.loading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--nrf-rouge-clair);
  font-family: var(--nrf-petites-cap);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.loading-ornement {
  font-size: 28px;
  margin-bottom: 12px;
  animation: pulse-load 1.5s infinite ease-in-out;
}

@keyframes pulse-load {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* ═══════════════════════════════════════════
   6. NAVIGATION
   ═══════════════════════════════════════════ */
.livre-nav {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  text-align: center;
}

.nav-pages {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 6px;
}

.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(139,45,45,0.2);
  border: 1px solid rgba(139,45,45,0.3);
  cursor: pointer;
  transition: all 0.3s;
}

.nav-dot-active {
  background: var(--nrf-rouge) !important;
  border-color: var(--nrf-rouge) !important;
  transform: scale(1.3);
}

.nav-dot-visited {
  background: rgba(139,45,45,0.45);
}

.nav-dot:hover {
  transform: scale(1.4);
  background: rgba(139,45,45,0.5);
}

.nav-label {
  font-family: var(--nrf-petites-cap);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(26,24,20,0.4);
}

/* ═══════════════════════════════════════════
   7. FOOTER RIN
   ═══════════════════════════════════════════ */
.morpheus-footer-rin {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9991;
  text-align: center;
  padding: 10px 20px;
  background: linear-gradient(180deg, transparent, rgba(50,30,15,0.6));
}

.footer-rin-nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 4px;
}

.footer-rin-nav a {
  font-family: var(--nrf-petites-cap);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245,241,232,0.55);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-rin-nav a:hover { color: rgba(245,241,232,0.9); }

.footer-rin-copy {
  font-family: var(--nrf-petites-cap);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: rgba(245,241,232,0.35);
  margin: 0;
}

/* ═══════════════════════════════════════════
   8. DOUBLE BORDURE DÉCORATIVE (livre ouvert)
   ═══════════════════════════════════════════ */
.livre-3d::before {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(139,45,45,0.2);
  border-radius: 4px;
  pointer-events: none;
  z-index: 15;
}

.livre-3d::after {
  content: '';
  position: absolute;
  inset: -1px;
  border: 0.5px solid rgba(139,45,45,0.12);
  border-radius: 3px;
  pointer-events: none;
  z-index: 15;
}

/* ═══════════════════════════════════════════
   9. RESPONSIVE
   ═══════════════════════════════════════════ */

/* Tablette */
@media (max-width: 1024px) {
  .livre-3d {
    width: 90vw;
    height: 65vh;
  }
  .page-inner { padding: 24px 20px 28px; font-size: 13.5px; }
  .couv-titre { font-size: 24px; }
  .nrf-couverture { width: 360px; }
}

/* Mobile */
@media (max-width: 768px) {
  .livre-3d {
    width: 96vw;
    height: 70vh;
  }
  .page-inner { padding: 18px 14px 22px; font-size: 13px; }
  .couv-titre { font-size: 22px; }
  .nrf-couverture { width: 300px; }
  .footer-rin-nav { gap: 12px; flex-wrap: wrap; }
}

/* Petit mobile */
@media (max-width: 480px) {
  .page-inner { padding: 14px 10px 18px; font-size: 12px; line-height: 1.65; }
  .nrf-couverture { width: 260px; }
  .livre-3d { height: 72vh; }
}
