html {
    font-family: Verdana, Geneva, Tahoma, sans-serif;
    overflow-y: scroll;
}

:root {
    /* LIGHT THEME */
    --bg: #ffffff;
    --text: #222222;
    --nav-bg: #808080;
    --nav-text: #000000;
    --nav-hover: #bcbcbc;
    --link: #0066cc;
    --border: #dddddd;
    --shadow: rgba(0,0,0,0.1);
}

[data-theme="dark"] {
    /* DARK THEME */
    --bg: #1a1a1a;
    --text: #e0e0e0;
    --nav-bg: #2c2c2c;
    --nav-text: #ffffff;
    --nav-hover: #555555;
    --link: #4da6ff;
    --border: #444444;
    --shadow: rgba(0,0,0,0.3);
}


/* Loader wrapper is visible by default */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg); /* Uses your theme's background color */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    /* Fades out the loader */
    transition: opacity 0.5s ease-out;
}

/* Hide the loader when the page is loaded */
body.loaded .loader-wrapper {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Allows clicking through it as it fades */
}

/* Hide the main content container by default */
.container {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

/* Show the main content when the page is loaded */
body.loaded .container {
    opacity: 1;
}

.loader {
    border: 8px solid var(--border); /* Uses your theme's border color */
    border-top: 8px solid var(--link); /* Uses your theme's link color */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Global theme application */
html {
    /* The html element must take up the full available height */
    height: 100%;
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
    /* FIX: Enable Flexbox Sticky Footer */
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensure body is at least viewport height */
}

/* ========================================
   1. HEADER CONTAINER
   ======================================== */
.site-header {
    width: 100%;
    background: var(--nav-bg);
    z-index: 1000;
    margin: 0 auto;
    padding: 0 2rem;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ========================================
   2. HAMBURGER BUTTON
   ======================================== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0.75rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    margin-left: auto;
    margin-right: 0.5rem;
}

.hamburger-line {
    width: 24px;
    height: 3px;
    background-color: var(--nav-text);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* X animation */
.hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}
.hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ========================================
   3. MOBILE: HAMBURGER + NAV
   ======================================== */
@media (max-width: 767px) {
    .hamburger {
        display: flex;
    }

    .site-header {
        width: 100%;
        background: var(--nav-bg);
        z-index: 1000;
        margin: 0 auto;
        
        /* FIX: Full width header and padding adjustment */
        padding: 0 1rem; /* Use a small horizontal padding for spacing from edges */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;

        max-width: 100vw;
        box-sizing: border-box;
        overflow-x: hidden;

        /* FIX: Centering the hamburger button */
        display: flex;
        align-items: center;
        min-height: 50px;
        border-radius: 0 0 16px 16px;
    }

    /* FIX: Ensure the hamburger button uses the header padding for its position */
    .hamburger {
        padding: 0.75rem;
        margin-left: auto;
        margin-right: 0; /* Let the header's padding handle the space */
    }

    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        background: var(--nav-bg);
        border-radius: 0 0 16px 16px;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
        padding: 4.5rem 1rem 1rem;
        box-sizing: border-box;
    }

    .main-nav.open {
        transform: translateY(0);
        /* FIX: Remove border-radius when open if it looks weird */
        /* border-radius: 0; */
    }

    .main-nav ul {
        list-style: none;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav a {
        border-radius: 8px 8px;
        display: block;
        padding: 1rem;
        color: var(--nav-text);
        text-decoration: none;
        font-weight: bold;
        text-align: center;
        transition: background 0.2s;
    }

    .main-nav a:hover {
        background: var(--nav-hover);
        color: var(--nav-text);
    }

    main {
        margin-top: 80px; /* Space for fixed header */
    }

    /* Backdrop blur (reduced clutter) */
    .main-nav.open::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: -1;
    }

    /* CLOSE BUTTON (X) */
    .main-nav .close-nav {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: rgba(255,255,255,0.2);
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        cursor: pointer;
        z-index: 1001;
        display: none;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    .main-nav.open .close-nav {
        display: flex;
    }

    .close-nav span {
        position: absolute;
        width: 20px;
        height: 3px;
        background: var(--nav-text);
        border-radius: 2px;
    }

    .close-nav span:nth-child(1) {
        transform: rotate(45deg);
    }
    .close-nav span:nth-child(2) {
        transform: rotate(-45deg);
    }

    .close-nav:hover {
        background: rgba(255,255,255,0.4);
    }

    /* Prevent animation during resize */
    .resize-animation-stopper .main-nav {
        transition: none !important;
    }

    /* FIX: Mobile Project Page Overflow */
    .gh-stats {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    .gh-stats a,
    .gh-stats img {
        width: 100%;
        height: auto;
    }
    
    /* === FOOTER CENTERING FIXES === */
    .site-footer .footer-content-wrapper {
        flex-direction: column; /* Force columns to stack */
        align-items: center; /* Center the entire stacked column horizontally */
        gap: 0.25rem; 
        width: 100%;
    }

    /* FIX 1: Explicitly center all content (text, links, and <strong>) within the Site Links group. */
    .site-footer .site-links-group,
    .site-footer .social-links-group{
        text-align: center;
        width: 100%; /* Ensure it takes full width for centering */
    }

    /* FIX 2: Ensure Social Media buttons are centered */
    .site-footer .social-buttons {
        justify-content: center;
    }

    /* FIX 3: Ensure <p> tags inside the links group also center their text */
    .site-footer .site-links-group p {
        text-align: center;
        margin-left: 0;
        margin-right: 0;
    }

    /* FIX 4: Correct the selector for the copyright line and center it */
    .site-footer .copyright {
        text-align: center;
    }
    /* === END FOOTER CENTERING FIXES === */
}

/* ========================================
   4. DESKTOP: FULL MENU + ROUNDED
   ======================================== */
@media (min-width: 768px) {
    .hamburger, .close-nav {
        display: none;
    }

    .site-header {
        position: static;
        /* FIX: Vertically center nav bar */
        display: flex;
        align-items: center;
        /* FIX: Horizontally center nav bar */
        justify-content: center; 
        
        max-width: 1200px;
        margin: 0.5rem auto; /* Reduced top/bottom margin */
        padding: 0 2rem;
        border-radius: 16px;
        overflow: visible;
        box-shadow: 0 4px 15px var(--shadow);
        min-height: 50px;
    }

    .main-nav {
        position: static;
        transform: none;
        background: transparent;
        border-radius: 16px;
        display: flex;
        flex-direction: row;
        padding: 0;
        box-sizing: border-box;
        /* FIX: Ensure nav itself is centered */
        width: auto; 
    }

    .main-nav ul {
        display: flex;
        flex-direction: row;
        list-style: none;
        margin: 0;
        padding: 0;
        /* FIX: Center items */
        width: auto;
        justify-content: center;
    }

    .main-nav li {
        margin: 0;
        /* FIX: Removed flex: 1 to group links */
    }

    .main-nav a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 1rem;
        color: var(--nav-text);
        font-weight: bold;
        text-decoration: none;
        border-radius: 8px 8px;
        transition: background 0.2s ease;
    }

    .main-nav a:hover,
    .main-nav a:focus {
        background: var(--nav-hover); /* Use variable */
        color: var(--nav-text);
        outline: none;
    }

    .push {
        margin-left: auto;
    }

    main {
        margin-top: 2rem; /* Fix: Desktop spacing */
    }
    .site-footer .site-links-group p {
        /* Adjust these values to control the gap */
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
}

/* ========================================
   5. THEME TOGGLE – Fixed Bottom-Right Circle
   ======================================== */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    font-size: 1.4rem;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px var(--shadow);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Sun / Moon icons */
.theme-toggle .sun,
.theme-toggle .moon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-toggle .sun  {
    opacity: 1;
    transform: rotate(0);
}
.theme-toggle .moon {
    opacity: 0;
    transform: rotate(-90deg);
}

[data-theme="dark"] .theme-toggle .sun  {
    opacity: 0;
    transform: rotate(90deg);
}
[data-theme="dark"] .theme-toggle .moon {
    opacity: 1;
    transform: rotate(0);
}

/* Keyboard focus */
.theme-toggle:focus-visible {
    outline: 3px solid var(--link);
    outline-offset: 2px;
}

/* Optional: SVG icons (if using SVG instead of text) */
.theme-toggle svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

/* ========================================
   6. CONTENT STYLES
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    /* FIX: Enable Flexbox Sticky Footer */
    flex-grow: 1;
}

.certifications {
    list-style: none;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.certifications li {
    background: #f0f0f0;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #808080;
}

[data-theme="dark"] .certifications li {
    background: #2a2a2a;
    border-left-color: #666;
}

section {
    margin-bottom: 2rem;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.button-group-404{
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.button-group-404 .spaced-button{
    display: block;
    width: 50%;
    max-width: 200px;
    box-sizing: border-box;
}

.spaced-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--nav-bg);
    color: var(--nav-text);
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    transition: background 0.2s;
}

.spaced-button:hover {
    background: var(--nav-hover);
}

/* Links */
a {
    color: var(--link);
    text-decoration: underline;
}

a:hover {
    opacity: 0.8;
}

/* Github Stats Cards */
.gh-stats{
    display: flex;
    gap:0.5%;
    flex-wrap: wrap;
    justify-content: left; /* Center cards on desktop */
}
.gh-stats a{
    margin:0;
    padding:0;
    display:block;
}

.page-not-found{
    color: red;
    text-align: center;
    font-size: 5rem;
}

.page-not-found-text {
    text-align: center;
    justify-content: center;
}



/* ========================================
   7. FOOTER & UTILITIES
   ======================================== */
.resize-animation-stopper * {
    transition: none !important;
}

.site-footer {
    /* FIX: Flexbox Sticky Footer */
    position: static; 
    width: 100%;
    margin-top: 4rem; /* Space above footer */

    background: var(--nav-bg);
    color: var(--nav-text);
    text-align: center;
    padding: 0.5rem;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Make the footer visible once JS injects its content */
.site-footer:not(:empty) {
    opacity: 1;
}

.site-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0.25rem;
    /* This container should not grow */
    flex-grow: 0; 
}

.site-footer strong{
    display: block;
    margin-bottom: 0.25rem;
    margin-top: 0.5rem;
}


.site-footer .footer-content-wrapper {
    display: flex;
    justify-content: space-between; /* Pushes content to the edges */
    align-items: stretch; /* Make columns same height */
    flex-wrap: wrap; /* Allows stacking on small screens */
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem; /* Add internal padding */
    padding-bottom: 2rem; /* Ensure space before copyright line */
    width: 100%;
    box-sizing: border-box; /* Ensure padding is included in width */
}

/* Styling for the social buttons group */
.social-buttons {
    display: flex;
    gap: 1rem; /* Space between buttons */
    margin-top: 0.5rem; /* Space below "Social Media" heading */
}

/* Styling for the circular social buttons */
.social-btn {
    background: var(--nav-text); /* White icon background on dark theme */
    color: var(--nav-bg); /* Dark icon color */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.social-btn svg {
    width: 20px;
    height: 20px;
}

.social-btn:hover {
    transform: scale(1.1);
}

/* Ensure the copyright line has a class to be targeted */
.site-footer .copyright {
    margin-top: 0.5rem;
    text-align: center;
    width: 100%; /* Ensure it spans full width */
}

body.body-no-scroll {
    overflow: hidden;
}

/* ========================================
   8. LINKTREE PAGE STYLES
   ======================================== */

/* This centers the whole block of links */
.links-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    min-height: auto;
    padding-top: 1.5rem;
    padding-bottom: 12rem;
}
@media (min-width:768px){
    .links-container{
        min-height: auto;
        justify-content: flex-start;
        padding-top: 4rem;
    }
}
/* This is the container for the buttons */
.links-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem; 
    width: 100%;
    max-width: 600px;
    margin-top: 1.5rem;
}

/* This styles the buttons themselves */
.links-group .spaced-button {
    display: flex; /* <-- THIS IS NEW */
    align-items: center; /* <-- THIS IS NEW */
    justify-content: center; /* <-- THIS IS NEW */
    gap: 0.75rem; /* <-- THIS IS NEW (adds space between icon and text) */
    
    width: 100%; 
    box-sizing: border-box; 
    padding: 1rem; 
    text-align: center;
}