/* ==========================================================================
   10. ANIMATIONS & KEYFRAMES
   ========================================================================== */
@keyframes heroLabelGlide {
    0% {
        background-position: 100% 100%;
    }
    72% {
        background-position: 0% 0%;
    }
    100% {
        background-position: 0% 0%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes scrollWheel {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    50% {
        opacity: 0.5;
        transform: translateY(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes mouseFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-7.5px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}


@keyframes breathingGlowHoverEnter {
    0% {
        box-shadow: none;
    }
    100% {
        box-shadow: 
            0 0 12px rgba(0, 115, 255, 0.6),
            0 0 18px rgba(220, 38, 38, 0.5),
            0 0 26px rgba(0, 115, 255, 0.4),
            0 0 34px rgba(220, 38, 38, 0.3);
    }
}

@keyframes breathingGlowHover {
    0% {
        box-shadow: 
            0 0 12px rgba(0, 115, 255, 0.6),
            0 0 18px rgba(220, 38, 38, 0.5),
            0 0 26px rgba(0, 115, 255, 0.4),
            0 0 34px rgba(220, 38, 38, 0.3);
    }
    25% {
        box-shadow: 
            0 0 14px rgba(0, 115, 255, 0.65),
            0 0 21px rgba(220, 38, 38, 0.55),
            0 0 30px rgba(0, 115, 255, 0.45),
            0 0 40px rgba(220, 38, 38, 0.35);
    }
    50% {
        box-shadow: 
            0 0 18px rgba(0, 115, 255, 0.8),
            0 0 26px rgba(220, 38, 38, 0.7),
            0 0 36px rgba(0, 115, 255, 0.6),
            0 0 48px rgba(220, 38, 38, 0.5),
            0 0 60px rgba(0, 115, 255, 0.4);
    }
    75% {
        box-shadow: 
            0 0 14px rgba(0, 115, 255, 0.65),
            0 0 21px rgba(220, 38, 38, 0.55),
            0 0 30px rgba(0, 115, 255, 0.45),
            0 0 40px rgba(220, 38, 38, 0.35);
    }
    100% {
        box-shadow: 
            0 0 12px rgba(0, 115, 255, 0.6),
            0 0 18px rgba(220, 38, 38, 0.5),
            0 0 26px rgba(0, 115, 255, 0.4),
            0 0 34px rgba(220, 38, 38, 0.3);
    }
}


@keyframes breathingGlowHoverEnterLight {
    0% {
        box-shadow: none;
    }
    100% {
        box-shadow: 
            0 0 10px rgba(0, 115, 255, 0.5),
            0 0 15px rgba(220, 38, 38, 0.4),
            0 0 22px rgba(0, 115, 255, 0.3);
    }
}

@keyframes breathingGlowHoverLight {
    0% {
        box-shadow: 
            0 0 10px rgba(0, 115, 255, 0.5),
            0 0 15px rgba(220, 38, 38, 0.4),
            0 0 22px rgba(0, 115, 255, 0.3);
    }
    25% {
        box-shadow: 
            0 0 12px rgba(0, 115, 255, 0.55),
            0 0 18px rgba(220, 38, 38, 0.45),
            0 0 26px rgba(0, 115, 255, 0.35);
    }
    50% {
        box-shadow: 
            0 0 15px rgba(0, 115, 255, 0.7),
            0 0 22px rgba(220, 38, 38, 0.6),
            0 0 32px rgba(0, 115, 255, 0.5),
            0 0 42px rgba(220, 38, 38, 0.35);
    }
    75% {
        box-shadow: 
            0 0 12px rgba(0, 115, 255, 0.55),
            0 0 18px rgba(220, 38, 38, 0.45),
            0 0 26px rgba(0, 115, 255, 0.35);
    }
    100% {
        box-shadow: 
            0 0 10px rgba(0, 115, 255, 0.5),
            0 0 15px rgba(220, 38, 38, 0.4),
            0 0 22px rgba(0, 115, 255, 0.3);
    }
}

@keyframes shimmerGradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.98) translateZ(0);
    }
    50% {
        transform: scale(1.01) translateZ(0);
    }
    100% {
        transform: scale(1) translateZ(0);
    }
}

/* ==========================================================================
   11. UTILITIES
   ========================================================================== */

/* Premium iOS-style transitions with hardware acceleration */
a, button {
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), 
                opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
                color 0.2s cubic-bezier(0.25, 0.1, 0.25, 1),
                border-color 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(0);
}

/* Enhanced focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.theme-toggle:focus,
.theme-toggle:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 1px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-primary);
}

/* Optimize scrolling performance */
html {
    -webkit-overflow-scrolling: touch;
}

/* Improve scroll performance on mobile */
body {
    -webkit-overflow-scrolling: touch;
}

/* Selection color */
::selection {
    background: color-mix(in srgb, var(--accent-color) 30%, transparent);
    color: var(--text-primary);
}

/* Mobile touch optimization - prevent sticky buttons */
button,
a.btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
    }
}

/* ==========================================================================
   12. THEME OVERRIDES - Light Mode Specific
   ========================================================================== */

/* Navbar in light theme - pure black for AMOLED/HDR support */
[data-theme="light"] .navbar {
    background: #0a0a0a;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}


[data-theme="light"] .navbar .nav-brand,
[data-theme="light"] .navbar .theme-toggle {
    color: #fafafa;
}

[data-theme="light"] .navbar .nav-menu a {
    color: rgba(255, 255, 255, 0.65);
}

[data-theme="light"] .navbar .nav-menu a:hover,
[data-theme="light"] .navbar .nav-menu a.active {
    color: #fafafa;
}

[data-theme="light"] .navbar .nav-brand:hover {
    color: var(--accent-color);
    transition: color 0.1s ease;
}

[data-theme="light"] .navbar .nav-brand:active {
    color: #fafafa;
    opacity: 1;
    transition: color 0s, opacity 0s;
}

[data-theme="light"] .navbar .hamburger span {
    background: #fafafa;
}

/* Hero Section - Light Theme: aceleași setări ca dark (video + overlay + CTA) */
[data-theme="light"] .hero {
    background: #292929;
}

[data-theme="light"] .hero-overlay {
    background: linear-gradient(180deg, 
        rgba(15, 15, 20, 0.19) 0%, 
        rgba(15, 15, 20, 0.27) 100%);
}

[data-theme="light"] .hero-bg-video {
    filter: brightness(1.30);
}

[data-theme="light"] .hero-badge {
    border: 1px solid rgba(0, 0, 0, 0.12); /* Subtle border, no strong background */
    color: rgba(0, 0, 0, 0.95); /* Increased for better text visibility */
    background: transparent; /* Let hero light gradient be the main background */
    text-shadow: none;
}

[data-theme="light"] .hero-title {
    color: #0a0a0a;
    text-shadow: none;
}

[data-theme="light"] .hero-logo {
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.2));
    color: #020202;
}

[data-theme="light"] .hero-subtitle {
    color: #4a4a4a;
    text-shadow: none;
}

/* Light: CTA text = aceleași ca dark (off-white #ececec, nu alb pur) */
[data-theme="light"] .hero-video-label-text {
    color: #ececec;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Light: mouse = același aspect ca dark (contur alb, fundal semi-transparent, wheel alb) */
[data-theme="light"] .mouse {
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .mouse-wheel {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* Buttons - Light Theme */
[data-theme="light"] .btn-primary {
    color: #0a0a0a;
    border-color: rgba(0, 0, 0, 0.75);
    border-width: 1.5px;
    text-shadow: none;
    font-weight: 400;
}

[data-theme="light"] .hero-buttons .btn-primary {
    transition: box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
                border-color 0.3s cubic-bezier(0.25, 0.1, 0.25, 1),
                color 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-theme="light"] .hero-buttons .btn-primary:hover {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    color: #fafafa;
    text-shadow: none;
    animation: none;
}

[data-theme="light"] .contact-form .btn-primary {
    /* ACCESSIBILITY: Stronger border for better contrast in light mode (0.5 → 0.9 opacity) */
    border-color: rgba(0, 0, 0, 0.9);
}

[data-theme="light"] .contact-form .btn-primary:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fafafa;
}

[data-theme="light"] .contact-form .btn-primary:active {
    background-color: transparent;
    border-color: rgba(0, 0, 0, 0.9);
    color: #0a0a0a;
}

[data-theme="light"] .error-page-cta.btn-primary {
    border-color: rgba(0, 0, 0, 0.9);
}

[data-theme="light"] .error-page-cta.btn-primary:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fafafa;
}

[data-theme="light"] .error-page-cta.btn-primary:active {
    background-color: transparent;
    border-color: rgba(0, 0, 0, 0.9);
    color: #0a0a0a;
}

[data-theme="light"] .contact-form {
    background: #f5f5f5; /* Light mode: darker white than background (#fafafa) for better contrast */
}

/* ==========================================================================
   13. DESKTOP LAYOUT ADJUSTMENTS
   ========================================================================== */

/* ==========================================================================
   14. RESPONSIVE DESIGN - Mobile
   ========================================================================== */
@media (max-width: 768px) {
    /* Ensure footer and "all rights reserved" zone stay visible above browser chrome */
    body {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
    }

    .hamburger {
        display: flex;
    }
    
    .theme-toggle {
        margin-right: 0.5rem;
        width: 36px;
        height: 36px;
    }
    
    .theme-icon {
        width: 18px;
        height: 18px;
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: left 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), 
                    opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), 
                    visibility 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
        opacity: 0;
        visibility: hidden;
        overflow-x: hidden;
    }

    .nav-menu.active {
        left: 0;
        opacity: 1;
        visibility: visible;
    }

    .nav-menu:not(.active) a {
        opacity: 0;
        transform: translateY(20px);
    }

    .nav-menu.active a {
        animation: fadeInUp 0.4s ease forwards;
        opacity: 1;
        display: inline-block;
        text-align: center;
        justify-content: center;
    }
    
    .nav-menu li {
        text-align: center;
    }
    
    /* Make the accent bar only as wide as the text in mobile menu */
    .nav-menu a::after {
        left: 50%;
        transform: translateX(-50%) translateZ(0);
        width: 0;
    }
    
    .nav-menu a:hover::after,
    .nav-menu a.active::after {
        width: 100%;
        left: 50%;
        transform: translateX(-50%) translateZ(0);
    }

    .nav-menu.active a:nth-child(1) { animation-delay: 0.1s; }
    .nav-menu.active a:nth-child(2) { animation-delay: 0.15s; }
    .nav-menu.active a:nth-child(3) { animation-delay: 0.2s; }
    .nav-menu.active a:nth-child(4) { animation-delay: 0.25s; }
    
    /* Light theme mobile menu: panel e deschis (#fafafa), text trebuie închis (altfel .navbar .nav-menu a câștigă = alb invizibil) */
    [data-theme="light"] .nav-menu {
        background: #fafafa;
    }
    
    [data-theme="light"] .navbar .nav-menu a,
    [data-theme="light"] .nav-menu a {
        color: #0a0a0a;
    }
    
    [data-theme="light"] .navbar .nav-menu.active a,
    [data-theme="light"] .nav-menu.active a {
        color: #0a0a0a;
        opacity: 1;
    }
    
    [data-theme="light"] .navbar .nav-menu a:hover,
    [data-theme="light"] .navbar .nav-menu a.active,
    [data-theme="light"] .nav-menu a:hover,
    [data-theme="light"] .nav-menu a.active {
        color: #0a0a0a;
    }
    
    [data-theme="light"] .navbar .nav-menu a:active,
    [data-theme="light"] .nav-menu a:active {
        color: #0a0a0a;
    }

    .hero-background-video {
        display: none;
    }

    .hero {
        min-height: 100vh;
        padding: 80px 0 40px;
    }

    .hero-content {
        padding: 0 1.5rem;
    }

    .hero-title {
        font-size: 2.5rem;
        letter-spacing: -1px;
        margin-bottom: 3rem;
    }

    .hero-logo {
        width: clamp(200px, 85vw, 350px);
        max-width: 95%;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 2.5rem;
    }
    
    .contact-form {
        padding: 2rem 1.5rem; /* Reduced horizontal padding on mobile to prevent overflow */
        margin: 0 -1.5rem; /* Negative margin to compensate and maintain visual spacing */
    }

    .section-header {
        margin-bottom: 3rem;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }

    .about-content,
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-buttons .btn,
    .btn-primary {
        justify-content: center;
        text-align: center;
        width: 100%;
        max-width: 300px;
    }

    .contact-form .btn-primary {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .about-text .social-links {
        justify-content: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer {
        position: relative;
        z-index: 1;
        padding-top: 3rem;
        padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    }

    .footer-bottom {
        text-align: center;
        padding-top: 2rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
        min-height: 2.5rem;
    }

    .footer-bottom p,
    .footer-copy {
        text-align: center;
        color: var(--text-muted);
        font-size: 0.8rem;
    }

    .footer-legal a {
        font-size: 0.75rem;
    }

    .footer-social .social-links {
        justify-content: center;
        align-items: center;
    }

}

@media (max-width: 480px) {
    .hero-content {
        padding: 0 1rem;
    }

    .hero-title {
        font-size: 2rem;
        margin-bottom: 2.5rem;
    }

    .hero-logo {
        width: clamp(180px, 90vw, 280px);
        max-width: 95%;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
    }

    .contact-form {
        padding: 1.5rem 1rem; /* Further reduced padding for very small screens */
        margin: 0 -1rem; /* Negative margin to compensate and maintain visual spacing */
    }

    .form-group textarea::-webkit-resizer {
        border-top: 30px solid transparent;
        border-left: 30px solid transparent;
        border-bottom: 30px solid var(--accent-color);
        border-right: 30px solid var(--accent-color);
        opacity: 0.9;
    }
}

/* ==========================================================================
   15. TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */

/* Prevent focus styles on touch devices for non-input elements */
@media (hover: none) and (pointer: coarse) {
    button:focus:not(:focus-visible),
    a:focus:not(:focus-visible),
    .nav-brand:focus:not(:focus-visible),
    .nav-menu a:focus:not(:focus-visible),
    .social-link:focus:not(:focus-visible) {
        outline: none;
        color: inherit;
        border-color: inherit;
        background: inherit;
        transform: none;
        opacity: 1;
    }
    
    /* Theme toggle: allow active state feedback but prevent focus issues */
    .theme-toggle:focus:not(:focus-visible) {
        outline: none;
        /* Don't reset transform/background on focus - allow active state to work */
    }
    
    /* Allow active state to show visual feedback on mobile */
    .theme-toggle:active {
        background: color-mix(in srgb, var(--text-primary) 8%, transparent);
        border-color: var(--border-color-hover);
        transform: scale(0.95);
    }
    
    /* Ensure nav-brand stays visible on light theme when active */
    [data-theme="light"] .navbar .nav-brand:active,
    [data-theme="light"] .navbar .nav-brand:focus:not(:focus-visible) {
        color: #fafafa;
        opacity: 1;
    }
    
    /* Icons should maintain their states and colors on mobile */
    .theme-toggle:active .theme-icon-dark,
    .theme-toggle:focus:not(:focus-visible) .theme-icon-dark {
        stroke: var(--accent-color);
        pointer-events: inherit;
    }
    
    .theme-toggle:active .theme-icon-light,
    .theme-toggle:focus:not(:focus-visible) .theme-icon-light {
        stroke: #ffd700;
        pointer-events: inherit;
    }
    
    /* Mobile menu text on light theme: același fix (specificitate .navbar .nav-menu) pentru touch */
    [data-theme="light"] .navbar .nav-menu a,
    [data-theme="light"] .nav-menu a {
        color: #0a0a0a;
    }
    
    [data-theme="light"] .navbar .nav-menu.active a,
    [data-theme="light"] .nav-menu.active a {
        color: #0a0a0a;
        opacity: 1;
    }
    
    [data-theme="light"] .navbar .nav-menu a:hover,
    [data-theme="light"] .navbar .nav-menu a.active,
    [data-theme="light"] .nav-menu a:hover,
    [data-theme="light"] .nav-menu a.active {
        color: #0a0a0a;
    }
    
    [data-theme="light"] .navbar .nav-menu a:active,
    [data-theme="light"] .nav-menu a:active {
        color: #0a0a0a;
    }
}

