/* CSS Variables for Liquid Glass Effect */
:root {
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-highlight: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.3);
}

/* Fullscreen gradient background */
html,
body {
  height: 100%;
  height: 100dvh; /* Dynamic viewport height for mobile */
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  width: 100%;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  background: #16098E;
  font-family: "SF Pro Rounded", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #fff;
  text-align: center;
}

/* Hide content while loading images */
body.loading {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

body:not(.loading) {
  opacity: 1;
}

/* Background container for smooth crossfade */
.background-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
}

/* Background layers that crossfade */
.background-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(60px);
  transform: scale(1.1) translateZ(0); /* Prevent blur edge artifacts + GPU layer */
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  perspective: 1000px;
  -webkit-perspective: 1000px;
}

.background-layer.active {
  opacity: 1;
}

/* Initialize first layer */
.background-layer-1 {
  background-image: url('/images/S-1.png');
  opacity: 1;
}

/* Gradient overlay on top of blurred background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 90, 180, 0.5));
  pointer-events: none;
}

/* Wrap everything into one column, centered */
.wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  width: 100vw;
  gap: clamp(8px, 1.5vh, 20px);
  box-sizing: border-box;
  padding: clamp(12px, 2vh, 30px) clamp(12px, 2vw, 20px);
  overflow: hidden;
}

/* Liquid Glass Effect Base Styles */
.glass-filter,
.glass-overlay,
.glass-specular {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.glass-filter {
  z-index: 0;
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  filter: url(#lensFilter) brightness(1.15);
}

.glass-overlay {
  z-index: 1;
  background: var(--glass-bg);
}

.glass-overlay--light {
  background: rgba(255, 255, 255, 0.85);
}

.glass-specular {
  z-index: 2;
  box-shadow:
    inset 1px 1px 0 var(--glass-highlight),
    inset 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Infinite Carousel with 2D Rotation */
.carousel-container {
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
  position: relative;
  margin: 0;
  padding: clamp(12px, 2vh, 30px) 0;
  flex-shrink: 1;
  min-height: 0;
  margin-left: calc(-1 * clamp(12px, 2vw, 20px));
  margin-right: calc(-1 * clamp(12px, 2vw, 20px));
}

.carousel-track {
  display: flex;
  gap: 4vw;
  will-change: transform;
}

/* Desktop override */
@media (min-width: 769px) {
  .carousel-container {
    width: 100vw;
    margin-left: calc(-1 * clamp(12px, 2vw, 20px));
    margin-right: calc(-1 * clamp(12px, 2vw, 20px));
  }

  .carousel-track {
    gap: 36px;
  }
}

/* Photo Cards with Dynamic 2D Tilt - Desktop First */
.photo-card {
  position: relative;
  flex-shrink: 0;
  width: 280px;
  height: 420px;
  max-height: 55vh;
  aspect-ratio: 5 / 8;
  border-radius: 40px;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.5);
  will-change: transform;
  transform: rotate(0deg); /* Initialize rotation to prevent flicker */
}

/* Mobile override - maintain aspect ratio */
@media (max-width: 768px) {
  .photo-card {
    width: auto;
    height: min(45vw, 65vh);
    aspect-ratio: 5 / 8;
    border-radius: 8vw;
  }
}

.photo-card .glass-filter,
.photo-card .glass-overlay,
.photo-card .glass-specular {
  display: none;
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 0;
}

.logo-container {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 70px;
  z-index: 4;
}

.photo-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent);
  z-index: 3;
  pointer-events: none;
}

.photo-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 70px;
  height: 70px;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 5;
}

.progress-ring-progress {
  fill: none;
  stroke: rgba(255, 255, 255, 1);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

/* Mobile override */
@media (max-width: 768px) {
  .logo-container {
    width: 16vw;
    height: 16vw;
    bottom: 2vw;
  }

  .photo-logo {
    width: 11.5vw;
    height: 11.5vw;
  }

  .progress-ring {
    width: 16vw;
    height: 16vw;
  }

  .progress-ring-bg,
  .progress-ring-progress {
    stroke-width: 4.5;
  }
}

/* Text styles - Desktop First */
.title {
  margin: 0;
  font-weight: 700;
  font-size: 48px;
  text-align: center;
  line-height: 1.2;
}

.subtitle {
  margin: 0;
  font-weight: 500;
  font-size: 24px;
  opacity: 0.85;
  text-align: center;
}

/* Mobile override */
@media (max-width: 768px) {
  .title {
    font-size: 8vw;
  }

  .subtitle {
    font-size: 4.5vw;
  }
}

/* App Store Button - Solid White */
.app-store-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #ffffff;
  color: #000000;
  padding: 16px 32px;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  max-width: 320px;
  width: 100%;
}

.app-store-button .glass-filter,
.app-store-button .glass-overlay,
.app-store-button .glass-specular {
  display: none;
}

.app-store-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.app-store-button:active {
  transform: scale(0.98);
}

.button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.app-store-icon {
  width: 28px;
  height: 28px;
}

/* Features with Liquid Glass */
.features {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
}

.feature-item {
  position: relative;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.1),
    0 0 0 1px var(--glass-border);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.feature-item:hover {
  transform: translateY(-1px);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.15),
    0 0 0 1px var(--glass-border);
}

.feature-text {
  position: relative;
  z-index: 3;
  display: block;
  padding: 8px 16px;
}

/* Rating */
.rating {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  opacity: 0.9;
  transition: opacity 0.3s ease;
  font-size: 14px;
}

.rating:hover {
  opacity: 1;
}

.stars {
  color: #FFD700;
  font-size: 16px;
  letter-spacing: 2px;
}

.rating-text {
  font-weight: 500;
}


/* Responsive adjustments - Mobile First */
@media (max-width: 768px) {
  .wrap {
    gap: 1.8vh;
    padding: 2vh 6vw; /* Increased horizontal padding */
  }

  .photo-card {
    width: auto !important;
    height: min(42vw, 54vh) !important;
    min-height: 310px !important;
    aspect-ratio: 5 / 8 !important;
  }

  .carousel-container {
    padding: 4vh 0;
    flex-shrink: 0;
    width: 100vw;
    margin-left: -6vw;
    margin-right: -6vw;
  }

  .carousel-track {
    gap: 5vw;
  }

  .features {
    row-gap: 3.5vw;
    column-gap: 2vw;
    width: 100%;
    padding: 0;
  }

  .feature-item {
    font-size: 3.2vw;
  }

  .feature-text {
    padding: 2vw 4vw;
  }

  .title {
    font-size: 7.5vw !important;
    margin-bottom: 0.5vh;
    width: 100%;
  }

  .subtitle {
    font-size: 4vw !important;
    width: 100%;
  }

  .app-store-button {
    padding: 3.5vw 10vw !important;
    font-size: 4vw !important;
    width: auto !important;
    max-width: calc(100% - 8vw) !important;
    margin: 0 4vw;
  }

  .rating {
    font-size: 3.2vw;
    width: 100%;
    justify-content: center;
  }

  .stars {
    font-size: 3.5vw;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 2vh 7vw; /* Extra horizontal padding for small screens */
  }

  .photo-card {
    width: auto !important;
    height: min(44vw, 56vh) !important;
    min-height: 320px !important;
    aspect-ratio: 5 / 8 !important;
  }

  .carousel-container {
    padding: 2vh 0;
    width: 100vw;
    margin-left: -7vw;
    margin-right: -7vw;
  }

  .carousel-track {
    gap: 5vw;
  }

  .title {
    font-size: 8vw !important;
  }

  .subtitle {
    font-size: 4.2vw !important;
  }

  .app-store-button {
    padding: 3.5vw 10vw !important;
    width: auto !important;
    max-width: calc(100% - 10vw) !important;
    margin: 0 5vw;
  }
}

/* Only apply height adjustments to mobile devices */
@media (max-width: 768px) and (max-height: 700px) {
  .photo-card {
    width: auto !important;
    height: min(40vw, 48vh) !important;
    min-height: 270px !important;
    aspect-ratio: 5 / 8 !important;
  }

  .wrap {
    gap: 1.5vh;
    padding: 1.5vh 6vw;
  }

  .carousel-container {
    padding: 1.5vh 0;
    width: 100vw;
    margin-left: -6vw;
    margin-right: -6vw;
  }

  .title {
    font-size: 6.5vw !important;
  }

  .subtitle {
    font-size: 3.5vw !important;
  }

  .app-store-button {
    padding: 3vw 8vw !important;
    font-size: 3.5vw !important;
    width: auto !important;
    max-width: calc(100% - 8vw) !important;
    margin: 0 4vw;
  }

  .feature-item {
    font-size: 2.8vw;
  }

  .rating {
    font-size: 2.8vw;
    justify-content: center;
  }

  .stars {
    font-size: 3vw;
  }
}

/* Enhance glass effect on capable browsers */
@supports (backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px)) {
  .glass-filter {
    backdrop-filter: blur(20px) saturate(120%) brightness(1.15);
    -webkit-backdrop-filter: blur(20px) saturate(120%) brightness(1.15);
  }
}
