/* ============================================ */
/* DESIGN TOKENS & RESET                        */
/* ============================================ */

:root {
  --color-bg: #fdf6ff;
  --color-surface: #fff8fe;
  --color-text: #2d1b4e;
  --color-text-muted: #7c6a99;
  --color-accent: #c084fc;
  --color-accent-warm: #fb923c;
  --color-gold: #fde68a;
  --color-dark: #1a1a1a;
  --color-green: #5a8f7b;
  --color-green-dark: #3d6b59;
  --color-red: #ef4444;
  --color-white: #ffffff;

  --font-title: 'Pacifico', cursive;
  --font-body: 'Nunito', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(45, 27, 78, 0.08);
  --shadow-md: 0 4px 20px rgba(45, 27, 78, 0.12);
  --shadow-lg: 0 8px 40px rgba(45, 27, 78, 0.18);
  --shadow-warm: 0 4px 24px rgba(192, 132, 252, 0.15);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --max-width: 1200px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============================================ */
/* UTILITIES                                     */
/* ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.spin {
  animation: spin 1s linear infinite;
}

body.overlay-open {
  overflow: hidden;
}

/* ============================================ */
/* TABLE SECTION                                 */
/* ============================================ */

.table-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
}

.table-surface {
  position: relative;
  width: 100%;
  max-width: 900px;
  min-height: 500px;
  background:
    radial-gradient(ellipse at 30% 20%, #fef3c7 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, #fce7f3 0%, transparent 50%),
    linear-gradient(180deg, #fef9ef 0%, #faf5e8 30%, #f5ecd7 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 3rem 2rem;
  overflow: hidden;
}

.table-grain {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
}

/* ============================================ */
/* OBJECTS ON TABLE                              */
/* ============================================ */

.object-wrapper {
  position: relative;
  transition: transform 0.3s var(--ease-out);
}

.object-wrapper:hover {
  transform: translateY(-4px);
}

.object {
  position: relative;
  cursor: pointer;
  transition:
    transform 0.3s var(--ease-out),
    box-shadow 0.3s var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
}

.object:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-warm);
}

/* --- Carnet --- */
.object--carnet {
  width: 140px;
  height: 180px;
  background: linear-gradient(135deg, #4a7c64 0%, #3d6b59 40%, #5a8f7b 100%);
  border-radius: 4px 12px 12px 4px;
  box-shadow:
    3px 3px 10px rgba(0,0,0,0.15),
    inset -1px 0 0 rgba(255,255,255,0.1);
  border: 2px solid var(--color-green-dark);
}

.carnet-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.carnet-cross {
  font-size: 2rem;
  color: rgba(255,255,255,0.9);
  font-weight: 300;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.carnet-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  text-align: center;
  line-height: 1.2;
}

/* --- Enveloppe --- */
.object--envelope {
  width: 160px;
  height: 110px;
  position: relative;
}

.envelope-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #faf5e8 0%, #f0e6cc 100%);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid #e0d5b8;
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, #f5ecd7 0%, #e8d9b0 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-bottom: 1px solid #d4c8a0;
}

.envelope-ribbon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.ribbon-knot {
  display: block;
  width: 24px;
  height: 24px;
  background: var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(192, 132, 252, 0.4);
  position: relative;
  z-index: 2;
}

.ribbon-tail {
  position: absolute;
  top: 10px;
  width: 16px;
  height: 40px;
  background: var(--color-accent);
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(192, 132, 252, 0.3);
}

.ribbon-tail--left {
  left: -10px;
  transform: rotate(-25deg);
}

.ribbon-tail--right {
  right: -10px;
  transform: rotate(25deg);
}

/* --- Livre d'or --- */
.object--livre {
  width: 150px;
  height: 110px;
  background: linear-gradient(135deg, #f5e6ff 0%, #ede0f7 100%);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid #d8c8e8;
  position: relative;
  transition: transform 0.4s var(--ease-out);
}

.object--livre::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-accent);
  border-radius: 2px 0 0 2px;
}

.livre-cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.livre-icon {
  width: 28px;
  height: 28px;
  color: var(--color-accent);
}

.livre-title {
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--color-text);
}

.livre-pen {
  position: absolute;
  right: -8px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotate(-30deg);
}

.pen-tip {
  width: 4px;
  height: 10px;
  background: var(--color-text);
  border-radius: 0 0 2px 2px;
}

.pen-body {
  width: 6px;
  height: 40px;
  background: var(--color-accent);
  border-radius: 3px;
  margin-top: -2px;
}

/* ============================================ */
/* SCROLL HINT                                   */
/* ============================================ */

.scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-top: 2rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  animation: bounce-down 2s ease-in-out infinite;
}

@keyframes bounce-down {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* ============================================ */
/* PSA1 MEMORIAL SECTION                         */
/* ============================================ */

.psa1-section {
  min-height: 100vh;
  background: var(--color-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
}

.psa1-container {
  max-width: 650px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* --- Candle --- */
.candle {
  position: relative;
  margin-bottom: 1rem;
}

.candle-body {
  width: 50px;
  height: 120px;
  background: linear-gradient(180deg, #f5f0e0 0%, #ebe0c0 50%, #ddd5b0 100%);
  border-radius: 6px 6px 2px 2px;
  position: relative;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.candle-wax {
  position: absolute;
  top: -6px;
  left: 2px;
  right: 2px;
  height: 20px;
  background: linear-gradient(180deg, #faf5e8, #f0e6cc);
  border-radius: 50% 50% 2px 2px;
}

.candle-wick {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: #333;
  border-radius: 1px;
}

.candle-flame {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 35px;
}

.flame-outer {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 35px;
  background: radial-gradient(ellipse at bottom center, #fb923c 0%, #fbbf24 40%, #fde68a 80%, transparent 100%);
  border-radius: 50% 50% 20% 20%;
  animation: flicker-outer 0.15s ease-in-out infinite alternate;
}

.flame-core {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 18px;
  background: radial-gradient(ellipse at bottom center, #fff 0%, #fde68a 80%, transparent 100%);
  border-radius: 50% 50% 20% 20%;
  z-index: 1;
  animation: flicker-core 0.1s ease-in-out infinite alternate;
}

@keyframes flicker-outer {
  0%   { transform: translateX(-50%) scale(0.95, 1); opacity: 0.85; }
  33%  { transform: translateX(-48%) scale(1.02, 0.95); opacity: 1; }
  66%  { transform: translateX(-52%) scale(0.98, 1.03); opacity: 0.85; }
  100% { transform: translateX(-50%) scale(1, 0.97); opacity: 0.9; }
}

@keyframes flicker-core {
  0%   { transform: translateX(-50%) scaleY(1); opacity: 1; }
  50%  { transform: translateX(-50%) scaleY(0.85); opacity: 0.85; }
  100% { transform: translateX(-50%) scaleY(1.05); opacity: 1; }
}

.candle-glow {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(251, 146, 60, 0.15), transparent 70%);
  border-radius: 50%;
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.5; }
  50%      { transform: translateX(-50%) scale(1.2); opacity: 0.8; }
}

/* --- PSA1 Text --- */
.psa1-title {
  font-family: var(--font-title);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--color-accent-warm);
  text-shadow: 0 2px 10px rgba(251, 146, 60, 0.3);
}

.psa1-subtitle {
  color: var(--color-gold);
  font-size: 1.1rem;
  opacity: 0.8;
  margin-top: -1rem;
}

.psa1-letter {
  text-align: left;
  color: #d4c8e0;
  font-size: 1rem;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 500px;
}

.psa1-letter p:first-child {
  font-style: italic;
}

.psa1-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-accent-warm);
  color: white;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  transition:
    transform 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out);
  box-shadow: 0 4px 16px rgba(251, 146, 60, 0.3);
}

.psa1-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(251, 146, 60, 0.4);
}

/* ============================================ */
/* OVERLAY SYSTEM                                */
/* ============================================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}

.overlay.active {
  pointer-events: auto;
  opacity: 1;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 27, 78, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition:
    background 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.modal-close:hover {
  background: rgba(255,255,255,0.25);
  transform: scale(1.1);
}

/* ============================================ */
/* CARNET MODAL                                  */
/* ============================================ */

.modal-carnet {
  position: relative;
  width: 95vw;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.book-3d {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 1200px;
}

/* Cover */
.book-cover--front {
  width: 100%;
  aspect-ratio: 0.72;
  max-height: 65vh;
  background: linear-gradient(135deg, #4a7c64 0%, #3d6b59 40%, #5a8f7b 100%);
  border-radius: 6px 16px 16px 6px;
  box-shadow:
    6px 6px 20px rgba(0,0,0,0.25),
    inset -2px 0 0 rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: left center;
  position: relative;
  border: 3px solid var(--color-green-dark);
}

.book-cover-texture {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.book-cross {
  font-size: 3rem;
  color: rgba(255,255,255,0.9);
  font-weight: 200;
  text-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.book-cover-title {
  font-family: var(--font-title);
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  color: rgba(255,255,255,0.95);
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.book-cover-subtitle {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.8);
  font-weight: 600;
}

/* Pages */
.book-pages {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.book-page {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #fefdf8, #faf5e8);
  border-radius: 6px 16px 16px 6px;
  box-shadow: var(--shadow-md);
  padding: 2rem;
  display: none;
  opacity: 0;
  border-left: 3px solid var(--color-green-dark);
  overflow-y: auto;
}

.book-page--active {
  display: flex;
  opacity: 1;
}

.page-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.page-content h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--color-green-dark);
  text-align: center;
  margin-bottom: 0.5rem;
}

.page-content dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: baseline;
}

.page-content dt {
  font-weight: 700;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.page-content dd {
  color: var(--color-text);
  font-size: 0.9rem;
}

.page-image {
  text-align: center;
}

.page-photo {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin: 0 auto;
  opacity: 0.7;
}

.photo-placeholder {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  margin-top: 0.5rem;
  font-style: italic;
}

.page-content--specs dl {
  grid-template-columns: 1fr 1fr;
}

.page-content--signes ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-left: 0.5rem;
}

.page-content--signes li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.95rem;
}

.page-content--signes li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-green);
  font-weight: 700;
}

/* Page navigation */
.page-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  z-index: 2;
}

.page-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition:
    background 0.2s var(--ease-out),
    opacity 0.2s var(--ease-out);
}

.page-nav-btn:hover:not(:disabled) {
  background: rgba(255,255,255,0.3);
}

.page-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-indicator {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ============================================ */
/* LETTRE MODAL                                  */
/* ============================================ */

.modal-lettre {
  position: relative;
  width: 95vw;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  min-height: 70vh;
  justify-content: center;
}

.letter-envelope {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1.6;
  max-height: 30vh;
  perspective: 800px;
}

.letter-envelope-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #faf5e8 0%, #f0e6cc 100%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 2px solid #e0d5b8;
}

.letter-envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(180deg, #f5ecd7 0%, #e8d9b0 100%);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  border-bottom: 1px solid #d4c8a0;
}

.letter-ribbon-clone {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.ribbon-knot-clone {
  display: block;
  width: 32px;
  height: 32px;
  background: var(--color-accent);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(192, 132, 252, 0.4);
  position: relative;
  z-index: 2;
}

.ribbon-tail-clone {
  position: absolute;
  top: 14px;
  width: 20px;
  height: 55px;
  background: var(--color-accent);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(192, 132, 252, 0.3);
}

.ribbon-tail-clone--left  { left: -8px;  transform: rotate(-25deg); }
.ribbon-tail-clone--right { right: -8px; transform: rotate(25deg);  }

/* Letter card */
.letter-card-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 400px;
}

.letter-card {
  background: linear-gradient(135deg, #fefce8, #fef9e8);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  border: 1px solid #e8dcc0;
  position: relative;
}

.letter-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 150px 150px;
  pointer-events: none;
  z-index: 0;
}

.letter-card-half {
  flex: 1;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

.letter-card-half--left {
  border-right: 1px dashed #d4c8a0;
}

.letter-text {
  font-family: var(--font-title);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
}

.letter-text p {
  margin-bottom: 0.5rem;
}

.letter-signature {
  margin-top: 1rem !important;
  font-size: 1.1rem;
}

/* Audio player */
.letter-audio {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-pill);
  width: 100%;
  max-width: 400px;
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-accent);
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  transition:
    background 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}

.audio-btn:hover {
  background: #ad6ff0;
  transform: scale(1.03);
}

.audio-progress {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
}

.audio-progress-bar {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.audio-time {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.8);
  min-width: 42px;
  text-align: right;
}

/* ============================================ */
/* LIVRE D'OR MODAL                              */
/* ============================================ */

.modal-livre {
  position: relative;
  width: 95vw;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  max-height: 90vh;
  overflow-y: auto;
}

.livre-open {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

/* Book spread */
.livre-spread {
  display: flex;
  width: 100%;
  gap: 2px;
  perspective: 1200px;
  min-height: 300px;
}

.livre-page--left,
.livre-page--right {
  flex: 1;
  background: linear-gradient(135deg, #fefdf8, #faf5e8);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
  border: 1px solid #e0d5c0;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.livre-page--left {
  border-right: 1px dashed #d4c8a0;
}

.messages-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

/* Message post-it style */
.message-item {
  background: linear-gradient(135deg, #faf5ff 0%, #f5eeff 100%);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--color-accent);
  animation: fadeInUp 0.4s var(--ease-out);
  position: relative;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.message-author {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-accent);
  margin-bottom: 0.25rem;
}

.message-text {
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.5;
  word-break: break-word;
}

.message-date {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: 0.4rem;
}

/* Navigation */
.livre-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.livre-nav .page-nav-btn {
  background: rgba(255,255,255,0.1);
}

/* Form */
.livre-form {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.form-row {
  position: relative;
}

.livre-form input,
.livre-form textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.1);
  color: white;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color 0.2s var(--ease-out);
  resize: vertical;
}

.livre-form input::placeholder,
.livre-form textarea::placeholder {
  color: rgba(255,255,255,0.5);
}

.livre-form input:focus,
.livre-form textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.char-count {
  position: absolute;
  bottom: 0.5rem;
  right: 0.75rem;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
}

.form-error {
  color: var(--color-red);
  font-size: 0.85rem;
  min-height: 1.2em;
  animation: shake 0.4s var(--ease-out);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}

.form-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--color-accent);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 2rem;
  border-radius: var(--radius-pill);
  transition:
    background 0.2s var(--ease-out),
    transform 0.2s var(--ease-out),
    box-shadow 0.2s var(--ease-out);
}

.form-submit:hover {
  background: #ad6ff0;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(192, 132, 252, 0.4);
}

.form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading */
.livre-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  font-size: 0.9rem;
}

.livre-loading.hidden {
  display: none;
}

.empty-messages {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
  text-align: center;
  margin: auto;
}

/* ============================================ */
/* RESPONSIVE                                    */
/* ============================================ */

@media (max-width: 600px) {
  .table-surface {
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem 1rem;
    min-height: auto;
  }

  .object--carnet {
    width: 120px;
    height: 155px;
  }

  .object--envelope {
    width: 140px;
    height: 95px;
  }

  .object--livre {
    width: 130px;
    height: 95px;
  }

  .book-page {
    padding: 1.25rem;
  }

  .letter-card {
    flex-direction: column;
  }

  .letter-card-half--left {
    border-right: none;
    border-bottom: 1px dashed #d4c8a0;
  }

  .livre-spread {
    flex-direction: column;
  }

  .livre-page--left {
    border-right: none;
    border-bottom: 1px dashed #d4c8a0;
  }

  .livre-page--left,
  .livre-page--right {
    min-height: 200px;
  }

  .letter-audio {
    flex-wrap: wrap;
    border-radius: var(--radius-md);
    gap: 0.5rem;
  }

  .audio-btn {
    width: 100%;
    justify-content: center;
  }

  .audio-progress {
    flex: 1;
    min-width: 100px;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .table-surface {
    gap: 1.5rem;
    padding: 2.5rem 1.5rem;
  }
}

/* ============================================ */
/* REDUCED MOTION                                */
/* ============================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .object-wrapper:hover {
    transform: none;
  }

  .object:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }

  .scroll-hint {
    animation: none;
  }
}
