/* --- Variables (Control Panel) --- */
:root {
    --primary-blue: #003366; /* Dark navy blue */
    --light-grey-bg: #ffffff; /* Pure white background */
    --border-color: #e0e0e0;
    --dark-text: #212121;
    --medium-text: #5f5f5f;
    --font-family-body: 'Inter', sans-serif;
    --font-family-heading: 'Inter', sans-serif;
}

/* Dark mode variables */
body.dark-mode {
    --primary-blue: #4a9eff; /* Lighter blue for dark mode */
    --light-grey-bg: #000000; /* Pure black background */
    --border-color: #404040;
    --dark-text: #e0e0e0; /* Light text */
    --medium-text: #b0b0b0;
}

/* --- Universal Box Sizing --- */
*, *::before, *::after {
    box-sizing: border-box;
}

/* --- General Styles --- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 60px;
    width: 100%;
}
body {
    margin: 0;
    font-family: var(--font-family-body);
    color: var(--dark-text);
    background-color: var(--light-grey-bg);
    width: 100%;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Main Header --- */
.main-header {
    height: 120px;
    background-color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}
.main-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: transparent;
}
.header-content {
    position: relative;
    text-align: center;
    padding: 0 1rem; /* Add padding to prevent edge touching */
}
.header-content h1 {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 400;
    font-family: var(--font-family-heading);
    margin: 0;
}
.mobile-break {
    display: none; /* Hide line break on desktop */
}

/* --- Theme Toggle Button --- */
.theme-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 1.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-50%) scale(1.05);
}
.theme-toggle i {
    transition: transform 0.3s ease;
}
body.dark-mode .theme-toggle {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}
body.dark-mode .theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

/* --- Sticky Sub-Navigation Bar --- */
.sub-nav {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}
.sub-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap; /* Allow wrapping on mobile */
    max-width: 100%;
}
.sub-nav a {
    color: var(--primary-blue); /* Match primary blue color */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-decoration: none;
    font-family: var(--font-family-heading);
}
.sub-nav a:hover {
    opacity: 0.7; /* Slightly transparent on hover */
}

/* --- Two-Column Layout --- */
.page-container {
    display: flex;
    max-width: 1200px;
    margin: 2rem auto;
    gap: 2rem;
    padding: 0 1rem; /* Add padding on sides to prevent edge overflow */
    box-sizing: border-box;
    width: 100%;
    align-items: flex-start; /* Important for sticky to work */
}

/* --- Left Sidebar --- */
.sidebar {
    width: 250px; /* Increased to accommodate larger buttons */
    flex-shrink: 0;
    text-align: center;
    padding-top: 0; /* Remove extra padding */
    background-color: transparent; /* Use body background */
    transition: background-color 0.3s ease;
    position: sticky;
    top: calc(0.5rem + 0.5rem + 0.9rem * 1.5 + 1px + 1.5rem); /* Sub-nav height + extra spacing */
    align-self: flex-start;
    height: fit-content;
}
.sidebar-image {
    width: 216px;
    height: 216px;
    border-radius: 50%; /* Changed to circle */
    object-fit: cover;
    border: 3px solid var(--primary-blue); /* Matches title colors */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}
.sidebar-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}
/* New Button Style */
.new-icon-button {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space between text and icon - right-aligns icon */
    gap: 0.5rem;
    padding: 0.75rem 1.2rem;
    background-color: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    font-family: var(--font-family-heading);
    transition: all 0.2s ease-in-out;
    width: 216px; /* Match headshot width */
    box-sizing: border-box; /* Include padding and border in width */
}
.new-icon-button:hover {
    background-color: var(--primary-blue);
    color: #fff;
    text-decoration: none;
}
.new-icon-button i {
    font-size: 1.2rem;
}

/* --- Right Main Content --- */
.main-content {
    flex-grow: 1;
    background-color: #fff;
    padding: 2.5rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* Removed border */
}
section {
    padding-bottom: 2rem;
}
section:last-child {
    padding-bottom: 0;
}
h2, h3, h4 {
    font-family: var(--font-family-heading);
}
h2 {
    font-size: 2rem;
    color: var(--primary-blue);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin: 0 0 1.5rem 0;
}
h3 {
    font-size: 1.5rem;
    color: var(--dark-text);
    margin-top: 2.5rem;
}
.work-in-progress {
    margin-top: 3rem;
}
h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}
h4 a {
    color: var(--dark-text);
}
h4 a:hover {
    color: var(--primary-blue);
    text-decoration: none;
}
h4 a i {
    color: var(--primary-blue);
    margin-right: 0.5rem;
    font-size: 1rem;
}
p {
    line-height: 1.8;
    font-size: 1.1rem;
}
.main-content p {
    text-align: justify;
}
.main-content ul {
    font-size: 1.1rem;
    line-height: 1.8;
}
.main-content li {
    margin-bottom: 0.5rem;
}

/* --- Dark Mode Specific Styles --- */
body.dark-mode .main-content {
    background-color: #000000;
}
body.dark-mode .sub-nav {
    background-color: #000000;
}
body.dark-mode .new-icon-button {
    background-color: transparent;
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}
body.dark-mode .new-icon-button:hover {
    background-color: var(--primary-blue);
    color: #000000;
}
body.dark-mode .sidebar-image {
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}


/* --- Responsive for Mobile --- */
@media (max-width: 900px) {
    .page-container {
        flex-direction: column;
        margin-top: 1rem;
        gap: 1rem;
        padding: 0; /* Remove side padding */
        width: 100%;
        max-width: 100vw; /* Prevent overflow */
    }
    .sidebar {
        width: 100%;
        max-width: 100%; /* Ensure sidebar doesn't overflow */
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 1rem 0; /* Only vertical padding, no horizontal */
        background-color: transparent; /* Use body background color */
        /* Removed border */
        box-shadow: none;
        order: -1;
        margin: 0 auto 1.5rem auto; /* Center with auto margins */
        box-sizing: border-box; /* Include padding in width */
        overflow-x: hidden;
        position: relative; /* Remove sticky on mobile */
    }
    .sidebar-image {
        width: 260px; /* Larger on mobile to match button width */
        height: 260px;
        margin-bottom: 0;
        margin-left: auto;
        margin-right: auto;
        border: 3px solid var(--primary-blue); /* Ensure border on mobile */
    }
    .sidebar-buttons {
        flex-direction: column; /* Stack buttons vertically on mobile */
        flex-wrap: nowrap;
        justify-content: center;
        align-items: center; /* Center buttons horizontally */
        gap: 0.8rem;
        width: 100%;
        margin: 0 auto; /* Ensure buttons container is centered */
    }
    .new-icon-button {
        padding: 0.75rem 1.2rem;
        font-size: 1rem;
        width: 260px; /* Wider on mobile to prevent text wrapping */
        max-width: calc(100vw - 2rem); /* Prevent overflow on very small screens */
        margin: 0 auto; /* Center each button */
    }
    .header-content h1 {
        font-size: 1.8rem;
        max-width: none; /* Remove max-width constraint */
        margin: 0 auto;
        word-wrap: break-word;
        line-height: 1.3;
    }
    .mobile-break {
        display: inline; /* Show line break on mobile */
    }
    .main-content {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%; /* Prevent overflow */
        box-sizing: border-box;
        overflow-wrap: break-word; /* Break long words if needed */
        overflow-x: hidden;
        margin: 0 auto; /* Center main content */
    }
    /* Navigation improvements for mobile */
    .sub-nav {
        padding: 0.5rem 1rem; /* Add side padding */
    }
    .sub-nav ul {
        gap: 0.8rem 1.5rem; /* Reduce gap on mobile: vertical horizontal */
    }
    .sub-nav a {
        font-size: 0.8rem; /* Slightly smaller text */
        color: var(--primary-blue); /* Ensure primary blue on mobile */
    }
    .theme-toggle {
        top: 50%;
        transform: translateY(-50%);
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

/* --- Very small screens --- */
@media (max-width: 600px) {
    .sub-nav ul {
        gap: 0.6rem 1rem; /* Even smaller gaps */
        padding: 0 0.5rem;
    }
    .sub-nav a {
        font-size: 0.75rem; /* Smaller text for tiny screens */
        color: var(--primary-blue); /* Ensure primary blue on small screens */
    }
    .header-content h1 {
        font-size: 1.5rem; /* Smaller font to help wrapping */
        max-width: none; /* Remove max-width */
        margin: 0 auto;
        line-height: 1.2;
    }
    .sidebar-image {
        width: 240px; /* Match button width on small screens */
        height: 240px;
        border: 3px solid var(--primary-blue); /* Ensure border on small screens */
    }
    .new-icon-button {
        width: 240px; /* Wider to prevent text wrapping */
    }
    .main-header {
        height: 100px; /* Smaller header on very small screens */
    }
}
