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 */
}
/* ========================================
   5. THEME TOGGLE – Fixed Bottom-Right Circle
   ======================================== */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    margin-bottom: env(safe-area-inset-bottom);
    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;
}

.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;
}

/* ========================================
   8. LINK 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;
}