/* ==========================================
   NOTRE HISTOIRE — Livre Amoureux
   Design: Rose & Or, Playfair Display
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Great+Vibes&family=Montserrat:wght@300;400;500&display=swap');

:root {
  --page-bg: #FDF6EF;
  --page-bg-alt: #FBF0E6;
  --text-dark: #2C1A1A;
  --text-medium: #5C3A3A;
  --text-light: #8B5E5E;
  --rose-deep: #8B1A4A;
  --rose-medium: #C4537A;
  --rose-light: #E8A0B4;
  --rose-pale: #F9E8EE;
  --gold: #C9A84C;
  --gold-light: #E8D5A0;
  --gold-pale: #FBF5E0;
  --book-shadow: rgba(0,0,0,0.5);
  --spine-color: #6B0F35;
}

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

body {
  background: radial-gradient(ellipse at center, #1a0a12 0%, #0d0308 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  overflow: hidden;
  position: relative;
}

/* ===== FLOATING PARTICLES ===== */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--gold-light);
  border-radius: 50%;
  opacity: 0;
  animation: float-up var(--dur, 8s) var(--delay, 0s) infinite ease-in-out;
}

@keyframes float-up {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-100vh) scale(1.2); }
}

/* ===== BOOK SCENE ===== */
.scene {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

/* ===== BOOK CONTAINER ===== */
.book-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.book-container {
  position: relative;
  width: min(820px, 90vw);
  height: min(560px, 75vh);
  perspective: 2500px;
  filter: drop-shadow(0 40px 80px rgba(0,0,0,0.8));
}

/* ===== BOOK FRAME ===== */
.book {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  transform-style: preserve-3d;
}

/* Book spine */
.book::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 12px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, var(--spine-color), #9B2555, var(--spine-color));
  z-index: 20;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

/* Book cover effect */
.book::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 2px 8px 8px 2px;
  box-shadow:
    inset -3px 0 8px rgba(0,0,0,0.2),
    inset 3px 0 8px rgba(0,0,0,0.1);
  z-index: 21;
  pointer-events: none;
}

/* ===== PAGES ===== */
.page-half {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: var(--page-bg);
}

.page-half.left {
  border-radius: 4px 0 0 4px;
  border-right: 1px solid rgba(139, 26, 74, 0.15);
  background: linear-gradient(to right, var(--page-bg), #FBF2E8);
}

.page-half.right {
  border-radius: 0 4px 4px 0;
  border-left: 1px solid rgba(139, 26, 74, 0.15);
  background: linear-gradient(to left, var(--page-bg), #FBF2E8);
}

/* Edge page effect (depth) */
.page-edges {
  position: absolute;
  right: 0;
  top: 2px;
  bottom: 2px;
  width: 8px;
  background: repeating-linear-gradient(
    to bottom,
    #f0e8e0 0px,
    #f8f0e8 2px
  );
  border-radius: 0 3px 3px 0;
  z-index: -1;
  transform: translateX(6px) rotateY(-10deg);
}

/* ===== FLIP PAGE ===== */
.flip-container {
  position: absolute;
  right: 0;
  top: 0;
  width: 50%;
  height: 100%;
  z-index: 30;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.645, 0.045, 0.355, 1.000);
  pointer-events: none;
}

.flip-container.flipping-forward {
  animation: flip-forward 0.7s cubic-bezier(0.645, 0.045, 0.355, 1.000) forwards;
}

.flip-container.flipping-backward {
  animation: flip-backward 0.7s cubic-bezier(0.645, 0.045, 0.355, 1.000) forwards;
}

@keyframes flip-forward {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(-180deg); }
}

@keyframes flip-backward {
  from { transform: rotateY(-180deg); }
  to   { transform: rotateY(0deg); }
}

.flip-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.flip-face.front {
  background: var(--page-bg);
}

.flip-face.back {
  background: linear-gradient(to right, #FBF2E8, var(--page-bg));
  transform: rotateY(180deg);
}

/* ===== PAGE INNER CONTENT ===== */
.page-inner {
  width: 100%;
  height: 100%;
  padding: 32px 28px 28px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ===== NAV BUTTONS ===== */
.nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gold-light);
  font-size: 48px;
  line-height: 1;
  padding: 10px;
  transition: all 0.3s ease;
  text-shadow: 0 0 20px var(--gold);
  user-select: none;
  opacity: 0.7;
  flex-shrink: 0;
}

.nav-btn:hover { opacity: 1; transform: scale(1.15); }
.nav-btn:disabled { opacity: 0.15; cursor: default; transform: none; }

/* ===== PAGE INDICATOR ===== */
.page-indicator {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.active {
  background: var(--gold);
  width: 22px;
  border-radius: 3px;
}

/* ===== DECORATIVE ELEMENTS ===== */
.ornament {
  text-align: center;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 8px;
  margin: 8px 0;
}

.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  margin: 12px 0;
}

.corner-decoration {
  position: absolute;
  width: 40px;
  height: 40px;
  opacity: 0.4;
}
.corner-decoration.tl { top: 12px; left: 12px; border-top: 1.5px solid var(--gold); border-left: 1.5px solid var(--gold); }
.corner-decoration.tr { top: 12px; right: 12px; border-top: 1.5px solid var(--gold); border-right: 1.5px solid var(--gold); }
.corner-decoration.bl { bottom: 12px; left: 12px; border-bottom: 1.5px solid var(--gold); border-left: 1.5px solid var(--gold); }
.corner-decoration.br { bottom: 12px; right: 12px; border-bottom: 1.5px solid var(--gold); border-right: 1.5px solid var(--gold); }

/* ===== PAGE NUMBER ===== */
.page-number {
  position: absolute;
  bottom: 14px;
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-light);
  opacity: 0.6;
}
.left .page-number { left: 28px; }
.right .page-number { right: 28px; }


/* =============================================
   PAGE TYPES — STYLES
   ============================================= */

/* ----- BACKGROUND IMAGE (cover / backcover) ----- */
.page-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.25;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
}

/* ----- COVER ----- */
.page-cover {
  background: linear-gradient(145deg, #1a0a12, #3D0014 40%, #6B0F35 100%) !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.cover-frame {
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 2px;
  pointer-events: none;
}

.cover-frame::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(201, 168, 76, 0.2);
  border-radius: 1px;
}

.cover-ornament {
  font-size: 22px;
  color: var(--gold);
  letter-spacing: 10px;
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.8);
}

.cover-title {
  font-family: 'Great Vibes', cursive;
  font-size: 46px;
  color: var(--gold-light);
  line-height: 1.2;
  text-shadow: 0 0 30px rgba(201, 168, 76, 0.5), 0 2px 10px rgba(0,0,0,0.5);
  margin-bottom: 6px;
}

.cover-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  color: rgba(255, 220, 180, 0.8);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.cover-photo-placeholder {
  width: 140px;
  height: 140px;
  border: 2px solid rgba(201, 168, 76, 0.5);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 12px auto;
  background: rgba(255,255,255,0.05);
  color: rgba(201, 168, 76, 0.7);
  font-size: 11px;
  font-family: 'Montserrat', sans-serif;
  gap: 6px;
  overflow: hidden;
  position: relative;
}

.cover-photo-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.cover-dedicace {
  font-family: 'Great Vibes', cursive;
  font-size: 22px;
  color: var(--rose-light);
  margin-top: 14px;
}

.cover-date {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-top: 8px;
}

/* ----- DECORATIVE BLANK ----- */
.page-decorative {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, var(--page-bg) 0%, var(--gold-pale) 100%);
}

.page-decorative .deco-symbol {
  font-family: 'Great Vibes', cursive;
  font-size: 80px;
  color: var(--gold-light);
  opacity: 0.3;
  line-height: 1;
}

/* ----- LETTER ----- */
.page-lettre .letter-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  color: var(--rose-deep);
  letter-spacing: 1px;
  margin-bottom: 14px;
  font-style: italic;
  text-align: center;
}

.page-lettre .letter-body {
  flex: 1;
  overflow: hidden;
}

.page-lettre .letter-paragraph {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13.5px;
  color: var(--text-dark);
  line-height: 1.85;
  margin-bottom: 8px;
}

.page-lettre .letter-signature {
  font-family: 'Great Vibes', cursive;
  font-size: 22px;
  color: var(--rose-deep);
  text-align: right;
  margin-top: 12px;
}

/* ----- POEM ----- */
.page-poeme {
  align-items: center;
  text-align: center;
  background: linear-gradient(180deg, var(--page-bg) 0%, #F9EEF5 100%);
}

.page-poeme .poem-ornament {
  color: var(--gold);
  font-size: 20px;
  letter-spacing: 12px;
  margin-bottom: 10px;
}

.page-poeme .poem-title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--rose-deep);
  font-style: italic;
  margin-bottom: 4px;
}

.page-poeme .poem-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  color: var(--text-light);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.page-poeme .poem-body {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  color: var(--text-dark);
  line-height: 2;
  flex: 1;
}

.page-poeme .poem-body .vers-blank {
  height: 10px;
}

.page-poeme.grand .poem-title { font-size: 24px; }
.page-poeme.grand .poem-body { font-size: 15px; line-height: 2.2; }

.poem-image-container {
  margin-top: 12px;
  flex-shrink: 0;
  height: 150px;
  display: flex;
  flex-direction: column;
}

/* ----- SECRETS / ANECDOTES ----- */
.page-secrets .section-title,
.page-anecdotes .section-title,
.page-liste .section-title,
.page-citations .section-title,
.page-futur .section-title,
.page-galerie .section-title {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  color: var(--rose-deep);
  font-style: italic;
  text-align: center;
  margin-bottom: 4px;
}

.section-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  color: var(--text-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 14px;
}

.secret-card, .anecdote-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(139,26,74,0.04), rgba(201,168,76,0.06));
  border-left: 2px solid var(--rose-light);
  border-radius: 0 6px 6px 0;
}

.secret-card:last-child, .anecdote-card:last-child { margin-bottom: 0; }

.card-icon { font-size: 16px; flex-shrink: 0; padding-top: 1px; }

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 11px;
  color: var(--rose-deep);
  font-weight: 600;
  margin-bottom: 3px;
}

.card-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: var(--text-medium);
  line-height: 1.7;
}

/* ----- PHOTO PAGE ----- */
.photo-placeholder {
  flex: 1;
  border: 1.5px dashed var(--gold-light);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold-pale), var(--rose-pale));
  gap: 8px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.photo-placeholder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.poem-bg {
  opacity: 0.1;
  filter: saturate(0.7);
}

.poem-image-legend {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  font-style: italic;
  color: var(--text-light);
  opacity: 0.65;
  text-align: center;
  margin-top: 4px;
  flex-shrink: 0;
}

/* Long poems (with subtitle) — compact spacing to fit all verses */
.page-poeme.long .poem-body { font-size: 11px; line-height: 1.5; }
.page-poeme.long .poem-body .vers-blank { height: 6px; }
.page-poeme.long .poem-subtitle { margin-bottom: 8px; }
.page-poeme.long .poem-ornament { margin-bottom: 6px; }

.photo-caption-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  color: rgba(255,255,255,0.9);
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  font-style: italic;
  padding: 14px 8px 5px;
  text-align: center;
  z-index: 1;
}

.photo-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1;
}

.photo-icon { font-size: 28px; opacity: 0.6; }

.photo-filename {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  color: var(--text-light);
  letter-spacing: 1px;
}

.photo-caption {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: var(--text-medium);
  font-style: italic;
  text-align: center;
}

.photo-page-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  color: var(--rose-deep);
  font-style: italic;
  text-align: center;
  margin-bottom: 10px;
}

.photo-page-quote {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  margin-top: 10px;
  line-height: 1.6;
}

/* ----- LIST PAGE ----- */
.liste-intro {
  font-family: 'Cormorant Garamond', serif;
  font-size: 13px;
  color: var(--text-medium);
  font-style: italic;
  text-align: center;
  margin-bottom: 14px;
  line-height: 1.6;
}

.liste-items {
  flex: 1;
  overflow: hidden;
}

.liste-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 7px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 12.5px;
  color: var(--text-dark);
  line-height: 1.6;
}

.liste-item::before {
  content: '✦';
  color: var(--gold);
  font-size: 8px;
  flex-shrink: 0;
  padding-top: 3px;
}

/* ----- CITATIONS ----- */
.citations-intro {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px;
  color: var(--text-light);
  font-style: italic;
  text-align: center;
  margin-bottom: 12px;
}

.citation-block {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--gold);
  background: linear-gradient(to right, rgba(201,168,76,0.06), transparent);
}

.citation-text {
  font-family: 'Playfair Display', serif;
  font-size: 12px;
  color: var(--text-dark);
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 4px;
}

.citation-author {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.citation-comment {
  font-family: 'Cormorant Garamond', serif;
  font-size: 11.5px;
  color: var(--text-medium);
  font-style: italic;
  line-height: 1.5;
}

/* ----- GALLERY ----- */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.gallery-item {
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, var(--gold-pale), var(--rose-pale));
  border: 1px dashed var(--gold-light);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  color: white;
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px;
  font-style: italic;
  padding: 12px 8px 4px;
  text-align: center;
}

.gallery-placeholder-icon {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 18px;
  color: var(--text-light);
  opacity: 0.5;
}

.gallery-placeholder-icon span {
  font-family: 'Montserrat', sans-serif;
  font-size: 8px;
  letter-spacing: 1px;
}

/* ----- FUTURE LETTER ----- */
.page-futur {
  background: linear-gradient(160deg, #FDF6EF 0%, #F9F0F5 100%);
}

.page-futur .letter-body {
  flex: 1;
  overflow: hidden;
}

.page-futur .letter-paragraph {
  line-height: 1.5;
  margin-bottom: 2px;
}

.page-futur .section-subtitle {
  margin-bottom: 6px;
}

.futur-image-small {
  height: 75px;
  margin-top: 6px;
  flex-shrink: 0;
}

/* ----- BACK COVER ----- */
.page-backcover {
  background: linear-gradient(145deg, #1a0a12, #3D0014 40%, #6B0F35 100%) !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
}

.backcover-frame {
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 2px;
}

.backcover-title {
  font-family: 'Great Vibes', cursive;
  font-size: 40px;
  color: var(--gold-light);
  text-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
  margin-bottom: 12px;
}

.backcover-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 14px;
  color: rgba(255,220,180,0.8);
  font-style: italic;
  line-height: 1.8;
  margin-bottom: 16px;
}

.backcover-dedicace {
  font-family: 'Great Vibes', cursive;
  font-size: 26px;
  color: var(--rose-light);
  margin: 12px 0;
}

.backcover-date {
  font-family: 'Montserrat', sans-serif;
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* ----- PHOTO HALF in anecdotes ----- */
.anecdotes-photo {
  height: 80px;
  margin-top: 8px;
  flex-shrink: 0;
}

/* ===== INTRO OVERLAY ===== */
.intro-overlay {
  position: fixed;
  inset: 0;
  background: #0d0308;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 1s ease, visibility 1s ease;
}

.intro-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.intro-title {
  font-family: 'Great Vibes', cursive;
  font-size: 52px;
  color: var(--gold-light);
  text-shadow: 0 0 40px rgba(201, 168, 76, 0.6);
  animation: pulse-glow 2s ease-in-out infinite;
}

.intro-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: rgba(255,220,180,0.7);
  letter-spacing: 4px;
  font-style: italic;
}

.intro-btn {
  margin-top: 20px;
  background: none;
  border: 1px solid var(--gold);
  color: var(--gold-light);
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: 12px 36px;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
}

.intro-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform: scaleX(0);
  transition: transform 0.4s ease;
  z-index: -1;
}

.intro-btn:hover {
  color: #1a0a12;
}

.intro-btn:hover::before {
  transform: scaleX(1);
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 40px rgba(201, 168, 76, 0.6); }
  50% { text-shadow: 0 0 60px rgba(201, 168, 76, 0.9), 0 0 100px rgba(201, 168, 76, 0.4); }
}

/* ===== HINT TEXT ===== */
.keyboard-hint {
  font-family: 'Montserrat', sans-serif;
  font-size: 9px;
  color: rgba(201, 168, 76, 0.3);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
}

/* ===== RESPONSIVE — TABLET ===== */
@media (max-width: 860px) {
  .book-container {
    width: min(720px, 92vw);
    height: min(500px, 72vh);
  }
  .page-inner { padding: 24px 20px 20px; }
  .cover-title { font-size: 38px; }
  .page-poeme .poem-body { font-size: 12px; }
  .card-text { font-size: 11.5px; }
  .liste-item { font-size: 12px; }
  .citation-text { font-size: 11.5px; }
}

/* ===== MOBILE BLOCK ===== */
.mobile-block {
  display: none;
}

@media (max-width: 860px) {
  .mobile-block {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at center, #2a0a18 0%, #0d0005 100%);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
  }
  .mobile-block-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    max-width: 320px;
  }
  .mobile-block-icon {
    font-size: 52px;
    opacity: 0.85;
  }
  .mobile-block-title {
    font-family: 'Great Vibes', cursive;
    font-size: 36px;
    color: rgba(201,168,76,0.9);
  }
  .mobile-block-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    line-height: 1.7;
  }
  /* Hide everything else */
  .particles, .intro-overlay, .scene { display: none !important; }
}

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 640px) {

  /* Allow body to scroll if content tall */
  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .scene {
    padding: 12px 8px;
    gap: 10px;
    min-height: 100dvh;
    justify-content: flex-start;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  /* Book wrapper: position relative for overlaid nav buttons */
  .book-wrapper {
    width: 100%;
    gap: 0;
    align-items: center;
    position: relative;
    overflow: visible;
  }

  /* Book: narrowed so page-peek strips are visible on sides */
  .book-container {
    width: 82vw;
    max-width: 380px;
    height: 68dvh;
    min-height: 340px;
    max-height: 520px;
    margin: 0 auto;
    filter: none;          /* remove filter to allow ::before/::after overflow */
    overflow: visible;
  }

  /* Shadow replacement (was handled by filter: drop-shadow) */
  .book {
    box-shadow: 0 18px 48px rgba(0,0,0,0.75);
  }

  /* Left pages peeking out like a real book */
  .book-container::before {
    content: '';
    position: absolute;
    top: 7px; bottom: 7px;
    left: -14px;
    width: 16px;
    background: linear-gradient(to left, #EDE5DB 0%, #E0D8D0 100%);
    border-radius: 3px 0 0 3px;
    box-shadow: -3px 2px 6px rgba(0,0,0,0.28);
    z-index: -1;
  }

  /* Right pages peeking out */
  .book-container::after {
    content: '';
    position: absolute;
    top: 7px; bottom: 7px;
    right: -14px;
    width: 16px;
    background: linear-gradient(to right, #EDE5DB 0%, #E0D8D0 100%);
    border-radius: 0 3px 3px 0;
    box-shadow: 3px 2px 6px rgba(0,0,0,0.28);
    z-index: -1;
  }

  /* Nav buttons: overlaid on book edges, not beside it */
  .nav-btn {
    position: absolute;
    top: 34dvh;           /* vertically centered on book */
    transform: translateY(-50%);
    z-index: 30;
    min-width: 40px;
    min-height: 44px;
    font-size: 30px;
    padding: 4px 6px;
    background: rgba(10, 3, 6, 0.35);
    border-radius: 50%;
    backdrop-filter: blur(3px);
    flex-shrink: 0;
    opacity: 0.85;
  }
  .nav-btn:hover { opacity: 1; transform: translateY(-50%) scale(1.1); }
  .nav-btn:disabled { opacity: 0.15; }

  #prevBtn { left: calc(50% - 41vw - 26px); }
  #nextBtn { right: calc(50% - 41vw - 26px); }

  /* Hide left half — JS shows pages one at a time on mobile */
  .page-half.left { display: none; }

  .page-half.right {
    flex: 1;
    width: 100%;
    border-radius: 6px;
    border-left: none;
    background: var(--page-bg);
  }

  /* Remove spine and depth effects on mobile */
  .book::before,
  .page-edges { display: none; }

  .book::after {
    border-radius: 6px;
  }

  /* Flip covers full single page */
  .flip-container {
    width: 100%;
    left: 0;
    right: 0;
  }

  /* Scrollable page content */
  .page-inner {
    padding: 18px 15px 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .page-inner::-webkit-scrollbar { display: none; }

  /* Nav buttons — min 44px touch targets */
  .nav-btn {
    font-size: 34px;
    padding: 6px 4px;
    min-width: 38px;
    min-height: 44px;
    flex-shrink: 0;
  }

  /* Dots — wrap on many pages */
  .page-indicator {
    flex-wrap: wrap;
    max-width: 90vw;
    gap: 5px;
    justify-content: center;
  }
  .dot { width: 5px; height: 5px; }
  .dot.active { width: 16px; }

  /* Hide keyboard hint on mobile */
  .keyboard-hint { display: none; }

  /* ----- COVER ----- */
  .cover-title { font-size: 34px; }
  .cover-subtitle { font-size: 10px; letter-spacing: 2px; margin-bottom: 12px; }
  .cover-photo-placeholder { width: 100px; height: 100px; }
  .cover-dedicace { font-size: 17px; margin-top: 10px; }
  .cover-ornament { font-size: 15px; letter-spacing: 5px; margin-bottom: 10px; }
  .cover-date { font-size: 9px; }

  /* ----- LETTER ----- */
  .page-lettre .letter-title { font-size: 13px; margin-bottom: 10px; }
  .page-lettre .letter-paragraph { font-size: 12.5px; line-height: 1.8; margin-bottom: 6px; }
  .page-lettre .letter-signature { font-size: 18px; margin-top: 10px; }

  /* ----- POEM ----- */
  .page-poeme .poem-ornament { font-size: 15px; letter-spacing: 8px; margin-bottom: 7px; }
  .page-poeme .poem-title { font-size: 15px; margin-bottom: 2px; }
  .page-poeme .poem-subtitle { font-size: 8px; margin-bottom: 10px; }
  .page-poeme .poem-body { font-size: 12.5px; line-height: 1.95; }
  .page-poeme.grand .poem-title { font-size: 19px; }
  .page-poeme.grand .poem-body { font-size: 14px; line-height: 2.1; }

  /* ----- SECRETS / ANECDOTES ----- */
  .section-title { font-size: 13px; margin-bottom: 2px; }
  .section-subtitle { font-size: 8px; margin-bottom: 10px; }
  .secret-card, .anecdote-card {
    padding: 8px 10px;
    margin-bottom: 7px;
    gap: 8px;
  }
  .card-icon { font-size: 14px; }
  .card-title { font-size: 10.5px; margin-bottom: 2px; }
  .card-text { font-size: 11.5px; line-height: 1.6; }

  /* ----- LIST ----- */
  .liste-intro { font-size: 12px; margin-bottom: 10px; }
  .liste-item { font-size: 12px; margin-bottom: 5px; line-height: 1.55; }
  .liste-item::before { font-size: 7px; }

  /* ----- CITATIONS ----- */
  .citations-intro { font-size: 11px; margin-bottom: 10px; }
  .citation-block { margin-bottom: 8px; padding: 8px 10px; }
  .citation-text { font-size: 11.5px; line-height: 1.65; margin-bottom: 3px; }
  .citation-author { font-size: 8px; }
  .citation-comment { font-size: 11px; line-height: 1.5; }

  /* ----- PHOTO PAGE ----- */
  .photo-page-title { font-size: 14px; margin-bottom: 8px; }
  .photo-page-quote { font-size: 11px; margin-top: 8px; }
  .photo-icon { font-size: 22px; }
  .photo-filename { font-size: 9px; }
  .photo-caption { font-size: 11px; }

  /* ----- GALLERY ----- */
  .gallery-grid { gap: 5px; }
  .gallery-item-label { font-size: 9px; padding: 10px 6px 4px; }
  .gallery-placeholder-icon { font-size: 16px; }
  .gallery-placeholder-icon span { font-size: 7px; }

  /* ----- BACK COVER ----- */
  .page-backcover { padding: 24px 20px; }
  .backcover-title { font-size: 30px; }
  .backcover-text { font-size: 12px; margin-bottom: 10px; }
  .backcover-dedicace { font-size: 20px; margin: 8px 0; }
  .backcover-date { font-size: 9px; }

  /* ----- INTRO ----- */
  .intro-title { font-size: 38px; }
  .intro-subtitle { font-size: 12px; letter-spacing: 2px; text-align: center; padding: 0 20px; }
  .intro-btn { font-size: 10px; padding: 10px 28px; letter-spacing: 3px; }

  /* ----- DIVIDERS & ORNAMENTS ----- */
  .ornament { font-size: 14px; letter-spacing: 6px; }
  .divider { margin: 8px 0; }
  .corner-decoration { width: 28px; height: 28px; }
  .corner-decoration.tl, .corner-decoration.tr { top: 8px; }
  .corner-decoration.tl { left: 8px; }
  .corner-decoration.tr { right: 8px; }

  /* Bottom corners: hidden on mobile (DOM order prevents reflowing them at end) */
  .corner-decoration.bl,
  .corner-decoration.br {
    display: none;
  }

  /* Page number: follows content scroll — appears at the very end */
  .page-number {
    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin-top: auto;
    padding-top: 10px;
    padding-bottom: 4px;
    text-align: right;
    width: 100%;
    border-top: 1px solid rgba(201, 168, 76, 0.15);
  }
}

/* ===== LANDSCAPE MOBILE ===== */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 480px) {
  .book-container {
    width: min(500px, 55vw);
    height: 86dvh;
    max-height: none;
  }
  .scene { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .page-indicator { width: 100%; }
}
