/* ═══════════════════════════════════════════
   Mis XV Años · Evelyn Dayana
   Estilo: scrapbook / álbum de recuerdos
   ═══════════════════════════════════════════ */

/* ---------- Fuentes locales ---------- */
@font-face {
  font-family: 'Caveat';
  src: url('../assets/fonts/caveat.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Amatic SC';
  src: url('../assets/fonts/amatic-sc-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Shadows Into Light';
  src: url('../assets/fonts/shadows-into-light.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

/* ---------- Variables ---------- */
:root {
  --paper: #f6efe3;
  --paper-dark: #efe4d0;
  --card: #fffdf7;
  --ink: #4a3f35;
  --ink-soft: #7a6a58;
  --rose: #d96c8a;
  --rose-soft: #f3c6d3;
  --gold: #c9a227;
  --sage: #8aa07e;
  --tape: rgba(232, 209, 156, .75);
  --shadow: 0 10px 25px rgba(74, 63, 53, .18);
  --hand: 'Caveat', 'Segoe Print', cursive;
  --title: 'Amatic SC', 'Segoe Print', cursive;
  --note: 'Shadows Into Light', 'Segoe Script', cursive;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--hand);
  color: var(--ink);
  background-color: var(--paper);
  /* textura de papel: puntitos y líneas sutiles, todo en CSS */
  background-image:
    radial-gradient(rgba(74, 63, 53, .05) 1px, transparent 1.5px),
    radial-gradient(rgba(74, 63, 53, .035) 1px, transparent 1.5px),
    linear-gradient(rgba(217, 108, 138, .03) 1px, transparent 1px);
  background-size: 22px 22px, 34px 34px, 100% 28px;
  background-position: 0 0, 11px 11px, 0 0;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ═══════════ Decoración flotante ═══════════ */
.floaters {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.floater {
  position: absolute;
  bottom: -8vh;
  font-size: 1.4rem;
  opacity: 0;
  animation: floatUp linear infinite;
}
.floater:nth-child(1) { left: 8%;  animation-duration: 19s; animation-delay: 0s; }
.floater:nth-child(2) { left: 22%; animation-duration: 24s; animation-delay: 4s; font-size: 1rem; }
.floater:nth-child(3) { left: 36%; animation-duration: 21s; animation-delay: 8s; }
.floater:nth-child(4) { left: 52%; animation-duration: 26s; animation-delay: 2s; font-size: 1.8rem; }
.floater:nth-child(5) { left: 65%; animation-duration: 18s; animation-delay: 10s; font-size: 1.1rem; }
.floater:nth-child(6) { left: 78%; animation-duration: 23s; animation-delay: 6s; }
.floater:nth-child(7) { left: 88%; animation-duration: 20s; animation-delay: 12s; font-size: .9rem; }
.floater:nth-child(8) { left: 45%; animation-duration: 27s; animation-delay: 14s; }

.floater img {
  width: 2.6em;
  height: auto;
  filter: drop-shadow(0 3px 5px rgba(74, 63, 53, .2));
}

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  8%   { opacity: .55; }
  90%  { opacity: .35; }
  100% { transform: translateY(-115vh) rotate(40deg); opacity: 0; }
}

/* ═══════════ Cinta adhesiva (washi tape) ═══════════ */
.tape {
  position: absolute;
  width: 92px;
  height: 26px;
  background: var(--tape);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, .35) 0 6px,
    transparent 6px 12px
  );
  box-shadow: 0 2px 4px rgba(74, 63, 53, .12);
  opacity: .9;
  z-index: 3;
}
.tape-tl { top: -12px; left: -26px;  transform: rotate(-38deg); }
.tape-tr { top: -12px; right: -26px; transform: rotate(38deg); }
.tape-top { top: -13px; left: 50%; transform: translateX(-50%) rotate(-3deg); }

/* ═══════════ PORTADA ═══════════ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 1.2rem 4vh;
  position: relative;
  z-index: 1;
}

.hero-paper {
  position: relative;
  background: var(--card);
  border-radius: 6px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(74, 63, 53, .05);
  padding: clamp(2rem, 6vw, 3.5rem) clamp(1.4rem, 6vw, 3.5rem);
  max-width: 640px;
  width: 100%;
  text-align: center;
  transform: rotate(-1.2deg);
  /* borde de papel ligeramente irregular */
  border: 1px dashed rgba(217, 108, 138, .35);
  outline: 6px solid var(--card);
}

.hero-pre {
  font-family: var(--note);
  color: var(--ink-soft);
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  margin-bottom: 1rem;
}

.hero-name {
  line-height: 1.05;
}
.hero-name-line {
  display: block;
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(3rem, 11vw, 5.2rem);
  color: var(--rose);
  text-shadow: 2px 2px 0 var(--rose-soft);
}
.hero-name-sub {
  display: block;
  font-family: var(--title);
  font-size: clamp(1.5rem, 5.5vw, 2.4rem);
  letter-spacing: .18em;
  color: var(--ink-soft);
  margin-top: .4rem;
  text-transform: uppercase;
}

.hero-xv {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin: 1.6rem 0 .8rem;
}
.xv-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.xv-text {
  font-family: var(--title);
  font-size: clamp(1.8rem, 6.5vw, 2.8rem);
  color: var(--gold);
  letter-spacing: .12em;
  white-space: nowrap;
  animation: shimmer 3.2s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { text-shadow: 0 0 0 rgba(201, 162, 39, 0); }
  50%      { text-shadow: 0 0 18px rgba(201, 162, 39, .55); }
}

.hero-date {
  font-family: var(--note);
  color: var(--sage);
  font-size: 1.15rem;
  margin-bottom: 1.2rem;
}

.hero-note {
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  color: var(--ink-soft);
}

.scroll-hint {
  margin-top: 4vh;
  text-decoration: none;
  color: var(--ink-soft);
  font-family: var(--note);
  font-size: 1.05rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
}
.scroll-arrow {
  font-size: 1.8rem;
  line-height: 1;
  animation: bounce 1.8s ease-in-out infinite;
  color: var(--rose);
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* Kitty y Kuromi asomándose por la portada */
.peek {
  position: absolute;
  width: clamp(58px, 12vw, 88px);
  height: auto;
  z-index: 4;
  filter: drop-shadow(0 4px 6px rgba(74, 63, 53, .25));
  animation: peekWiggle 4s ease-in-out infinite;
}
.peek-kitty  { bottom: -34px; left: -22px;  transform: rotate(-12deg); }
.peek-kuromi { bottom: -36px; right: -28px; width: clamp(78px, 16vw, 118px); transform: rotate(12deg); animation-delay: 2s; }

@keyframes peekWiggle {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -7px; }
}

/* ═══════════ Títulos de sección ═══════════ */
section { position: relative; z-index: 1; padding: 4.5rem 1.2rem; }

.section-title {
  font-family: var(--title);
  font-size: clamp(2.4rem, 8vw, 3.6rem);
  text-align: center;
  color: var(--ink);
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  flex-wrap: wrap;
}
.title-doodle { color: var(--rose); font-size: .6em; }

.section-sub {
  text-align: center;
  font-family: var(--note);
  color: var(--ink-soft);
  font-size: 1.15rem;
  margin: .4rem 0 3rem;
}

/* ═══════════ Polaroids ═══════════ */
.polaroid {
  position: relative;
  background: #fff;
  padding: 12px 12px 8px;
  box-shadow: var(--shadow);
  border-radius: 2px;
  transition: transform .35s ease, box-shadow .35s ease;
}
.polaroid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--paper-dark);
  filter: sepia(.12) saturate(1.05);
}
.polaroid figcaption {
  font-family: var(--hand);
  font-size: 1.35rem;
  text-align: center;
  color: var(--ink);
  padding: .55rem .2rem .35rem;
}
.polaroid:hover {
  transform: scale(1.03) rotate(0deg) !important;
  box-shadow: 0 16px 35px rgba(74, 63, 53, .28);
  z-index: 5;
}

/* Stickers de Kitty y Kuromi pegados en las polaroids */
.polaroid .sticker {
  position: absolute;
  bottom: -16px;
  right: -18px;
  width: clamp(58px, 10vw, 78px);
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  background: none;
  filter: drop-shadow(0 4px 6px rgba(74, 63, 53, .3));
  transform: rotate(10deg);
  z-index: 4;
  pointer-events: none;
}
.tl-item:nth-child(even) .polaroid .sticker {
  right: auto;
  left: -18px;
  transform: rotate(-10deg);
}

/* Foto completa sin recorte */
.polaroid img.fit-full { object-fit: contain; }

/* Placeholder cuando aún no hay foto */
.polaroid img.is-placeholder {
  object-fit: contain;
  padding: 12%;
  filter: none;
}

/* ═══════════ Línea de tiempo ═══════════ */
.timeline {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  padding: 1rem 0;
}
/* línea "cosida" central */
.timeline::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  border-left: 3px dashed var(--rose-soft);
}

.tl-item {
  position: relative;
  width: 50%;
  padding: 1.4rem 3rem 1.4rem 0;
}
.tl-item:nth-child(even) {
  margin-left: 50%;
  padding: 1.4rem 0 1.4rem 3rem;
}

.tl-dot {
  position: absolute;
  top: 2.2rem;
  right: -1.35rem;
  width: 2.7rem;
  height: 2.7rem;
  background: var(--card);
  border: 2px dashed var(--rose);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  z-index: 2;
  box-shadow: 0 3px 8px rgba(74, 63, 53, .15);
}
.tl-item:nth-child(even) .tl-dot { right: auto; left: -1.35rem; }

.tl-item:nth-child(odd)  .polaroid { transform: rotate(-2.5deg); }
.tl-item:nth-child(even) .polaroid { transform: rotate(2.5deg); }

/* ═══════════ Galería ═══════════ */
.gallery {
  max-width: 1050px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 2.2rem 1.8rem;
  padding: .5rem;
}
.g-item { cursor: zoom-in; }
.g-item:nth-child(4n+1) { transform: rotate(-2.4deg); }
.g-item:nth-child(4n+2) { transform: rotate(1.8deg); }
.g-item:nth-child(4n+3) { transform: rotate(-1.4deg); }
.g-item:nth-child(4n+4) { transform: rotate(2.6deg); }

/* ═══════════ Video en la línea de tiempo ═══════════ */
.video-polaroid video {
  display: block;
  width: 100%;
  border-radius: 2px;
  background: #241f1a;
}

/* ═══════════ Carta ═══════════ */
.letter {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  background: var(--card);
  /* papel rayado */
  background-image: repeating-linear-gradient(
    transparent 0 31px,
    rgba(138, 160, 126, .25) 31px 32px
  );
  padding: clamp(2rem, 6vw, 3rem) clamp(1.4rem, 6vw, 3rem) 4.5rem;
  box-shadow: var(--shadow);
  border-radius: 4px;
  transform: rotate(.6deg);
  font-size: clamp(1.35rem, 4.2vw, 1.6rem);
  line-height: 32px;
}
.letter p { margin-bottom: 32px; }

.letter-greeting {
  font-weight: 700;
  font-size: 1.15em;
  color: var(--rose);
}

.letter-sign { text-align: right; margin-bottom: 0 !important; }
.letter-sig {
  font-family: var(--note);
  font-size: 1.1em;
  color: var(--rose);
}

.letter-seal {
  position: absolute;
  bottom: 1.4rem;
  left: 2rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e58ca6, var(--rose) 60%, #b34e6c);
  color: #fff7f9;
  font-family: var(--title);
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(179, 78, 108, .45), inset 0 0 0 4px rgba(255, 255, 255, .25);
  transform: rotate(-12deg);
}

/* Kuromi cuidando la carta */
.letter-kuromi {
  position: absolute;
  top: -44px;
  right: 8%;
  width: clamp(60px, 13vw, 92px);
  transform: rotate(8deg);
  filter: drop-shadow(0 4px 6px rgba(74, 63, 53, .25));
  animation: peekWiggle 4s ease-in-out infinite;
}

/* ═══════════ Footer ═══════════ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3.5rem 1rem 4.5rem;
  font-size: 1.35rem;
  color: var(--ink-soft);
}
.footer-heart {
  font-size: 2rem;
  animation: heartbeat 1.6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25%      { transform: scale(1.18); }
  40%      { transform: scale(1); }
}
.footer-small {
  font-family: var(--title);
  letter-spacing: .2em;
  color: var(--gold);
  margin-top: .3rem;
}

/* ═══════════ Easter egg ═══════════ */
.egg { margin-top: 2.5rem; }

.egg-lock {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  opacity: .35;
  transition: opacity .3s, transform .3s;
}
.egg-lock:hover { opacity: 1; transform: scale(1.25) rotate(-8deg); }

.egg-box {
  max-width: 340px;
  margin: 1rem auto 0;
  background: var(--card);
  border: 1px dashed var(--rose);
  border-radius: 6px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  animation: popIn .3s ease;
}
.egg-title { font-size: 1.4rem; color: var(--ink); }
.egg-hint {
  font-family: var(--note);
  font-size: .95rem;
  color: var(--ink-soft);
  margin: .3rem 0 .8rem;
}
#egg-form { display: flex; gap: .5rem; }
#egg-pass {
  flex: 1;
  min-width: 0;
  font-family: var(--hand);
  font-size: 1.1rem;
  padding: .45rem .7rem;
  border: 1.5px solid var(--rose-soft);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
#egg-pass:focus { outline: 2px solid var(--rose); }
#egg-form button {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.1rem;
  padding: .45rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--rose);
  color: #fff;
  cursor: pointer;
}
#egg-form button:hover { background: #c45877; }
.egg-error {
  font-size: 1.1rem;
  color: var(--rose);
  margin-top: .6rem;
  animation: shake .4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Modal del secreto */
.egg-modal[hidden] { display: none; }
.egg-modal {
  position: fixed;
  inset: 0;
  background: rgba(42, 34, 28, .88);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn .25s ease;
}
.egg-modal-paper {
  position: relative;
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: min(92vw, 560px);
  width: 100%;
  padding: 2.5rem 1.8rem 2rem;
  text-align: center;
  transform: rotate(-.6deg);
  animation: popIn .3s ease;
}
.egg-close {
  position: absolute;
  top: .6rem;
  right: .8rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.egg-fu {
  font-family: var(--title);
  font-size: clamp(3rem, 12vw, 4.5rem);
  color: var(--rose);
  letter-spacing: .08em;
  animation: shake .5s ease .3s;
}
.egg-balance {
  font-size: 1.5rem;
  color: var(--ink);
  margin: 1rem 0 1.6rem;
}
.egg-next {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.3rem;
  padding: .55rem 1.6rem;
  border: none;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(201, 162, 39, .4);
}
.egg-next:hover { transform: scale(1.05); }
.egg-video-title { font-size: 1.5rem; margin-bottom: 1rem; }
.egg-modal-paper video {
  display: block;
  width: 100%;
  max-height: 68vh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 4px;
  background: #241f1a;
}

/* ═══════════ Lightbox ═══════════ */
.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(42, 34, 28, .88);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.lb-polaroid {
  max-width: min(92vw, 560px);
  max-height: 88vh;
  transform: rotate(-1deg);
  animation: popIn .3s ease;
}
.lb-polaroid img {
  aspect-ratio: auto;
  max-height: 70vh;
  object-fit: contain;
}
@keyframes popIn {
  from { transform: scale(.85) rotate(-4deg); opacity: 0; }
  to   { transform: scale(1) rotate(-1deg);  opacity: 1; }
}

.lb-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: 2px dashed rgba(255, 255, 255, .6);
  border-radius: 50%;
  width: 2.8rem;
  height: 2.8rem;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ═══════════ Animación de aparición (scroll) ═══════════ */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity .8s ease, transform .8s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
/* respetar rotaciones al aparecer */
.hero-paper.reveal.visible { transform: translateY(0) rotate(-1.2deg); }
.tl-item.reveal { transition-delay: .1s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ═══════════ Móvil ═══════════ */
@media (max-width: 640px) {
  .timeline::before { left: 1.2rem; }
  .tl-item,
  .tl-item:nth-child(even) {
    width: 100%;
    margin-left: 0;
    padding: 1.2rem 0 1.2rem 3.4rem;
  }
  .tl-dot,
  .tl-item:nth-child(even) .tl-dot {
    left: -.1rem;
    right: auto;
  }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 1.6rem 1rem; }
  .polaroid figcaption { font-size: 1.1rem; }
  .tape { width: 64px; height: 20px; }
}

/* QR del pie de página */
.footer-qr {
  margin: 1.8rem auto 0;
  background: #fff;
  padding: 10px 10px 6px;
  width: fit-content;
  box-shadow: var(--shadow);
  border-radius: 2px;
  transform: rotate(-1.5deg);
}
.footer-qr img { display: block; width: clamp(110px, 18vw, 150px); }
.footer-qr figcaption {
  font-family: var(--hand);
  font-size: 1.05rem;
  color: var(--ink);
  padding-top: .3rem;
}

/* Imagen que reemplaza al video en impresión */
.print-only { display: none; }

/* ═══════════ Impresión ═══════════ */
@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
  .floaters, .scroll-hint, .egg, .egg-modal, .lightbox { display: none !important; }
  .hero { min-height: auto; padding: 3rem 1rem; }
  video { display: none !important; }
  .print-only {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: var(--paper-dark);
  }
  .polaroid, .letter, .footer-qr { break-inside: avoid; }
  body { background: #fff; }
}
