:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --accent-color: #0B66C2;
    --secondary-text: #555;
    --gradient-1: rgba(11, 102, 194, 0.08);
    --gradient-2: rgba(255, 0, 150, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.05);

    /* Spacing system */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
}

html.dark-mode {
    --bg-color: #050505;
    --text-color: #ffffff;
    --accent-color: #64b5f6;
    --secondary-text: #b0b0b0;
    --gradient-1: rgba(100, 181, 246, 0.1);
    --gradient-2: rgba(150, 0, 255, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

html,
body {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    overflow: hidden;
    position: relative;
    font-family: 'HK Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    font-size: 16px;
    transition: color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Mesh Gradient Background - Optimized */
body::before {
    content: '';
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 50% 50%, var(--gradient-1), transparent 60%),
        radial-gradient(circle at 80% 20%, var(--gradient-2), transparent 50%),
        var(--bg-color);
    z-index: -1;
    animation: gradientMove 20s ease-in-out infinite alternate;
    pointer-events: none;
    transition: background 0.3s ease;
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

@keyframes gradientMove {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }
    100% {
        transform: translate3d(-5%, -5%, 0) rotate(5deg);
    }
}

/* Typography */
h1,
h2,
h3 {
    font-family: 'HK Grotesk', sans-serif;
    font-weight: 700;
    margin-top: 0;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(1.75rem, 5vw, 3.5rem);
    line-height: 1.1;
    margin-bottom: 0;
    max-width: 600px;
}

p {
    margin-top: 0;
    margin-bottom: var(--space-sm);
    color: var(--secondary-text);
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    max-width: 550px;
    line-height: 1.6;
}

[data-i18n="mission"] {
    margin-bottom: 0;
}

[data-i18n="mission"] p {
    color: var(--text-color);
    margin-bottom: var(--space-sm);
}

[data-i18n="mission"] p:last-child {
    margin-bottom: 0;
}

/* Layout */
.content-wrap {
    width: 100%;
    max-width: 1400px;
    margin: 0;
    padding: var(--space-xl) 5% var(--space-xl) 12%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    box-sizing: border-box;
}

.content {
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--space-sm);
    transition: opacity 0.4s ease, filter 0.4s ease;
    opacity: 1;
    filter: blur(0);
}

.content.switching {
    opacity: 0;
    filter: blur(10px);
}

/* Links */
.link-1 {
    position: relative;
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.link-1::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease-out;
}

.link-1:hover::after,
.link-1:focus::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Language & Mode Switcher */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0;
    margin-bottom: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.language-switcher span {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s ease, color 0.2s ease;
    letter-spacing: 0.05em;
}

.language-switcher span:hover,
.language-switcher span:focus {
    opacity: 1;
    color: var(--accent-color);
}

#mode-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

#mode-toggle:hover,
#mode-toggle:focus {
    opacity: 1;
    transform: rotate(15deg);
    color: var(--accent-color);
}

/* Icon Visibility Logic */
.icon-sun {
    display: none;
}

.icon-moon {
    display: block;
}

html.dark-mode .icon-sun {
    display: block;
}

html.dark-mode .icon-moon {
    display: none;
}

/* Typed Container */
.typed-container {
    min-height: 30px;
    display: block;
}

#typed {
    font-style: italic;
}

.typed-cursor {
    color: var(--accent-color);
    font-weight: 300;
}

/* Footer */
footer {
    width: 100%;
    padding: 0;
    text-align: left;
    font-family: 'HK Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary-text);
    opacity: 0.5;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Subtitle Styling */
.subtitle {
    color: inherit;
}

/* ========================================
   ANIMATIONS - Optimized for 60fps
   ======================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.animate-in {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
    animation: fadeInUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    will-change: opacity, transform;
}

/* Staggered delays - tighter timing for smoother feel */
.delay-1 { animation-delay: 0s; }
.delay-2 { animation-delay: 0.08s; }
.delay-3 { animation-delay: 0.16s; }
.delay-4 { animation-delay: 0.24s; }
.delay-5 { animation-delay: 0.32s; }

/* After animation completes */
.animate-in.animated {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    animation: none;
    will-change: auto;
}

/* Fade out state for language switch */
.animate-in.fading-out {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
    animation: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ========================================
   RESPONSIVE - Mobile First Approach
   ======================================== */

/* Extra Small Devices (phones < 360px) */
@media screen and (max-width: 359px) {
    :root {
        --space-lg: 1.25rem;
        --space-xl: 2rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    p {
        font-size: 0.9rem;
    }

    .content-wrap {
        padding: 0 16px;
    }

    .language-switcher {
        gap: 16px;
    }
}

/* Small Devices (phones 360px - 480px) */
@media screen and (min-width: 360px) and (max-width: 479px) {
    :root {
        --space-lg: 1.5rem;
        --space-xl: 2.5rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .content-wrap {
        padding: 0 20px;
    }
}

/* Medium Devices (large phones 480px - 767px) */
@media screen and (min-width: 480px) and (max-width: 767px) {
    h1 {
        font-size: 2rem;
        max-width: 100%;
    }

    p {
        max-width: 100%;
    }

    .content-wrap {
        padding: 0 24px;
    }
}

/* Mobile Devices (< 768px) - Common styles */
@media screen and (max-width: 767px) {
    h1 {
        line-height: 1.15;
        max-width: 100%;
    }

    p {
        max-width: 100%;
    }



    .typed-container {
        min-height: 24px;
    }

    /* Touch targets - 44x44px minimum */
    .language-switcher span {
        min-height: 44px;
        display: flex;
        align-items: center;
        letter-spacing: 0;
        margin-left: 0;
        padding-left: 0;
    }

    #mode-toggle {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }


    a {
        padding: 4px 0;
    }
}

/* Tablet Devices (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    h1 {
        font-size: 2.5rem;
        max-width: 500px;
    }

    .content-wrap {
        padding: 0 5% 0 8%;
    }
}

/* Small Desktop (1024px - 1199px) */
@media screen and (min-width: 1024px) and (max-width: 1199px) {
    h1 {
        font-size: 3rem;
    }

    .content-wrap {
        padding: 0 5% 0 12%;
    }
}

/* Desktop Devices (>= 1200px) */
@media screen and (min-width: 1200px) {
    .content-wrap {
        padding: 0 5% 0 18%;
    }
}

/* Large Desktop (>= 1600px) */
@media screen and (min-width: 1600px) {
    h1 {
        font-size: 3.5rem;
        max-width: 700px;
    }

    p {
        font-size: 1.15rem;
        max-width: 600px;
    }
}

/* ========================================
   HEIGHT-BASED QUERIES
   ======================================== */

/* Very short screens (landscape phones) */
@media screen and (max-height: 500px) {
    :root {
        --space-lg: 0.75rem;
        --space-xl: 1.5rem;
    }

    .content {
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: var(--space-sm);
    }

    p {
        margin-bottom: var(--space-xs);
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .language-switcher {
        margin-bottom: var(--space-sm);
    }

    footer {
        margin-top: var(--space-sm);
    }
}

/* Short screens */
@media screen and (min-height: 501px) and (max-height: 650px) {
    :root {
        --space-lg: 1rem;
        --space-xl: 2rem;
    }

    .content {
    }

    h1 {
        font-size: 1.75rem;
    }

    p {
        font-size: 0.95rem;
    }
}

/* ========================================
   ACCESSIBILITY & REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body::before {
        animation: none;
    }

    .animate-in {
        opacity: 1;
        transform: none;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    body::before {
        display: none;
    }

    .language-switcher,
    #mode-toggle {
        display: none;
    }

    .content-wrap {
        padding: 0;
    }

    .animate-in {
        opacity: 1;
        transform: none;
        animation: none;
    }
}
