/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    font-family: 'Nunito', 'Microsoft YaHei', 'PingFang SC', sans-serif; 
    /* Magical fairy tale background */
    background-color: #f0f4f8; 
    background-image: radial-gradient(circle at top center, #ffffff 0%, #e6eef5 100%);
    color: #334155; 
    line-height: 1.6; 
    min-height: 100vh; 
    overflow-x: hidden; 
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* Theme Variables - Pop-up Book */
:root {
    --book-cover: #4338ca;
    --book-page: #fdfbf7;
    --primary-blue: #3b82f6;
    --primary-hover: #2563eb;
    --accent-gold: #fbbf24;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-light: #ffffff;
}

/* Navigation */
.navbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 15px 5%; 
    background: rgba(255, 255, 255, 0.9); 
    backdrop-filter: blur(2px);
    position: sticky; 
    top: 0; 
    z-index: 100; 
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.nav-logo { 
    font-size: 26px; 
    font-weight: 900; 
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--book-cover);
}
.nav-logo svg {
    width: 36px;
    height: 36px;
    fill: var(--primary-blue);
}
.nav-links { display: flex; gap: 30px; align-items: center; font-weight: 800; }
.nav-links a { 
    color: var(--text-muted); 
    transition: all 0.3s; 
    font-size: 16px; 
    position: relative;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px; left: 0; width: 0; height: 3px;
    background: var(--accent-gold);
    transition: width 0.3s ease;
    border-radius: 2px;
}
.nav-links a:hover { color: var(--book-cover); }
.nav-links a:hover::after { width: 100%; }

.btn-download-nav { 
    padding: 10px 24px !important; 
    background: var(--primary-blue);
    color: #fff !important; 
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.3s; 
}
.btn-download-nav::after { display: none; }
.btn-download-nav:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    background: var(--primary-hover);
}

/* Hero Section - Pop-up Book */
.hero-wrapper {
    position: relative;
    min-height: 95vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 60px 5% 100px;
    overflow: hidden;
    perspective: 1500px;
}

/* Magic sparkles */
.magic-sparkles {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(var(--accent-gold) 1px, transparent 2px);
    background-size: 50px 50px;
    opacity: 0.3;
    animation: sparkleMove 20s linear infinite;
    z-index: 0;
}
@keyframes sparkleMove {
    0% { background-position: 0 0; }
    100% { background-position: 100px 100px; }
}

/* The Pop-up Book Structure */
.book-container {
    position: relative;
    width: 800px;
    height: 300px;
    margin-top: 50px;
    transform-style: preserve-3d;
    transform: rotateX(25deg);
    z-index: 1;
}

.book-page {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: var(--book-page);
    box-shadow: inset 0 0 30px rgba(0,0,0,0.05), 0 20px 40px rgba(0,0,0,0.2);
}
.book-left {
    left: 0;
    border-radius: 15px 0 0 15px;
    transform-origin: right center;
    transform: rotateY(15deg);
    background: linear-gradient(to right, #f4f0e6, #ffffff);
}
.book-right {
    right: 0;
    border-radius: 0 15px 15px 0;
    transform-origin: left center;
    transform: rotateY(-15deg);
    background: linear-gradient(to left, #f4f0e6, #ffffff);
}
.book-spine {
    position: absolute;
    left: 50%;
    top: 0;
    width: 60px;
    height: 100%;
    transform: translateX(-50%) translateZ(-5px);
    background: linear-gradient(to right, rgba(0,0,0,0.1), rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.1));
    z-index: 2;
}

/* Pop-up Elements */
.pop-up-elements {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform-style: preserve-3d;
    transform: translateX(-50%) translateZ(40px) rotateX(-25deg);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pop-up-castle {
    width: 250px;
    height: 250px;
    fill: var(--book-cover);
    filter: drop-shadow(0 15px 15px rgba(0,0,0,0.3));
    transform-origin: bottom center;
    animation: popUpAnim 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.pop-up-plane {
    position: absolute;
    top: -50px;
    right: -100px;
    width: 120px;
    height: 120px;
    fill: var(--primary-blue);
    filter: drop-shadow(0 10px 10px rgba(59, 130, 246, 0.4));
    animation: planeFly 4s ease-in-out infinite alternate;
}

.pop-up-text {
    position: absolute;
    bottom: -30px;
    font-size: 32px;
    font-weight: 900;
    color: var(--accent-gold);
    text-shadow: 2px 2px 0 var(--book-cover), 4px 4px 10px rgba(0,0,0,0.3);
    white-space: nowrap;
    transform: translateZ(20px);
}

@keyframes popUpAnim {
    0% { transform: rotateX(-90deg); opacity: 0; }
    100% { transform: rotateX(0deg); opacity: 1; }
}
@keyframes planeFly {
    0% { transform: translate(0, 0) rotate(-10deg); }
    100% { transform: translate(30px, -30px) rotate(10deg); }
}

.hero-content { 
    z-index: 20; 
    max-width: 1000px; 
    text-align: center;
    position: relative;
    margin-top: 20px;
}

.hero-title {
    font-size: 36px; /* Adjusted for longer title */
    font-weight: 900;
    margin-bottom: 20px;
    color: var(--book-cover);
    text-shadow: 0 4px 15px rgba(67, 56, 202, 0.2);
    line-height: 1.4;
}

.hero p { 
    font-size: 20px; 
    margin-bottom: 40px; 
    color: var(--text-muted);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    font-weight: bold;
}

.hero-buttons { display: flex; gap: 20px; justify-content: center; margin-bottom: 50px; flex-wrap: wrap; }

.btn-primary { 
    padding: 16px 35px; 
    font-size: 18px; 
    font-weight: 800; 
    color: #fff; 
    background: var(--primary-blue);
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
    transition: all 0.3s;
}
.btn-primary:hover { 
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(59, 130, 246, 0.6);
    background: var(--primary-hover);
}

.btn-outline { 
    padding: 16px 35px; 
    font-size: 18px; 
    font-weight: 800; 
    color: var(--primary-blue); 
    background: #fff;
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
    transition: all 0.3s;
}
.btn-outline:hover { 
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(59, 130, 246, 0.2);
    background: #f0f7ff;
}

.hero-images { 
    display: flex; 
    justify-content: center; 
    gap: 25px; 
    align-items: flex-end; 
    margin-top: -20px;
    z-index: 20;
}
.hero-images img { 
    max-width: 28%; 
    border-radius: 12px;
    border: 6px solid #fff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.hero-images img:nth-child(2) {
    transform: translateY(-20px);
    z-index: 2;
}
.hero-images img:hover { 
    transform: translateY(-30px) scale(1.05); 
}

/* Features Section */
.features { padding: 100px 5%; background: var(--bg-light); position: relative; z-index: 10;}
.section-title { 
    text-align: center; 
    font-size: 36px; 
    margin-bottom: 60px; 
    font-weight: 900;
    color: var(--book-cover);
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}
.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 20%;
    width: 60%;
    height: 4px;
    background: var(--accent-gold);
    border-radius: 2px;
}

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; max-width: 1200px; margin: 0 auto; }

.feature-card { 
    padding: 40px 30px; 
    text-align: center; 
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
    transition: all 0.3s; 
    position: relative;
    overflow: hidden;
}
/* Folded corner effect */
.feature-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    border-width: 0 30px 30px 0;
    border-style: solid;
    border-color: #f0f4f8 #fff #fff #f0f4f8;
    background: #fff;
    box-shadow: -2px 2px 5px rgba(0,0,0,0.05);
    border-bottom-left-radius: 4px;
    transition: all 0.3s;
}
.feature-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 20px 40px rgba(67, 56, 202, 0.1);
}
.feature-card:hover::before {
    border-width: 0 40px 40px 0;
}
.feature-card h3 { 
    font-size: 22px; 
    margin-bottom: 15px; 
    font-weight: 900; 
    color: var(--book-cover);
}
.feature-card p { color: var(--text-muted); font-size: 15px; font-weight: 600;}

/* Blog Section */
.blog { padding: 100px 5%; background: #f8fafc; }
.blog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px; max-width: 1100px; margin: 0 auto; }
.blog-card { 
    display: flex; 
    flex-direction: column; 
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: all 0.3s;
}
.blog-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 20px 40px rgba(67, 56, 202, 0.1);
}
.blog-card img { width: 100%; height: 260px; object-fit: cover; }
.blog-content { padding: 35px; }
.blog-date { display: inline-block; margin-bottom: 15px; font-size: 14px; color: #fff; background: var(--accent-gold); padding: 5px 15px; border-radius: 20px; font-weight: 800;}
.blog-content h3 { font-size: 24px; margin-bottom: 15px; font-weight: 900; color: var(--text-main);}
.blog-content p { color: var(--text-muted); margin-bottom: 0; font-weight: 600;}
.btn-more { 
    display: block; 
    width: 240px; 
    margin: 60px auto 0; 
    text-align: center; 
    padding: 16px; 
    background: #fff;
    color: var(--primary-blue); 
    font-weight: 800; 
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    transition: all 0.3s; 
}
.btn-more:hover { background: var(--primary-blue); color: #fff; box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);}

/* FAQ Section */
.faq { padding: 100px 5%; max-width: 900px; margin: 0 auto; background: var(--bg-light); margin-top: 40px; margin-bottom: 80px; border-radius: 20px; box-shadow: 0 15px 40px rgba(0,0,0,0.05);}
.faq-item { 
    background: #f8fafc; 
    margin-bottom: 20px; 
    padding: 25px 30px; 
    border-radius: 12px;
    border-left: 4px solid var(--accent-gold);
    transition: all 0.3s;
}
.faq-item:hover { 
    transform: translateX(5px);
    background: #fff;
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}
.faq-question { font-size: 18px; font-weight: 900; margin-bottom: 12px; color: var(--book-cover);}
.faq-answer { color: var(--text-muted); font-size: 15px; font-weight: 600;}

/* Footer */
.footer { background: #0f172a; padding: 80px 5% 30px; color: #94a3b8; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px; max-width: 1200px; margin: 0 auto 50px; }
.footer-col h4 { font-size: 18px; color: #fff; margin-bottom: 25px; font-weight: 900;}
.footer-col ul li { margin-bottom: 15px; }
.footer-col ul li a { color: #94a3b8; transition: all 0.2s; font-weight: 600;}
.footer-col ul li a:hover { color: var(--accent-gold); padding-left: 5px;}
.footer-bottom { text-align: center; padding-top: 30px; border-top: 1px solid rgba(255,255,255,0.1); font-size: 14px;}

/* Download Page Grid */
.download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 30px; max-width: 1100px; margin: 60px auto; padding: 0 5%; }
.download-card { 
    padding: 40px 30px; 
    text-align: center; 
    background: #fff; 
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: all 0.3s;
}
.download-card:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 20px 40px rgba(67, 56, 202, 0.1);
}
.download-card h3 { font-size: 24px; margin-bottom: 15px; font-weight: 900; color: var(--book-cover);}
.download-card p { color: var(--text-muted); margin-bottom: 30px; font-size: 15px; font-weight: 600;}
.btn-dl-card { 
    display: inline-block; 
    padding: 14px 30px; 
    background: var(--primary-blue);
    color: #fff; 
    font-weight: 800; 
    border-radius: 8px;
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.2s; 
}
.btn-dl-card:hover { 
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.5);
    background: var(--primary-hover); 
}

/* Page specific headers */
.page-header { 
    padding: 100px 5% 80px; 
    text-align: center; 
    background: #f0f4f8;
    background-image: radial-gradient(circle at top center, #ffffff 0%, #e6eef5 100%);
}
.page-header-content {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 50px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
}
.page-header h1 { 
    font-size: 42px; 
    margin-bottom: 20px; 
    font-weight: 900;
    color: var(--book-cover);
}
.page-header p { font-size: 18px; color: var(--text-muted); font-weight: 700;}

/* === perf: reduce motion & lower GPU cost === */
.feature-card,
.blog-card,
.hero-content,
.glass-panel,
.pearl-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.navbar {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* perf: limit decorative infinite layers on mid/low-end devices */
@media (max-width: 768px) {
    .bubble:nth-child(n+3),
    .tiny-plane:nth-child(n+3),
    .bg-shard:nth-child(n+4),
    .orb:nth-child(n+2) {
        display: none !important;
    }
}
