/* Manual resumido de marca CUC
Rojo #A3161A · Amarillo #FCD116 · Dorado #C9A227 · Verde #078930 · Gris #595959
*/
:root {
  --cuc-red: #A3161A;
  --cuc-red-deep: #841014;
  --cuc-red-light: #bf252a;
  --cuc-yellow: #FCD116;
  --cuc-gold: #C9A227;
  --cuc-green: #078930;
  --cuc-gray: #595959;
  --cuc-gray-mid: #A5A5A5;
  --cuc-gray-light: #CCCCCC;
  --paper: #fffdf8;
  --bg: #f5f5f4;
  --white: #ffffff;
  --shadow-soft: 0 18px 45px rgba(89, 89, 89, 0.12);
  --shadow-envelope: 0 22px 40px rgba(89, 89, 89, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Red Hat Display", system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(252, 209, 22, 0.16), transparent 22%),
    radial-gradient(circle at 85% 85%, rgba(163, 22, 26, 0.1), transparent 24%),
    linear-gradient(180deg, #fbfbfb 0%, #f2f2f2 100%);
  color: var(--cuc-gray);
  overflow-x: hidden;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.scene {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 460px) minmax(320px, 520px);
  gap: clamp(72px, 8vw, 120px);
  align-items: center;
  justify-content: center;
  padding: 32px;
  position: relative;
  z-index: 2;
}

.intro-kicker {
  margin: 0 0 14px;
  color: var(--cuc-gray-mid);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-weight: 800;
  font-size: 0.82rem;
}

.intro h1 {
  margin: 0;
  color: var(--cuc-red);
  font-size: clamp(2.4rem, 3.7vw, 4.1rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.intro-text {
  margin: 22px 0 0;
  max-width: 34rem;
  font-size: 1.1rem;
  line-height: 1.85;
}

.experience {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.envelope-stage {
  position: relative;
  width: min(100%, 520px);
  height: clamp(420px, 72vh, 650px);
  perspective: 1800px;
  transform-style: preserve-3d;
  transition: width 600ms ease, height 600ms ease;
}

.envelope-stage:not(.is-open) {
  cursor: pointer;
}

.shadow-base {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 74%;
  height: 36px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(89,89,89,0.28) 0%, rgba(89,89,89,0.05) 65%, rgba(89,89,89,0) 100%);
  filter: blur(8px);
  transition: transform 700ms ease, opacity 700ms ease;
}

.letter {
  position: absolute;
  left: 50%;
  bottom: 78px;
  width: 78%;
  height: 50%;
  transform: translateX(-50%) translateY(40px) scale(0.94);
  background: linear-gradient(180deg, #fffefb 0%, #fffaf0 100%);
  border-radius: 18px;
  box-shadow: 0 26px 40px rgba(89, 89, 89, 0.16);
  border: 1px solid rgba(201, 162, 39, 0.18);
  overflow: hidden;
  opacity: 0;
  transition:
    width 900ms cubic-bezier(.2,.8,.18,1),
    height 900ms cubic-bezier(.2,.8,.18,1),
    bottom 900ms cubic-bezier(.2,.8,.18,1),
    transform 900ms cubic-bezier(.2,.8,.18,1),
    box-shadow 800ms ease,
    opacity 500ms ease,
    z-index 0ms linear 250ms;
  z-index: 1;
}

.letter-topbar {
  height: 8px;
  background: linear-gradient(90deg, var(--cuc-red), var(--cuc-gold), var(--cuc-yellow));
}

.letter-body {
  height: calc(100% - 8px);
  padding: clamp(20px, 4.5vw, 34px) clamp(20px, 5vw, 42px) clamp(22px, 4.5vw, 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.letter-logo {
  width: clamp(136px, 34%, 190px);
  height: auto;
  object-fit: contain;
  margin-top: 4px;
}

.letter-kicker {
  margin: clamp(14px, 3vh, 24px) 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--cuc-gray-mid);
  font-weight: 800;
}

.letter h2 {
  margin: 2px 0 clamp(10px, 2vh, 16px);
  color: var(--cuc-red);
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.letter-message {
  margin: 0;
  font-size: clamp(1rem, 1.55vw, 1.24rem);
  line-height: 1.75;
  color: var(--cuc-gray);
}

.divider {
  width: 72px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cuc-yellow), var(--cuc-gold));
  margin: 18px 0 16px;
}

.letter-closing {
  margin: 0;
  font-size: clamp(0.95rem, 1.35vw, 1.08rem);
  line-height: 1.7;
  color: var(--cuc-gray);
}

.signature-block {
  margin-top: auto;
  padding-top: 18px;
  width: 100%;
}

.signature-line {
  width: 120px;
  height: 2px;
  background: rgba(89,89,89,0.26);
  margin: 0 auto 10px;
}

.signature {
  margin: 0;
  font-family: "Great Vibes", cursive;
  font-size: clamp(2rem, 4vw, 2.65rem);
  color: var(--cuc-red);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 600ms ease 350ms, transform 600ms ease 350ms;
}

.signature-role {
  margin: 2px 0 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cuc-gray-mid);
  font-weight: 700;
}

.envelope-back,
.envelope-front {
  position: absolute;
  left: 50%;
  bottom: 34px;
  width: 100%;
  height: min(315px, 50%);
  transform: translateX(-50%);
  border-radius: 0 0 28px 28px;
}

.envelope-back {
  background:
    linear-gradient(180deg, var(--cuc-red-light) 0%, var(--cuc-red) 100%);
  box-shadow: var(--shadow-envelope);
  z-index: 0;
}

.flap-button {
  position: absolute;
  left: 50%;
  top: calc(100% - 34px - min(315px, 50%));
  width: 100%;
  height: min(210px, 34%);
  transform: translateX(-50%);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  z-index: 6;
  perspective: 1400px;
  transition: transform 850ms cubic-bezier(.2,.8,.18,1), opacity 550ms ease;
}

.flap-button::after {
  content: "Abrir";
  position: absolute;
  left: 50%;
  bottom: 24%;
  transform: translateX(-50%);
  min-width: 74px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: var(--cuc-red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 8px 18px rgba(0,0,0,0.14);
  animation: cuePulse 1500ms ease-in-out infinite;
  z-index: 8;
}

.flap {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  transition: transform 850ms cubic-bezier(.2,.8,.18,1), filter 800ms ease;
  transform-origin: top center;
  backface-visibility: hidden;
}

.flap-outer {
  background: linear-gradient(180deg, #d2ac33 0%, var(--cuc-gold) 100%);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.25);
}

.flap-inner {
  background: linear-gradient(180deg, #7b1013 0%, var(--cuc-red-deep) 100%);
  transform: rotateX(180deg);
}

.envelope-front {
  z-index: 4;
  overflow: hidden;
  background: transparent;
  transition:
    transform 850ms cubic-bezier(.2,.8,.18,1),
    opacity 650ms ease,
    filter 650ms ease;
}

.front-left,
.front-right,
.front-center {
  position: absolute;
  inset: 0;
}

.front-center {
  background: linear-gradient(180deg, #c11f25 0%, var(--cuc-red) 100%);
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
}

.front-left {
  background: linear-gradient(180deg, #8d1115 0%, #a3161a 100%);
  clip-path: polygon(0 0, 0 100%, 50% 58%);
}

.front-right {
  background: linear-gradient(180deg, #cf2a2f 0%, #b51d22 100%);
  clip-path: polygon(100% 0, 100% 100%, 50% 58%);
}

.seal-ring,
.seal {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
}

.seal-ring {
  width: 76px;
  height: 76px;
  background: rgba(255,255,255,0.22);
  z-index: 5;
}

.seal {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle at 30% 30%, #ffe174 0%, var(--cuc-yellow) 45%, var(--cuc-gold) 100%);
  color: var(--cuc-red);
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: 0 8px 18px rgba(0,0,0,0.14);
  z-index: 6;
}

.action-button {
  margin-top: 26px;
  border: 0;
  border-radius: 16px;
  background: var(--cuc-red);
  color: var(--white);
  font: inherit;
  font-weight: 800;
  padding: 14px 24px;
  cursor: pointer;
  box-shadow: 0 12px 22px rgba(163,22,26,0.2);
  transition: transform 180ms ease, background 180ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
  background: var(--cuc-red-deep);
}

.helper-text {
  margin: 12px 0 0;
  font-size: 0.95rem;
  color: var(--cuc-gray);
  text-align: center;
}

.is-open .letter {
  bottom: 18px;
  width: min(96%, 500px);
  height: calc(100% - 36px);
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
  z-index: 9;
  box-shadow: 0 38px 70px rgba(89, 89, 89, 0.24);
  transition:
    width 900ms cubic-bezier(.2,.8,.18,1),
    height 900ms cubic-bezier(.2,.8,.18,1),
    bottom 900ms cubic-bezier(.2,.8,.18,1),
    transform 900ms cubic-bezier(.2,.8,.18,1),
    box-shadow 800ms ease,
    opacity 500ms ease,
    z-index 0ms;
}

.is-open .signature {
  opacity: 1;
  transform: translateY(0);
}

.is-open .shadow-base {
  transform: translateX(-50%) scaleX(0.86);
  opacity: 0.55;
}

.is-open .envelope-front {
  transform: translateX(-50%) translateY(34px) scaleY(0.94);
  opacity: 0.62;
  filter: saturate(0.92);
}

.is-open .seal,
.is-open .seal-ring {
  opacity: 0;
  pointer-events: none;
}

.is-open .flap-button {
  transform: translateX(-50%) translateY(28px);
  opacity: 0;
  pointer-events: none;
}

.is-open .flap-button::after {
  animation: none;
}

.is-open .flap-outer {
  transform: rotateX(180deg);
  filter: brightness(0.96);
}

.is-open .flap-inner {
  transform: rotateX(0deg);
}

@keyframes cuePulse {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(-6px);
  }
}

@media (max-width: 1024px) {
  .scene {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 28px 18px 40px;
  }

  .intro {
    text-align: center;
    max-width: 760px;
    margin: 0 auto;
  }

  .intro-text {
    margin-left: auto;
    margin-right: auto;
  }

  .envelope-stage {
    width: min(100%, 500px);
    height: clamp(430px, 68vh, 600px);
  }
}

@media (max-width: 560px) {
  .intro h1 {
    font-size: 2.4rem;
  }

  .intro-text {
    font-size: 1rem;
    line-height: 1.7;
  }

  .envelope-stage {
    width: min(100%, 360px);
    height: min(620px, 72vh);
  }

  .letter {
    width: 82%;
    height: 48%;
    bottom: 72px;
    transform: translateX(-50%) translateY(34px) scale(0.94);
  }

  .letter-body {
    padding: 18px 18px 20px;
  }

  .letter-logo {
    width: 128px;
  }

  .letter-message,
  .letter-closing {
    font-size: 0.93rem;
    line-height: 1.62;
  }

  .signature {
    font-size: 1.8rem;
  }

  .envelope-back,
  .envelope-front {
    height: min(250px, 48%);
  }

  .flap-button {
    top: calc(100% - 34px - min(250px, 48%));
    height: min(170px, 32%);
  }

  .seal-ring {
    width: 68px;
    height: 68px;
  }

  .seal {
    width: 54px;
    height: 54px;
    font-size: 0.92rem;
  }

  .is-open .letter {
    width: 96%;
    height: calc(100% - 28px);
    bottom: 14px;
    transform: translateX(-50%) translateY(0) scale(1);
  }

  .action-button {
    width: 100%;
    max-width: 320px;
  }
}
