/* =========================
   CORE - SHARED BASE
   ========================= */

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
}

body.noscroll {
  height: 100dvh;
  overflow: hidden;
}

.is-hidden,
.hidden-template-block {
  display: none !important;
}

/* =========================
   CORE - INVITATION STATE
   ========================= */

#invitation {
  display: none;
  opacity: 0;
  transform: translateY(var(--invitation-enter-y, 10px));
  transition:
    opacity var(--invitation-transition, 0.7s ease),
    transform var(--invitation-transition, 0.7s ease);
}

#invitation.unlocked {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   CORE - REVEAL ANIMATIONS
   ========================= */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 800ms ease,
    transform 800ms ease;
  will-change: opacity, transform;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal.delay1 {
  transition-delay: 90ms;
}

.reveal.delay2 {
  transition-delay: 180ms;
}

.reveal.delay3 {
  transition-delay: 270ms;
}

/* =========================
   CORE - GATE / VIDEO INTRO
   ========================= */

#gate {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--gate-backdrop, rgba(0, 0, 0, 0.7));
  z-index: 9999;
}

.gate-frame {
  width: min(860px, 100vw);
  height: 100dvh;
  background: var(--gate-frame-bg, #fff);
  border-radius: var(--gate-frame-radius, 0);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.gate-head {
  padding: 16px 16px 12px;
  text-align: center;
  border-bottom: var(--gate-border, 1px solid rgba(0, 0, 0, 0.08));
  background: var(--gate-head-bg, transparent);
}

.gate-head h2 {
  margin: 0;
  font-family: var(--gate-title-font, var(--font-title, inherit));
  font-weight: var(--gate-title-weight, 700);
  font-size: clamp(16px, 2.2vw, 30px);
  letter-spacing: var(--gate-title-spacing, 0.08em);
  color: var(--gate-title-color, var(--ink, #111));
}

.gate-head p {
  margin: 8px 0 0;
  font-family: var(--gate-text-font, var(--font-body, inherit));
  font-size: clamp(14px, 2vw, 20px);
  color: var(--gate-text-color, var(--muted, rgba(0, 0, 0, 0.6)));
  line-height: 1.45;
}

.gate-pill {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--gate-pill-bg, rgba(255, 255, 255, 0.16));
  color: var(--gate-pill-color, var(--gate-title-color, #111));
  font-family: var(--font-ui, var(--font-body, inherit));
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gate-media {
  position: relative;
  background: var(--gate-media-bg, #000);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#previewBtn {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: transparent;
}

#previewImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#introVideo {
  width: 100%;
  height: 100%;
  display: block;
  background-color: var(--gate-media-bg, #000);
  object-fit: contain;
  object-position: center;
  cursor: pointer;
}

#fadeOverlay {
  position: absolute;
  inset: 0;
  background: var(--gate-fade-bg, #fff);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
  z-index: 5;
}

.playBadge {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.playCircle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
}

.playTri {
  width: 0;
  height: 0;
  border-left: 16px solid #fff;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 4px;
}

.tapHint {
  position: absolute;
  inset: auto 0 18px;
  margin: auto;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.86);
  color: var(--primary-dark, #111);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
  pointer-events: none;
  z-index: 6;
}

.gate-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 16px 18px;
  border-top: var(--gate-border, 1px solid rgba(0, 0, 0, 0.08));
  background: var(--gate-actions-bg, transparent);
  position: relative;
  z-index: 2;
}

#skipBtn {
  width: 100%;
}

@media (min-width: 900px) {
  #gate {
    padding: 22px;
  }

  .gate-frame {
    width: min(980px, 92vw);
    height: min(820px, 92vh);
  }
}

@media (max-width: 720px) {
  html,
  body {
    height: auto;
    overflow-x: hidden;
  }

  body.noscroll .gate-head,
  body.noscroll .gate-actions {
    display: none;
  }

  body.noscroll .gate-frame {
    width: 100vw;
    height: 100dvh;
    grid-template-rows: 1fr;
  }

  body.noscroll .gate-media {
    width: 100vw;
    height: 100dvh;
  }

  body.noscroll #introVideo {
    width: 100vw;
    height: 100dvh;
    object-fit: scale-down;
  }
}

/* =========================
   CORE - CAROUSEL / ITINERARY / EXTRAS
   Shared structure. Templates only override CSS variables.
   ========================= */

.carousel {
  position: relative;
  width: 100%;
  margin-top: var(--carousel-margin-top, 28px);
  overflow: visible;
  user-select: none;
  box-sizing: border-box;
}

.track {
  display: flex;
  width: 100%;
  gap: var(--carousel-gap, 14px);
  overflow: hidden;
  scroll-behavior: smooth;
  border-radius: var(--carousel-radius, var(--radius, 18px));
  box-sizing: border-box;
}

.slide {
  flex: 0 0 100%;
  min-width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
  scroll-snap-align: start;
  border-radius: var(--carousel-radius, var(--radius, 18px));
  background: var(--slide-bg, rgba(255, 255, 255, 0.85));
  border: var(--slide-border, 1px solid rgba(0, 0, 0, 0.06));
  box-shadow: var(
    --slide-shadow,
    var(--shadow, 0 16px 48px rgba(0, 0, 0, 0.1))
  );
  box-sizing: border-box;
}

.slideGrid {
  display: grid;
  grid-template-columns: var(--slide-grid-columns, 1fr 1fr);
  min-height: var(--slide-min-height, 390px);
}

.mediaBox {
  width: 100%;
  height: 100%;
  min-height: var(--media-min-height, 280px);
  background: var(--media-bg, #fff);
  border-right: var(--media-border-right, none);
  border-bottom: var(--media-border-bottom, none);
  overflow: hidden;
}

.mediaBox img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: var(--media-object-fit, cover);
  aspect-ratio: var(--media-aspect-ratio, auto);
}

.slideContent {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: var(--slide-content-padding, clamp(24px, 5vw, 48px));
  text-align: center;
}

.slideTitle {
  margin: 0;
  font-family: var(--slide-title-font, var(--font-title, inherit));
  font-size: var(--slide-title-size, clamp(34px, 5vw, 56px));
  line-height: var(--slide-title-line-height, 1);
  letter-spacing: var(--slide-title-spacing, 0);
  color: var(--slide-title-color, var(--primary-dark, var(--ink, #111)));
}

.slideText {
  margin: 14px 0 0;
  max-width: var(--slide-text-max-width, 36ch);
  font-size: var(--slide-text-size, var(--sub, 20px));
  line-height: var(--slide-text-line-height, 1.55);
  color: var(--slide-text-color, var(--muted, rgba(0, 0, 0, 0.6)));
}

.timePill {
  display: inline-block;
  margin-top: 14px;
  padding: var(--time-pill-padding, 10px 14px);
  border-radius: 999px;
  font-family: var(--time-pill-font, var(--font-title, inherit));
  font-size: var(--time-pill-size, clamp(18px, 2vw, 26px));
  font-weight: var(--time-pill-weight, 700);
  letter-spacing: var(--time-pill-spacing, var(--ls-mid, 0.18em));
  text-transform: uppercase;
  color: var(--time-pill-color, var(--ink, #111));
  background: var(--time-pill-bg, rgba(255, 255, 255, 0.85));
  border: var(--time-pill-border, 1px solid rgba(0, 0, 0, 0.12));
}

.navBtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: var(--nav-size, 46px);
  height: var(--nav-size, 46px);
  border-radius: 999px;
  border: var(--nav-border, 1px solid rgba(0, 0, 0, 0.1));
  background: var(--nav-bg, rgba(255, 255, 255, 0.92));
  color: var(--nav-color, var(--primary-dark, #111));
  box-shadow: var(--nav-shadow, var(--shadow, 0 16px 48px rgba(0, 0, 0, 0.1)));
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: var(--nav-font-size, 32px);
  line-height: 1;
  padding: 0;
}

.navBtn:hover {
  background: var(--nav-bg-hover, var(--nav-bg, #fff));
}

.navPrev {
  left: var(--nav-prev-left, -12px);
}

.navNext {
  right: var(--nav-next-right, -12px);
}

.bullets {
  display: flex;
  justify-content: center;
  gap: var(--bullets-gap, 10px);
  margin-top: var(--bullets-margin-top, 16px);
}

.bullet {
  width: var(--bullet-size, 10px);
  height: var(--bullet-size, 10px);
  border-radius: 999px;
  border: var(--bullet-border, 1px solid rgba(0, 0, 0, 0.18));
  background: var(--bullet-bg, transparent);
  cursor: pointer;
  opacity: 0.8;
  padding: 0;
}

.bullet.active {
  width: var(--bullet-active-width, 28px);
  background: var(--bullet-active-bg, var(--primary-dark, #111));
  border-color: var(
    --bullet-active-border-color,
    var(--bullet-active-bg, var(--primary-dark, #111))
  );
  opacity: 1;
}

.slide--extra {
  min-height: var(--extra-slide-height, 320px);
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 768px) {
  .carousel {
    width: calc(100vw - 44px);
    max-width: calc(100vw - 44px);
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
  }

  .track {
    width: 100%;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .track::-webkit-scrollbar {
    display: none;
  }

  .slide {
    flex: 0 0 100%;
    min-width: 100%;
    max-width: 100%;
  }

  .slide--extra {
    height: 320px;
    display: grid;
    place-items: center;
    text-align: center;
  }

  .slide--extra .slideContent {
    width: min(80%, 460px);
  }

  .slideGrid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .mediaBox {
    height: var(--media-mobile-height, clamp(220px, 34vh, 320px));
    min-height: 0;
    border-right: none;
    border-bottom: var(
      --media-mobile-border-bottom,
      var(--media-border-bottom, none)
    );
  }

  .mediaBox img {
    height: 100%;
    aspect-ratio: auto;
  }

  .slideContent {
    padding: var(--slide-content-padding-mobile, 22px 18px 26px);
  }

  .navPrev {
    left: var(--nav-prev-left-mobile, 6px);
  }

  .navNext {
    right: var(--nav-next-right-mobile, 6px);
  }
}

/* =========================
   CORE - MUSIC BUTTON
   ========================= */

.music-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  z-index: 999;
  cursor: pointer;
}

.vinyl {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #111 40%, #000 41%, #222 44%, #000 45%),
    repeating-radial-gradient(
      circle at center,
      #111 0px,
      #111 2px,
      #000 3px,
      #000 4px
    );
  position: relative;
  animation: spin 2s linear infinite;
}

.vinyl-center {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #c9a96e;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Nota sobrepuesta centrada (gira con el disco) */
.vinyl::after {
  content: "♫";
  background-color: #000;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  font-size: 22px; /* ← tamaño (antes 18px) */
  color: #ffffff; /* ← blanco */

  pointer-events: none;
  z-index: 2;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.vinyl.paused {
  animation-play-state: paused;
  opacity: 0.6;
}

/* =========================
   CORE - EVENT STATUS
   ========================= */

.event-status-section {
  position: relative;
  overflow: hidden;
}

.event-status-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--event-status-radius, 28px);
  padding: clamp(32px, 8vw, 70px) clamp(18px, 5vw, 42px);
  background: var(
    --event-status-bg,
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.96),
      rgba(255, 235, 248, 0.94)
    )
  );
  border: var(--event-status-border, 1px solid rgba(255, 255, 255, 0.65));
  box-shadow: var(
    --event-status-shadow,
    var(--shadow, 0 24px 90px rgba(0, 0, 0, 0.14))
  );
}

.event-status-card::before,
.event-status-card::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.55;
}

.event-status-card::before {
  width: 160px;
  height: 160px;
  top: -60px;
  right: -45px;
  background: var(--event-status-glow-1, rgba(255, 79, 163, 0.28));
}

.event-status-card::after {
  width: 130px;
  height: 130px;
  left: -50px;
  bottom: -48px;
  background: var(--event-status-glow-2, rgba(76, 201, 240, 0.22));
}

.event-status-title {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  font-family: var(
    --font-title,
    var(--font-body, ui-sans-serif, system-ui, Arial, sans-serif)
  );
  font-size: clamp(34px, 9vw, 78px);
  line-height: 0.96;
  color: var(--event-status-title-color, var(--ink, #111));
  text-wrap: balance;
}

.event-status-text {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 18px auto 0;
  font-family: var(--font-body, ui-sans-serif, system-ui, Arial, sans-serif);
  font-size: clamp(17px, 2.4vw, 24px);
  line-height: 1.55;
  color: var(--event-status-text-color, var(--muted, rgba(0, 0, 0, 0.62)));
}

.event-confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.event-confetti-canvas.is-active {
  display: block;
}

/* =========================
   CORE - LIGHTBOX
   ========================= */

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: none;
  place-items: center;
  padding: 18px;
  background: var(--lightbox-bg, rgba(0, 0, 0, 0.75));
}

#lightbox.open {
  display: grid;
}

.lbFrame {
  position: relative;
  max-width: min(980px, 94vw);
  max-height: 88dvh;
}

.lbFrame img {
  display: block;
  max-width: 100%;
  max-height: 88dvh;
  object-fit: contain;
  border-radius: var(--lightbox-radius, 18px);
  box-shadow: var(--shadow, 0 24px 90px rgba(0, 0, 0, 0.35));
}

.lbClose {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--lightbox-close-bg, #fff);
  color: var(--lightbox-close-color, #111);
  font-family: var(--font-ui, var(--font-body, inherit));
  font-weight: 900;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* =========================
   CORE - BRAND SIGNATURE
   ========================= */

.rb-signature {
  padding: 40px 20px 60px;
  text-align: center;
}

.rb-wrap {
  max-width: 600px;
  margin: auto;
}

.rb-text {
  font-family: var(--font-body, ui-sans-serif, system-ui, Arial, sans-serif);
  font-size: 18px;
  color: var(--signature-text-color, var(--muted, rgba(0, 0, 0, 0.55)));
  margin: 0;
}

.rb-text a {
  text-decoration: none;
}

.rb-brand {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.rb-red {
  color: red;
}

.rb-white {
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.rb-black {
  color: black;
}

.rb-contact {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(
    --signature-link-color,
    var(--azulejo, var(--primary-dark, #2f6f6b))
  );
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  opacity: 0.85;
  transition: opacity 0.3s ease;
}

.rb-contact:hover {
  opacity: 1;
}
