/* Global Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Define color variables for easier management */
    --primary-color: #ff1744;
    --primary-hover: #ff4569;
    --bg-color: #0c0c0c;
    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);

    /* Section-specific colors */
    --section1-accent: #ff1744;
    --section2-accent: #7c4dff;
    --section3-accent: #00e5ff;
    --section4-accent: #76ff03;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    touch-action: none;
    /* Disable browser handling of touch gestures */
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    /* Smooth fonts on WebKit */
    -moz-osx-font-smoothing: grayscale;
    /* Smooth fonts on Mac */
    text-rendering: optimizeLegibility;
    perspective: 1000px;
    /* For 3D effects in carousel */
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: 100%;
    background-color: rgba(12, 12, 12, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
}

h1 {
    font-size: 20px;
    font-weight: 500;
}

.nav-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.lang-btn {
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-color);
    padding: 8px 15px;
    border-radius: 30px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.email-btn {
    background-color: var(--primary-color);
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.email-text {
    padding-bottom: 4px;
}

.email-btn:hover {
    background-color: var(--primary-hover);
}

.email-icon {
    display: none;
    /* Hidden by default, shown on mobile */
}

/* Main Content */
main {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Carousel Structure */
.carousel-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.carousel-track {
    /* Remove the column flex and height adjustments */
    display: block;
    position: relative;
    height: 100%;
    width: 100%;
    /* Remove transform transition as we'll animate individual slides */
    transition: none;
}

.carousel-slide {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    padding-top: 80px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
}

/* Active slide is visible and on top */
.carousel-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 5;
}

/* Slide that's coming in from bottom */
.carousel-slide.coming-in {
    opacity: 1;
    visibility: visible;
    z-index: 10;
    /* Highest z-index to appear on top */
    animation: slideInFromBottom 0.8s forwards;
}

/* Slide that's going out to top */
.carousel-slide.going-out {
    opacity: 1;
    visibility: visible;
    z-index: 5;
    animation: slideOutToTop 0.8s forwards;
}

/* Update animations for overlay effect */
@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        /* Start from below the viewport */
        opacity: 0.1;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutToTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-30%);
        /* Slide up and fade out */
        opacity: 0;
    }
}

/* Make sure background is solid for each slide */
.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: -1;
}

/* SVG Decorations */
.decoration-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.decoration-img {
    position: absolute;
    transition: opacity 0.8s ease;
    transform: translateZ(0);
    /* Hardware acceleration */
    bottom: -100px;
}

.decoration-img.active,
.carousel-slide.coming-in .decoration-img {
    opacity: 1;
}

/* Update slides for stacking with proper decoration handling */
.carousel-slide {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    padding-top: 80px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    z-index: 1;
}

/* Active slide is visible and on top */
.carousel-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 5;
}

/* Slide that's coming in from bottom */
.carousel-slide.coming-in {
    opacity: 1;
    visibility: visible;
    z-index: 10;
    /* Highest z-index to appear on top */
    animation: slideInFromBottom 0.8s forwards;
}

/* Slide that's going out to top */
.carousel-slide.going-out {
    opacity: 1;
    visibility: visible;
    z-index: 5;
    animation: slideOutToTop 0.8s forwards;
}

/* Update animations for overlay effect */
@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        /* Start from below the viewport */
        opacity: 0.1;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutToTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-30%);
        /* Slide up and fade out */
        opacity: 0;
    }
}

/* Make sure background is solid for each slide */
.carousel-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: -1;
}

/* Ensure section-specific decorations appear on their slides */
.decoration {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.7s;
}

.carousel-slide.active .decoration,
.carousel-slide.coming-in .decoration {
    opacity: 1;
}

.container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5vw;
    max-width: 1400px;
    margin: 0 auto;
    gap: 5vw;
    height: 100%;
    position: relative;
    z-index: 5;
    animation: slideInFromBottom 0.8s ease-out forwards;
}

/* Phone and content styling */
.phone-mockup {
    flex: 0 0 280px;
    position: relative;
    height: 560px;
    margin: 0 auto;
    max-width: 100%;
    max-height: 80vh;
}

.screen-container {
    position: relative;
    width: 100%;
    height: 100%;
    opacity: 1;
    transform: translateY(0);
}

.phone-img {
    width: 100%;
    height: auto;
    max-height: 100%;
    display: none;
    object-fit: contain;
}

/* Show the correct language image */
html[lang="en"] .en-img {
    display: block;
}

html[lang="zh"] .cn-img {
    display: block;
}

.app-description {
    flex: 0 0 450px;
    position: relative;
    height: 380px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 50px;
}

.description-section {
    position: relative;
    width: 100%;
    opacity: 1;
    transform: translateY(0);
}

/* Language text display */
.en-text,
.cn-text {
    display: none;
}

html[lang="en"] .en-text {
    display: block;
}

html[lang="zh"] .cn-text {
    display: block;
}

.main-title {
    font-size: 42px;
    font-weight: 700;
}

.subtitle {
    font-size: 36px;
    font-weight: 500;
    margin-bottom: 10px;
    line-height: 1.4;
}

.features {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.8;
}

.download-btn-container {}

.app-store-badge {
    height: 50px;
    width: auto;
}

.download-btn {
    display: inline-block;
    transition: transform 0.3s ease;
}

.download-btn:hover {
    transform: scale(1.05);
}

/* Carousel Navigation Arrows */
.carousel-nav {
    display: none;
}

/* Desktop Pagination Dots */
.pagination {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background-color: var(--primary-color);
    width: 12px;
    height: 12px;
}

/* Mobile Pagination (horizontal dots at bottom) */
.mobile-pagination {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    flex-direction: row;
    gap: 12px;
}

.mobile-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.mobile-dot.active {
    background-color: var(--primary-color);
    width: 10px;
    height: 10px;
}

/* Swipe hint for mobile */
.swipe-hint {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    opacity: 0.7;
    animation: fadeInOut 2s infinite;
}

.swipe-hint i {
    display: block;
    font-size: 18px;
    margin-top: 5px;
    animation: bounce 1.5s infinite;
    transform: rotate(0deg);
    /* Make sure the icon points up */
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* Add these styles for better vertical transitions */
.carousel-slide {
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Optimize the vertical slide animation with these additional styles */
@keyframes slideInFromBottom {
    0% {
        transform: translateY(30px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutToTop {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-30px);
        opacity: 0;
    }
}

.container {
    animation: slideInFromBottom 0.8s ease-out forwards;
}

/* Enhance the section-specific decorations to complement vertical movement */
[data-decoration="1"] .line-1-1,
[data-decoration="1"] .line-1-2,
[data-decoration="1"] .line-1-3 {
    transition: transform 1s ease, opacity 1s ease;
    transition-delay: 0.2s;
}

[data-decoration="2"] .circle-decoration {
    transition: transform 1s ease, opacity 1s ease;
    transition-delay: 0.3s;
}

[data-decoration="3"] .wave-decoration {
    transition: transform 1s ease, width 1s ease;
    transition-delay: 0.2s;
}

[data-decoration="4"] .dot-grid {
    transition: opacity 1s ease;
    transition-delay: 0.3s;
}

/* Responsive Design - Main Breakpoints */
@media (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }

    .main-title {
        font-size: 36px;
    }

    .subtitle {
        font-size: 30px;
    }

    .features {
        font-size: 16px;
    }
}

/* Tablet Portrait */
@media (max-width: 900px) {
    .carousel-slide {
        padding-top: 70px;
    }

    .container {
        flex-direction: column;
        gap: 20px;
        justify-content: center;
        height: calc(100% - 70px);
    }

    .phone-mockup {
        flex: 0 0 auto;
        height: 45vh;
        margin-bottom: 0;
    }

    .app-description {
        flex: 0 0 auto;
        height: auto;
        text-align: center;
        max-height: 40vh;
        overflow-y: auto;
        justify-content: center;
    }

    .main-title {
        font-size: 32px;
        margin-bottom: 20px;
    }

    .subtitle {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .features {
        margin-bottom: 20px;
    }

    .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* Mobile */
@media (max-width: 767px) {
    header {
        padding: 15px 20px;
        height: 60px;
    }

    .carousel-slide {
        padding-top: 60px;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        margin-right: 10px;
    }

    h1 {
        font-size: 16px;
    }

    .email-text {
        display: none;
    }

    .email-icon {
        display: block;
    }

    .email-btn {
        padding: 10px;
        width: 36px;
        height: 36px;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .lang-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .pagination {
        display: none;
        /* Hide desktop pagination */
    }

    .mobile-pagination {
        display: flex;
        /* Show mobile pagination */
    }

    .swipe-hint {
        display: block;
        /* Show swipe hint */
    }

    .container {
        padding: 0 20px;
    }

    .phone-mockup {
        height: 40vh;
    }

    .main-title {
        font-size: 26px;
        margin-bottom: 15px;
    }

    .subtitle {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .features {
        font-size: 14px;
        line-height: 1.6;
    }

    .app-store-badge {
        height: 40px;
    }

    .carousel-nav {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .prev-slide {
        left: 10px;
    }

    .next-slide {
        right: 10px;
    }

    /* Simplify decorations on mobile */
    [data-decoration="2"] .circle-decoration {
        width: 100px;
        height: 100px;
    }
}

/* Small Mobile */
@media (max-width: 374px) {
    .container {
        padding: 0 15px;
    }

    .phone-mockup {
        height: 35vh;
    }

    .main-title {
        font-size: 22px;
    }

    .subtitle {
        font-size: 18px;
    }
}

/* Landscape Mode Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 10px 20px;
        height: 50px;
    }

    .carousel-slide {
        padding-top: 50px;
    }

    .container {
        flex-direction: row;
        padding: 0 30px;
        height: calc(100% - 50px);
    }

    .phone-mockup {
        flex: 0 0 180px;
        height: 70vh;
    }

    .app-description {
        height: 70vh;
        text-align: left;
        justify-content: center;
    }

    .main-title {
        font-size: 24px;
        margin-bottom: 10px;
    }

    .subtitle {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .features {
        margin-bottom: 10px;
        font-size: 13px;
        line-height: 1.4;
    }

    .app-store-badge {
        height: 36px;
    }

    .mobile-pagination {
        bottom: 10px;
    }

    .swipe-hint {
        display: none;
    }
}

/* Fix for notched phones */
@supports (padding: max(0px)) {
    header {
        padding-left: max(5vw, env(safe-area-inset-left));
        padding-right: max(5vw, env(safe-area-inset-right));
    }

    .pagination {
        right: max(30px, env(safe-area-inset-right));
    }

    .container {
        padding-left: max(5vw, env(safe-area-inset-left));
        padding-right: max(5vw, env(safe-area-inset-right));
    }
}

/* Fix for older browsers */
@supports not (gap: 10px) {
    .pagination .dot {
        margin-bottom: 10px;
    }

    .mobile-pagination .mobile-dot {
        margin-right: 12px;
    }

    .nav-controls>* {
        margin-left: 15px;
    }
}