/* style.css */
:root {
    --bg-main: #ffffff;
    --primary-color: #1a0dab;
    --text-main: #202124;
    --text-muted: #70757a;
    --bg-light: #f8f9fa;
    --border-color: #dadce0;
    
    --witty-blue: #4285F4;
    --witty-red: #EA4335;
    --witty-yellow: #FBBC05;
    --witty-green: #34A853;
    --focus-ring: #4285F4;
}

/* Dark Mode Variables */
:root.dark-mode {
    --bg-main: #202124;
    --text-main: #e8eaed;
    --text-muted: #9aa0a6;
    --bg-light: #303134;
    --border-color: #5f6368;
    --primary-color: #8ab4f8; 
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-main);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

/* Accessibility: Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    z-index: 100;
    text-decoration: none;
    transition: top 0.2s ease-in-out;
}

.skip-link:focus { top: 0; }

a:focus-visible, button:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

header {
    background-color: var(--bg-light);
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    transition: background-color 0.3s, border-color 0.3s;
}

/* Base Logo Look */
header h1 {
    margin: 0 0 1rem 0;
    font-size: 2rem;
    letter-spacing: -1px;
    display: inline-block;
    padding: 0.4rem 1.5rem;
    border-radius: 16px;
    background-color: transparent;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0); 
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

/* Base Logo Colors */
.brand-w { color: var(--witty-blue); }
.brand-i { color: var(--witty-red); }
.brand-t { color: var(--witty-yellow); }
.brand-t2 { color: var(--witty-blue); }
.brand-y { color: var(--witty-green); }

/* Dark Mode Button Effect (Applied to Logo & Mobile Menu) */
:root.dark-mode header h1,
:root.dark-mode .mobile-menu-btn {
    background-color: #ffffff;
    color: #202124; 
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 
}

/* --- Layout Wrapper for Header Controls --- */
.header-nav-area {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/* Desktop Flex Ordering */
#main-nav { order: 1; }
.desktop-divider { order: 2; }
.github-link { order: 3; }

/* Mobile Menu Button - Hidden on desktop */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 0.4rem 1.5rem;
    border-radius: 16px;
    background-color: transparent;
    color: var(--text-main);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0); 
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

/* Ensure hamburger icon and text remain black inside the white button */
:root.dark-mode .mobile-menu-btn .hamburger-icon { color: #202124; }

nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

nav a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem;
    transition: color 0.3s;
}

nav a:hover { text-decoration: underline; }

nav a[aria-current="page"] {
    color: var(--text-main);
    font-weight: 700;
    text-decoration: none;
    border-bottom: 2px solid var(--text-main);
}

.nav-divider {
    width: 1px;
    height: 1.5rem;
    background-color: var(--border-color);
    margin: 0 0.5rem;
    transition: background-color 0.3s;
}

.theme-toggle-btn {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s, color 0.2s, border-color 0.3s;
}

.theme-toggle-btn:hover { background: var(--border-color); }

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #24292e;
    color: #ffffff !important;
    padding: 0.5rem 1rem !important;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.github-link:hover {
    background-color: #000000;
    text-decoration: none !important;
}

.github-icon {
    display: block;
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h2 {
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    transition: color 0.3s, border-color 0.3s;
}

h3 { color: var(--text-main); margin-top: 1.5rem; transition: color 0.3s; }
p, li { color: var(--text-main); transition: color 0.3s; }

code {
    background-color: var(--bg-light);
    color: var(--text-main);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: Consolas, monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.file-block {
    background: var(--bg-light);
    border-left: 4px solid var(--witty-blue);
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    transition: background-color 0.3s;
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    transition: color 0.3s, border-color 0.3s;
}

/* Footer Link Styling */
.site-footer a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: color 0.3s;
}

/* Make the email link white in dark mode */
:root.dark-mode .site-footer a {
    color: #ffffff;
}

/* Tablet and Desktop Adjustments */
@media (min-width: 768px) {
    header { padding: 2rem; }
    nav { gap: 1.5rem; }
    main { padding: 3rem 2rem; }
}

/* Mobile Adjustments (Hamburger Menu & Flex Ordering) */
@media (max-width: 767px) {
    .header-nav-area { gap: 0.8rem; }
    
    .mobile-menu-btn {
        display: inline-flex;
        order: 1; /* Puts it first */
    }
    
    .github-link {
        order: 2; /* Puts it next to the menu button */
    }
    
    #main-nav {
        display: none; 
        flex-direction: column;
        width: 100%;
        padding-top: 1rem;
        order: 3; /* Pushes the menu items below the top buttons */
    }
    
    #main-nav.open { display: flex; }
    
    .nav-divider {
        width: 60%;
        height: 1px;
        margin: 0.5rem auto;
    }
    
    .desktop-divider {
        display: none !important; /* Hide the external divider on mobile */
    }
}