@font-face { font-family: "Brown Sugar"; src: url("assets/diseno/brown-sugar.woff") format("woff"); font-display: block; }
@font-face { font-family: "Serenity"; src: url("assets/diseno/serenity.woff") format("woff"); font-display: block; }

:root {
  --papel: #eee;
  --oscuro: #4c4945;
  --tinta: #100f0d;
  /* --k = un punto del lienzo de 345 de ancho */
  --k: calc(min(100vw, 430px) / 345);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--papel); color: #000; overflow-x: hidden; }
body.cerrada { overflow: hidden; height: 100vh; height: 100dvh; }
.definiciones { position: absolute; width: 0; height: 0; }
.solo-lectores { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- Lienzos ---------- */
.lienzo { position: relative; width: calc(345 * var(--k)); margin: 0 auto; overflow: hidden; }
.lienzo-invitacion { height: calc(3504 * var(--k)); background: var(--papel); }

#inicio {
  position: fixed; inset: 0; z-index: 20; overflow: hidden;
  background: var(--oscuro);
  transition: opacity .2s ease, visibility .2s;
}
#inicio.fuera { opacity: 0; visibility: hidden; }
.lienzo-inicio {
  --k: min(100vw / 345, 430px / 345, 100vh / 690);
  --k: min(100vw / 345, 430px / 345, 100dvh / 690);
  height: calc(722.8 * var(--k));
}

/* ---------- Piezas ---------- */
.el {
  position: absolute; display: block;
  left: calc(var(--x) * var(--k)); top: calc(var(--y) * var(--k));
  width: calc(var(--w) * var(--k)); height: calc(var(--h) * var(--k));
  max-width: none;
}
.caja { position: absolute; left: calc(var(--x) * var(--k)); top: calc(var(--y) * var(--k)); width: calc(var(--w) * var(--k)); height: calc(var(--h) * var(--k)); }
.recorte { overflow: hidden; }
img.foto { object-fit: cover; filter: sepia(.12) saturate(.9); }
.giro { transform: rotate(180deg); }
.volteo { transform: scaleY(-1); }
.velo { transform: rotate(-90deg); opacity: .48; }
.olivo { transform: rotate(63.1deg); }
.mano { transform: rotate(-28.6deg); pointer-events: none; }

.t {
  position: absolute; pointer-events: none;
  left: calc((var(--cx) - 200) * var(--k)); top: calc(var(--y) * var(--k));
  width: calc(400 * var(--k)); text-align: center; white-space: nowrap;
  font-weight: 400; color: var(--tinta);
  font-size: calc(var(--f) * var(--k));
  line-height: calc(var(--l) * var(--k));
  letter-spacing: calc(var(--s, 0) * var(--k));
}
.ci { font-family: "Cinzel", serif; color: #000; }
.pi { font-family: "Pinyon Script", cursive; }
.ab { font-family: "Abhaya Libre", serif; }
.bs { font-family: "Brown Sugar", "Cormorant Garamond", serif; color: #000; }
.se { font-family: "Serenity", "Pinyon Script", cursive; }
.num { font-family: "Times New Roman", Tinos, serif; font-variant-numeric: tabular-nums; color: #fff; }
.may { text-transform: uppercase; }
.negrita { font-weight: 700; }
.blanco { color: #fff; }
.claro { color: #fefefe; }
.ampersand { opacity: .39; }

.linea, .punto { background: #000; }
.punto, .color { border-radius: 50%; }
.color { border: calc(.9 * var(--k)) solid #000; }

/* ---------- Botones ---------- */
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid #bdab9b; outline-offset: 2px; }
.pildora { border-radius: 999px; }
#btn-iniciar { background: #747655; }
/* área táctil más grande que la píldora */
#btn-iniciar::after { content: ""; position: absolute; inset: -14px -18px; }
.arena { background: #bdab9b; }
a.arena[href]:active { filter: brightness(.9); }

.zona { border-radius: 50%; }
.zona:active { background: rgba(255,255,255,.25); }
.play {
  border-radius: 50%; background: #6d6a68; border: calc(1.4 * var(--k)) solid #fff;
  display: grid; place-items: center;
}
.play svg { width: 45%; height: 45%; fill: #fff; }
.ico-pausa, .sonando .ico-play { display: none; }
.sonando .ico-pausa { display: block; }

/* ---------- Foto con bordes rasgados ---------- */
.rasgado { clip-path: url(#rasgado); }
.rasgado img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.1) saturate(.95); }

/* ---------- Animaciones de entrada ---------- */
@keyframes desenfoque { from { opacity: 0; filter: blur(calc(32 * var(--k))); } }
@keyframes sube { from { opacity: 0; transform: translateY(calc(var(--d) * var(--k))); } 15% { opacity: 1; } }
@keyframes desde-izquierda { from { opacity: 0; transform: translateX(calc(-80 * var(--k))); } }

/* Pantalla de inicio: se anima al cargar */
#inicio .entra-desenfoque { animation: desenfoque .55s cubic-bezier(.25,.46,.45,.94) both; }
#inicio .entra-sube { animation: sube .45s cubic-bezier(.25,.46,.45,.94) var(--r) both; }
#inicio .entra-izquierda { animation: desde-izquierda .55s cubic-bezier(.25,.46,.45,.94) var(--r) both; }

/* Invitación: se anima al tocar "Iniciar" */
body.cerrada #invitacion [class*="entra-"] { opacity: 0; }
body:not(.cerrada) #invitacion .entra-desenfoque { animation: desenfoque .65s cubic-bezier(.25,.46,.45,.94) .08s both; }
body:not(.cerrada) #invitacion .entra-sube { animation: sube .52s cubic-bezier(.25,.46,.45,.94) var(--r) both; }
body:not(.cerrada) #invitacion .entra-izquierda { animation: desde-izquierda .5s cubic-bezier(.25,.46,.45,.94) var(--r) both; }

@media (prefers-reduced-motion: reduce) {
  [class*="entra-"] { animation: none !important; }
}
