/* ============================================
   unmake.it Enhancements
   - Dark/Light mode
   - Subtle animations
   - Mobile menu polish
   ============================================ */

/* ============ THEME SYSTEM ============ */
:root {
    /* Dark theme (default) */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --text-primary: #f5f0e6;
    --text-secondary: #999;
    --accent: #ff6b00;
    --accent-dark: #e55f00;
    --border: rgba(255,255,255,0.1);
    --shadow: rgba(0,0,0,0.3);
}

[data-theme="light"] {
    --bg-primary: #f5f0e6;
    --bg-secondary: #f5f0e6;
    --text-primary: #0a0a0a;
    --text-secondary: #666;
    --accent: #ff6b00;
    --accent-dark: #e55f00;
    --border: rgba(0,0,0,0.1);
    --shadow: rgba(0,0,0,0.1);
}

/* Apply theme variables */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

header {
    background: var(--bg-primary) !important;
    border-bottom-color: var(--border) !important;
    transition: background 0.3s ease, border-color 0.3s ease;
}

nav a {
    color: var(--text-primary) !important;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--accent) !important;
}

footer {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    transition: background 0.3s ease, color 0.3s ease;
}

[data-theme="light"] footer {
    background: var(--bg-secondary) !important;
}

/* Mobile nav background fix for light mode */
@media (max-width: 768px) {
    nav {
        background: var(--bg-primary) !important;
        border-left-color: var(--border) !important;
    }
}

/* Logo handling for themes - show/hide based on theme */
.logo,
.footer-logo {
    display: flex;
    align-items: center;
}

.logo img,
.footer-logo img {
    transition: opacity 0.3s ease;
}

/* Dark/Light logo switching */
.logo-dark,
.footer-logo .logo-dark { 
    display: block; 
}

.logo-light,
.footer-logo .logo-light { 
    display: none; 
}

[data-theme="light"] .logo-dark,
[data-theme="light"] .footer-logo .logo-dark { 
    display: none; 
}

[data-theme="light"] .logo-light,
[data-theme="light"] .footer-logo .logo-light { 
    display: block; 
}

/* ============ LIGHT MODE SECTION FIXES ============ */

/* Sections that need theme awareness */
[data-theme="light"] section {
    background: var(--bg-primary);
}

[data-theme="light"] .hero {
    background: var(--bg-primary);
}

/* Cards and content boxes */
[data-theme="light"] .service-card,
[data-theme="light"] .case-study,
[data-theme="light"] .principle {
    background: var(--bg-secondary);
    border-color: var(--border);
}

/* Text colors */
[data-theme="light"] p,
[data-theme="light"] .subtitle {
    color: var(--text-secondary);
}

[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] strong {
    color: var(--text-primary);
}

/* Inverted sections (like CTA areas that are cream in dark mode) */
.section-inverted {
    background: var(--bg-secondary) !important;
}

[data-theme="light"] .section-inverted {
    background: var(--bg-primary) !important;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Blockquotes */
[data-theme="light"] blockquote {
    background: var(--cream);
    border-left-color: var(--accent);
}

/* Form inputs */
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
    color: var(--text-secondary);
}

/* Buttons */
[data-theme="light"] .cta-btn,
[data-theme="light"] .submit-btn {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

[data-theme="light"] .cta-btn:hover,
[data-theme="light"] .submit-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    width: 16px;
    height: 16px;
}

/* Default (dark theme) - show sun, hide moon */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }

/* Light theme - show moon, hide sun */
[data-theme="light"] .theme-toggle .icon-sun { display: none !important; }
[data-theme="light"] .theme-toggle .icon-moon { display: block !important; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block !important; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none !important; }

/* ============ ANIMATIONS ============ */

/* Fade in on scroll */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.stagger-children.animated > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.animated > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.animated > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.animated > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.animated > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-children.animated > *:nth-child(6) { transition-delay: 0.6s; }
.stagger-children.animated > *:nth-child(7) { transition-delay: 0.7s; }

.stagger-children.animated > * {
    opacity: 1;
    transform: translateY(0);
}

/* Hero entrance */
.hero-animate {
    opacity: 0;
    transform: translateY(40px);
    animation: heroEntrance 0.8s ease-out 0.2s forwards;
}

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

/* Subtle hover lift */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px var(--shadow);
}

/* Link underline animation */
.link-animate {
    position: relative;
}

.link-animate::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.link-animate:hover::after {
    width: 100%;
}

/* Button pulse on hover */
.btn-pulse:hover {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ============ MOBILE MENU POLISH ============ */

/* Smoother mobile nav transition */
@media (max-width: 768px) {
    nav {
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
                    opacity 0.3s ease,
                    visibility 0.3s ease !important;
        opacity: 0;
        visibility: hidden;
        background: var(--bg-primary) !important;
    }
    
    nav.active {
        opacity: 1;
        visibility: visible;
        right: 0 !important;
    }
    
    /* Backdrop blur when menu open */
    .menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 99;
    }
    
    [data-theme="light"] .menu-backdrop {
        background: rgba(0,0,0,0.3);
    }
    
    .menu-backdrop.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Nav links stagger animation */
    nav a {
        opacity: 0;
        transform: translateX(20px);
        transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease !important;
    }
    
    nav.active a {
        opacity: 1;
        transform: translateX(0);
    }
    
    nav.active a:nth-child(1) { transition-delay: 0.1s !important; }
    nav.active a:nth-child(2) { transition-delay: 0.15s !important; }
    nav.active a:nth-child(3) { transition-delay: 0.2s !important; }
    nav.active a:nth-child(4) { transition-delay: 0.25s !important; }
    nav.active a:nth-child(5) { transition-delay: 0.3s !important; }
    nav.active a:nth-child(6) { transition-delay: 0.35s !important; }
    
    /* Smoother burger animation */
    .burger span {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        background: var(--text-primary) !important;
    }
}

/* Burger color for light mode */
[data-theme="light"] .burger span {
    background: var(--text-primary) !important;
}

/* Lang switcher theme colors */
.lang-btn {
    color: var(--text-secondary) !important;
}

.lang-btn:hover {
    color: var(--text-primary) !important;
}

.lang-btn.active {
    color: var(--accent) !important;
}

.lang-switcher {
    border-left-color: var(--border) !important;
}

/* ============ SEO-FRIENDLY FOCUS STATES ============ */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent) !important;
    outline-offset: 2px;
}

/* Remove any blue default colors */
a {
    color: inherit;
}

a:visited {
    color: inherit;
}

/* Ensure accent color is used everywhere, not browser blue */
::selection {
    background: var(--accent);
    color: white;
}

::-moz-selection {
    background: var(--accent);
    color: white;
}

/* Skip to content link (accessibility) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--accent);
    color: var(--bg-primary);
    padding: 0.5rem 1rem;
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

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

/* Social links in footer - adapt to theme */
footer .social-links a {
    color: var(--text-primary) !important;
}

footer .social-links a:hover {
    color: var(--accent) !important;
}

/* Footer links text */
footer .footer-links,
footer .footer-links a,
footer .footer-links span {
    color: var(--text-secondary) !important;
}

footer .footer-links a:hover {
    color: var(--accent) !important;
}

/* Social link SVG icons */
footer .social-links a svg {
    display: block;
    fill: currentColor;
}


/* Mobile: keep theme toggle with language buttons */
@media (max-width: 768px) {
    .lang-switcher {
        display: flex !important;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .lang-switcher .theme-toggle {
        margin-left: 0;
    }
}

/* Newsletter "Unmaking" text - orange in light mode */
[data-theme="light"] .newsletter h2 .hl {
    color: var(--accent) !important;
    text-shadow: 2px 2px 0 var(--black);
}

/* Manifesto blockquote - black background in dark mode */
.manifesto blockquote {
    background: var(--black) !important;
}

[data-theme="light"] .manifesto blockquote {
    background: var(--cream) !important;
}
