@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,600;0,700;1,400&display=swap');

:root {
    --primary-brown: #4A2C0F;
    --text-dark: #1A1A1A;
    --text-light: #FFFFFF;
    --bg-color: #FFFFFF;
    --card-radius: 20px;
    --btn-radius: 30px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.logo img {
    height: clamp(60px, 8vw, 80px); /* Fluid logo size */
    display: block;
}

.header-badges img {
    height: 40px;
    margin-left: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.header-badges img:hover {
    transform: scale(1.05);
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(40px, 8vw, 60px) 0;
    gap: 40px;
    flex-wrap: wrap; /* Allow wrapping */
}

.hero-content {
    flex: 1 1 450px; /* Min width before wrapping */
}

.hero-title {
    font-size: clamp(40px, 6vw, 64px); /* Fluid typography */
    line-height: 1.1;
    color: #000;
    margin-bottom: 20px;
}

.hero-title span {
    font-style: italic;
    font-weight: 400;
}

.hero-description {
    font-size: clamp(14px, 2vw, 16px);
    color: #555;
    margin-bottom: 30px;
    max-width: 450px;
}

.btn-primary {
    background-color: var(--primary-brown);
    color: var(--text-light);
    padding: 15px 35px;
    border-radius: var(--btn-radius);
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.btn-primary:hover {
    background-color: #3a220b;
    transform: translateY(-2px);
}

.hero-image {
    flex: 1 1 400px;
    display: flex;
    justify-content: center;
}

.phone-img {
    max-width: 100%;
    height: auto;
    max-height: 600px; /* Control height */
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.2));
}

/* Why Rewear Section */
.why-rewear {
    text-align: center;
    padding: clamp(40px, 8vw, 80px) 0;
}

.section-title {
    font-size: clamp(32px, 5vw, 48px);
    color: #000;
    margin-bottom: 40px;
}

.section-title span {
    font-style: italic;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Automatic responsive grid */
    gap: 30px;
    justify-items: center;
}

.feature-card {
    background-color: var(--primary-brown);
    color: var(--text-light);
    padding: 40px 30px;
    border-radius: var(--card-radius);
    width: 100%;
    max-width: 350px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card h3 {
    font-size: 20px;
    margin-bottom: 15px;
}

.feature-card p {
    font-size: 14px;
    opacity: 0.9;
}

/* How it Works */
.how-it-works {
    padding: clamp(40px, 8vw, 80px) 0;
    padding-bottom: 0px;
    text-align: center;
}

.how-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(30px, 5vw, 80px);
    flex-wrap: wrap;
    text-align: left; /* Reset text align for content */
}

.how-image {
    flex: 1 1 400px;
    display: flex;
    justify-content: center; /* Center on smaller screens naturally */
}

.how-image .phone-img {
    max-height: 550px;
}

.steps-container {
    flex: 1 1 350px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    position: relative;
    max-width: 500px;
}

/* Vertical dashed line */
.steps-container::before {
    content: '';
    position: absolute;
    left: 20px; /* Aligns with the center of the number circles */
    top: 20px;
    width: 2px;
    border-left: 2px dashed #ccc;
    z-index: 0;
    
    /* Animation Initial State */
    height: 0; 
    transition: height 1.5s ease-out;
}

.steps-container.active::before {
    height: calc(100% - 40px);
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.step-number {
    background-color: var(--primary-brown);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.step-info p {
    font-size: 14px;
    color: #666;
}

/* Footer CTA */
.footer-cta {
    padding: clamp(80px, 10vw, 120px) 0 clamp(2px, 20vw, 5px); /* Fluid padding, large bottom for phone */
    overflow: visible;
}

.cta-card {
    background-color: var(--primary-brown);
    border-radius: clamp(30px, 4vw, 50px);
    padding: clamp(40px, 5vw, 80px) clamp(30px, 5vw, 70px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    margin-top: 0; 
    overflow: visible;
    flex-wrap: wrap; /* Allow wrapping */
}

.cta-content {
    flex: 1 1 300px;
    z-index: 2;
    max-width: 600px; /* Don't let it get too wide on large screens */
}

.cta-title {
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.2;
    margin-bottom: 30px;
}

.cta-title span {
    font-style: italic;
}

.cta-badges {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.cta-badges img {
    height: clamp(35px, 4vw, 45px);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    transition: transform 0.2s;
}

.cta-badges img:hover {
    transform: translateY(-2px);
}

.cta-image-container {
    position: relative;
    width: 40%; 
    min-width: 300px; /* Ensure it has size */
    height: 0; 
    display: flex;
    align-items: center;
    justify-content: center;
}

.cta-phone-img {
    width: clamp(300px, 50vw, 450px); /* Fluid width */
    max-width: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-45%, -55%) rotate(1deg);
    filter: drop-shadow(0 40px 60px rgba(0,0,0,0.3));
    z-index: 1;
}

/* =========================================
   ANIMATIONS & TRANSITIONS
   ========================================= */
.reveal {
    opacity: 0;
    transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}

.reveal.active {
    opacity: 1;
    transform: translate(0, 0) scale(1);
}

/* Restore hover effects after animation */
.feature-card.reveal.active:hover {
    transform: translateY(-5px);
}

.header-badges img.reveal.active:hover {
    transform: scale(1.05);
}

.btn-primary.reveal.active:hover {
    transform: translateY(-2px);
    background-color: #3a220b;
}

/* Fade Up */
.reveal-up {
    transform: translateY(50px);
}

/* Fade Down */
.reveal-down {
    transform: translateY(-50px);
}

/* Fade Left */
.reveal-left {
    transform: translateX(50px);
}

/* Fade Right */
.reveal-right {
    transform: translateX(-50px);
}

/* Zoom In */
.reveal-zoom {
    transform: scale(0.9);
}

/* Stagger Delays */
.delay-100 { transition-delay: 0.1s; }
.delay-200 { transition-delay: 0.2s; }
.delay-300 { transition-delay: 0.3s; }
.delay-400 { transition-delay: 0.4s; }
.delay-500 { transition-delay: 0.5s; }

/* Specific Element Animations */
.hero-image.reveal-left {
    transform: translateX(50px) scale(0.95);
}

.cta-phone-img.reveal-pop {
    opacity: 0;
    transform: translate(-45%, 20%) rotate(5deg) scale(0.8); /* Start lower and smaller */
    transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* Bouncy effect */
}

.cta-phone-img.reveal-pop.active {
    opacity: 1;
    transform: translate(-45%, -55%) rotate(1deg) scale(1) !important; /* End state matches original */
}

@media (max-width: 1024px) {
    .cta-phone-img.reveal-pop {
        transform: rotate(5deg) translateY(100px) scale(0.9);
    }
    
    .cta-phone-img.reveal-pop.active {
        transform: rotate(1deg) translateY(-40px) scale(1) !important;
        margin-bottom: -150px; /* Maintain layout margin */
    }
}

@media (max-width: 768px) {
    .cta-phone-img.reveal-pop {
        transform: rotate(3deg) translateY(50px);
    }
    
    .cta-phone-img.reveal-pop.active {
        transform: rotate(3deg) translateY(-30px) !important;
        margin-bottom: -100px;
    }
}

/* =========================================
   ADVANCED ANIMATIONS (Floating, Pulse, Gradient)
   ========================================= */

/* 1. Floating Animation (Levitation) */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

/* 2. Gradient Text Animation */
.text-gradient {
    background: linear-gradient(45deg, #4A2C0F, #8B5E3C, #4A2C0F);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shine 3s linear infinite;
    display: inline-block;
}

@keyframes gradient-shine {
    to { background-position: 200% center; }
}

/* 3. Pulse Glow Animation for Button */
@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(74, 44, 15, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(74, 44, 15, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 44, 15, 0); }
}

.animate-pulse {
    animation: pulse-glow 2s infinite;
}

/* Update Hero Image to use Float after reveal */
.hero-image.reveal-left.active .phone-img {
    animation: float 4s ease-in-out infinite;
    animation-delay: 1s; /* Start floating after slide-in */
}

/* =========================================
   RESPONSIVE MEDIA QUERIES
   ========================================= */

/* Large Tablets & Small Laptops (max-width: 1024px) */
@media (max-width: 1024px) {
    /* Footer Stacked Layout */
    .footer-cta {
        padding: 80px 0 200px;
    }

    .cta-card {
        flex-direction: column;
        text-align: center;
        align-items: center;
        padding: 60px 40px 0; /* No bottom padding, let image hang */
        height: auto;
    }

    .cta-content {
        max-width: 100%;
        margin-bottom: 50px;
        flex: none;
    }

    .cta-badges {
        justify-content: center;
        max-width: 100%;
        flex-wrap: wrap;
    }

    .cta-image-container {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin-top: 0;
        display: block; /* Reset flex */
        text-align: center;
        overflow: visible; /* Allow pop-out */
    }

    .cta-phone-img {
        position: relative;
        top: auto;
        left: auto;
        transform: rotate(1deg);
        margin-bottom: -150px; /* Reduced margin to avoid issues */
        width: 70%; /* Safer width */
        max-width: 450px;
        display: inline-block; /* Allow centering */
    }

    /* Hero adjustments */
    .hero-title { font-size: 52px; }
}

/* Tablets & Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .container { padding: 0 20px; }

    /* Header */
    header {
        justify-content: center;
        flex-direction: column;
        gap: 15px;
    }
    
    .header-badges {
        margin-left: 0;
    }

    /* Hero */
    .hero {
        flex-direction: column;
        text-align: center;
        padding: 40px 0;
        gap: 40px;
    }

    .hero-content {
        flex: none;
        width: 100%;
        max-width: 100%; /* Prevent blowout */
    }
    
    .hero-image {
        flex: none;
        width: 100%;
        max-width: 100%;
    }
    
    .hero-description {
        margin: 0 auto 30px;
        max-width: 100%;
    }

    /* Features */
    .features-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }
    
    .feature-card {
        max-width: 100%; /* Full width */
        width: 100%;
    }

    /* How It Works */
    .how-content {
        flex-direction: column;
        gap: 40px;
        max-width: 100%;
    }
    
    .how-image {
        order: -1;
        width: 100%;
        max-width: 100%;
    }
    
    .how-image .phone-img {
        max-width: 100%;
        height: auto;
    }
    
    .steps-container {
        width: 100%;
        max-width: 100%;
        padding-left: 0;
    }
    
    .steps-container::before {
        display: none; /* Hide line on mobile */
    }
    
    .step {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Footer adjustments for mobile */
    .footer-cta {
        padding-bottom: 150px;
    }

    .cta-phone-img {
        width: 90%;
        max-width: 350px;
        margin-bottom: -100px;
        transform: translateY(-30px) rotate(3deg); /* Less rotation on mobile */
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .hero-title { font-size: 36px; }
    .section-title { font-size: 32px; }
    .cta-title { font-size: 32px; }

    .cta-card {
        padding: 40px 20px 0;
    }

    .cta-phone-img {
        transform: none; /* No rotation on very small screens */
        margin-bottom: -100px;
        width: 100%; /* Ensure it doesn't overflow width */
        max-width: 320px; /* Optional cap */
    }
    
    .cta-badges img { height: 35px; }
}
