@import url('reset.css');
@import url('https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css');

html,
body {
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 20;
  background-size: cover;
  --frame-width: 8px;
  --frame-color: #0273CF;
}

#overlay .frame-border {
  position: absolute;
  inset: 0;
  border: var(--frame-width) solid var(--frame-color);
  pointer-events: none;
  z-index: 250;
  box-sizing: border-box;
}

#overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 300;
}

#overlay.capture-flash::after {
  animation: capture-flash 220ms ease-out;
}

#overlay .logo {
  position: absolute;
  top: 0;
  width: 80%;
  height: auto;
  left: 50%;
  transform: translate(-50%, -35%);
  z-index: 40;
}

#overlay .top-gradient {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 28%;
  background: linear-gradient(to bottom, #f3ecdf 0%, rgba(243, 236, 223, 0) 100%);
  z-index: 39;
  pointer-events: none;
}

#overlay .dune {
  position: absolute;
  bottom: 0;
  width: 300%;
  max-width: none;
  height: auto;
  left: 50%;
  transform: translate(-50%, 50%);
  z-index: 38;
}

#overlay .passport {
  position: absolute;
  bottom: 1%;
  width: 60%;
  max-width: none;
  height: auto;
  left: -20%;
  z-index: 30;
}

#overlay .postcard {
  position: absolute;
  bottom: -1%;
  width: 60%;
  max-width: none;
  height: auto;
  right: -24%;
  z-index: 50;
}

#overlay img {
  pointer-events: none;
}

#overlay .photo {
  background: white;
  border: none;
  border-radius: 100%;
  outline: 3px solid white;
  outline-offset: 5px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%) scale(1);
  transition: transform 180ms ease, opacity 220ms ease;
  z-index: 100;
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
  isolation: isolate;
}

#overlay .photo:active {
  transform: translateX(-50%) scale(0.9);
}

#overlay .photo::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  animation: halo-pulse 1.8s ease-out infinite;
}

#overlay .photo img {
  width: 80%;
  height: auto;
  opacity: 0.5;
  filter: brightness(0);
}

#overlay .close,
#overlay .share {
  position: absolute;
  background: white;
  border-radius: 50%;
  height: 50px;
  width: 50px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 18%;
  transform: scale(1);
  transition: transform 180ms ease, opacity 220ms ease;
  cursor: pointer;
}

#overlay .close {
  left: 10%;
}

#overlay .share {
  right: 10%;
}

#overlay .close img,
#overlay .share img {
  height: auto;
}

#overlay .close img {
  width: 90%;
}

#overlay .share img {
  width: 80%;
}

#overlay .close,
#overlay .share,
#overlay .cta {
  opacity: 0;
  pointer-events: none;
}

#overlay .close:active,
#overlay .share:active {
  transform: scale(0.9);
}

#overlay.cta-visible .photo {
  opacity: 0;
  pointer-events: none;
}

/* Hide duplicate overlays when in capture/preview mode */
#overlay.cta-visible .logo,
#overlay.cta-visible .top-gradient,
#overlay.cta-visible .dune,
#overlay.cta-visible .passport,
#overlay.cta-visible .postcard {
  opacity: 0;
  pointer-events: none;
}

#overlay.photo-hidden .photo {
  display: none;
}

#overlay.cta-visible .close,
#overlay.cta-visible .share,
#overlay.cta-visible .cta {
  opacity: 1;
  pointer-events: auto;
}

#overlay.preview-only .logo,
#overlay.preview-only .top-gradient,
#overlay.preview-only .dune,
#overlay.preview-only .passport,
#overlay.preview-only .postcard,
#overlay.preview-only .photo {
  display: none;
}

#overlay.preview-only .close,
#overlay.preview-only .share {
  opacity: 1;
  pointer-events: auto;
}

#overlay .cta {
  position: absolute;
  border: none;
  background: transparent;
  padding: 0;
  bottom: -12%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: 80%;
  transition: opacity 220ms ease;
}

#overlay .cta img {
  width: 100%;
  display: block;
}

@keyframes halo-pulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.25);
    opacity: 0;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

@keyframes capture-flash {
  0% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}
