@font-face {
  font-family: 'slight';
  font-style: normal;
  font-weight: normal;
  src: url('https://royal-invite.com/wp-content/uploads/2026/01/slight-regular.ttf') format('truetype');
}

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

:root {
  --crema: #f5e8ea;
  --papel: #FDF6F8;
  --rose: #B76E79;
  --rose-deep: #9A6B7A;
  --tinta: #333333;
  --tinta-media: #5C4A4A;
  --tinta-suave: #888888;
  --tinta-clara: #AAAAAA;
  --fondo-textura: url('https://pub-a65601eb9ffe4b62a9bcbf111a23ee8c.r2.dev/invitations/custom-orders/daniela-sofia-xv/fondo-ro.webp');
}

html {
  min-height: 100%;
  background-color: var(--crema);
}

html, body {
  overflow-x: hidden;
  width: 100%;
  color: var(--tinta);
  font-family: 'Antic Didone', serif;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  padding-bottom: 40px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-color: var(--crema);
  background-image:
    linear-gradient(180deg,
      rgba(245, 232, 234, 0.35) 0%,
      rgba(245, 232, 234, 0.2) 50%,
      rgba(245, 232, 234, 0.3) 100%),
    var(--fondo-textura);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.page-top {
  text-align: center;
  padding: 20px 16px 8px;
  position: relative;
  z-index: 2;
}

.back-link {
  display: inline-block;
  font-family: 'Antic Didone', serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tinta-suave);
  text-decoration: none;
  margin-bottom: 12px;
  transition: color 0.25s;
}

.back-link:hover { color: var(--rose); }

.page-mis-xv {
  font-family: 'Lustria', serif;
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 6px;
}

.page-title {
  font-family: 'slight', cursive;
  font-size: clamp(28px, 7vw, 42px);
  font-weight: normal;
  color: var(--tinta);
  line-height: 1.15;
  margin-bottom: 6px;
}

.page-sub {
  font-family: 'Lustria', serif;
  font-size: clamp(13px, 3.2vw, 15px);
  color: var(--tinta-media);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.55;
}

.upload-carta {
  padding: 12px 16px 0;
  position: relative;
  z-index: 1;
  margin-bottom: clamp(-40px, -8vw, -24px);
}

.inv-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: clamp(560px, 148vw, 680px);
  overflow: visible;
}

@media (max-width: 480px) {
  .inv-container { min-height: 128vw; }
}

.layer {
  position: absolute;
  width: 100%;
  height: auto;
  top: 0;
  left: 0;
  pointer-events: none;
  user-select: none;
}

.z1 { z-index: 1; }

.inv-sello {
  width: 22%;
  left: 40%;
  top: 20%;
  z-index: 10;
}

.paper-wrapper {
  position: absolute;
  top: 23.5%;
  left: 50%;
  width: 86%;
  transform: translateX(-50%);
  z-index: 5;
}

.inv-paper {
  width: 100%;
  min-height: clamp(340px, 88vw, 420px);
  background-color: var(--papel);
  border: 1px solid rgba(183, 110, 121, 0.22);
  box-shadow: 0 18px 50px rgba(154, 107, 122, 0.12);
  padding: clamp(18px, 4.5vw, 28px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.inv-paper::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(183, 110, 121, 0.12);
  pointer-events: none;
}

.inv-paper-inner {
  width: 100%;
  max-width: 300px;
  position: relative;
  z-index: 1;
  transform: translateY(clamp(-18px, -4.5vw, -12px));
}

.upload-camara-spacer {
  width: clamp(56px, 16vw, 72px);
  height: clamp(50px, 14vw, 68px);
  margin: 0 auto 8px;
  flex-shrink: 0;
}

@keyframes camara-salto {
  0%, 100% { transform: translateY(0); }
  18% { transform: translateY(-10px); }
  36% { transform: translateY(0); }
  48% { transform: translateY(-5px); }
  60% { transform: translateY(0); }
}

.upload-names {
  font-family: 'slight', cursive;
  font-size: clamp(22px, 6vw, 32px);
  color: var(--tinta);
  margin-bottom: 12px;
  line-height: 1.1;
}

.upload-desc {
  font-family: 'Lustria', serif;
  font-size: clamp(11px, 2.8vw, 13px);
  line-height: 1.65;
  color: var(--tinta-media);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.upload-wrapper {
  width: 100%;
  padding: 8px 4px 4px;
  text-align: center;
}

.upload-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.btn-subir-fotos {
  display: inline-block;
  width: 100%;
  max-width: 280px;
  padding: 13px 20px;
  background: var(--rose);
  color: #FDF6F8;
  border: 1.5px solid var(--rose);
  border-radius: 10px;
  font-family: 'Antic Didone', serif;
  font-size: 12px;
  font-weight: 100;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(183, 110, 121, 0.25);
  transition: background 0.25s, transform 0.2s, color 0.25s;
}

.btn-subir-fotos--sec {
  background: transparent;
  color: var(--rose);
  box-shadow: none;
}

.btn-subir-fotos:hover {
  background: var(--rose-deep);
  color: #FDF6F8;
  transform: translateY(-1px);
}

.btn-subir-fotos--sec:hover {
  background: rgba(183, 110, 121, 0.1);
  color: var(--rose-deep);
}

.btn-subir-fotos:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.upload-hint.ok { color: var(--rose-deep); }
.upload-hint.err { color: #8B4513; }

.upload-hint {
  font-family: 'Lustria', serif;
  font-size: 11px;
  line-height: 1.55;
  color: var(--tinta-suave);
  margin-top: 10px;
  padding: 0 6px;
}

.btn-refrescar {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 18px;
  background: transparent;
  border: 1px solid rgba(183, 110, 121, 0.35);
  color: var(--tinta-media);
  font-family: 'Antic Didone', serif;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
}

.btn-refrescar:hover {
  background: rgba(183, 110, 121, 0.08);
}

.scroll-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 320px;
  margin: clamp(10px, 3vw, 18px) auto 0;
  padding: 0 16px 8px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 4;
  font-family: 'Lustria', serif;
  -webkit-tap-highlight-color: transparent;
}

.scroll-cue-camara {
  width: clamp(68px, 19vw, 88px);
  height: auto;
  display: block;
  animation: camara-salto 2.2s ease-in-out infinite;
  filter: drop-shadow(0 5px 12px rgba(183, 110, 121, 0.22));
}

.scroll-cue-text {
  font-size: clamp(11px, 2.9vw, 13px);
  color: var(--rose-deep);
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.scroll-cue-arrow {
  font-size: 18px;
  color: var(--rose);
  line-height: 1;
  animation: scroll-flecha 1.6s ease-in-out infinite;
}

@keyframes scroll-flecha {
  0%, 100% { transform: translateY(0); opacity: 0.75; }
  50% { transform: translateY(5px); opacity: 1; }
}

.gallery-section {
  max-width: 520px;
  margin: clamp(-12px, -3vw, -4px) auto 0;
  padding: 0 12px 24px;
  text-align: center;
  position: relative;
  z-index: 2;
  transition: opacity 0.45s ease;
}

.gallery-camara {
  width: clamp(72px, 20vw, 96px);
  margin: 0 auto 4px;
  animation: camara-salto 2.2s ease-in-out infinite;
}

.gallery-camara img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 5px 12px rgba(183, 110, 121, 0.18));
}

.gallery-title {
  font-family: 'slight', cursive;
  font-size: clamp(26px, 6.5vw, 36px);
  color: var(--tinta);
  margin-bottom: 8px;
  margin-top: 0;
}

.gallery-hint {
  font-family: 'Lustria', serif;
  font-size: clamp(12px, 3vw, 14px);
  color: var(--tinta-suave);
  margin-bottom: 6px;
}

.gallery-hashtag {
  font-family: 'Lustria', serif;
  font-size: clamp(16px, 4vw, 20px);
  color: var(--rose);
  margin-bottom: 14px;
}

.mosaico-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 10px;
  padding: 8px 6px 12px;
  background: transparent;
  border: none;
  min-height: 100px;
  max-height: calc(3 * (min(148px, 28vw) + 2.75rem) + 2 * 14px + 0.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  align-items: start;
  justify-items: center;
  scrollbar-width: thin;
  scrollbar-color: rgba(183, 110, 121, 0.45) transparent;
}

.mosaico-grid::-webkit-scrollbar {
  width: 5px;
}

.mosaico-grid::-webkit-scrollbar-thumb {
  background: rgba(183, 110, 121, 0.4);
  border-radius: 999px;
}

#status-msg {
  grid-column: 1 / -1;
  font-family: 'Lustria', serif;
  font-size: 13px;
  color: var(--tinta-clara);
  padding: 24px 8px;
}

.polaroid-item {
  width: 100%;
  max-width: 148px;
  background: #fff;
  padding: 7px 7px 22px;
  box-shadow:
    0 3px 10px rgba(183, 110, 121, 0.14),
    0 8px 22px rgba(154, 107, 122, 0.08);
  cursor: pointer;
  transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
  position: relative;
  z-index: 1;
  will-change: transform;
}

.polaroid-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: var(--papel);
}

.polaroid-item:hover {
  z-index: 5;
  box-shadow:
    0 6px 16px rgba(183, 110, 121, 0.2),
    0 14px 28px rgba(154, 107, 122, 0.12);
  transform: rotate(var(--rot, 0deg)) translateY(calc(var(--ty, 0px) - 3px)) scale(1.04);
}

.polaroid-item.is-new {
  animation: polaroidEnter 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  z-index: 6;
}

.polaroid-item.is-shift {
  animation: polaroidShift 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes polaroidEnter {
  from {
    opacity: 0;
    transform: translateX(-36px) rotate(calc(var(--rot, 0deg) - 4deg)) scale(0.88);
  }
  to {
    opacity: 1;
    transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px)) scale(1);
  }
}

@keyframes polaroidShift {
  0% {
    transform: translateX(-32px) rotate(var(--rot, 0deg)) translateY(var(--ty, 0px));
  }
  45% {
    transform: translateX(16px) rotate(var(--rot, 0deg)) translateY(var(--ty, 0px));
  }
  100% {
    transform: rotate(var(--rot, 0deg)) translateY(var(--ty, 0px));
  }
}

.modal-overlay {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(74, 48, 58, 0.88);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  padding: 16px;
}

.modal-content-wrapper {
  position: relative;
  max-width: 92%;
  width: 100%;
  max-width: 480px;
  text-align: center;
}

#modal-img {
  max-width: 100%;
  max-height: 68vh;
  border: 1px solid rgba(253, 246, 248, 0.35);
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.modal-controls {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-nav, .btn-download {
  display: inline-block;
  padding: 11px 20px;
  background: transparent;
  color: var(--papel);
  border: 1.5px solid rgba(253, 246, 248, 0.65);
  font-family: 'Antic Didone', serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}

.btn-nav:hover, .btn-download:hover {
  background: var(--papel);
  color: var(--tinta);
}

.modal-close {
  position: absolute;
  top: -44px;
  right: 0;
  color: var(--papel);
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-camara { animation: none; }
  .scroll-cue-camara,
  .scroll-cue-arrow { animation: none; }
  .polaroid-item.is-new,
  .polaroid-item.is-shift { animation: none; }
}
