/* --- THEME VARIABLES --- */
:root, [data-theme="dark"] {
    --primary-color: #58a6ff;
    --background-color: #030613;
    --surface-color: rgba(16, 23, 43, 0.75);
    --text-color: #e0e0e0;
    --heading-color: #ffffff;
    --subtle-text-color: #a0a0a0;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --glow-color: rgba(88, 166, 255, 0.5);
}

[data-theme="light"] {
    --primary-color: #006494; 
    --background-color: #f0f8ff;
    --surface-color: rgba(255, 255, 255, 0.85); 
    --text-color: #012a4a; 
    --heading-color: #011c34;
    --subtle-text-color: #2a6f97;
    --shadow-color: rgba(0, 91, 150, 0.15);
    --border-color: rgba(0, 0, 0, 0.08);
    --glow-color: rgba(0, 100, 148, 0.4);
}

/* --- BASIC SETUP --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

[data-theme="light"] body {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* --- CANVAS BACKGROUND --- */
#dynamic-background-canvas {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
}

/* --- LAYOUT & GENERAL STYLES --- */
main { max-width: 1100px; margin: auto; padding: 0 2rem; position: relative; z-index: 2; }
section { padding: 6rem 0; text-align: center; }
h1, h2, h3 { color: var(--heading-color); font-weight: 600; }
h1 { font-size: 3.2rem; margin-bottom: 0.5rem; }
h2 { font-size: 2.5rem; margin-bottom: 3rem; }
h3 { font-size: 1.5rem; }
p { margin-bottom: 1rem; max-width: 650px; margin-left: auto; margin-right: auto; }

/* --- ENHANCED BUTTONS --- */
.button, .button-secondary {
    display: inline-block; padding: 0.8rem 1.8rem;
    border-radius: 50px; font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    text-decoration: none;
    box-shadow: 0 0 0 0 var(--glow-color);
}
.button { background: var(--primary-color); color: #fff; }
.button:hover { background: transparent; color: var(--primary-color); box-shadow: 0 0 20px 5px var(--glow-color); }
.button-secondary { background: transparent; color: var(--primary-color); }
.button-secondary:hover { background: var(--primary-color); color: #fff; box-shadow: 0 0 20px 5px var(--glow-color); }

/* --- HEADER & ENHANCED NAVIGATION --- */
#header {
    position: sticky; top: 0; width: 100%;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem;
    background-color: var(--surface-color);
    backdrop-filter: blur(12px);
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}
#header.scrolled { box-shadow: 0 2px 10px var(--shadow-color); }
.logo { font-size: 1.8rem; font-weight: bold; color: var(--heading-color); text-decoration: none; }
nav ul { list-style: none; display: flex; gap: 2rem; }
nav a { position: relative; font-weight: 600; color: var(--text-color); transition: color 0.3s ease; text-decoration: none; padding-bottom: 5px; }
nav a::after { content: ''; position: absolute; width: 100%; transform: scaleX(0); height: 2px; bottom: 0; left: 0; background-color: var(--primary-color); transform-origin: bottom right; transition: transform 0.25s ease-out; }
nav a:hover::after { transform: scaleX(1); transform-origin: bottom left; }
nav a.active { color: var(--primary-color); }
nav a.active::after { transform: scaleX(1); transform-origin: bottom left; }
#theme-toggle { background: transparent; border: none; color: var(--text-color); font-size: 1.2rem; cursor: pointer; padding: 0.5rem; }
#theme-toggle .fa-sun { display: none; }
#theme-toggle .fa-moon { display: block; }
[data-theme="light"] #theme-toggle .fa-sun { display: block; }
[data-theme="light"] #theme-toggle .fa-moon { display: none; }

/* --- HERO SECTION --- */
#hero { min-height: 90vh; display: flex; align-items: center; justify-content: center; }
.hero-content { text-align: center; }
.hero-text h1 { font-size: 3rem; }
.hero-text h2 { font-size: 2rem; margin-bottom: 1rem; color: var(--primary-color); }
#typing-text { border-right: 3px solid var(--primary-color); animation: blink 0.75s step-end infinite; }
@keyframes blink { from, to { border-color: transparent } 50% { border-color: var(--primary-color); } }
.hero-buttons { margin-top: 2rem; display: flex; gap: 1rem; justify-content: center; }

/* --- TECH STACK SECTION --- */
.tech-stack-container { display: flex; flex-direction: column; gap: 2rem; max-width: 900px; margin: auto; }
.tech-category-card { background-color: var(--surface-color); border: 1px solid var(--border-color); backdrop-filter: blur(5px); padding: 2rem; border-radius: 8px; text-align: left; }
.tech-category-card h3 { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; font-size: 1.3rem; color: var(--primary-color); }
.skills-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
.skill-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border-radius: 6px; background-color: rgba(0,0,0,0.1); transition: background-color 0.3s ease; }
.skill-item:hover { background-color: rgba(0,0,0,0.2); }
.skill-item i { color: var(--subtle-text-color); font-size: 1.2rem; }

/* --- PROJECTS & EXPERIENCE --- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.project-card, .experience-item { background-color: var(--surface-color); border: 1px solid var(--border-color); backdrop-filter: blur(5px); border-radius: 8px; padding: 2rem; text-align: left; transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease; }
.project-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px var(--shadow-color); border-color: var(--primary-color); }
.project-card { display: flex; flex-direction: column; }
.project-card p { flex-grow: 1; }
.project-links a { font-weight: bold; display: inline-block; margin-top: 1rem; color: var(--primary-color); text-decoration: none; }
.experience-item { max-width: 800px; margin: 0 auto; border-left: 4px solid var(--primary-color); }
.experience-details { font-style: italic; color: var(--subtle-text-color); margin-bottom: 1rem; }
.experience-item ul { list-style-position: inside; padding-left: 1rem; }

/* --- EDUCATION SECTION STYLES --- */
.credential-list-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 900px;
    margin: auto;
}
.credential-item-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
    padding: 2.5rem;
    border-radius: 12px;
    text-align: left;
}
.credential-item-card h3 {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}
.credential-item-card h4 {
    font-size: 1.2rem;
    color: var(--heading-color);
    margin-bottom: 0.25rem;
}
.credential-item-card p {
    margin-left: 0;
    margin-bottom: 1rem;
    color: var(--subtle-text-color);
}
.sub-course-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.sub-course-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-color);
}
.sub-course-item i {
    color: var(--primary-color);
}

/* --- CONTACT SECTION --- */
.contact-links {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 2.5rem;
}
.contact-links a {
    font-size: 2rem;
    color: var(--text-color);
    transition: color 0.3s ease, transform 0.3s ease;
}
.contact-links a:hover {
    color: var(--primary-color);
    transform: translateY(-5px);
}

/* --- FOOTER --- */
footer { text-align: center; padding: 3rem 0; font-size: 0.9rem; color: var(--subtle-text-color); background-color: var(--surface-color); border-top: 1px solid var(--border-color); }

/* --- SCROLL ANIMATIONS --- */
[data-animation] { opacity: 0; transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
[data-animation="fade-in-up"] { transform: translateY(50px); }
[data-animation="slide-in-left"] { transform: translateX(-100px); }
[data-animation="slide-in-right"] { transform: translateX(100px); }
[data-animation].in-view { opacity: 1; transform: translateX(0) translateY(0); }

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    #header { flex-direction: column; gap: 1rem; padding: 1rem; }
}