/* =========================================
   VARIABLES & THEME CONFIGURATION
   ========================================= */
:root {
    /* Apple Cupertino Palette */
    --primary: #007AFF;
    --primary-rgb: 0, 122, 255;
    --primary-hover: #0062CC;
    
    --secondary: #5856D6;
    --secondary-rgb: 88, 86, 214;
    
    --accent: #34C759;
    --accent-rgb: 52, 199, 89;
    
    --background: #F5F5F7;
    --background-alt: #FFFFFF;
    --surface: #FFFFFF;
    
    --text-primary: #1D1D1F;
    --text-secondary: #86868b;
    --text-muted: #D2D2D7;
    
    --border: #D2D2D7;
    
    /* Spacing */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    
    /* Animation */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* =========================================
   RESET & GLOBAL STYLES
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

/* =========================================
   SECTION STYLING - MANDATORY
   ========================================= */
section, .section, #playground, #how-to-use, #gallery, #testimonials, #faq, #features, #why-use {
    padding: 5rem 2rem;
    position: relative;
}

section:nth-child(odd) {
    background-color: var(--background);
}

section:nth-child(even) {
    background-color: var(--background-alt);
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.section-header h2 {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* =========================================
   BUTTON STYLES
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    border-radius: 9999px;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 15px rgba(var(--primary-rgb), 0.4);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--primary);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
}

/* =========================================
   HEADER & NAV
   ========================================= */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

header nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

header nav a:not(.btn) {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
}

header nav a:not(.btn):hover {
    color: var(--primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0.5rem;
}

/* =========================================
   HERO SECTION
   ========================================= */
.hero {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding-top: 5rem;
}

.hero-bg-image {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-bg-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Morphing Blobs Animation */
.hero-bg-animation {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.morph-blob {
    position: absolute;
    width: 50vw;
    height: 50vw;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.4) 0%, rgba(var(--secondary-rgb), 0.4) 100%);
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morphBlob 15s ease-in-out infinite;
    filter: blur(80px);
    opacity: 0.5;
}

.morph-blob:nth-child(1) {
    top: -10%;
    right: -10%;
    animation-delay: 0s;
}

.morph-blob:nth-child(2) {
    bottom: -10%;
    left: -10%;
    background: linear-gradient(135deg, rgba(var(--secondary-rgb), 0.4) 0%, rgba(var(--accent-rgb), 0.4) 100%);
    animation-delay: -5s;
    animation-direction: reverse;
}

@keyframes morphBlob {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: rotate(0deg); }
    33% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; transform: rotate(120deg); }
    66% { border-radius: 50% 60% 30% 60% / 30% 40% 70% 60%; transform: rotate(240deg); }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.4); /* Light overlay for Apple theme */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 900px;
    padding: 0 1rem;
}

.hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.hero p {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* =========================================
   PLAYGROUND SECTION
   ========================================= */
#playground {
    background-color: var(--background-alt);
}

.playground-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.playground-panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.panel-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.panel-header h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.upload-zone, .result-display {
    height: 350px;
    width: 100%;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.upload-zone {
    background: rgba(var(--primary-rgb), 0.03);
    border: 2px dashed rgba(var(--primary-rgb), 0.2);
    cursor: pointer;
    transition: var(--transition-normal);
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
}

.upload-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.upload-placeholder svg {
    margin-bottom: 1rem;
    color: var(--primary);
}

.upload-text {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-display {
    background: #000;
    border: 1px solid var(--border);
}

.result-placeholder {
    color: var(--text-muted);
    text-align: center;
}

.result-placeholder svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

#preview-image, #result-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 10;
}

.hidden {
    display: none !important;
}

.prompt-input-container {
    margin-top: 1.5rem;
}

textarea#prompt-input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.2s;
}

textarea#prompt-input:focus {
    border-color: var(--primary);
}

.playground-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   FEATURES & BENEFITS SECTIONS
   ========================================= */
.features-grid {
    display: grid;
    /* Fixed: Adjusted minmax to 250px to ensure 4 items fit in 1200px container */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: var(--transition-normal);
    border: 1px solid rgba(0,0,0,0.03);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.feature-image {
    height: 200px;
    overflow: hidden;
}

.feature-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.feature-card:hover .feature-image img {
    transform: scale(1.05);
}

.feature-content {
    padding: 2rem;
}

.feature-content h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.feature-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Why Use Grid */
.why-use-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.benefit-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0,0,0,0.05);
}

.icon-wrapper {
    width: 56px;
    height: 56px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.benefit-card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.benefit-card p {
    color: var(--text-secondary);
}

/* =========================================
   HOW IT WORKS SECTION
   ========================================= */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    position: relative;
}

.step-card {
    background: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
    position: relative;
    z-index: 1;
}

.step-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.08);
}

.step-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
    box-shadow: 0 8px 16px rgba(var(--primary-rgb), 0.3);
}

.step-card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.step-card p {
    color: var(--text-secondary);
}

/* =========================================
   GALLERY SECTION
   ========================================= */
.gallery-grid {
    display: grid;
    /* Fixed: Adjusted minmax to 250px to ensure balance in 1200px container */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 4/5;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-overlay span {
    color: white;
    font-weight: 600;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-item:hover .gallery-overlay span {
    transform: translateY(0);
}

/* =========================================
   TESTIMONIALS SECTION
   ========================================= */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.testimonial-card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.testimonial-card::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 20px;
    font-size: 5rem;
    color: var(--primary);
    opacity: 0.1;
    font-family: Georgia, serif;
    line-height: 1;
}

.testimonial-text {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.testimonial-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(var(--primary-rgb), 0.2);
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    color: var(--text-primary);
}

.author-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* =========================================
   FAQ SECTION
   ========================================= */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: var(--surface);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-question {
    padding: 1.5rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.faq-question::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--primary);
    transition: transform 0.3s ease;
    line-height: 1;
}

.faq-item.active .faq-question::after {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 1.5rem;
}

.faq-answer p {
    padding-bottom: 1.5rem;
    color: var(--text-secondary);
}

.faq-item.active .faq-answer {
    max-height: 500px; /* Arbitrary large number */
}

/* =========================================
   FOOTER
   ========================================= */
footer {
    background: var(--surface);
    border-top: 1px solid rgba(0,0,0,0.05);
    padding: 4rem 2rem 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-column h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.footer-brand p {
    color: var(--text-secondary);
    max-width: 300px;
    margin-top: 1rem;
}

.footer-column a {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.footer-column a:hover {
    color: var(--primary);
}

.footer-bottom {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0,0,0,0.05);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* =========================================
   ANIMATIONS & EFFECTS
   ========================================= */
.fade-in-up, .fade-in-left, .fade-in-right {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-left { transform: translateX(-30px); }
.fade-in-left.visible { opacity: 1; transform: translateX(0); }

.fade-in-right { transform: translateX(30px); }
.fade-in-right.visible { opacity: 1; transform: translateX(0); }

/* =========================================
   MEDIA QUERIES (MOBILE RESPONSIVE)
   ========================================= */

/* Mobile (max 767px) */
@media (max-width: 767px) {
    html { font-size: 14px; }
    
    .hero {
        min-height: 80vh;
        padding-top: 6rem;
    }
    
    .playground-grid, 
    .steps-grid, 
    .features-grid, 
    .why-use-grid,
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .menu-toggle { display: block; }
    
    header nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        padding: 1.5rem;
        gap: 1.5rem;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    }
    
    header nav.active { display: flex; }
    
    .mobile-cta-container {
        width: 100%;
        padding-top: 1rem;
        border-top: 1px solid rgba(0,0,0,0.05);
    }
    
    .mobile-cta-container .btn { width: 100%; }
    
    .upload-zone, .result-display { height: 280px; }
    
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .hero-actions .btn {
        width: 100%;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    html { font-size: 15px; }
    
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
    .footer-content { grid-template-columns: repeat(2, 1fr); }
    
    /* Last item in odd numbered grid spans 2 columns */
    .steps-grid .step-card:last-child {
        grid-column: span 2;
        max-width: 60%;
        margin: 0 auto;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    /* Styles inherit from base, grids defined above */
}