/* Hallmark · discipline: locked tokens · canon easings · reduced-motion respected · roman display type
 * Boda · bienvenida: sobre de carta con sello de cera, fondo botánico y rayos de luz al abrir.
 */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --paper-1: #fdf6e8;
  --paper-2: #f1e3c8;
  --paper-3: #e6d2ae;
  --foil-1: #f3dfa4;
  --foil-2: #b8913d;
  --wax-1: #c8553a;
  --wax-2: #8e2f1c;
  --ray: rgba(255, 228, 156, 0.55);
}

/* ---------- Fondo: patrón botánico elegante ---------- */
.welcome {
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 252, 244, 0.95) 0, rgba(255, 250, 240, 0) 52%),
    radial-gradient(circle at 4% 100%, rgba(180, 88, 58, 0.22), transparent 46%),
    radial-gradient(circle at 100% 0, rgba(107, 112, 92, 0.22), transparent 42%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23b4583a' stroke-opacity='.17' stroke-width='1.1' stroke-linecap='round'%3E%3Cpath d='M45 8c0 46 0 92 0 140'/%3E%3Cpath d='M45 40c-15-4-24-15-24-28 15 4 24 15 24 28zM45 40c15-4 24-15 24-28-15 4-24 15-24 28zM45 78c-15-4-24-15-24-28 15 4 24 15 24 28zM45 78c15-4 24-15 24-28-15 4-24 15-24 28zM45 116c-15-4-24-15-24-28 15 4 24 15 24 28zM45 116c15-4 24-15 24-28-15 4-24 15-24 28z'/%3E%3C/g%3E%3Cg fill='none' stroke='%236b705c' stroke-opacity='.2' stroke-width='1.1'%3E%3Cpath d='M135 70c0 46 0 92 0 100'/%3E%3Cpath d='M135 100c-13-3-21-13-21-24 13 3 21 13 21 24zM135 100c13-3 21-13 21-24-13 3-21 13-21 24zM135 136c-13-3-21-13-21-24 13 3 21 13 21 24zM135 136c13-3 21-13 21-24-13 3-21 13-21 24z'/%3E%3C/g%3E%3Cg fill='%23b8913d' fill-opacity='.35'%3E%3Ccircle cx='100' cy='24' r='1.8'/%3E%3Ccircle cx='160' cy='150' r='1.8'/%3E%3Ccircle cx='14' cy='164' r='1.8'/%3E%3Cpath d='M100 90l1.6 3.4 3.4 1.6-3.4 1.6L100 100l-1.6-3.4L95 95l3.4-1.6z'/%3E%3C/g%3E%3C/svg%3E"),
    var(--cream);
  background-size: auto, auto, auto, 180px 180px, auto;
}

.welcome::after {
  content: "";
  position: absolute;
  inset: 14px;
  z-index: 1;
  border: 1px solid rgba(184, 145, 61, 0.55);
  border-radius: 22px;
  box-shadow: inset 0 0 0 6px var(--cream), inset 0 0 0 7px rgba(184, 145, 61, 0.35);
  pointer-events: none;
}

/* ---------- Sobre ---------- */
.wed-env {
  position: relative;
  display: block;
  width: min(80vw, 320px);
  aspect-ratio: 300 / 206;
  margin: 30px 0 28px;
  padding: 0;
  border: 0;
  background: none;
  isolation: isolate;
  cursor: pointer;
  animation: wed-float 5s var(--ease-in-out) infinite;
}

.wed-env:focus-visible {
  outline: 3px solid var(--clay);
  outline-offset: 12px;
  border-radius: 10px;
}

@keyframes wed-float {
  50% { transform: translateY(-7px); }
}

.wed-body {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 6px;
  filter: drop-shadow(0 22px 22px rgba(110, 60, 35, 0.3));
  perspective: 900px;
}

.wed-liner {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='46' viewBox='0 0 46 46'%3E%3Cg fill='none' stroke='%23fdf6e8' stroke-opacity='.28' stroke-width='1'%3E%3Cpath d='M23 4 42 23 23 42 4 23Z'/%3E%3Ccircle cx='23' cy='23' r='3'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(160deg, #c8694a, #a24a2e);
}

/* Carta que sale del sobre */
.wed-card {
  position: absolute;
  z-index: 2;
  top: 8%;
  right: 7%;
  bottom: 7%;
  left: 7%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 10px;
  border-radius: 4px;
  text-align: center;
  color: var(--ink);
  background: linear-gradient(180deg, var(--paper-1), var(--paper-2));
  box-shadow: inset 0 0 0 5px var(--paper-1), inset 0 0 0 6px var(--foil-2), 0 8px 18px rgba(80, 40, 20, 0.25);
  transition: transform 1.2s var(--ease-out) 0.75s;
}

.wed-card small {
  font: 500 8px/1 Jost, sans-serif;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--clay-dark);
}

.wed-card b {
  font: 500 clamp(18px, 6vw, 25px)/1.05 "Playfair Display", serif;
  color: var(--ink);
}

.wed-card b i {
  font-style: normal;
  color: var(--clay);
}

.wed-card em {
  font: 400 9px/1 Jost, sans-serif;
  font-style: normal;
  letter-spacing: 0.32em;
  color: var(--brown-soft);
}

/* Bolsillo frontal y solapa */
.wed-front,
.wed-flap {
  position: absolute;
  left: 0;
  width: 100%;
  display: block;
}

.wed-front {
  z-index: 3;
  inset: 0;
}

.wed-flap {
  z-index: 5;
  top: 0;
  height: 58%;
  transform-origin: 50% 0;
  backface-visibility: visible;
}

.wed-front svg,
.wed-flap svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wed-sprig {
  position: absolute;
  z-index: 4;
  bottom: 5%;
  width: 11%;
  height: 40%;
  color: var(--olive);
  opacity: 0.85;
}

.wed-sprig.l { left: 5%; rotate: -14deg; }
.wed-sprig.r { right: 5%; rotate: 14deg; }

.wed-rings {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 13%;
  width: 19%;
  height: 13%;
  margin-left: -9.5%;
  color: var(--foil-2);
}

/* Sello de cera */
.wed-seal {
  position: absolute;
  z-index: 6;
  top: 56%;
  left: 50%;
  display: grid;
  place-items: center;
  grid-auto-flow: column;
  width: 21%;
  aspect-ratio: 1;
  border-radius: 52% 48% 55% 45% / 48% 55% 45% 52%;
  color: #ffe9c4;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.42) 0 8%, transparent 9%),
    radial-gradient(circle at 50% 50%, var(--wax-1), var(--wax-2));
  box-shadow: inset 0 0 0 4px rgba(255, 220, 170, 0.18), inset 0 0 0 5px rgba(60, 12, 4, 0.35), 0 6px 12px rgba(60, 20, 8, 0.5);
  font: 500 clamp(11px, 4vw, 17px) "Playfair Display", serif;
  transform: translate(-50%, -50%);
}

.wed-seal i {
  font-style: normal;
  font-size: 0.7em;
  opacity: 0.85;
}

/* Luz que sale al abrir */
.wed-rays,
.wed-glow {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 46%;
  pointer-events: none;
  opacity: 0;
}

.wed-rays {
  width: 170vmax;
  height: 170vmax;
  margin: -85vmax 0 0 -85vmax;
  background: repeating-conic-gradient(from 0deg, transparent 0 4deg, var(--ray) 6deg 8deg, transparent 10deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, transparent 46%);
  mask-image: radial-gradient(circle, #000 0, transparent 46%);
}

.wed-glow {
  width: 120vmin;
  height: 120vmin;
  margin: -60vmin 0 0 -60vmin;
  background: radial-gradient(circle, rgba(255, 238, 190, 0.9) 0, rgba(255, 220, 140, 0.35) 35%, transparent 62%);
}

/* ---------- Botón de apertura ---------- */
.wed-open {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 66px;
  padding: 0 38px;
  border: 0;
  border-radius: 999px;
  color: #fff7e6;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 46%),
    linear-gradient(135deg, #cf6a49, #a24a2e 60%, #8e3f27);
  box-shadow: 0 0 0 3px var(--cream), 0 0 0 4px var(--foil-2), 0 18px 30px rgba(110, 60, 35, 0.38), inset 0 1px 0 rgba(255, 238, 200, 0.5);
  font: 500 15px/1 Jost, sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: wed-ring 3s var(--ease-out) infinite;
}

.wed-open:hover {
  transform: translateY(-3px);
}

.wed-open:focus-visible {
  outline: 3px solid var(--foil-2);
  outline-offset: 6px;
}

.wed-open__orn {
  font-size: 15px;
  color: var(--foil-1);
}

.wed-open__ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 15px;
  color: var(--wax-2);
  background: radial-gradient(circle at 35% 30%, #fff3c4, var(--foil-1) 60%, var(--foil-2));
  box-shadow: 0 2px 6px rgba(60, 30, 10, 0.4);
}

@keyframes wed-ring {
  0% { box-shadow: 0 0 0 3px var(--cream), 0 0 0 4px var(--foil-2), 0 18px 30px rgba(110, 60, 35, 0.38), 0 0 0 4px rgba(184, 145, 61, 0.55); }
  70%, 100% { box-shadow: 0 0 0 3px var(--cream), 0 0 0 4px var(--foil-2), 0 18px 30px rgba(110, 60, 35, 0.38), 0 0 0 22px rgba(184, 145, 61, 0); }
}

.welcome-content h1 {
  margin: 4px 0 6px;
  font: 500 clamp(32px, 9.4vw, 44px)/1.1 "Playfair Display", serif;
}

.welcome-content .welcome-date + br {
  display: none;
}

.welcome-content .welcome-date {
  margin-bottom: 22px;
}

.hint {
  margin-top: 18px;
  letter-spacing: 0.22em;
}

/* ---------- Apertura ---------- */
.welcome.opening .wed-env {
  animation: none;
}

.welcome.opening .wed-seal {
  animation: wed-seal 0.6s var(--ease-out) forwards;
}

.welcome.opening .wed-flap {
  animation: wed-flap 1.05s var(--ease-in-out) 0.3s forwards;
}

.welcome.opening .wed-card {
  transform: translateY(-62%);
}

.welcome.opening .wed-rays {
  animation: wed-rays 3.2s var(--ease-out) 0.35s forwards;
}

.welcome.opening .wed-glow {
  animation: wed-glow 2.6s var(--ease-out) 0.3s forwards;
}

.welcome.opening .welcome-content > .eyebrow,
.welcome.opening .welcome-content > h1,
.welcome.opening .welcome-date,
.welcome.opening .welcome-content > .wed-open,
.welcome.opening .hint {
  animation: welcomeTextOut 0.5s ease 2s forwards;
}

@keyframes wed-seal {
  35% { transform: translate(-50%, -50%) scale(1.2) rotate(-6deg); }
  100% { opacity: 0; transform: translate(-50%, -78%) scale(0.45) rotate(20deg); }
}

@keyframes wed-flap {
  0% { transform: rotateX(0); z-index: 5; }
  45% { z-index: 5; }
  46% { z-index: 1; }
  100% { transform: rotateX(180deg); z-index: 1; }
}

@keyframes wed-rays {
  0% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  28% { opacity: 1; }
  100% { opacity: 0.9; transform: scale(1) rotate(38deg); }
}

@keyframes wed-glow {
  0% { opacity: 0; transform: scale(0.3); }
  40% { opacity: 1; }
  100% { opacity: 0.8; transform: scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  .wed-env,
  .wed-open { animation: none; }
}

.wed-open { white-space: nowrap; }

@media (max-width: 480px) {
  .wed-open { gap: 10px; padding: 0 26px 0 18px; font-size: 13px; letter-spacing: 0.13em; }
  .wed-open__orn:first-child { display: none; }
}

/* ---------- Portada: la foto se funde con el fondo (sin marco) ---------- */
body[data-tpl="boda"] .cover.xph-cover {
  justify-content: flex-start;
  padding: 0 22px 120px !important;
}

body[data-tpl="boda"] .xph-fig {
  align-self: center;
  width: min(calc(100% + 44px), 560px);
  height: clamp(440px, 72svh, 660px);
  aspect-ratio: auto;
  margin: 0 auto -118px;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  animation: none;
  -webkit-mask-image: linear-gradient(180deg, #000 52%, transparent 100%), linear-gradient(90deg, transparent, #000 17%, #000 83%, transparent);
  mask-image: linear-gradient(180deg, #000 52%, transparent 100%), linear-gradient(90deg, transparent, #000 17%, #000 83%, transparent);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

body[data-tpl="boda"] .xph-fig::after {
  display: none;
}

body[data-tpl="boda"] .xph-fig img {
  object-position: 50% 8%;
  border-radius: 0;
  animation: wed-kenburns 24s var(--ease-in-out) infinite alternate;
}

body[data-tpl="boda"] .cover > .rings,
body[data-tpl="boda"] .cover > .label,
body[data-tpl="boda"] .cover > .names,
body[data-tpl="boda"] .cover > .date-big {
  position: relative;
  z-index: 2;
}

@keyframes wed-kenburns {
  to { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  body[data-tpl="boda"] .xph-fig img { animation: none; }
}
