@layer reset, tokens, base, components, scroll-effects;

@layer reset {
  html,
  body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  h1,
  h2,
  h3,
  p,
  dl,
  dt,
  dd,
  article,
  dialog {
    margin: 0;
    box-sizing: border-box;
  }

  button,
  img,
  svg,
  section,
  div,
  header,
  footer {
    box-sizing: border-box;
  }

  img,
  svg {
    display: block;
    max-inline-size: 100%;
  }

  button {
    font: inherit;
    color: inherit;
    cursor: pointer;
  }
}

@layer tokens {
  :root {
    --in-oklab: ;

    --color-pine-950: #04170c;
    --color-pine-900: #082917;
    --color-pine-800: #0d3d23;
    --color-aurrera-green: #0b6e35;
    --color-aurrera-red: #c81e28;
    --color-aurrera-red-dark: #94141c;
    --color-gold-300: #fae39c;
    --color-gold-400: #f2c349;
    --color-gold-500: #d99b1e;
    --color-cream-50: #fffdf8;
    --color-cream-100: #fbf3e4;
    --color-cream-200: #f2e4ca;
    --color-paper-front: #f7ebd7;
    --color-paper-side: #eeddc1;
    --color-paper-bottom: #f3e4cb;
    --color-ink-900: #1d1a16;
    --color-ink-700: #4c4338;

    --font-display: 'Fredoka', system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
    --font-script: 'Dancing Script', cursive;

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-pill: 999px;

    --env-w: min(90dvw, 560px);
    --env-h: calc(var(--env-w) * 0.68);
    --card-tucked-scale: 0.44;
    --card-tucked-y: 2%;
    --card-tucked-clip: 42%;

    --shadow-card: 0 32px 90px rgba(2, 10, 5, 0.7), 0 0 46px rgba(242, 195, 73, 0.22);
    --paper-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
    --linen-weave:
      repeating-linear-gradient(0deg, rgba(130, 98, 62, 0.035) 0 1px, transparent 1px 3px),
      repeating-linear-gradient(90deg, rgba(130, 98, 62, 0.03) 0 1px, transparent 1px 3px);

    timeline-scope: --envelope-tl;
  }

  @media (max-width: 839px) {
    :root {
      --card-tucked-scale: 0.42;
      --card-tucked-y: 12%;
      --card-tucked-clip: 54%;
    }
  }

  @supports (linear-gradient(in oklab, white, black)) {
    :root {
      --in-oklab: in oklab;
    }
  }
}

@layer base {
  html {
    scroll-behavior: smooth;
    background-color: var(--color-pine-950);
    color: var(--color-cream-50);
    font-family: var(--font-body);
    line-height: 1.5;
    scrollbar-color: var(--color-gold-500) var(--color-pine-950);
  }

  body {
    min-block-size: 100dvh;
    overflow-x: clip;
    background-color: var(--color-pine-950);
    position: relative;
  }

  :where(button, a, [tabindex]):focus-visible {
    outline: 3px solid var(--color-gold-400);
    outline-offset: 3px;
  }
}

@layer components {
  /* ============================================================
     ESCENARIO FESTIVO DE PANTALLA COMPLETA
     ============================================================ */
  .stage-backdrop {
    position: fixed;
    inset: 0;
    inline-size: 100dvw;
    block-size: 100dvh;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
    background:
      radial-gradient(circle at 20% 18%, rgba(200, 30, 40, 0.26), transparent 40%),
      radial-gradient(circle at 82% 20%, rgba(242, 195, 73, 0.22), transparent 38%),
      radial-gradient(circle at 50% 62%, rgba(11, 110, 53, 0.42), transparent 58%),
      linear-gradient(170deg var(--in-oklab), #04170c 0%, #092e1a 52%, #04150b 100%);
  }

  .bokeh-lights {
    position: absolute;
    inset: -6%;
    will-change: transform, opacity;
  }

  .bokeh-lights--a {
    background-image:
      radial-gradient(circle at 14% 32%, rgba(250, 227, 156, 0.36) 0 5px, transparent 42px),
      radial-gradient(circle at 86% 42%, rgba(250, 227, 156, 0.32) 0 6px, transparent 52px),
      radial-gradient(circle at 26% 78%, rgba(200, 30, 40, 0.28) 0 7px, transparent 54px),
      radial-gradient(circle at 74% 80%, rgba(242, 195, 73, 0.3) 0 6px, transparent 48px),
      radial-gradient(circle at 50% 24%, rgba(255, 253, 248, 0.22) 0 4px, transparent 38px);
    animation: bokehTwinkleA 5.5s ease-in-out infinite alternate;
  }

  .bokeh-lights--b {
    background-image:
      radial-gradient(circle at 22% 18%, rgba(242, 195, 73, 0.26) 0 4px, transparent 38px),
      radial-gradient(circle at 78% 22%, rgba(200, 30, 40, 0.22) 0 5px, transparent 44px),
      radial-gradient(circle at 10% 62%, rgba(255, 246, 214, 0.22) 0 4px, transparent 34px),
      radial-gradient(circle at 90% 68%, rgba(250, 227, 156, 0.28) 0 5px, transparent 46px),
      radial-gradient(circle at 46% 86%, rgba(255, 243, 207, 0.22) 0 4px, transparent 40px);
    animation: bokehTwinkleB 7s ease-in-out infinite alternate;
  }

  .snow-layer {
    position: absolute;
    inset-block: -13rem 0;
    inset-inline: -2rem;
    will-change: transform;
  }

  .snow-layer--far {
    opacity: 0.36;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.88) 1.4px, transparent 2.4px);
    background-size: 9rem 9rem;
    animation: snowDriftFar 18s linear infinite;
  }

  .snow-layer--near {
    opacity: 0.44;
    background-image:
      radial-gradient(circle, rgba(250, 227, 156, 0.78) 1.5px, transparent 2.8px),
      radial-gradient(circle, rgba(255, 255, 255, 0.9) 1px, transparent 2px);
    background-size: 12rem 12rem, 6rem 6rem;
    background-position: 4rem 5rem, 2rem 1.5rem;
    animation: snowDriftNear 12s linear infinite;
  }

  .fairy-garland {
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    inline-size: 100%;
    block-size: clamp(64px, 11dvh, 110px);
    opacity: 0.95;
  }

  .bulb-group {
    transform-box: fill-box;
    transform-origin: center;
  }

  .bulb-a {
    animation: bulbTwinkle 2.6s ease-in-out infinite alternate;
  }

  .bulb-b {
    animation: bulbTwinkle 3.2s ease-in-out 0.9s infinite alternate;
  }

  .bulb-c {
    animation: bulbTwinkle 2.9s ease-in-out 1.7s infinite alternate;
  }

  .corner-pine {
    position: absolute;
    inset-block-start: 0;
    inline-size: clamp(140px, 24dvw, 280px);
    block-size: auto;
    opacity: 0.9;
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  }

  .corner-pine-left {
    inset-inline-start: 0;
    transform-origin: 0% 0%;
    animation: pineSwayLeft 8s ease-in-out infinite alternate;
  }

  .corner-pine-right {
    inset-inline-end: 0;
    transform-origin: 100% 0%;
    animation: pineSwayRight 9s ease-in-out infinite alternate;
  }

  /* Barra superior de progreso */
  .scroll-progress-track {
    position: fixed;
    inset-block-start: 0;
    inset-inline: 0;
    block-size: 4px;
    background: rgba(255, 255, 255, 0.12);
    z-index: 40;
    pointer-events: none;
  }

  .scroll-progress-bar {
    inline-size: 100%;
    block-size: 100%;
    background: linear-gradient(90deg var(--in-oklab), var(--color-aurrera-red), var(--color-gold-400), var(--color-aurrera-green));
    transform-origin: left center;
    transform: scaleX(0);
  }

  main {
    position: relative;
    z-index: 1;
  }

  /* ============================================================
     PISTA DE SCROLL 3D Y ESCENARIO CENTRAL
     ============================================================ */
  .envelope-track {
    position: relative;
    block-size: 360dvh;
    view-timeline: --envelope-tl block;
  }

  .envelope-stage {
    position: sticky;
    inset-block-start: 0;
    block-size: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-block: clamp(1rem, 2.5dvh, 2rem);
    padding-inline: clamp(0.85rem, 3.5vw, 2rem);
  }

  .stage-intro {
    position: absolute;
    inset-block-start: clamp(4.75rem, 11.5dvh, 7.25rem);
    inset-inline: clamp(1rem, 4vw, 2rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    z-index: 20;
    pointer-events: none;
  }

  .stage-title {
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 1.15rem + 2vw, 2.55rem);
    font-weight: 700;
    line-height: 1.15;
    text-wrap: balance;
    color: var(--color-cream-50);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
  }

  .script-accent {
    font-family: var(--font-script);
    font-size: 1.24em;
    color: var(--color-gold-400);
    font-weight: 700;
  }

  /* Ancla común para el sobre (capas 1, 4, 6, 8) y la tarjeta real (2 -> 15) */
  .scene-anchor {
    position: relative;
    inline-size: min(94dvw, 1000px);
    block-size: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
  }

  .envelope-rig {
    display: contents;
  }

  .envelope-shadow,
  .envelope-back,
  .envelope-front,
  .envelope-flap,
  .envelope-seal {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    inline-size: var(--env-w);
    block-size: var(--env-h);
    margin-block-start: calc(var(--env-h) / -2);
    margin-inline-start: calc(var(--env-w) / -2);
    pointer-events: none;
  }

  .envelope-shadow {
    z-index: 0;
    border-radius: 22px;
    background:
      radial-gradient(ellipse at 50% 56%, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.34) 48%, transparent 74%);
    transform: translate3d(0, 28px, 0) scale(1.08);
    filter: blur(20px);
  }

  /* Parte trasera del sobre + borde festivo de caramelo */
  .envelope-back {
    z-index: 1;
    border-radius: 18px;
    padding: 10px;
    background:
      var(--paper-grain),
      repeating-linear-gradient(
        -45deg,
        var(--color-aurrera-red) 0 12px,
        var(--color-cream-50) 12px 22px,
        var(--color-aurrera-green) 22px 34px,
        var(--color-cream-50) 34px 44px
      );
    box-shadow:
      0 30px 68px rgba(0, 0, 0, 0.62),
      0 6px 14px rgba(0, 0, 0, 0.38),
      inset 0 1px 1px rgba(255, 255, 255, 0.65);
  }

  .envelope-inner-depth {
    inline-size: 100%;
    block-size: 100%;
    border-radius: 10px;
    background:
      var(--paper-grain),
      repeating-linear-gradient(
        45deg,
        rgba(242, 195, 73, 0.08) 0 8px,
        transparent 8px 18px
      ),
      linear-gradient(180deg var(--in-oklab), #09321b 0%, #104d2a 32%, #d8c29e 100%);
    box-shadow:
      inset 0 22px 42px rgba(4, 18, 9, 0.72),
      inset 0 2px 6px rgba(0, 0, 0, 0.45);
  }

  /* Bolsillo frontal del sobre con textura de algodón y pliegues realistas */
  .envelope-front {
    z-index: 4;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 250, 240, 0.68);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.75),
      inset 0 -3px 10px rgba(72, 46, 22, 0.16);
  }

  .pocket-left,
  .pocket-right,
  .pocket-bottom,
  .envelope-paper-grain {
    position: absolute;
    inset: 0;
  }

  .pocket-left {
    background:
      var(--linen-weave),
      radial-gradient(circle at 12% 28%, rgba(255, 252, 244, 0.55), transparent 55%),
      linear-gradient(122deg var(--in-oklab), #f9efdc 0%, #eddac0 56%, #dec6a5 100%);
    clip-path: polygon(0 0, 54% 53%, 0 100%);
    filter: drop-shadow(3px 1px 9px rgba(42, 22, 8, 0.2));
  }

  .pocket-right {
    background:
      var(--linen-weave),
      radial-gradient(circle at 86% 24%, rgba(255, 250, 240, 0.36), transparent 52%),
      linear-gradient(238deg var(--in-oklab), #f5e8d1 0%, #e7d2b3 58%, #d7bc99 100%);
    clip-path: polygon(100% 0, 46% 53%, 100% 100%);
    filter: drop-shadow(-3px 1px 9px rgba(42, 22, 8, 0.22));
  }

  .pocket-bottom {
    background:
      var(--linen-weave),
      radial-gradient(ellipse at 50% 44%, rgba(255, 253, 248, 0.78) 0%, transparent 55%),
      linear-gradient(180deg var(--in-oklab), #fbf2e2 0%, #f0dfc4 62%, #e2c9a6 100%);
    clip-path: polygon(0 100%, 50% 44%, 100% 100%);
    filter: drop-shadow(0 -7px 14px rgba(38, 20, 6, 0.24));
  }

  /* Borde iluminado del doblez inferior del bolsillo */
  .pocket-bottom::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.62) 44%, transparent 48%);
    clip-path: polygon(0 100%, 50% 44%, 100% 100%, 98% 100%, 50% 45.2%, 2% 100%);
    opacity: 0.75;
  }

  .envelope-paper-grain {
    background-image: var(--paper-grain);
    mix-blend-mode: multiply;
    opacity: 0.52;
    pointer-events: none;
  }

  .envelope-stamp {
    position: absolute;
    inset-block-start: clamp(10px, 2.5%, 20px);
    inset-inline-end: clamp(10px, 2.5%, 20px);
    inline-size: clamp(66px, 14vw, 92px);
    backface-visibility: hidden;
    transform: translateZ(2px);
    filter: drop-shadow(0 3px 6px rgba(42, 22, 8, 0.22));
  }

  .envelope-front-label {
    position: absolute;
    inset-block-end: clamp(14px, 7.5%, 30px);
    inset-inline: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.16rem;
  }

  .env-to {
    font-family: var(--font-script);
    font-size: clamp(1.55rem, 1.25rem + 1.4vw, 2.35rem);
    color: #09582a;
    font-weight: 700;
    line-height: 1;
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.72),
      0 -0.5px 0 rgba(4, 34, 16, 0.28);
  }

  .env-sub {
    font-size: clamp(0.68rem, 0.62rem + 0.25vw, 0.82rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #a91821;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
  }

  /* Solapa triangular superior en 3D */
  .envelope-flap {
    z-index: 6;
    transform-origin: 50% 0%;
    transform-style: preserve-3d;
  }

  .flap-face {
    position: absolute;
    inset: 0;
    clip-path: polygon(0 0, 100% 0, 50% 56%);
    backface-visibility: hidden;
  }

  .flap-outer {
    border-radius: 18px 18px 0 0;
    background:
      var(--paper-grain),
      var(--linen-weave),
      radial-gradient(circle at 26% 14%, rgba(255, 255, 255, 0.65), transparent 52%),
      linear-gradient(180deg var(--in-oklab), #fffaf1 0%, #f4e4ca 62%, #e6cea9 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    filter: drop-shadow(0 10px 18px rgba(28, 14, 4, 0.3));
  }

  .flap-inner {
    transform: rotateX(180deg);
    background:
      var(--paper-grain),
      repeating-linear-gradient(
        45deg,
        rgba(242, 195, 73, 0.16) 0 8px,
        transparent 8px 20px
      ),
      repeating-linear-gradient(
        -45deg,
        rgba(250, 227, 156, 0.08) 0 8px,
        transparent 8px 20px
      ),
      linear-gradient(180deg var(--in-oklab), #0d542b 0%, #073219 100%);
    box-shadow: inset 0 -10px 24px rgba(0, 0, 0, 0.35);
  }

  /* Sello dorado y moño rojo */
  .envelope-seal {
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .seal-svg {
    inline-size: clamp(146px, 31%, 194px);
    block-size: auto;
    transform: translateY(4%);
  }

  /* ============================================================
     TARJETA REAL QUE SALE DEL SOBRE Y PERMANECE AL FINAL
     ============================================================ */
  .card-reveal-shell {
    position: relative;
    z-index: 2;
    inline-size: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    opacity: 0;
    transform: translate3d(0, var(--card-tucked-y), 0) scale(var(--card-tucked-scale));
    clip-path: inset(0 0 var(--card-tucked-clip) 0 round 22px);
    will-change: transform, clip-path, opacity;
  }

  .invitation-card {
    position: relative;
    inline-size: 100%;
    background: linear-gradient(165deg var(--in-oklab), var(--color-cream-50) 0%, var(--color-cream-100) 65%, var(--color-cream-200) 100%);
    color: var(--color-ink-900);
    border-radius: var(--radius-lg);
    border: 2px solid rgba(217, 155, 30, 0.75);
    box-shadow: var(--shadow-card);
    padding: clamp(1.35rem, 3.2vw, 2.75rem);
    overflow: hidden;
  }

  .invitation-card::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: calc(var(--radius-lg) - 8px);
    border: 1px dashed rgba(11, 110, 53, 0.28);
    pointer-events: none;
  }

  .card-ribbon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    color: #7c5210;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(0.88rem, 0.82rem + 0.3vw, 1.02rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-align: center;
    margin-block-end: 1.5rem;
    position: relative;
    z-index: 1;
  }

  .card-ribbon::before,
  .card-ribbon::after {
    content: "";
    flex: 1;
    block-size: 1px;
    max-inline-size: 140px;
  }

  .card-ribbon::before {
    background: linear-gradient(90deg, transparent, rgba(168, 120, 26, 0.65));
  }

  .card-ribbon::after {
    background: linear-gradient(270deg, transparent, rgba(168, 120, 26, 0.65));
  }

  .card-ribbon .ornament {
    color: #a8781a;
    font-size: 0.85em;
    letter-spacing: 0;
  }

  .invitation-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1.5rem, 3.5vw, 2.75rem);
    align-items: center;
    position: relative;
    z-index: 1;
  }

  @media (min-width: 840px) {
    .invitation-grid {
      grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    }
  }

  .flyer-showcase {
    display: flex;
    justify-content: center;
  }

  .flyer-zoom-trigger {
    position: relative;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(217, 155, 30, 0.45);
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(29, 26, 22, 0.14);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-inline-size: 380px;
    inline-size: 100%;
  }

  .flyer-zoom-trigger:hover {
    transform: translateY(-4px) rotate(-0.6deg);
    box-shadow: 0 24px 52px rgba(29, 26, 22, 0.22);
  }

  .flyer-zoom-trigger img {
    inline-size: 100%;
    block-size: auto;
    aspect-ratio: 960 / 1080;
    object-fit: cover;
    border-radius: calc(var(--radius-md) - 5px);
  }

  .zoom-chip {
    position: absolute;
    inset-block-end: 1rem;
    inset-inline-end: 1rem;
    padding-block: 0.35rem;
    padding-inline: 0.8rem;
    border-radius: var(--radius-pill);
    background: rgba(8, 41, 23, 0.88);
    color: var(--color-cream-50);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .invitation-details {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
  }

  .brand-kicker {
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-aurrera-green);
  }

  .invitation-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 1.4rem + 1.8vw, 2.7rem);
    line-height: 1.12;
    text-wrap: balance;
    color: var(--color-ink-900);
  }

  .invitation-title strong {
    display: block;
    color: var(--color-aurrera-red);
    font-weight: 700;
  }

  .script-highlight {
    font-family: var(--font-script);
    font-size: 1.2em;
    color: var(--color-aurrera-green);
  }

  .invitation-copy {
    font-size: clamp(0.98rem, 0.94rem + 0.22vw, 1.1rem);
    color: var(--color-ink-700);
    text-wrap: pretty;
    max-inline-size: 46ch;
  }

  .event-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.85rem;
  }

  .meta-box {
    background: #ffffff;
    border: 1.5px solid rgba(11, 110, 53, 0.18);
    border-radius: var(--radius-md);
    padding: 0.9rem 1.05rem;
    box-shadow: 0 8px 20px rgba(29, 26, 22, 0.05);
  }

  .meta-box dt {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-aurrera-red);
    margin-block-end: 0.28rem;
  }

  .meta-box dd {
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 1rem + 0.3vw, 1.22rem);
    font-weight: 600;
    color: var(--color-ink-900);
  }

  /* Cuenta Regresiva */
  .countdown-block {
    background: linear-gradient(145deg var(--in-oklab), var(--color-pine-900) 0%, var(--color-pine-800) 100%);
    color: var(--color-cream-50);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    border: 1.5px solid rgba(242, 195, 73, 0.48);
  }

  .countdown-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-gold-300);
    margin-block-end: 0.75rem;
    text-align: center;
  }

  .countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .time-capsule {
    background: rgba(4, 23, 12, 0.68);
    border: 1px solid rgba(242, 195, 73, 0.32);
    border-radius: 14px;
    padding-block: 0.7rem;
    padding-inline: 0.35rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.12rem;
  }

  .time-value {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 1.15rem + 1.15vw, 2rem);
    font-weight: 700;
    line-height: 1;
    color: var(--color-gold-400);
    font-variant-numeric: tabular-nums;
  }

  .time-unit {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 253, 248, 0.82);
  }

  .countdown-status {
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.12rem;
    color: var(--color-gold-300);
    padding-block: 0.45rem;
  }

  .cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-block-start: 0.2rem;
  }

  .btn-festive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-block-size: 46px;
    min-inline-size: 46px;
    padding-block: 0.75rem;
    padding-inline: 1.6rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 243, 207, 0.7);
    background: linear-gradient(135deg var(--in-oklab), var(--color-aurrera-red) 0%, #e02c37 55%, var(--color-aurrera-red-dark) 100%);
    color: var(--color-cream-50);
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
    font-weight: 600;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.28);
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
  }

  .btn-festive:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(200, 30, 40, 0.55);
    filter: brightness(1.06);
  }

  .btn-primary-action {
    background: linear-gradient(135deg var(--in-oklab), var(--color-aurrera-green) 0%, #128a45 55%, #074f25 100%);
    box-shadow: 0 10px 26px rgba(11, 110, 53, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  }

  .btn-primary-action:hover {
    box-shadow: 0 14px 30px rgba(11, 110, 53, 0.48);
  }

  .btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-block-size: 46px;
    min-inline-size: 46px;
    padding-block: 0.72rem;
    padding-inline: 1.35rem;
    border-radius: var(--radius-pill);
    border: 1.5px solid rgba(11, 110, 53, 0.35);
    background: rgba(11, 110, 53, 0.07);
    color: var(--color-aurrera-green);
    font-weight: 700;
    font-size: 0.95rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
  }

  .btn-outline:hover {
    background: rgba(11, 110, 53, 0.14);
    transform: translateY(-1px);
  }

  /* Controles inferiores iniciales */
  .stage-bottom-hud {
    position: absolute;
    inset-block-end: clamp(1rem, 3.5dvh, 2.25rem);
    inset-inline: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    z-index: 20;
  }

  .scroll-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-cream-50);
    font-size: 0.88rem;
    font-weight: 600;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
  }

  .mouse-icon {
    inline-size: 18px;
    block-size: 28px;
    border: 2px solid rgba(242, 195, 73, 0.85);
    border-radius: 12px;
    position: relative;
    background: rgba(4, 23, 12, 0.45);
  }

  .mouse-icon::after {
    content: "";
    position: absolute;
    inset-block-start: 5px;
    inset-inline-start: 50%;
    inline-size: 3px;
    block-size: 6px;
    border-radius: 3px;
    background: var(--color-gold-400);
    transform: translateX(-50%);
    animation: wheelBounce 1.6s ease-in-out infinite;
  }

  /* Pie de página discreto integrado debajo de la tarjeta dentro de .card-reveal-shell */
  .powered-by-footer {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.84rem;
    color: rgba(255, 253, 248, 0.82);
    opacity: 0;
    pointer-events: none;
  }

  .powered-by-footer a {
    display: inline-flex;
    align-items: center;
    min-block-size: 32px;
    padding-inline: 0.25rem;
    color: var(--color-gold-300);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 1px solid rgba(250, 227, 156, 0.45);
    transition: color 0.2s ease, border-color 0.2s ease;
  }

  .powered-by-footer a:hover {
    color: var(--color-cream-50);
    border-bottom-color: var(--color-cream-50);
  }

  /* Ajustes responsivos DESPUÉS de las reglas base para asegurar que la tarjeta y el pie entren completos en cualquier móvil o laptop */
  @media (max-width: 839px) {
    .invitation-card {
      padding: 0.95rem 1rem;
    }

    .card-ribbon {
      margin-block-end: 0.65rem;
      font-size: 0.76rem;
    }

    .invitation-grid {
      gap: 0.75rem;
    }

    .flyer-zoom-trigger {
      max-inline-size: min(42dvw, 168px);
      padding: 0.3rem;
    }

    .zoom-chip {
      inset-block-end: 0.55rem;
      inset-inline-end: 0.55rem;
      padding-block: 0.25rem;
      padding-inline: 0.6rem;
      font-size: 0.7rem;
    }

    .invitation-details {
      gap: 0.58rem;
    }

    .brand-kicker {
      font-size: 0.74rem;
    }

    .invitation-title {
      font-size: clamp(1.38rem, 1.15rem + 1.4vw, 1.75rem);
    }

    .invitation-copy {
      font-size: 0.86rem;
      line-height: 1.38;
    }

    .event-meta-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0.55rem;
    }

    .meta-box {
      padding: 0.52rem 0.7rem;
    }

    .meta-box dd {
      font-size: 0.96rem;
    }

    .countdown-block {
      padding: 0.68rem;
    }

    .countdown-label {
      margin-block-end: 0.45rem;
      font-size: 0.72rem;
    }

    .time-capsule {
      padding-block: 0.45rem;
    }

    .time-value {
      font-size: 1.3rem;
    }

    .cta-row {
      justify-content: center;
      margin-block-start: 0.1rem;
    }

    .btn-outline {
      min-block-size: 40px;
      padding-block: 0.52rem;
      padding-inline: 1.1rem;
      font-size: 0.88rem;
    }
  }

  @media (max-height: 760px) and (min-width: 840px) {
    .invitation-card {
      padding: 1.4rem 1.8rem;
    }

    .flyer-zoom-trigger {
      max-inline-size: 290px;
    }
  }

  /* Dialog nativo */
  .flyer-dialog {
    padding: 0;
    border: 2px solid rgba(242, 195, 73, 0.65);
    border-radius: var(--radius-lg);
    background: var(--color-pine-950);
    color: var(--color-cream-50);
    max-inline-size: min(92vw, 620px);
    max-block-size: 90dvh;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.85);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.25s ease, transform 0.25s ease, display 0.25s allow-discrete, overlay 0.25s allow-discrete;
  }

  .flyer-dialog[open] {
    opacity: 1;
    transform: scale(1);
  }

  @starting-style {
    .flyer-dialog[open] {
      opacity: 0;
      transform: scale(0.95);
    }
  }

  .flyer-dialog::backdrop {
    background: rgba(2, 12, 6, 0.82);
    backdrop-filter: blur(6px);
  }

  .dialog-inner {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }

  .dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .dialog-header h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--color-gold-300);
  }

  .dialog-close {
    min-inline-size: 44px;
    min-block-size: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-cream-50);
    font-weight: 700;
  }

  .dialog-close:hover {
    background: rgba(200, 30, 40, 0.8);
  }

  .dialog-inner img {
    inline-size: 100%;
    block-size: auto;
    max-block-size: 74dvh;
    object-fit: contain;
    border-radius: var(--radius-md);
  }
}

@layer scroll-effects {
  @keyframes wheelBounce {
    0%, 100% {
      transform: translate(-50%, 0);
      opacity: 1;
    }
    50% {
      transform: translate(-50%, 7px);
      opacity: 0.35;
    }
  }

  @keyframes bokehTwinkleA {
    0% {
      opacity: 0.68;
      transform: translate3d(0, 0, 0) scale(1);
    }
    100% {
      opacity: 1;
      transform: translate3d(1.2%, -1.4%, 0) scale(1.04);
    }
  }

  @keyframes bokehTwinkleB {
    0% {
      opacity: 1;
      transform: translate3d(0, 0, 0) scale(1.03);
    }
    100% {
      opacity: 0.58;
      transform: translate3d(-1.4%, 1.2%, 0) scale(0.98);
    }
  }

  @keyframes snowDriftFar {
    from {
      transform: translate3d(0, 0, 0);
    }
    to {
      transform: translate3d(0, 9rem, 0);
    }
  }

  @keyframes snowDriftNear {
    from {
      transform: translate3d(0, 0, 0);
    }
    to {
      transform: translate3d(0, 12rem, 0);
    }
  }

  @keyframes bulbTwinkle {
    0% {
      opacity: 0.42;
      transform: scale(0.88);
    }
    55% {
      opacity: 1;
      transform: scale(1.1);
    }
    100% {
      opacity: 0.65;
      transform: scale(0.95);
    }
  }

  @keyframes pineSwayLeft {
    from {
      transform: rotate(-1.2deg);
    }
    to {
      transform: rotate(1.4deg);
    }
  }

  @keyframes pineSwayRight {
    from {
      transform: rotate(1.2deg);
    }
    to {
      transform: rotate(-1.4deg);
    }
  }

  @keyframes progress-grow {
    from {
      transform: scaleX(0);
    }
    to {
      transform: scaleX(1);
    }
  }

  @keyframes intro-fade {
    0% {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
    18%, 100% {
      opacity: 0;
      transform: translate3d(0, -18px, 0);
    }
  }

  @keyframes hud-fade {
    0% {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
    16%, 100% {
      opacity: 0;
      transform: translate3d(0, 16px, 0);
      pointer-events: none;
    }
  }

  @keyframes seal-open {
    0% {
      opacity: 1;
      transform: translate3d(0, 0, 0) scale(1);
    }
    14% {
      opacity: 0;
      transform: translate3d(0, -16px, 0) scale(1.16);
    }
    100% {
      opacity: 0;
      transform: translate3d(0, 40dvh, 0) scale(0.8);
    }
  }

  @keyframes flap-open {
    0%, 8% {
      transform: perspective(1400px) translate3d(0, 0, 0) scale(1) rotateX(0deg);
      z-index: 6;
      opacity: 1;
    }
    20% {
      transform: perspective(1400px) translate3d(0, 0, 0) scale(1) rotateX(92deg);
      z-index: 1;
      opacity: 1;
    }
    34%, 52% {
      transform: perspective(1400px) translate3d(0, 0, 0) scale(1) rotateX(178deg);
      z-index: 1;
      opacity: 1;
    }
    86%, 100% {
      transform: perspective(1400px) translate3d(0, 42dvh, 0) scale(0.84) rotateX(178deg);
      z-index: 1;
      opacity: 0;
    }
  }

  @keyframes envelope-exit {
    0%, 52% {
      transform: translate3d(0, 0, 0) scale(1);
      opacity: 1;
    }
    86%, 100% {
      transform: translate3d(0, 42dvh, 0) scale(0.84);
      opacity: 0;
    }
  }

  @keyframes card-emerge {
    0%, 14% {
      opacity: 0;
      z-index: 2;
      transform: translate3d(0, var(--card-tucked-y), 0) scale(var(--card-tucked-scale));
      clip-path: inset(0 0 var(--card-tucked-clip) 0 round 22px);
    }
    22% {
      opacity: 1;
      z-index: 2;
      transform: translate3d(0, var(--card-tucked-y), 0) scale(var(--card-tucked-scale));
      clip-path: inset(0 0 var(--card-tucked-clip) 0 round 22px);
    }
    48% {
      opacity: 1;
      z-index: 2;
      transform: translate3d(0, -32%, 0) scale(calc(var(--card-tucked-scale) * 1.1));
      clip-path: inset(0 0 0% 0 round 22px);
    }
    52% {
      opacity: 1;
      z-index: 15;
      transform: translate3d(0, -32%, 0) scale(calc(var(--card-tucked-scale) * 1.1));
      clip-path: inset(0 0 0% 0 round 22px);
    }
    88%, 100% {
      opacity: 1;
      z-index: 15;
      transform: translate3d(0, 0, 0) scale(1);
      clip-path: inset(0 0 0% 0 round 22px);
    }
  }

  @keyframes credit-reveal {
    0%, 82% {
      opacity: 0;
      transform: translate3d(0, 10px, 0);
      pointer-events: none;
    }
    95%, 100% {
      opacity: 1;
      transform: translate3d(0, 0, 0);
      pointer-events: auto;
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    @supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
      .scroll-progress-bar {
        animation: progress-grow auto linear both;
        animation-timeline: scroll(root block);
      }

      .stage-intro {
        animation: intro-fade auto linear both;
        animation-timeline: --envelope-tl;
        animation-range: contain 0% contain 100%;
      }

      .stage-bottom-hud {
        animation: hud-fade auto linear both;
        animation-timeline: --envelope-tl;
        animation-range: contain 0% contain 100%;
      }

      .envelope-seal {
        animation: seal-open auto linear both;
        animation-timeline: --envelope-tl;
        animation-range: contain 0% contain 100%;
      }

      .envelope-flap {
        animation: flap-open auto linear both;
        animation-timeline: --envelope-tl;
        animation-range: contain 0% contain 100%;
      }

      .envelope-shadow,
      .envelope-back,
      .envelope-front {
        animation: envelope-exit auto linear both;
        animation-timeline: --envelope-tl;
        animation-range: contain 0% contain 100%;
      }

      .card-reveal-shell {
        animation: card-emerge auto linear both;
        animation-timeline: --envelope-tl;
        animation-range: contain 0% contain 100%;
      }

      .powered-by-footer {
        animation: credit-reveal auto linear both;
        animation-timeline: --envelope-tl;
        animation-range: contain 0% contain 100%;
      }
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    .envelope-track {
      block-size: auto;
    }

    .envelope-stage {
      position: relative;
      padding-block: 3rem 2rem;
    }

    .envelope-rig,
    .stage-intro,
    .stage-bottom-hud,
    .mouse-icon::after {
      display: none !important;
      animation: none !important;
    }

    .card-reveal-shell {
      animation: none !important;
      z-index: 15;
      transform: none !important;
      clip-path: none !important;
      opacity: 1 !important;
    }

    .powered-by-footer {
      animation: none !important;
      opacity: 1 !important;
      transform: none !important;
      pointer-events: auto !important;
    }

    .scroll-progress-bar {
      animation: none !important;
      transform: scaleX(1) !important;
    }

    .bokeh-lights,
    .snow-layer,
    .bulb-group,
    .corner-pine {
      animation: none !important;
      transform: none !important;
    }
  }
}
