/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for Theme Switching */
:root {
    /* Light theme (default) */
    --bg-primary: beige; /* Body background (light theme) */
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8f9fa;
    --bg-navbar: var(--bg-footer); /* Match navbar with footer color (light theme) */
    --bg-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-footer: #e6cfa0; /* Darker beige footer for stronger contrast */
    --bg-section: #f8f9fa;
    --bg-contact: #ffffff;
    --bg-navigation: #ecf0f1;
    
    --text-primary: #333;
    --text-secondary: #555;
    --text-heading: #2c3e50;
    --text-heading-secondary: #34495e;
    --text-white: white;
    --text-muted: #7f8c8d;
    --text-footer: #86a2b8;
    
    --accent-primary: #3498db;
    --accent-secondary: #2980b9;
    --accent-bullet: #3498db;
    --accent-link: #3498db;
    --accent-link-hover: #2980b9;
    --accent-work: #e74c3c;
    
    --border-color: transparent;
    --border-navigation: #bdc3c7;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --bg-navbar: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --bg-header: linear-gradient(135deg, #424242 0%, #616161 100%);
    --bg-footer: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --bg-section: #3a3a3a;
    --bg-contact: #404040;
    --bg-navigation: #3a3a3a;
    
    --text-primary: #e8e8e8;
    --text-secondary: #e0e0e0;
    --text-heading: #ffffff;
    --text-heading-secondary: #f0f0f0;
    --text-white: white;
    --text-muted: #b0b0b0;
    --text-footer: #b0b0b0;
    
    --accent-primary: #64b5f6;
    --accent-secondary: #90caf9;
    --accent-bullet: #64b5f6;
    --accent-link: #81c784;
    --accent-link-hover: #a5d6a7;
    --accent-work: #ffab91;
    
    --border-color: #404040;
    --border-navigation: #757575;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
}

	body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
		/* The page wrapper remains a block element; the main grid is the `.container` */
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 1rem;
    text-align: center;
    transition: color 0.3s ease;
}

h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-heading-secondary);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

p {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/*
	Grid-first page layout
	- We use CSS Grid on `.container` to create a responsive, masonry-like layout for sections
	- Header and Navbar will span all columns (see `.header, .navbar { grid-column: 1 / -1 }`)
	- Individual sections auto-flow into columns using `repeat(auto-fit, minmax(...))`
*/
	.container {
	max-width: 1200px;
	margin: 2rem auto;
	padding: 2rem;
	background-color: var(--bg-secondary);
	box-shadow: 0 0 20px var(--shadow);
	border-radius: 10px;
	/* Single-column grid for consistent vertical flow across pages */
	display: grid; /* Grid is ideal for overall page structure */
	grid-template-columns: 1fr; /* Force one column layout */
	grid-auto-rows: auto; /* Let rows size to their content */
	gap: 2rem; /* Consistent spacing between grid items */
	transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Make header and navbar span across all grid columns */
.header,
.navbar {
	grid-column: 1 / -1; /* Full-width rows inside the grid */
}

/*
	Flexbox for inline navigation controls
	- Flex is great for single-dimensional layouts like nav bars
*/
.navbar {
    background: var(--bg-navbar);
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    border: 1px solid var(--border-color);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}


/*
	Flex container: center nav links horizontally and wrap on small screens
*/
.navbar ul {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar li {
    margin: 0;
    padding: 0;
}

.navbar li::before {
    display: none;
}

.navbar a {
    color: black;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.navbar a.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Header Section (full-width grid item) */
.header {
	display: flex; /* Flex aligns inner content (image, title, button) */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 0;
    background: var(--bg-header);
    color: white;
    border-radius: 10px;
	margin-bottom: 2rem; /* extra breathing room against subsequent grid items */
    position: relative;
    overflow: hidden;
    animation: slideInFromLeft 0.8s ease-out;
    transition: background 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.theme-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.theme-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(180deg);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.header h1 {
    color: white;
    position: relative;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid white;
    margin: 1rem 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    object-fit: cover;
}

/*
	Section cards
	- These become individual grid items within `.container`
	- No need for explicit grid rules here; they auto-place within the container grid
*/

/*
	Section cards use Flexbox internally for structured vertical layouts
	- Keep headings, text, and lists evenly spaced using `gap`
*/
	.section {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background-color: var(--bg-section);
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    border: 1px solid var(--border-color);
	display: flex; /* Flexbox for internal alignment */
	flex-direction: column;
	gap: 1rem; /* Even spacing between child elements */
}

.section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-hover);
}

/* Lists */
ul {
    list-style: none;
    padding-left: 0;
}

li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
}

li::before {
    content: '▶';
    color: var(--accent-bullet);
    font-weight: bold;
    position: absolute;
    left: 0;
    transition: color 0.3s ease;
}

/* Work Experience specific styling */
	/* Nested lists inside sections: use flex column for tidy bullets */
	.section ul li ul {
    margin-top: 0.5rem;
		margin-left: 1rem;
		display: flex;
		flex-direction: column;
		gap: 0.4rem;
}

.section ul li ul li {
    padding-left: 1rem;
}

.section ul li ul li::before {
    content: '•';
    color: var(--text-muted);
    transition: color 0.3s ease;
}

/* Links */
a {
    color: var(--accent-link);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-link-hover);
    text-decoration: underline;
}

/*
	Contact Page: Flexbox cards
	- Flex layout allows even distribution and wrapping of contact cards
*/
.contact-info {
	display: flex; /* Flex aligns contact cards and wraps as needed */
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 2rem 0;
    justify-content: center;
}

.contact-item {
    background-color: var(--bg-contact);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    flex: 1; /* Allow cards to grow equally in a row */
    min-width: 250px;
    max-width: 300px;
    border: 1px solid var(--border-color);
}

.contact-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 20px var(--shadow-hover);
}

.contact-item h3 {
    color: var(--text-heading);
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.contact-item p {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

/* Navigation */
.navigation {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--bg-navigation);
    border-radius: 8px;
    text-align: center;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border-color);
}

.navigation hr {
    border: none;
    height: 1px;
    background-color: var(--border-navigation);
    margin: 1rem 0;
    transition: background-color 0.3s ease;
}

.navigation p {
    margin: 0.5rem 0;
}

.navigation a {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--accent-primary);
    color: white;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.navigation a:hover {
    background-color: var(--accent-secondary);
    text-decoration: none;
}

/* Footer */
footer {
    background: var(--bg-footer);
    color: var(--text-footer);
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    border-radius: 10px;
    transition: background 0.3s ease, color 0.3s ease;
    border: 1px solid var(--border-color);
}

footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    /* Mobile-specific heading styles for contact page */
    .header h1 {
        font-size: 1.8rem;
        line-height: 1.2;
        max-width: calc(100% - 70px); /* Account for toggle button */
        margin-left: 10px; /* Add some space from toggle button */
    }
    
    /* Break "Contact Information" into two lines on mobile */
    .header h1.mobile-break {
        white-space: normal;
        word-break: normal;
        overflow-wrap: break-word;
    }
    
    /* Force line break after "Contact" on mobile only */
    .header h1.mobile-break .mobile-break-word::before {
        content: "\A";
        white-space: pre;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .header img {
        width: 120px;
        height: 120px;
    }
    
    .contact-info {
        flex-direction: column;
        align-items: center;
    }
    
    .contact-item {
        max-width: 100%;
    }
    
    .section {
        padding: 1rem;
    }
    
    .navbar ul {
        gap: 1rem;
    }
    
    .navbar a {
        padding: 0.6rem 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.5rem;
        margin: 0.5rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    /* Further adjustments for very small screens */
    .header h1 {
        font-size: 1.6rem;
        max-width: calc(100% - 60px);
        margin-left: 5px;
    }
    
    .header img {
        width: 100px;
        height: 100px;
    }
    
    /* Ensure theme toggle button doesn't interfere */
    .theme-toggle {
        width: 45px;
        height: 45px;
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* Animation for page load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Sliding animation for header */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.section {
    animation: fadeInUp 0.6s ease-out;
}

.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.2s; }
.section:nth-child(4) { animation-delay: 0.3s; }
.section:nth-child(5) { animation-delay: 0.4s; }
.section:nth-child(6) { animation-delay: 0.5s; }
.section:nth-child(7) { animation-delay: 0.6s; }

/* Skills section specific styling */
.section ul li strong {
    color: var(--text-heading);
    font-weight: 600;
    transition: color 0.3s ease;
}

/* Work experience timeline effect */
.section ul li h3 {
    color: var(--accent-work);
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.section ul li p {
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}