/* Critical CSS for above-the-fold content */
:root {
    --bg-color: #fafafa;
    --text-color: #1a202c; /* Improved contrast from #2c3e50 */
    --section-bg: #ffffff;
    --header-bg: linear-gradient(135deg, #4CAF50, #1DA1F2);
    --accent-color: #2d7d2d; /* Improved contrast from #3DDC84 */
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.06);
    --card-bg: #ffffff;
    --transition-speed: 400ms;
    --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
    --surface-shadow: 0 2px 8px var(--shadow-color);
}

body.dark-mode {
    --bg-color: #111827;
    --text-color: #e2e8f0;
    --section-bg: #1a1f2e;
    --header-bg: linear-gradient(135deg, #065f46, #0c4a6e);
    --accent-color: #22d3ee; /* Better contrast in dark mode */
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --card-bg: rgba(30, 41, 59, 0.8);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cinzel', serif;
    margin: 0;
    padding: 0;
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color var(--transition-speed) var(--transition-timing), color var(--transition-speed) var(--transition-timing);
}

.container, main.container {
    width: 95%;
    margin: 0 auto;
    padding: 0 15px;
}

main {
    flex: 1;
    width: 100%;
}

* {
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

img, video {
    max-width: 100%;
    height: auto;
}

/* Header */
header {
    background: var(--header-bg);
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 4px var(--shadow-color);
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

header .container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Theme Toggle */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 100;
    transition: all var(--transition-speed) var(--transition-timing);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 50%;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 50px;
    height: 50px;
}

#theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

#theme-toggle i {
    font-size: 16px;
    transition: all var(--transition-speed) var(--transition-timing);
    position: absolute;
}

#theme-toggle .fa-sun {
    display: block;
    color: #fbbf24;
    opacity: 1;
    transform: rotate(0deg);
}

#theme-toggle .fa-moon {
    display: none;
    color: #6366f1;
    opacity: 0;
    transform: rotate(180deg);
}

/* Dark mode styles */
body.dark-mode #theme-toggle {
    background: rgba(0, 0, 0, 0.15);
}

body.dark-mode #theme-toggle:hover {
    background: rgba(0, 0, 0, 0.25);
}

body.dark-mode #theme-toggle .fa-sun {
    display: none;
    opacity: 0;
    transform: rotate(-180deg);
}

body.dark-mode #theme-toggle .fa-moon {
    display: block;
    opacity: 1;
    transform: rotate(0deg);
}

/* Theme Toggle Hover Effect */
#theme-toggle::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

#theme-toggle:hover::after {
    opacity: 1;
}

/* Profile Photo Section */
#profile-photo img, #profile-photo video {
    display: block;
    margin: 0 auto;
    border-radius: 50%;
    border: 4px solid var(--accent-color);
    width: 256px;
    height: 256px;
}

.jobtitle {
    font-size: 1.5rem;
    color: var(--accent-color);
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    position: relative;
    font-weight: 700;
    letter-spacing: 1px;
}

.jobtitle p {
    margin: 0;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

section {
    margin: 20px auto;
    padding: 20px;
    background: var(--section-bg);
    border-radius: 8px;
    box-shadow: var(--surface-shadow);
    border: 1px solid var(--border-color);
    transition: all var(--transition-speed) var(--transition-timing);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

h2 {
    color: var(--accent-color);
    margin-bottom: 20px;
    text-align: center;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container, main.container {
        width: 96%;
        padding: 0 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    #profile-photo img, #profile-photo video {
        width: 180px;
        height: 180px;
    }
    
    .jobtitle {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.3rem;
    }
    
    #profile-photo img, #profile-photo video {
        width: 140px;
        height: 140px;
    }
    
    .jobtitle {
        font-size: 1.2rem;
    }
    
    #theme-toggle {
        width: 45px;
        height: 45px;
        top: 10px;
        right: 10px;
        padding: 10px;
    }
    
    #theme-toggle i {
        font-size: 14px;
    }
}
