/* 
 * ET Sibeko Personal Website - Version 2.0
 * Modern professional design with clean aesthetics
 * 
 * Performance Optimizations:
 * - CSS Variables for efficient theme switching
 * - Optimized transitions and animations
 * - Minimal repaints and reflows
 * - Efficient selectors and specificity
 */

/* ROOT VARIABLES - Modern Professional Palette with Light/Dark Theme Support */
:root {
    /* Primary Colors - Consistent across themes */
    --primary-blue: #1877f2;
    --primary-dark-blue: #0d47a1;
    --primary-light-blue: #42a5f5;
    --accent-blue: #2196f3;
    --accent-green: #42b883;
    --accent-orange: #ff9800;
    
    /* Light Mode Colors */
    --light-bg-primary: #ffffff;
    --light-bg-secondary: #f5f7fa;
    --light-bg-tertiary: #f0f2f5;
    --light-text-primary: #1c1e21;
    --light-text-secondary: #65676b;
    --light-text-tertiary: #8a8d91;
    --light-border-primary: #dadde1;
    --light-border-secondary: #ccd0d5;
    --light-shadow-light: rgba(0, 0, 0, 0.08);
    --light-shadow-medium: rgba(0, 0, 0, 0.12);
    --light-shadow-dark: rgba(0, 0, 0, 0.18);
    
    /* Dark Mode Colors */
    --dark-bg-primary: #1a1a1a;
    --dark-bg-secondary: #242526;
    --dark-bg-tertiary: #2c2c2e;
    --dark-text-primary: #ffffff;
    --dark-text-secondary: #b0b3b8;
    --dark-text-tertiary: #8a8d91;
    --dark-border-primary: #3a3a3c;
    --dark-border-secondary: #484a4d;
    --dark-shadow-light: rgba(0, 0, 0, 0.3);
    --dark-shadow-medium: rgba(0, 0, 0, 0.4);
    --dark-shadow-dark: rgba(0, 0, 0, 0.6);
    
    /* Default to Light Mode */
    --background-white: var(--light-bg-primary);
    --background-off-white: var(--light-bg-secondary);
    --background-gray: var(--light-bg-tertiary);
    --text-black: var(--light-text-primary);
    --text-gray: var(--light-text-secondary);
    --text-light-gray: var(--light-text-tertiary);
    --text-white: #ffffff;
    --border-light: var(--light-border-primary);
    --border-medium: var(--light-border-secondary);
    --shadow-light: var(--light-shadow-light);
    --shadow-medium: var(--light-shadow-medium);
    --shadow-dark: var(--light-shadow-dark);
    --notification-blue: var(--primary-blue);
    --hover-color: var(--primary-dark-blue);
    --accent-gradient: linear-gradient(135deg, var(--primary-blue) 0%, var(--accent-blue) 100%);
    --card-shadow: 0 2px 8px var(--light-shadow-light);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Theme */
[data-theme="dark"] {
    --background-white: var(--dark-bg-primary);
    --background-off-white: var(--dark-bg-secondary);
    --background-gray: var(--dark-bg-tertiary);
    --text-black: var(--dark-text-primary);
    --text-gray: var(--dark-text-secondary);
    --text-light-gray: var(--dark-text-tertiary);
    --border-light: var(--dark-border-primary);
    --border-medium: var(--dark-border-secondary);
    --shadow-light: var(--dark-shadow-light);
    --shadow-medium: var(--dark-shadow-medium);
    --shadow-dark: var(--dark-shadow-dark);
    --card-shadow: 0 2px 8px var(--dark-shadow-light);
}

/* Auto theme detection based on system preference */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --background-white: var(--dark-bg-primary);
        --background-off-white: var(--dark-bg-secondary);
        --background-gray: var(--dark-bg-tertiary);
        --text-black: var(--dark-text-primary);
        --text-gray: var(--dark-text-secondary);
        --text-light-gray: var(--dark-text-tertiary);
        --border-light: var(--dark-border-primary);
        --border-medium: var(--dark-border-secondary);
        --shadow-light: var(--dark-shadow-light);
        --shadow-medium: var(--dark-shadow-medium);
        --shadow-dark: var(--dark-shadow-dark);
        --card-shadow: 0 2px 8px var(--dark-shadow-light);
    }
}

/* BASE STYLES */
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background-color: var(--background-gray);
    color: var(--text-black);
    transition: var(--transition-smooth);
}

/* HEADER */
.header {
    background: var(--background-white);
    position: sticky;
    top: 0;
    color: var(--text-black);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--card-shadow);
    border-bottom: 1px solid var(--border-light);
    z-index: 200;
    contain: layout style;
}

.go-home {
    text-decoration: none;
    color: var(--text-black);
    transition: var(--transition-smooth);
}

.go-home:hover {
    color: var(--primary-blue);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.025em;
    color: var(--text-black);
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary-blue);
    background-color: var(--primary-blue);
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
}

.logo-icon:hover {
    transform: scale(1.05);
}

/* FLOATING THEME SWITCHER */
.theme-switcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    /* Prevent movement on mobile scroll */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

.theme-toggle {
    background-color: var(--background-white);
    border: 1px solid var(--border-light);
    color: var(--text-gray);
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: var(--transition-smooth);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    /* Mobile stability */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.theme-toggle:hover {
    background-color: var(--primary-blue);
    color: var(--text-white);
    border-color: var(--primary-blue);
    box-shadow: 0 6px 20px rgba(24, 119, 242, 0.3);
    transform: translateY(-2px);
}

.theme-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle svg {
    transition: var(--transition-smooth);
    width: 20px;
    height: 20px;
    color: var(--text-gray);
    fill: var(--text-gray);
}

.theme-toggle:hover svg {
    color: #ffffff;
    fill: #ffffff;
}

/* NAVIGATION */
nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 16px;
    align-items: center;
}

nav a {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 20px;
    background-color: var(--background-off-white);
    color: var(--text-black);
    transition: var(--transition-smooth);
    font-weight: 500;
    border: none;
}

nav a:hover {
    background-color: var(--primary-blue);
    color: var(--text-white);
    box-shadow: var(--card-shadow);
}

/* All Navigation Icons Styling - About, Projects, Blog, LinkedIn & GitHub */
nav a[aria-label="About Me"],
nav a[aria-label="Projects"],
nav a[aria-label="Blog"],
nav a[aria-label="LinkedIn Profile"],
nav a[aria-label="GitHub Profile"] {
    background: none !important;
    border: none !important;
    padding: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 36px;
    height: 36px;
}

nav a[aria-label="About Me"]:hover,
nav a[aria-label="Projects"]:hover,
nav a[aria-label="Blog"]:hover,
nav a[aria-label="LinkedIn Profile"]:hover,
nav a[aria-label="GitHub Profile"]:hover {
    background: none !important;
    box-shadow: none;
}

nav a[aria-label="About Me"] svg,
nav a[aria-label="Projects"] svg,
nav a[aria-label="Blog"] svg,
nav a[aria-label="LinkedIn Profile"] svg,
nav a[aria-label="GitHub Profile"] svg {
    display: block;
    transition: var(--transition-smooth);
    filter: brightness(0) saturate(100%); /* Makes SVG black in light mode */
    width: 20px;
    height: 20px;
}

/* Dark mode: make navigation icons white */
[data-theme="dark"] nav a[aria-label="About Me"] svg,
[data-theme="dark"] nav a[aria-label="Projects"] svg,
[data-theme="dark"] nav a[aria-label="Blog"] svg,
[data-theme="dark"] nav a[aria-label="LinkedIn Profile"] svg,
[data-theme="dark"] nav a[aria-label="GitHub Profile"] svg {
    filter: brightness(0) saturate(100%) invert(1); /* Makes SVG white in dark mode */
}

nav a[aria-label="About Me"]:hover svg,
nav a[aria-label="Projects"]:hover svg,
nav a[aria-label="Blog"]:hover svg,
nav a[aria-label="LinkedIn Profile"]:hover svg,
nav a[aria-label="GitHub Profile"]:hover svg {
    filter: brightness(0) saturate(100%) sepia(100%) hue-rotate(200deg) saturate(1000%); /* Makes SVG blue on hover */
}

/* Dark mode: keep navigation icons white on hover */
[data-theme="dark"] nav a[aria-label="About Me"]:hover svg,
[data-theme="dark"] nav a[aria-label="Projects"]:hover svg,
[data-theme="dark"] nav a[aria-label="Blog"]:hover svg,
[data-theme="dark"] nav a[aria-label="LinkedIn Profile"]:hover svg,
[data-theme="dark"] nav a[aria-label="GitHub Profile"]:hover svg {
    filter: brightness(0) saturate(100%) invert(1); /* Keeps SVG white on hover in dark mode */
}

.contact-btn a {
    background-color: var(--primary-blue);
    color: var(--text-white);
    font-size: 14px;
    font-weight: 600;
    border-radius: 20px;
    padding: 8px 16px;
}

.contact-btn a:hover {
    background-color: var(--primary-light-blue);
    color: var(--text-white);
    box-shadow: var(--card-shadow);
}

/* NOTIFICATION BAR */
#box1 h3 {
    background: var(--primary-blue);
    color: var(--text-white);
    text-align: center;
    position: fixed;
    width: 100%;
    margin: 0 !important;
    padding: 12px;
    font-weight: 500;
    font-size: 14px;
    box-shadow: var(--card-shadow);
    animation: pulseNotice 3s ease-in-out infinite;
    z-index: 100;
    will-change: opacity;
    box-sizing: border-box;
}

@keyframes pulseNotice {
    0%, 100% {
        opacity: 0.9;
    }
    50% {
        opacity: 1;
    }
}

/* SECTIONS */
.section {
    background-color: var(--background-white);
    margin: 24px auto;
    padding: 32px;
    max-width: 800px;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-light);
    contain: layout style;
    transition: var(--transition-smooth);
}

.section:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.section h2 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-black);
    border-bottom: none;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section h2::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary-blue);
    border-radius: 2px;
}

.section h3 {
    font-size: 20px;
    font-weight: 600;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--text-black);
}

.section p {
    margin-bottom: 16px;
    color: var(--text-gray);
}

.section ul {
    padding-left: 24px;
    margin-bottom: 16px;
}

.section li {
    margin-bottom: 8px;
    color: var(--text-gray);
}

#introduction {
    margin-top: 70px;
}

/* BUTTONS */
button,
.click-me-btn {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    background-color: var(--primary-blue);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-white);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow-light);
}

button:hover,
.click-me-btn:hover {
    background-color: var(--primary-light-blue);
    box-shadow: var(--card-shadow);
}

button:active,
.click-me-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px var(--shadow-light);
}

/* FOOTER */
footer {
    background: var(--background-white);
    color: var(--text-gray);
    text-align: center;
    padding: 24px;
    font-size: 14px;
    margin-top: 40px;
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

/* MOBILE MENU */
#menu-toggle {
    display: none;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    nav ul {
        display: none;
    }

    .header {
        flex-direction: row;
        align-items: center;
        padding: 12px 16px;
        position: sticky;
        top: 32px;
        margin-top: 0;
        z-index: 150;
    }

    .header-container {
        width: 100%;
        position: relative;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Mobile floating theme switcher */
    .theme-switcher {
        position: fixed;
        bottom: 16px;
        left: 16px;
        z-index: 1000;
        /* Prevent movement on scroll */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }

    .theme-toggle {
        width: 44px;
        height: 44px;
        padding: 10px;
        /* Additional mobile stability */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .logo {
        width: auto;
        margin-bottom: 0;
        font-size: 16px;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
    }

    #menu-toggle {
        display: inline-block;
        padding: 8px 16px;
        background: var(--background-off-white);
        border: 1px solid var(--border-light);
        border-radius: 20px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        color: var(--text-black);
        transition: var(--transition-smooth);
    }

    #menu-toggle:hover {
        background: var(--primary-blue);
        color: var(--text-white);
        box-shadow: var(--card-shadow);
    }

    nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1000;
        width: 100%;
        box-sizing: border-box;
    }

    nav ul {
        display: none;
        flex-direction: row;
        flex-wrap: nowrap;
        background-color: var(--background-white);
        padding: 16px;
        border-radius: 16px;
        margin: 8px;
        width: calc(100% - 16px);
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        box-shadow: var(--card-shadow);
        border: 1px solid var(--border-light);
        box-sizing: border-box;
        overflow: hidden;
    }

    nav.active ul {
        display: flex;
    }

    nav ul li {
        width: auto;
        text-align: center;
        flex-shrink: 1;
        min-width: 0;
    }

    nav ul li a {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        background-color: var(--background-off-white);
        color: var(--text-black);
        border: none;
        border-radius: 20px;
    }

    /* Mobile Navigation Icons */
    nav ul li a[aria-label="About Me"],
    nav ul li a[aria-label="Projects"],
    nav ul li a[aria-label="Blog"],
    nav ul li a[aria-label="LinkedIn Profile"],
    nav ul li a[aria-label="GitHub Profile"] {
        background: none !important;
        border: none !important;
        padding: 8px !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        border-radius: 0;
        width: auto;
        height: auto;
        margin: 0 auto;
    }

    nav ul li a[aria-label="About Me"]:hover,
    nav ul li a[aria-label="Projects"]:hover,
    nav ul li a[aria-label="Blog"]:hover,
    nav ul li a[aria-label="LinkedIn Profile"]:hover,
    nav ul li a[aria-label="GitHub Profile"]:hover {
        background: none !important;
        box-shadow: none;
    }

    nav ul li a[aria-label="About Me"] svg,
    nav ul li a[aria-label="Projects"] svg,
    nav ul li a[aria-label="Blog"] svg,
    nav ul li a[aria-label="LinkedIn Profile"] svg,
    nav ul li a[aria-label="GitHub Profile"] svg {
        filter: brightness(0) saturate(100%) !important; /* Black in light mode */
        width: 20px;
        height: 20px;
    }

    /* Mobile dark mode: make navigation icons white */
    [data-theme="dark"] nav ul li a[aria-label="About Me"] svg,
    [data-theme="dark"] nav ul li a[aria-label="Projects"] svg,
    [data-theme="dark"] nav ul li a[aria-label="Blog"] svg,
    [data-theme="dark"] nav ul li a[aria-label="LinkedIn Profile"] svg,
    [data-theme="dark"] nav ul li a[aria-label="GitHub Profile"] svg {
        filter: brightness(0) saturate(100%) invert(1) !important; /* White in dark mode */
    }

    nav ul li a[aria-label="About Me"]:hover svg,
    nav ul li a[aria-label="Projects"]:hover svg,
    nav ul li a[aria-label="Blog"]:hover svg,
    nav ul li a[aria-label="LinkedIn Profile"]:hover svg,
    nav ul li a[aria-label="GitHub Profile"]:hover svg {
        filter: brightness(0) saturate(100%) sepia(100%) hue-rotate(200deg) saturate(1000%) !important; /* Makes SVG blue on hover */
    }

    /* Mobile dark mode: keep navigation icons white on hover */
    [data-theme="dark"] nav ul li a[aria-label="About Me"]:hover svg,
    [data-theme="dark"] nav ul li a[aria-label="Projects"]:hover svg,
    [data-theme="dark"] nav ul li a[aria-label="Blog"]:hover svg,
    [data-theme="dark"] nav ul li a[aria-label="LinkedIn Profile"]:hover svg,
    [data-theme="dark"] nav ul li a[aria-label="GitHub Profile"]:hover svg {
        filter: brightness(0) saturate(100%) invert(1) !important; /* Keeps SVG white on hover in dark mode */
    }

    nav ul li a:hover {
        background-color: var(--primary-blue);
        color: var(--text-white);
    }

    .contact-btn a {
        background-color: var(--primary-blue);
        color: var(--text-white);
    }

    #introduction {
        margin-top: 40px;
    }

    #box1 h3 {
        display: block;
        position: fixed;
        width: 100%;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
        margin: 0 !important;
        font-size: 12px;
        padding: 8px;
        text-align: center;
        box-sizing: border-box;
    }

    .section {
        margin: 16px 8px;
        padding: 24px 20px;
    }

    .section h2 {
        font-size: 20px;
    }

    .section h3 {
        font-size: 18px;
    }
}