/* ===========================================================
   Black Secret Night — Invitación 15 años de Edgard
   Paleta: negro · dorado · blanco · misterio
   =========================================================== */

:root {
  --black: #0a0a0a;
  --black-2: #121012;
  --gold: #d4af37;
  --gold-soft: #e8c977;
  --gold-deep: #9c7a1e;
  --white: #f5f1e8;
  --gray: #9a958c;
  --danger: #e06666;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body { height: 100%; }

body {
  font-family: "Cormorant Garamond", Georgia, serif;
  background:
    radial-gradient(120% 120% at 50% -10%, #1c1814 0%, var(--black) 55%, #050505 100%);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* ---------- Fondo: brillo y partículas ---------- */
.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(40% 30% at 50% 0%, rgba(212,175,55,0.14), transparent 70%),
    radial-gradient(30% 30% at 80% 90%, rgba(212,175,55,0.07), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.particles span {
  position: absolute;
  bottom: -10px;
  width: 4px;
  height: 4px;
  background: var(--gold);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 8px rgba(212,175,55,0.8);
  animation: float-up linear infinite;
}
@keyframes float-up {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  10%  { opacity: .9; }
  90%  { opacity: .6; }
  100% { transform: translateY(-105vh) scale(0.3); opacity: 0; }
}

/* ---------- Escenario ---------- */
.stage {
  position: relative;
  z-index: 1;
  width: min(680px, 92vw);
  padding: 40px 0 64px;
}

/* =========================================================
   PANTALLA DE ACCESO
   ========================================================= */
.lock-screen {
  text-align: center;
  animation: fade-in .8s var(--ease) both;
}

.mask-emblem {
  width: 92px;
  height: 92px;
  margin: 0 auto 22px;
  color: var(--gold);
  filter: drop-shadow(0 0 14px rgba(212,175,55,0.5));
  animation: breathe 4s ease-in-out infinite;
}
.mask-emblem svg { width: 100%; height: 100%; }
@keyframes breathe {
  0%,100% { transform: translateY(0) scale(1); opacity: .9; }
  50%     { transform: translateY(-6px) scale(1.04); opacity: 1; }
}

.eyebrow {
  letter-spacing: .42em;
  text-transform: uppercase;
  font-family: "Cinzel", serif;
  font-size: .72rem;
  color: var(--gray);
  margin-bottom: 14px;
}
.eyebrow.gold { color: var(--gold-soft); }

.title {
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  letter-spacing: .04em;
  line-height: 1.05;
  background: linear-gradient(180deg, #fff7e0 0%, var(--gold) 55%, var(--gold-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 30px rgba(212,175,55,0.25);
}

.tagline {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: clamp(1rem, 4vw, 1.4rem);
  letter-spacing: .12em;
  margin-top: 10px;
  background: linear-gradient(180deg, #fff7e0, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 22px rgba(212,175,55,0.3);
}

.subtitle {
  color: var(--gray);
  font-size: 1.1rem;
  margin: 14px auto 30px;
  max-width: 420px;
}

/* ---------- Efecto glitch en el título ---------- */
.title.glitch { position: relative; }
.title.glitch::before,
.title.glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  background: none;
  -webkit-text-fill-color: currentColor;
  text-shadow: none;
  pointer-events: none;
  opacity: 0;
}
.title.glitch::before {
  color: #ff3864;
  animation: glitch-a 4.5s infinite steps(2, jump-none);
}
.title.glitch::after {
  color: #36e2ff;
  animation: glitch-b 4.5s infinite steps(2, jump-none);
}
@keyframes glitch-a {
  0%, 92%, 100% { opacity: 0; transform: translate(0); clip-path: inset(0 0 100% 0); }
  93%  { opacity: .75; transform: translate(-3px, -2px); clip-path: inset(10% 0 60% 0); }
  95%  { opacity: .75; transform: translate(3px, 1px);  clip-path: inset(50% 0 20% 0); }
  97%  { opacity: .75; transform: translate(-2px, 2px); clip-path: inset(20% 0 50% 0); }
}
@keyframes glitch-b {
  0%, 92%, 100% { opacity: 0; transform: translate(0); clip-path: inset(0 0 100% 0); }
  93%  { opacity: .7; transform: translate(3px, 2px);   clip-path: inset(60% 0 10% 0); }
  95%  { opacity: .7; transform: translate(-3px, -1px); clip-path: inset(20% 0 55% 0); }
  97%  { opacity: .7; transform: translate(2px, -2px);  clip-path: inset(45% 0 25% 0); }
}

/* ---------- Botón de silenciar música ---------- */
.mute-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(212,175,55,0.4);
  color: var(--gold-soft);
  font-size: 1.1rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .2s, transform .2s;
}
.mute-btn:hover { background: rgba(212,175,55,0.2); transform: scale(1.06); }
.mute-btn[hidden] { display: none; }

/* ---------- Formulario del desafío ---------- */
.challenge {
  background: linear-gradient(160deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  border: 1px solid rgba(212,175,55,0.28);
  border-radius: var(--radius);
  padding: 30px 26px 24px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);
}

.question {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 22px;
  color: var(--white);
  min-height: 1.6em;
}

.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.answer-input {
  flex: 1 1 200px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--white);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.15rem;
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}
.answer-input::placeholder { color: #6f6a61; }
.answer-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,0.18);
}

.btn-unlock {
  flex: 0 0 auto;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  color: #1a1407;
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .03em;
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .25s;
  box-shadow: 0 8px 24px rgba(212,175,55,0.3);
}
.btn-unlock:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(212,175,55,0.45); }
.btn-unlock:active { transform: translateY(0); }

.feedback {
  min-height: 1.4em;
  margin-top: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: opacity .2s;
}
.feedback.error { color: var(--danger); animation: shake .4s; }
.feedback.success { color: var(--gold-soft); }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-7px); }
  40%,80% { transform: translateX(7px); }
}

.link-hint {
  margin-top: 18px;
  background: none;
  border: none;
  color: var(--gray);
  font-family: "Cinzel", serif;
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s;
}
.link-hint:hover { color: var(--gold-soft); }

/* =========================================================
   PANTALLA DE INVITACIÓN
   ========================================================= */
.invitation-screen { text-align: center; }
.invitation-screen[hidden] { display: none; }

.reveal-title {
  font-family: "Cinzel", serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2.3rem);
  margin: 8px 0 6px;
  background: linear-gradient(180deg, #fff7e0, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.reveal-sub {
  font-size: 1.25rem;
  color: var(--white);
  margin-bottom: 26px;
}
.reveal-sub strong { color: var(--gold-soft); }

/* ---------- Hero: el flyer ocupa toda la pantalla ---------- */
.invite-hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 0;
}

.invite-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(212,175,55,0.4);
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 40px rgba(212,175,55,0.15);
  max-width: min(440px, 92vw);
  margin: 0 auto;
  cursor: zoom-in;
  transition: transform .4s var(--ease);
}
.invite-card:hover { transform: scale(1.015); }
.invite-card img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 82vh;   /* el flyer llena el alto de la pantalla */
  height: auto;
  margin: 0 auto;
}

/* Indicador "desliza para ver los detalles" */
.scroll-hint {
  background: none;
  border: none;
  color: var(--gold-soft);
  font-family: "Cinzel", serif;
  font-size: .78rem;
  letter-spacing: .08em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: .85;
  transition: opacity .2s;
}
.scroll-hint:hover { opacity: 1; }
.scroll-hint .arrow {
  display: inline-block;
  font-size: 1.1rem;
  animation: bounce-arrow 1.4s ease-in-out infinite;
}
@keyframes bounce-arrow {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(6px); }
}

.details-block { padding-top: 18px; }
.details-block[hidden] { display: none; }

/* ---------- Fase 2: lluvia de 0 y 1 (Matrix) ---------- */
.matrix-stage {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #050505;
  display: flex;
  align-items: center;
  justify-content: center;
}
.matrix-stage[hidden] { display: none; }
.matrix-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.matrix-caption {
  position: relative;
  z-index: 1;
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: .25em;
  font-size: clamp(.9rem, 3.5vw, 1.4rem);
  color: var(--gold-soft);
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(212,175,55,0.7), 0 0 4px rgba(0,0,0,0.9);
  padding: 14px 22px;
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 10px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  animation: caption-pulse 1.3s ease-in-out infinite;
}
@keyframes caption-pulse {
  0%, 100% { opacity: .7; }
  50%      { opacity: 1; }
}

/* Sello "✓ ACCESO CONCEDIDO" estampado */
.matrix-caption.granted {
  animation: stamp-in .5s var(--ease) both;
  color: #fff7e0;
  border-color: var(--gold);
  background: rgba(212,175,55,0.18);
  box-shadow: 0 0 30px rgba(212,175,55,0.55), inset 0 0 18px rgba(212,175,55,0.25);
  letter-spacing: .3em;
}
@keyframes stamp-in {
  0%   { opacity: 0; transform: scale(2.4) rotate(-8deg); filter: blur(6px); }
  55%  { opacity: 1; transform: scale(.92) rotate(-2deg); filter: blur(0); }
  75%  { transform: scale(1.04) rotate(0deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
.zoom-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(212,175,55,0.4);
  color: var(--gold-soft);
  font-family: "Cinzel", serif;
  font-size: .68rem;
  letter-spacing: .04em;
  padding: 6px 12px;
  border-radius: 30px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- Cuenta regresiva ---------- */
.countdown {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin: 0 auto 28px;
  max-width: 480px;
  width: 100%;
}
.cd-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 14px 6px;
  background: linear-gradient(160deg, rgba(212,175,55,0.10), rgba(255,255,255,0.02));
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.cd-num {
  font-family: "Cinzel", serif;
  font-weight: 900;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  line-height: 1;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 16px rgba(212,175,55,0.35);
}
.cd-label {
  margin-top: 6px;
  font-family: "Cinzel", serif;
  font-size: .6rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gray);
}
.cd-live {
  font-family: "Cinzel", serif;
  font-size: 1.3rem;
  color: var(--gold-soft);
  text-shadow: 0 0 18px rgba(212,175,55,0.5);
}

/* ---------- Detalles de la fiesta ---------- */
.party-details {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 480px;
  margin: 0 auto 28px;
  text-align: left;
}
.party-details li {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: 12px;
  padding: 12px 14px;
}
.party-details li.full { grid-column: 1 / -1; }
.party-details .ico { font-size: 1.4rem; line-height: 1; }
.party-details b {
  display: block;
  font-family: "Cinzel", serif;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 2px;
}
.party-details span { font-size: 1.05rem; color: var(--white); }

/* ---------- Botones de acción ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(212,175,55,0.4);
  color: var(--white);
  border-radius: 12px;
  padding: 12px 20px;
  font-family: "Cinzel", serif;
  font-size: .85rem;
  letter-spacing: .02em;
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s var(--ease), background .25s, border-color .25s;
}
.btn:hover { transform: translateY(-2px); background: rgba(212,175,55,0.12); border-color: var(--gold); }
.btn.gold-btn {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold-deep));
  color: #1a1407;
  border: none;
  font-weight: 700;
}
.btn.copied { background: rgba(212,175,55,0.25); border-color: var(--gold); }

/* ---------- Menú "Agregar al calendario" ---------- */
.cal-wrap { position: relative; display: inline-block; }

.cal-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(160deg, #17130c, #0c0a08);
  border: 1px solid rgba(212,175,55,0.4);
  border-radius: 12px;
  padding: 8px;
  min-width: 230px;
  z-index: 20;
  box-shadow: 0 18px 40px rgba(0,0,0,0.7);
  animation: fade-in .2s var(--ease) both;
}
.cal-menu[hidden] { display: none; }
.cal-menu::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: rgba(212,175,55,0.4);
}

.cal-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  color: var(--white);
  border-radius: 9px;
  padding: 11px 14px;
  font-family: "Cinzel", serif;
  font-size: .82rem;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.cal-opt:hover { background: rgba(212,175,55,0.14); border-color: rgba(212,175,55,0.5); }

@media (max-width: 520px) {
  .cal-wrap { flex: 1 1 100%; }
  .cal-wrap .btn { width: 100%; justify-content: center; }
  .cal-menu { min-width: 90%; }
}

.footer-note {
  color: var(--gray);
  font-style: italic;
  font-size: 1.05rem;
}

/* =========================================================
   LIGHTBOX
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in .3s ease both;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 0 60px rgba(212,175,55,0.25);
  animation: zoom-in .35s var(--ease) both;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(212,175,55,0.4);
  color: var(--white);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background .2s;
}
.lightbox-close:hover { background: rgba(212,175,55,0.25); }

/* =========================================================
   ANIMACIONES DE REVELADO
   ========================================================= */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes zoom-in {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---------- Revelado ---------- */
@keyframes reveal-seq {
  0%   { opacity: 0; transform: translateY(28px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* El flyer entra primero, con un gesto más marcado */
@keyframes flyer-in {
  0%   { opacity: 0; transform: translateY(40px) scale(.9) rotateX(8deg); filter: blur(12px); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1) rotateX(0); filter: blur(0); }
}

/* El flyer aparece animado al desbloquear */
.invitation-screen.revealing .invite-card {
  animation: flyer-in 1s var(--ease) both;
}

/* Los detalles empiezan ocultos SOLO si JS activa el revelado por scroll;
   así nunca quedan invisibles si algo falla o si hay "reducir movimiento". */
.details-block.reveal-on-scroll > * { opacity: 0; }
.details-block.in-view > * { animation: reveal-seq .65s var(--ease) both; }
.details-block.in-view > *:nth-child(1) { animation-delay: .00s; }
.details-block.in-view > *:nth-child(2) { animation-delay: .08s; }
.details-block.in-view > *:nth-child(3) { animation-delay: .16s; }
.details-block.in-view > *:nth-child(4) { animation-delay: .24s; }
.details-block.in-view > *:nth-child(5) { animation-delay: .32s; }
.details-block.in-view > *:nth-child(6) { animation-delay: .40s; }
.details-block.in-view > *:nth-child(7) { animation-delay: .48s; }
.fade-out { animation: fade-out .5s var(--ease) both; }
@keyframes fade-out {
  to { opacity: 0; transform: translateY(-20px) scale(.97); }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 520px) {
  .stage { padding: 24px 0 48px; }
  .challenge { padding: 24px 18px 20px; }
  .question { font-size: 1.3rem; }
  .party-details { grid-template-columns: 1fr; }
  .btn-unlock { flex: 1 1 100%; }
  .actions .btn { flex: 1 1 100%; justify-content: center; }
  /* Contador: 4 cajas siempre en una fila, más compactas */
  .countdown { gap: 6px; }
  .cd-box { padding: 10px 2px; }
  .cd-num { font-size: 1.5rem; }
  .cd-label { font-size: .55rem; letter-spacing: .08em; }
}
@media (max-width: 360px) {
  .cd-num { font-size: 1.25rem; }
  .cd-label { letter-spacing: .04em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* Garantiza que todo sea visible aunque las animaciones estén desactivadas */
  .details-block > *, .invite-card { opacity: 1 !important; }
}
