/* --- CSS with Theme Variables --- */
:root {
    /* Light Mode Variables */
    --bg-color-light: #f4f4f9;
    --text-color-light: #1a1a1a;
    --card-bg-color-light: #ffffff;
    --header-bg-color-light: #ffffff;
    --border-color-light: #e0e0e0;
    --button-bg-color-light: #2563eb;
    --button-text-color-light: #ffffff;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);

    /* Dark Mode Variables */
    --bg-color-dark: #121212;
    --text-color-dark: #e0e0e0;
    --card-bg-color-dark: #1e1e1e;
    --header-bg-color-dark: #1e1e1e;
    --border-color-dark: #333333;
    --button-bg-color-dark: #3b82f6;
    --button-text-color-dark: #ffffff;
    --shadow-dark: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);

    /* Generic Variables */
    --font-family-main: 'Inter', sans-serif;
    --border-radius: 0.75rem; /* 12px */
}

/* --- Global Styles --- */
body {
    font-family: var(--font-family-main);
    margin: 0;
    transition: background-color 0.3s, color 0.3s;
}

/* --- Theme Class Styles --- */
body.light-mode {
    background-color: var(--bg-color-light);
    color: var(--text-color-light);
}

body.dark-mode {
    background-color: var(--bg-color-dark);
    color: var(--text-color-dark);
}

/* --- Component Styles --- */
.header {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid;
    position: sticky;
    top: 0;
    z-index: 10;
    transition: background-color 0.3s, border-color 0.3s;
}
.light-mode .header {
    background-color: var(--header-bg-color-light);
    border-color: var(--border-color-light);
    box-shadow: var(--shadow-light);
}
.dark-mode .header {
    background-color: var(--header-bg-color-dark);
    border-color: var(--border-color-dark);
    box-shadow: var(--shadow-dark);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    z-index: 1001; /* Ensure logo is clickable over the nav overlay */
}
.logo a {
    text-decoration: none;
}
.light-mode .logo a { color: var(--text-color-light); }
.dark-mode .logo a { color: var(--text-color-dark); }


/* --- Navigation Styles --- */
.nav {
    display: none; /* Hidden on mobile by default */
}

.nav-toggle {
    display: block;
    background: transparent;
    border: 0;
    padding: .5em;
    cursor: pointer;
    position: absolute;
    right: 5.5rem; /* Position next to the theme toggle */
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001; /* Above nav overlay */
}

.hamburger {
    display: block;
    position: relative;
    width: 2em;
    height: 3px;
    transition: transform 250ms ease-in-out;
}
.light-mode .hamburger, .light-mode .hamburger::before, .light-mode .hamburger::after { background: var(--text-color-light); }
.dark-mode .hamburger, .dark-mode .hamburger::before, .dark-mode .hamburger::after { background: var(--text-color-dark); }

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    transition: transform 250ms ease-in-out;
}

.hamburger::before { top: -8px; }
.hamburger::after { bottom: -8px; }

/* Styles for when nav is open */
.nav--visible {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}
.light-mode .nav--visible { background: rgba(255, 255, 255, 0.95); }
.dark-mode .nav--visible { background: rgba(18, 18, 18, 0.95); }

.nav__list {
    list-style: none;
    padding: 0;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.nav__link {
    font-size: 1.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: color .2s;
}
.light-mode .nav__link { color: var(--text-color-light); }
.dark-mode .nav__link { color: var(--text-color-dark); }

.light-mode .nav__link:hover { color: var(--button-bg-color-light); }
.dark-mode .nav__link:hover { color: var(--button-bg-color-dark); }

/* Animate hamburger into an X */
.nav--visible .hamburger {
    transform: rotate(.625turn);
}
.nav--visible .hamburger::before {
    transform: rotate(90deg) translateX(-8px);
}
.nav--visible .hamburger::after {
    opacity: 0;
}


.theme-toggle-button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    z-index: 1001; /* Ensure theme toggle is clickable */
}
.theme-toggle-button svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}
.light-mode .theme-toggle-button svg { fill: var(--text-color-light); }
.dark-mode .theme-toggle-button svg { fill: var(--text-color-dark); }
.theme-toggle-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}
.dark-mode .theme-toggle-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Hide one icon based on theme */
.dark-mode .sun-icon { display: block; }
.dark-mode .moon-icon { display: none; }
.light-mode .sun-icon { display: none; }
.light-mode .moon-icon { display: block; }


.container {
    max-width: 1024px;
    margin: 2rem auto;
    padding: 0 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

p {
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.card {
    padding: 2rem;
    border-radius: var(--border-radius);
    border: 1px solid;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.light-mode .card {
    background-color: var(--card-bg-color-light);
    border-color: var(--border-color-light);
    box-shadow: var(--shadow-light);
}
.dark-mode .card {
    background-color: var(--card-bg-color-dark);
    border-color: var(--border-color-dark);
    box-shadow: var(--shadow-dark);
}

.main-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}
.light-mode .main-button {
    background-color: var(--button-bg-color-light);
    color: var(--button-text-color-light);
}
.dark-mode .main-button {
    background-color: var(--button-bg-color-dark);
    color: var(--button-text-color-dark);
}
.main-button:hover {
    transform: translateY(-2px);
}

.footer {
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 1px solid;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}
.light-mode .footer {
    border-color: var(--border-color-light);
}
.dark-mode .footer {
    border-color: var(--border-color-dark);
}

/* --- Responsive Design (Media Queries) --- */

/* Tablet Styles */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }

    .nav {
        display: block;
        position: static;
    }

    .nav__list {
        flex-direction: row;
        height: auto;
        gap: 2.5rem;
    }

    .nav__link {
        font-size: 1rem;
    }
    
    .header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 2rem;
    }
    .logo { grid-column: 1 / 2; }
    .nav { grid-column: 2 / 3; justify-self: center; }
    .theme-toggle-button { grid-column: 3 / 4; }
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 3rem;
    }
}
