/* ==========================================================================
   Theme Toggle Component & Theme Transitions
   ========================================================================== */

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary-text);
    opacity: 0.7;
    position: relative;
    border-radius: 50%;
    padding: 0;
    z-index: 2000;
    transform-origin: center;
    transition: all 0.4s var(--ease-out-expo);
    outline: none;
}

.theme-toggle:hover {
    opacity: 1;
    background: var(--card-bg);
    transform: scale(1.1);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle:focus {
    outline: none;
}

.theme-toggle:focus-visible {
    outline: none !important;
    opacity: 1;
    background: var(--card-bg);
    transform: scale(1.05);
}

/* Theme Toggle Icons */
.theme-toggle::before {
    content: '';
    width: 20px;
    height: 20px;
    background: var(--primary-text);
    mask: url('/assets/icons/dark-mode.svg') no-repeat 50% 50%;
    -webkit-mask: url('/assets/icons/dark-mode.svg') no-repeat 50% 50%;
    mask-size: contain;
    -webkit-mask-size: contain;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Mode Icon */
body.light-mode .theme-toggle::before {
    background: var(--primary-text);
    mask: url('/assets/icons/light-mode.svg') no-repeat 50% 50%;
    -webkit-mask: url('/assets/icons/light-mode.svg') no-repeat 50% 50%;
    mask-size: contain;
    -webkit-mask-size: contain;
    width: 28px;
    height: 26px;
}

/* Theme Toggle Animation States */
.theme-toggle.switching::before {
    transform: rotate(180deg) scale(0);
    opacity: 0;
}

.theme-toggle.switching {
    pointer-events: none;
}

/* Mobile Theme Toggle Positioning */
@media (max-width: 768px) {
    .theme-toggle {
        position: fixed;
        top: 2rem;
        left: 2rem;
        z-index: 3000;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        transform: translate(8px, -6.6px) !important;
    }

    /* Show theme toggle when mobile menu is open */
    body.menu-open .theme-toggle {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    /* Light mode mobile theme toggle */
    body.light-mode .theme-toggle {
        background: rgba(255, 255, 255, 0.9);
    }

    body.light-mode.menu-open .theme-toggle {
        background: rgba(255, 255, 255, 0.9);
    }
}

/* ==========================================================================
   Theme Transition Animations
   ========================================================================== */

/* Global theme transition */
body {
    transition: background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1), 
                color 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Add smooth transitions for theme-dependent elements */
.project-card,
.feature-card,
.timeline-content,
.contact-item,
.highlight-card,
.about-skills {
    transition: background-color 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-description,
.contact-description,
.about-intro,
.highlight-label,
.section-title {
    transition: color 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Ensure consistent transitions for interactive elements */
.cta-button,
.timeline-expand-btn,
.project-link,
.contact-item,
.project-tags span,
.tech-stack span {
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Typography Gradient Fallbacks
   ========================================================================== */

/* Gradient text dla dark mode - gdy jest wspierany */
@supports (-webkit-background-clip: text) {
    .section-title,
    .hero-text .first,
    .hero-text .second {
        color: transparent !important;
        -webkit-text-fill-color: transparent !important;
    }
}

/* Fallback dla dark mode gdy gradient text nie jest wspierany */
@supports not (-webkit-background-clip: text) {
    .section-title,
    .hero-text .first,
    .hero-text .second {
        color: #ffffff !important;
        -webkit-text-fill-color: #ffffff !important;
        background: none !important;
    }
}

/* Safari-specific gradient text fixes */
@supports (-webkit-background-clip: text) and (not (background-clip: text)) {
    .section-title,
    .hero-text .first,
    .hero-text .second {
        -webkit-text-fill-color: var(--primary-text);
        color: var(--primary-text);
        background: none;
    }
}

/* Firefox-specific fallbacks */
@-moz-document url-prefix() {
    .section-title {
        opacity: 1 !important;
        visibility: visible !important;
        display: block !important;
        color: var(--primary-text) !important;
        -webkit-text-fill-color: initial !important;
    }
}

/* Alternative Firefox fallback */
@supports (-moz-appearance: none) {
    .section-title {
        opacity: 1 !important;
        visibility: visible !important;
        color: var(--primary-text) !important;
    }
}

/* ==========================================================================
   Theme-aware Focus States
   ========================================================================== */

/* Enhanced focus states that work in both themes - Updated */
.nav-link:focus-visible,
.cta-button:focus-visible,
.project-link:focus-visible,
.contact-item:focus-visible {
    outline: 2px solid var(--primary-text);
    outline-offset: 2px;
    opacity: 1;
}

body.light-mode .nav-link:focus-visible,
body.light-mode .cta-button:focus-visible,
body.light-mode .project-link:focus-visible,
body.light-mode .contact-item:focus-visible {
    outline-color: var(--light-primary);
}

/* Remove default outlines where we have custom focus states */
.theme-toggle,
.theme-toggle:focus,
.theme-toggle:focus-visible,
.project-card *:focus,
.project-card:focus,
.timeline-expand-btn:focus {
    outline: none !important;
} 