/* ===== CSS Variables for Theme ===== */
:root {
    /* Light Mode (default) */
    --bg-primary: #f4f7ff;
    --bg-secondary: #ffffff;
    --bg-header: rgba(244, 247, 255, 0.9);
    --text-main: #1a2b56;
    --text-sub: #5a6b8c;
    --border-color: rgba(37, 99, 235, 0.1);
    --card-bg: #ffffff;
    --card-border: transparent;
    --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
    --hero-gradient: radial-gradient(circle at 50% 0%, #f4f7ff 0%, #ffffff 70%);
    --glass-blur: blur(16px);
    --accent-cyan: #22d3ee;
    --btn-secondary-border: #1a2b56;
    --btn-secondary-bg-hover: rgba(26, 43, 86, 0.05);
    --footer-border: rgba(26, 43, 86, 0.05);
}

[data-theme="dark"] {
    --bg-primary: #0B1121;
    --bg-secondary: #0f172a;
    --bg-header: rgba(11, 17, 33, 0.8);
    --text-main: #f8fafc;
    --text-sub: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.05);
    --card-bg: rgba(30, 41, 59, 0.3);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --hero-gradient: none;
    --accent-cyan: #22d3ee;
    --btn-secondary-border: #475569;
    --btn-secondary-bg-hover: rgba(255, 255, 255, 0.05);
    --footer-border: rgba(255, 255, 255, 0.1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Dark mode mesh gradient background */
[data-theme="dark"] body {
    background-color: #0B1121;
    background-image:
        radial-gradient(at 0% 0%, rgba(109, 40, 217, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(109, 40, 217, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(37, 99, 235, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

::selection {
    background-color: #2563eb;
    color: white;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Header ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background-color: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    transition: transform 0.3s ease, background-color 0.3s ease;
    background-color: #1a2b56;
    color: white;
}

[data-theme="dark"] .logo-icon {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.logo:hover .logo-icon {
    transform: rotate(12deg);
}

.logo-text {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.nav {
    display: none;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-sub);
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: #2563eb;
}

[data-theme="dark"] .nav-link:hover {
    color: var(--accent-cyan);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    background-color: transparent;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--text-sub);
}

.theme-toggle:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-toggle .material-symbols-outlined {
    font-size: 1.25rem;
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

.btn-primary-small {
    display: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    background-color: #1a2b56;
    border-radius: 9999px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(26, 43, 86, 0.1);
}

[data-theme="dark"] .btn-primary-small {
    background-color: rgba(255, 255, 255, 0.2);
    /* Brighter background */
    border: 1px solid rgba(255, 255, 255, 0.4);
    /* clearer border */
    color: white;
}

.btn-primary-small:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 0.5rem;
    background-color: transparent;
    cursor: pointer;
    color: var(--text-main);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    background-color: var(--bg-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    z-index: 90;
    padding: 1rem;
}

.mobile-menu.active {
    display: block;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mobile-nav-link {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    border-radius: 0.75rem;
    transition: background-color 0.2s ease;
}

.mobile-nav-link:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

/* ===== Hero Section ===== */
/* Hero Section */
.hero {
    position: relative;
    padding: 8rem 1.5rem 4rem;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--hero-gradient);
}

.hero-content {
    max-width: 48rem;
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    background-color: rgba(37, 99, 235, 0.1);
    color: #1e40af;
    text-transform: none;
}

[data-theme="dark"] .badge {
    background-color: rgba(37, 99, 235, 0.15);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #93c5fd;
}

.badge-dot {
    position: relative;
    width: 0.5rem;
    height: 0.5rem;
}

.badge-dot::before {
    content: '';
    position: absolute;
    inset: 0;
    background-color: #2563eb;
    border-radius: 50%;
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
    opacity: 0.75;
}

.badge-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: #2563eb;
    border-radius: 50%;
}

@keyframes ping {

    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.hero-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
}

.hero-title-accent {
    background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .hero-title-accent {
    color: var(--accent-cyan);
    background: none;
    -webkit-text-fill-color: var(--accent-cyan);
}

.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-sub);
    max-width: 40rem;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(90deg, #2563eb 0%, #06b6d4 100%);
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 280px;
}

.btn-primary:hover {
    transform: scale(1.03);
    box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.4);
}

.btn-primary .material-symbols-outlined {
    font-size: 1.25rem;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    background-color: transparent;
    border: 1px solid var(--btn-secondary-border);
    border-radius: 1rem;
    transition: background-color 0.2s ease;
    width: 100%;
    max-width: 280px;
}

.btn-secondary:hover {
    background-color: var(--btn-secondary-bg-hover);
}

/* ===== Apps Section ===== */
.apps-section {
    padding: 2rem 1.5rem 4rem;
    max-width: 80rem;
    margin: 0 auto;
    /* Optional: transition for bg if we add it */
    transition: background-color 0.3s ease;
}

[data-theme="dark"] .apps-section {
    background-color: rgba(30, 41, 59, 0.4);
    /* Alternating Secondary BG */
    border-radius: 2rem;
    /* Optional: rounded container for apps in dark mode */
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.apps-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.app-card {
    position: relative;
    /* Glass Card Refinement */
    background: rgba(255, 255, 255, 0.6);
    /* Reduced opacity from 0.7 */
    border: 1px solid rgba(255, 255, 255, 0.6);
    /* Glass Edge Highlight */
    border-radius: 2rem;
    padding: 2.5rem;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(24px);
    /* Increased blur */
    -webkit-backdrop-filter: blur(24px);

    /* Softened Shadow (Blur focused) */
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.05), inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
}

/* Fix Dark Mode Visibility & Style */
[data-theme="dark"] .app-card {
    background: rgba(30, 41, 59, 0.3);
    /* Adjusted opacity */
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
}

/* Ensure text is visible in dark mode cards */
[data-theme="dark"] .app-description {
    color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .app-subtitle {
    color: rgba(255, 255, 255, 0.8) !important;
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .app-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
    background: rgba(30, 41, 59, 0.6);
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.5s ease;
}

.app-card:hover .card-glow {
    opacity: 0.8;
}

.card-glow-blue {
    background: radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.2) 0%, transparent 60%);
}

.card-glow-magenta {
    background: radial-gradient(circle at 80% 20%, rgba(217, 70, 239, 0.2) 0%, transparent 60%);
}

.card-glow-green {
    background: radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.2) 0%, transparent 60%);
}

.card-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.app-icon {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 2;
    background: transparent;
    /* Remove gradients */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    /* Generic shadow base */
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1.1rem;
    /* Slightly less than container to fit perfectly */
    display: block;
}

.app-card:hover .app-icon {
    transform: scale(1.1);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.app-icon .material-symbols-outlined {
    display: none;
    /* Hide glyphs */
}

/* Specific shadows based on app color (optional, can be refined) */
.app-icon-blue {
    box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.4);
}

.app-icon-magenta {
    box-shadow: 0 12px 24px -6px rgba(217, 70, 239, 0.4);
}

.app-icon-green {
    box-shadow: 0 12px 24px -6px rgba(16, 185, 129, 0.4);
}

.app-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.app-title-row .app-title {
    margin-bottom: 0;
}

.pro-badge {
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 800;
    color: white;
    background-color: #2563eb;
    border-radius: 0.25rem;
}

.app-description {
    font-size: 1rem;
    color: var(--text-sub);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    line-height: 1.6;
}

.app-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: white;
    border-radius: 1.25rem;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.app-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.app-btn:hover::after {
    opacity: 1;
}

.app-btn-blue {
    background: linear-gradient(90deg, #60a5fa 0%, #22d3ee 100%);
    /* Desaturated */
    box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.3);
}

.app-btn-magenta {
    background: linear-gradient(90deg, #e879f9 0%, #f472b6 100%);
    /* Desaturated */
    box-shadow: 0 8px 20px -4px rgba(217, 70, 239, 0.3);
}

.app-btn-green {
    background: linear-gradient(90deg, #34d399 0%, #6ee7b7 100%);
    /* Desaturated */
    box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.3);
}

.app-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    /* Light reaction on hover only */
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.15);
}

.app-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

/* ===== Story Section ===== */
.story-section {
    padding: 4rem 1.5rem;
    background-color: var(--bg-secondary);
    transition: background-color 0.3s ease;
}

[data-theme="dark"] .story-section {
    background-color: transparent;
    /* Same as Hero/Main BG */
    border-top: none;
    border-bottom: none;
}

.story-content {
    max-width: 48rem;
    margin: 0 auto;
    text-align: center;
}

.section-badge {
    display: inline-block;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    background-color: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

[data-theme="dark"] .section-badge {
    background-color: rgba(37, 99, 235, 0.15);
    color: #93c5fd;
}

.section-title {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
}

.story-text {
    font-size: 1.125rem;
    color: var(--text-sub);
    line-height: 1.8;
    margin-bottom: 3rem;
}

.story-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(90deg, #2563eb 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-sub);
    letter-spacing: 0.05em;
}

/* ===== Support Section ===== */
.support-section {
    padding: 4rem 1.5rem;
    transition: background-color 0.3s ease;
}

[data-theme="dark"] .support-section {
    background-color: rgba(30, 41, 59, 0.4);
    /* Alternating Secondary BG */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.support-content {
    max-width: 32rem;
    margin: 0 auto;
    text-align: center;
}

.support-text {
    font-size: 1.125rem;
    color: var(--text-sub);
    margin-bottom: 2rem;
    line-height: 1.7;
}

/* ===== Footer ===== */
.footer {
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--footer-border);
    background-color: var(--bg-primary);
    /* Default Light Mode bg */
}

/* Dark Mode Footer Separation */
[data-theme="dark"] .footer {
    background-color: rgba(11, 17, 33, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-copy {
    font-size: 0.875rem;
    color: var(--text-sub);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-link {
    font-size: 0.875rem;
    color: var(--text-sub);
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #2563eb;
}

[data-theme="dark"] .footer-link:hover {
    color: var(--accent-cyan);
}

/* ===== Responsive Design ===== */
@media (min-width: 640px) {
    .hero-buttons {
        flex-direction: row;
        justify-content: center;
    }

    .btn-primary,
    .btn-secondary {
        width: auto;
    }
}

@media (min-width: 768px) {
    .header {
        padding: 1rem 2rem;
    }

    .nav {
        display: flex;
    }

    .btn-primary-small {
        display: inline-block;
    }

    .mobile-menu-btn {
        display: none;
    }

    .hero {
        padding: 10rem 2rem 6rem;
        min-height: 70vh;
    }

    .apps-section {
        padding: 4rem 2rem 6rem;
    }

    .apps-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }

    .story-section,
    .support-section {
        padding: 6rem 2rem;
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

@media (min-width: 1024px) {
    .header {
        padding: 1rem 3rem;
    }

    .hero {
        padding: 12rem 3rem 8rem;
    }

    .apps-section {
        padding: 4rem 3rem 8rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.hero-content>* {
    animation: fadeInUp 0.6s ease forwards;
}

.hero-content>*:nth-child(1) {
    animation-delay: 0.1s;
}

.hero-content>*:nth-child(2) {
    animation-delay: 0.2s;
}

.hero-content>*:nth-child(3) {
    animation-delay: 0.3s;
}

.hero-content>*:nth-child(4) {
    animation-delay: 0.4s;
}

.app-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.app-card:nth-child(1) {
    animation-delay: 0.5s;
}

.app-card:nth-child(2) {
    animation-delay: 0.6s;
}

.app-card:nth-child(3) {
    animation-delay: 0.7s;
}