/* =========================
   Variables & base styles
   ========================= */
:root {
  --page-bg: #E8E0D5;
  --site-text: #333335;
  --sheet-bg: #FAF8F3;
  --sheet-text: #1A1714;
  --accent-hover: #9E8F7B;
  --retard: 100ms;
  --max-width: 780px;
}

@font-face {
  font-family: 'Times New Normal';
  src: url('fonts/times.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--page-bg);
  color: var(--site-text);
  font-family: 'Red Hat Text', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Texture grain subtile sur le fond de page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
}

header { padding: 32px 16px; text-align: center; position: relative; z-index: 1; }

main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: calc(100vh - 160px);
  position: relative;
  z-index: 1;
}

/* ── La feuille de papier ── */
.sheet {
  background: var(--sheet-bg);
  color: var(--sheet-text);
  max-width: var(--max-width);
  width: 100%;
  padding: 52px 56px 48px;
  border-radius: 3px;
  box-sizing: border-box;
  position: relative;

  /* Ombres en couches pour simuler l'épaisseur du papier */
  box-shadow:
    0 1px 1px rgba(0,0,0,0.10),
    0 2px 2px rgba(0,0,0,0.08),
    0 4px 4px rgba(0,0,0,0.06),
    0 8px 16px rgba(0,0,0,0.06),
    0 24px 48px rgba(0,0,0,0.08);

  /* Très légère rotation pour effet "posé sur table" */
  transform: rotate(-0.25deg);
}

/* Grain papier sur la feuille elle-même */
.sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Filet d'en-tête sous le titre/date */
.sheet-header {
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(0,0,0,0.10);
  position: relative;
  z-index: 1;
}

/* Tout le contenu au-dessus du grain */
.sheet > * { position: relative; z-index: 1; }

/* ── Typographie ── */
.title, .titleh3, h1, h2 {
  font-family: 'Indie Flower', cursive;
}
.letter-body {
  font-family: 'Sour Gummy', cursive;
}

.title {
  font-size: 2rem;
  text-align: center;
  margin: 0 0 5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.titleh3 {
  font-size: 1.3rem;
  text-align: center;
  margin: 0 0 8px;
  font-weight: 700;
  color: #5A4F45;
}
.letter-date {
  font-family: 'Sour Gummy', cursive;
  font-size: 1rem;
  font-weight: 400;
  color: #000;
  text-align: right;
  margin: 0 0 0;
  font-style: italic;
}

/* Séparateur visuel entre en-tête et corps */
.letter-divider {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.10);
  margin: 18px 0 26px;
}

.letter-body { font-size: 1.05rem; line-height: 1.85; color: #1A1714; }
.letter-body p { margin: 0 0 18px; }

/* ── Effet survol ── */
.char {
  display: inline-block;
  line-height: 1.2;
  transition: transform var(--retard) cubic-bezier(.22,.9,.3,1);
  will-change: transform;
  -webkit-user-select: text;
  user-select: text;
}
.word {
  display: inline-block;
  white-space: nowrap;
}
.word--break {
  white-space: normal;
  word-break: break-all;
}
@media (prefers-reduced-motion: reduce) {
  .char { transition: none !important; transform: none !important; will-change: auto !important; }
}

/* ── Footer ── */
footer {
  padding: 18px 16px;
  text-align: center;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}
.discord-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.discord-link svg { width: 18px; height: 18px; fill: currentColor; }
a:hover, a:focus { color: var(--accent-hover); outline: none; }

/* ── Cookie banner ── */
.cookie-banner {
  position: fixed;
  left: 12px; right: 12px; bottom: 12px;
  background: rgba(250,248,243,0.98);
  color: var(--site-text);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  max-width: 980px;
  margin: 0 auto;
  z-index: 1000;
  transition: transform 300ms ease, opacity 300ms ease;
}
.cookie-banner.hidden { opacity: 0; transform: translateY(20px) scale(.995); pointer-events: none; }
.cookie-actions { display: flex; gap: 8px; }
.btn { background: #1A1714; color: #FAF8F3; border: 0; padding: 8px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-family: 'Red Hat Text', sans-serif; }
.btn:focus { outline: 3px solid rgba(158,143,123,0.2); }
.cookie-banner a { text-decoration: underline; }

/* ── Utilitaires ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1A1714;
  color: #FAF8F3;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2000;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.toast button { background: none; border: none; color: #FAF8F3; font-size: 1.1rem; cursor: pointer; }

/* ── Photo modal ── */
.photo-trigger-wrap { margin-top: 20px; }
.photo-link { color: inherit; text-decoration: underline; cursor: pointer; }
.photo-link:hover, .photo-link:focus { color: var(--accent-hover); }

.photo-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box;
  z-index: 3000; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.photo-modal.show { opacity: 1; pointer-events: auto; }
.photo-modal-content {
  position: relative;
  max-width: min(1000px, 92vw);
  max-height: 90vh;
  display: flex; align-items: center; justify-content: center;
}
.photo-modal img {
  display: block; max-width: 100%; max-height: 90vh;
  width: auto; height: auto;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}
.photo-close {
  position: absolute; top: -14px; right: -14px;
  width: 38px; height: 38px; border: 0; border-radius: 999px;
  background: #FAF8F3; color: #111; font-size: 1.5rem;
  line-height: 1; cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
}
.photo-close:hover, .photo-close:focus { color: var(--accent-hover); outline: none; }
body.modal-open { overflow: hidden; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .sheet { padding: 32px 24px 28px; transform: none; }
  .title { font-size: 1.7rem; }
  .cookie-banner { left: 8px; right: 8px; padding: 10px; }
  .btn { padding: 8px 10px; }
}

#cookies { margin-top: 28px; font-size: 0.95rem; }


.sheet-header-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.sheet-header-titles {
  flex: 1;
}

.letter-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  margin-top: -2px;
  border-radius: 50%;
  border: 1px solid #9b7143,
}

/* Lightbox */
#logo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(4px);
}
#logo-lightbox.show {
  opacity: 1;
  pointer-events: auto;
}
#logo-lightbox img {
  max-width: min(340px, 85vw);
  max-height: 85vh;
  border-radius: 50%;
  box-shadow: 0 16px 60px rgba(0,0,0,0.4);
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(.22,.9,.3,1);
}
#logo-lightbox.show img {
  transform: scale(1);
}