/* ── RESET ── */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}

#scratchCanvas, .scratchCard, .eventCard {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html {
  scroll-behavior: smooth;
  background: #000;
  overflow-x: hidden;
}

body {
  background: transparent;
  max-width: 430px;
  margin: 0 auto;
}

/* ── LOADER ── */
#loader {
  z-index: 99999;
  background: #000;
  justify-content: center;
  align-items: center;
  transition: opacity 0.6s;
  display: flex;
  position: fixed;
  inset: 0;
}

.loaderInner {
  flex-direction: column;
  align-items: center;
  gap: 12px;
  display: flex;
}

.loaderIcon { font-size: 2rem; }

.loaderText {
  color: #fff;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.9;
  font-size: 1rem;
}

#loader.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── FRAME SECTION ── */
#frame-section {
  height: 1396vh;
  position: relative;
}

.sticky {
  will-change: transform;
  background: transparent;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

/* ── PARALLAX ── */
#parallax {
  z-index: 10;
  opacity: 0;
  will-change: opacity;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

#revealLayer {
  z-index: 15;
  will-change: transform;
  pointer-events: none;
  background: #000;
  position: absolute;
  inset: 0;
  transform: translateY(100%);
}

.staticBg {
  object-fit: cover;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

#parallaxTitle {
  opacity: 0;
  pointer-events: none;
  width: 100%;
  height: auto;
  transition: opacity 0.5s linear, transform 0.5s linear;
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ── FRAME LAYER ── */
#frameLayer {
  z-index: 11;
  will-change: clip-path;
  background: #000;
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: translateZ(0);
}

#frameCanvas {
  z-index: 10;
  will-change: clip-path, filter;
  width: 100%;
  height: 100%;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  transition: filter 80ms linear;
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ── WAVE CANVAS ── */
#waveCanvas {
  z-index: 20;
  pointer-events: none;
  display: none;
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  transform: translateZ(0);
}

canvas {
  backface-visibility: hidden;
  transform: translateZ(0);
}

/* ── HERO TITLE ── */
#heroTitle {
  z-index: 15;
  text-align: center;
  opacity: 0;
  color: #ffe5a0;
  text-transform: uppercase;
  width: 95%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.titleTop {
  letter-spacing: 0.12em;
  text-shadow: 0 0 12px rgba(255, 210, 122, 0.6);
  margin-bottom: 0.2em;
  font-size: clamp(0.9rem, 5vw, 1.6rem);
}

.titleMain {
  color: #ffd27a;
  text-shadow:
    0 0 10px rgba(255, 210, 122, 0.8),
    0 0 25px rgba(255, 210, 122, 0.7),
    0 0 60px rgba(255, 210, 122, 0.5);
  margin-bottom: 0.15em;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 700;
  line-height: 0.95;
}

.titleBottom {
  letter-spacing: 0.18em;
  text-shadow: 0 0 10px rgba(255, 210, 122, 0.6);
  font-size: clamp(0.8rem, 3vw, 1.4rem);
}

#heroTitle::before {
  content: "";
  filter: blur(60px);
  z-index: -1;
  background: radial-gradient(circle, rgba(255, 210, 122, 0.35), transparent 70%);
  width: 400px;
  height: 400px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ── CLOUD LAYER ── */
#cloudLayer {
  z-index: 30;
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cloud {
  opacity: 0;
  width: 100%;
  position: absolute;
  bottom: -120vh;
  left: 50%;
  transform: translateX(-50%);
}

.cloud.far { z-index: 1; }
.cloud.near { z-index: 3; }

/* ── PORTRAIT LAYER ── */
#portraitLayer {
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  perspective: 2000px;
  justify-content: center;
  align-items: center;
  display: flex;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.portraitFront {
  object-fit: cover;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.cardTitle {
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  will-change: opacity, transform;
  width: 100%;
  height: auto;
  position: absolute;
  top: 9%;
  left: 54%;
  transform: translate(-50%);
}

#portraitBg {
  object-fit: cover;
  opacity: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.6s;
  position: absolute;
  inset: 0;
  transform: scale(1.08);
}

/* ── STORY REVEAL ── */
#storyReveal {
  opacity: 0;
  z-index: 2;
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
}

#storyImage {
  object-fit: cover;
  object-position: bottom;
  z-index: 1;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

/* ── LOGO LAYER ── */
#logoLayer {
  pointer-events: none;
  z-index: 9999;
  position: fixed;
  inset: 0;
}

#movingLogo {
  opacity: 0;
  will-change: transform, width, height, opacity;
  backface-visibility: hidden;
  width: auto;
  height: auto;
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  transform: translate(0, 0);
}

#logoAnchor {
  pointer-events: none;
  width: 130px;
  height: 220px;
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translate(-50%);
}

#logoTitle {
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
  width: 220px;
  height: auto;
  position: fixed;
  top: 220px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
}

/* ── SCRATCH CARD ── */
.scratchCard {
  pointer-events: none;
  width: 315px;
  height: 568px;
  transform-style: preserve-3d;
  transform-origin: 50%;
  z-index: 3;
  border-radius: 24px;
  position: relative;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.45);
}

.scratchFace {
  backface-visibility: hidden;
  color: #fff;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  font-size: 60px;
  display: flex;
  position: absolute;
  inset: 0;
}

.scratchBack { transform: rotateY(180deg); }

#scratchCard {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.scratchBg {
  object-fit: cover;
  z-index: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.scratchReveal {
  object-fit: contain;
  z-index: 1;
  width: 90%;
  height: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#scratchCanvas {
  pointer-events: auto;
  touch-action: none;
  z-index: 2;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

/* ── STORY CONTINUATION ── */
#storyContinuation {
  background: #000;
  width: 100%;
  position: relative;
  overflow: hidden;
}

#storyVideo {
  width: 100%;
  height: auto;
  display: block;
}

/* ── EVENT CARDS SECTION ── */
#storyEnding {
  background-image: url(images/event-cards/bg.webp);
  background-position: top;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
}

#storyOverlay {
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding-bottom: 40px;
  display: flex;
  position: relative;
}

#storyCards {
  flex-direction: column;
  align-items: center;
  gap: 23px;
  width: 100%;
  padding-top: 6%;
  display: flex;
}

.eventCard {
  width: 350px;
  aspect-ratio: 19 / 12.5;
  perspective: 1800px;
  cursor: pointer;
}

.eventInner {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
  position: relative;
}

.eventFront, .eventBack {
  will-change: transform;
  backface-visibility: hidden;
  border-radius: 24px;
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: translateZ(0);
  box-shadow:
    0 8px 8px rgba(0, 0, 0, 0.12),
    0 8px 8px rgba(0, 0, 0, 0.16),
    0 8px 8px rgba(0, 0, 0, 0.2);
}

.eventFront img, .eventBack img {
  object-fit: cover;
  object-position: center;
  width: 100%;
  height: 100%;
  display: block;
}

.eventBack {
  transform: rotateY(180deg);
  position: relative;
}

.eventCard.flipped .eventInner {
  transform: rotateY(180deg);
}

.eventRegister {
  z-index: 20;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background: transparent;
  width: 44%;
  height: 12%;
  position: absolute;
  bottom: 16%;
  left: 28%;
}

/* ── ENDING VIDEO ── */
#endingVideoWrap {
  width: 100%;
  position: relative;
}

#endingVideo {
  width: 100%;
  height: auto;
  margin-top: 20px;
  display: block;
}

/* ── SWIPE HINT ── */
#swipeHint {
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%);
}

#swipeHint.static {
  transition: opacity 3s;
  opacity: 1 !important;
  animation: none !important;
}

#swipeHint.visible {
  opacity: 1;
  animation: swipePulse 1.8s ease-in-out infinite;
}

#swipeHint img {
  width: 200px;
  height: auto;
}

@keyframes swipePulse {
  0%, 100% {
    opacity: 1;
    transform: translate(-50%) translateY(0);
  }
  50% {
    opacity: 0.5;
    transform: translate(-50%) translateY(-8px);
  }
}

/* ── MUTE BUTTON ── */
#muteBtn {
  position: fixed;
  top: 16px;
  right: max(16px, calc(50% - 199px));
  z-index: 99998;
  width: 44px;
  height: 44px;
  cursor: pointer;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#muteBtn svg {
  width: 22px;
  height: 22px;
}

/* ── VIDEO PLAY OVERLAY ── */
.videoPlayOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: transparent;
  z-index: 999;
  cursor: pointer;
}

.videoPlayOverlay img {
  width: 64px;
  height: 64px;
}

/* ── RESPONSIVE ── */
@media (min-width: 431px) {
  #loader, #logoLayer {
    width: 430px;
    left: 50%;
    right: auto;
    transform: translate(-50%);
  }
}
