/*
 * Critical CSS
 * - Loaded synchronously to avoid FOUC (flash of unstyled content)
 * - Keep this file small: only above-the-fold (nav + hero) essentials
 *
 * Full styles still load asynchronously via /style.css.
 */

:root {
    --primary-color: #9381FF;
    --primary-light: #B8B8FF;
    --primary-dark: #7A6BE0;

    --background-color: #F8F7FF;
    --surface-color: #FFFFFF;

    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-bg-hover: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-border-subtle: rgba(147, 129, 255, 0.12);
    --glass-blur: 16px;
    --glass-blur-strong: 32px;

    --text-primary: #2D2D2D;
    --text-secondary: #757575;

    --border-color: rgba(147, 129, 255, 0.1);
    --divider-color: rgba(147, 129, 255, 0.06);

    --gradient-primary: linear-gradient(135deg, #7B6FE0 0%, #5F52CC 100%);

    --shadow-sm: 0 4px 12px rgba(147, 129, 255, 0.08);
    --shadow-md: 0 12px 36px rgba(147, 129, 255, 0.12);
    --shadow-lg: 0 16px 48px rgba(147, 129, 255, 0.12);
    --shadow-glass: 0 8px 32px rgba(147, 129, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);

    --navbar-height: 64px;
    --container-max: 1120px;
    --container-padding: 20px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-full: 9999px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    --iphone-shell-radius: 28px;
    --iphone-screen-radius: 22px;
    --iphone-bezel-padding: 6px;
    --iphone-frame-dark: #0D0D12;
    --iphone-frame-light: #F2F2F8;
    --iphone-island: #0B0B10;
}

[data-theme="dark"] {
    --primary-color: #B8B8FF;
    --primary-light: #9381FF;
    --primary-dark: #5E548E;

    --background-color: #14141E;
    --surface-color: #1F1F2E;

    --glass-bg: rgba(31, 31, 46, 0.7);
    --glass-bg-hover: rgba(31, 31, 46, 0.85);
    --glass-border: rgba(147, 129, 255, 0.2);
    --glass-border-subtle: rgba(147, 129, 255, 0.1);

    --text-primary: #F8F7FF;
    --text-secondary: #A0A0B0;

    --border-color: #2E2E3E;
    --divider-color: #2E2E3E;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);

    --iphone-frame-light: #2A2A34;
    --iphone-frame-dark: #0B0B10;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Sora', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background-color);
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(147, 129, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(184, 184, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 50% 80%, rgba(224, 177, 203, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-slow), color var(--transition-slow);
}

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

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

.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    position: relative;
    z-index: 1;
}

/* Background decorators (visual identity) */
.bg-shapes {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.shape-1 {
    width: min(600px, 90vw);
    height: min(600px, 90vw);
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    top: -150px;
    right: -100px;
}

.shape-2 {
    width: min(700px, 100vw);
    height: min(700px, 100vw);
    background: linear-gradient(135deg, rgba(224, 177, 203, 1) 0%, rgba(255, 216, 190, 1) 100%);
    bottom: -100px;
    left: -200px;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur-strong));
    -webkit-backdrop-filter: blur(var(--glass-blur-strong));
    border-bottom: 1px solid var(--glass-border-subtle);
    transition: all var(--transition-normal);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--glass-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glass);
    border: 1px solid var(--glass-border);
}

.logo-text {
    font-size: 1.375rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Button reset - prevents browser-default styles from flashing before style.css loads */
button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font: inherit;
    color: inherit;
}

/* Nav links - correct display from first paint */
.nav-links {
    display: none;
    align-items: center;
    gap: 6px;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
        gap: 20px;
    }
}

/* Language switcher */
.lang-switcher {
    position: relative;
    display: flex;
    align-items: center;
}

.language-dropdown {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* Mobile menu button - hidden on desktop from first paint */
.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    z-index: 1001;
}

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transform-origin: center;
}

/* Home hero */
body.home h1,
body.home h2,
body.home h3 {
    font-family: 'Fraunces', 'Times New Roman', serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

body.home .home-hero {
    padding: calc(var(--navbar-height) + 70px) 0 100px;
    position: relative;
}

body.home h1 {
    font-size: clamp(2.25rem, 6vw, 4rem);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
}

body.home .hero-grid {
    display: grid;
    gap: 48px;
    align-items: center;
    width: 100%;
}

@media (min-width: 960px) {
    body.home .hero-grid {
        grid-template-columns: 1.1fr 0.9fr;
    }
}

body.home .hero-lead {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

body.home .section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

body.home .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 20px 0 16px;
}

body.home .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

body.home .btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: var(--shadow-md);
}

body.home .btn-glass {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    color: var(--text-primary);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

body.home .hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

body.home .stat {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
}

body.home .stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

body.home .stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

body.home .hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    overflow: visible;
    min-height: 420px;
}

body.home .hero-phones {
    position: relative;
    width: 100%;
    max-width: 520px;
    height: 480px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
}

body.home .hero-phone {
    position: absolute;
}

body.home .hero-phone .phone-bezel {
    position: relative;
    background: var(--iphone-frame-dark);
    border-radius: var(--iphone-shell-radius);
    padding: var(--iphone-bezel-padding);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.22),
        0 14px 44px rgba(0, 0, 0, 0.26),
        0 4px 16px rgba(0, 0, 0, 0.16);
    overflow: hidden;
}

body.home .hero-phone .showcase-img {
    width: 100%;
    display: block;
    border-radius: var(--iphone-screen-radius);
    object-fit: cover;
    aspect-ratio: 9 / 19.5;
}

body.home .hero-phone-center {
    width: 200px;
    z-index: 3;
}

body.home .hero-phone-center .phone-bezel {
    background: var(--iphone-frame-light);
}

body.home .hero-phone-left {
    width: 170px;
    z-index: 2;
    transform: translateX(-130px) translateY(20px) rotate(-8deg);
}

body.home .hero-phone-right {
    width: 170px;
    z-index: 2;
    transform: translateX(130px) translateY(20px) rotate(8deg);
}

/* Prevent language menu from flashing before main stylesheet async-loads */
.language-menu {
    visibility: hidden;
    opacity: 0;
}

@media (max-width: 767px) {
    body.home .hero-visual {
        min-height: 400px;
    }

    body.home .hero-phones {
        height: 350px;
        max-width: 340px;
        --hero-mobile-offset: clamp(70px, 22vw, 92px);
    }

    body.home .hero-phone-center {
        width: clamp(148px, 46vw, 176px);
    }

    body.home .hero-phone-left {
        width: clamp(108px, 33vw, 128px);
        transform: translateX(calc(var(--hero-mobile-offset) * -1)) translateY(18px) rotate(-7deg);
    }

    body.home .hero-phone-right {
        width: clamp(108px, 33vw, 128px);
        transform: translateX(var(--hero-mobile-offset)) translateY(18px) rotate(7deg);
    }
}
