/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Variables for theming */
:root {
    --bg-color: #fff;
    --text-color: #333;
    --text-secondary: #444;
    --text-muted: #555;
    --text-light: #666;
    --border-color: #eee;
    --border-light: #e9ecef;
    --border-medium: #dee2e6;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --nav-text: #333;
    --nav-text-muted: #666;
    --sidebar-bg: #f8f9fa;
    --sidebar-border: #e9ecef;
    --link-color: #0066cc;
    --link-hover: #0066cc;
    --section-title: #111;
    --content-bg: #fff;
    --special-bg: #f1f3f4;
}

/* Dark mode variables */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #c0c0c0;
    --text-muted: #a0a0a0;
    --text-light: #888;
    --border-color: #333;
    --border-light: #404040;
    --border-medium: #505050;
    --nav-bg: rgba(26, 26, 26, 0.95);
    --nav-text: #e0e0e0;
    --nav-text-muted: #a0a0a0;
    --sidebar-bg: #2a2a2a;
    --sidebar-border: #404040;
    --link-color: #66b3ff;
    --link-hover: #4da6ff;
    --section-title: #f0f0f0;
    --content-bg: #1a1a1a;
    --special-bg: #333;
}

/* Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    padding-top: 80px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Global list styling - slightly indented like CV section */
ul, ol {
    list-style-type: disc;
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

.nav-home {
    font-weight: 600;
    text-decoration: none;
    color: var(--nav-text);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.nav-links {
    display: flex;
    gap: 2rem;
    grid-column: 2;
    justify-self: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--nav-text-muted);
    transition: color 0.2s ease;
}

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

/* Dark mode toggle */
.dark-mode-toggle {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
    color: var(--nav-text);
    grid-column: 3;
    justify-self: end;
}

.dark-mode-toggle:hover {
    background: var(--border-color);
    transform: scale(1.05);
}

.dark-mode-icon {
    font-size: 18px;
    transition: transform 0.3s ease;
}

[data-theme="dark"] .dark-mode-icon {
    transform: rotate(180deg);
}

/* Main content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Two-column layout for homepage */
.homepage-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    align-items: start;
}

.main-content {
    min-width: 0; /* Prevents grid overflow */
}

.projects-sidebar {
    background: var(--sidebar-bg);
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--sidebar-border);
    position: sticky;
    top: 2rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Base header class for unified styling */
.base-header {
    width: 100%;
    aspect-ratio: 5 / 1;
    max-height: 250px;
    position: relative;
    margin-bottom: 2rem;
    overflow: visible;
    background-color: var(--header-bg-color, #0c0c0c);
    border-bottom: var(--header-border, none);
}

/* Dynamic header */
.dynamic-header {
    --header-bg-color: #0c0c0c;
}

/* Fullscreen header for landing page */
.fullscreen-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: none;
    aspect-ratio: unset;
    margin-bottom: 0;
    z-index: -1;
}

/* Body style for fullscreen landing page */
body.fullscreen-landing {
    padding-top: 0;
}

/* System picker styling - matches toggle-controls-button aesthetic */
.system-picker {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    transition: background-color 0.2s;
}

.system-picker:hover {
    background: rgba(255, 255, 255, 0.2);
}

.system-picker label {
    color: #fff;
    font-size: 0.9rem;
    font-weight: 400;
    white-space: nowrap;
}

.system-picker select {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    min-width: 150px;
    padding: 0;
}

.system-picker select option {
    background: #1a1a1a;
    color: #fff;
}

/* Ensure header overlay is properly positioned in fullscreen */
.fullscreen-header .header-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    text-align: center;
}

.dynamic-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    /* background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.8)); */
    pointer-events: none;
    z-index: 10;
}

/* Canvas elements in headers should be clipped to header boundaries */
.base-header canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

#henonCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.header-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    text-align: center;
}

.header-overlay h1 {
    font-size: 3rem;
    font-weight: 300;
    margin: 0 0 1rem 0;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

/* Header Controls */
.header-controls {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
    position: relative;
}

.toggle-controls-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 30;
}

.toggle-controls-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.about-landing-link {
    color: #ccc;
    font-size: 0.9rem;
    text-decoration: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    transition: opacity 0.2s;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.about-landing-link:hover {
    text-decoration: underline;
    color: #fff;
    opacity: 0.8;
}

.controls-panel {
    background: rgba(0, 0, 0, 0.85);
    padding: 1rem;
    border-radius: 8px;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
    position: fixed;
    top: 140px;
    right: 10px;
    z-index: 1001;
    min-width: 280px;
    max-width: 320px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    /* Custom scrollbar styling for webkit browsers */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.controls-panel::-webkit-scrollbar {
    width: 6px;
}

.controls-panel::-webkit-scrollbar-track {
    background: transparent;
}

.controls-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.controls-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.controls-panel.hidden {
    display: none;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.close-controls {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 1002;
}

.close-controls:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}


.parameter-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.parameter-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.parameter-control label {
    color: #fff;
    font-size: 0.8rem;
    min-width: 80px;
    white-space: nowrap;
}

.parameter-control input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.parameter-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.parameter-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: none;
}

.parameter-value {
    color: #fff;
    font-size: 0.8rem;
    min-width: 40px;
    text-align: right;
    font-family: monospace;
}

.reset-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.reset-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Equation Box */
.equation-box {
    position: absolute;
    top: 60px;
    left: 15px;
    /* background: rgba(0, 0, 0, 0.8); */
    /* backdrop-filter: blur(10px); */
    /* border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px; */
    padding: 16px 20px;
    color: #fff;
    max-width: 320px;
    z-index: 25;
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); */
    transition: all 0.3s ease;
}

.equation-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.equation-content {
    color: #fff;
    font-weight: 400;
}

/* MathJax specific styling */
.equation-box .MathJax {
    color: #fff !important;
    font-size: 1.0em !important;
}

.equation-box .MathJax_Display {
    margin: 0 !important;
    text-align: left !important;
}

/* MathJax SVG output styling */
.equation-box .MathJax svg {
    color: #fff;
    fill: currentColor;
}

/* Ensure MathJax respects our color scheme */
.equation-box .mjx-container {
    color: #fff;
}

.equation-box .mjx-container[jax="SVG"] {
    direction: ltr;
}

/* Dark theme compatibility */
/*[data-theme="dark"] .equation-box {
    background: rgba(26, 26, 26, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
}*/

/* Responsive adjustments for header controls */
@media (max-width: 768px) {
    .header-controls {
        max-width: 100%;
    }

    .equation-box {
        top: 120px;
        left: 15px;
        padding: 12px 16px;
        max-width: 280px;
    }

    .equation-title {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .controls-panel {
        padding: 0.8rem;
        top: 100px;
        right: 5px;
        min-width: 240px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 120px);
    }

    .parameter-control {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
    }

    .parameter-control label {
        min-width: auto;
        text-align: center;
    }

    .toggle-controls-button {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

@media (max-width: 360px) {
    .controls-panel {
        top: 120px;
        right: 2px;
        left: 2px;
        min-width: auto;
        max-width: none;
        margin: 0 auto;
        max-height: calc(100vh - 140px);
    }

    .toggle-controls-button {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .header-controls {
        margin-top: 0.5rem;
    }
}

/* Height-based media queries for limited vertical space */
@media (max-height: 600px) {
    .controls-panel {
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        top: 80px;
    }

    .parameter-controls {
        gap: 0.6rem;
    }

    .controls-panel {
        padding: 0.6rem;
    }
}

@media (max-height: 500px) {
    .controls-panel {
        max-height: calc(100vh - 120px);
        top: 60px;
        padding: 0.5rem;
    }

    .parameter-controls {
        gap: 0.4rem;
    }

    .parameter-control {
        gap: 0.2rem;
    }

    .parameter-control label {
        font-size: 0.75rem;
    }

    .controls-header h4 {
        font-size: 0.8rem;
    }
}

@media (max-height: 400px) {
    .controls-panel {
        max-height: calc(100vh - 100px);
        top: 40px;
        padding: 0.4rem;
        min-width: 200px;
    }

    .parameter-controls {
        gap: 0.3rem;
    }

    .parameter-control {
        gap: 0.1rem;
    }

    .parameter-control label {
        font-size: 0.7rem;
    }

    .parameter-value {
        font-size: 0.7rem;
        min-width: 30px;
    }

    .toggle-controls-button {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .reset-button {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* For extremely short screens, center the panel vertically */
@media (max-height: 320px) {
    .controls-panel {
        top: 50%;
        transform: translateY(-50%);
        max-height: calc(100vh - 40px);
        right: 5px;
        min-width: 180px;
        padding: 0.3rem;
    }

    .parameter-controls {
        gap: 0.2rem;
    }

    .parameter-control {
        flex-direction: row;
        gap: 0.3rem;
    }

    .parameter-control label {
        font-size: 0.65rem;
        min-width: 60px;
    }

    .parameter-value {
        font-size: 0.65rem;
        min-width: 25px;
    }

    .controls-header h4 {
        font-size: 0.7rem;
    }

    .reset-button {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }
}

/* Combined width and height constraints for landscape phones */
@media (max-width: 768px) and (max-height: 450px) {
    .controls-panel {
        top: 20px;
        right: 5px;
        left: auto;
        max-height: calc(100vh - 40px);
        min-width: 200px;
        max-width: 250px;
    }

    .parameter-control {
        flex-direction: row;
        align-items: center;
        gap: 0.3rem;
    }

    .parameter-control label {
        min-width: 50px;
        text-align: left;
        font-size: 0.7rem;
    }
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
    font-style: italic;
}

/* Content sections */
.content {
    margin-bottom: 4rem;
}

.content h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 2.5rem 0 1rem 0;
    color: var(--section-title);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.content h2:first-child {
    margin-top: 0;
}

.content p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* Links */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Project sections */
.project-category {
    margin-bottom: 2rem;
}

.project-category h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--section-title);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.project-item {
    margin-bottom: .5rem;
    padding: 0.25rem 0;
}

.project-item:last-child {
    margin-bottom: 0;
}

.project-link {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--link-color);
    text-decoration: none;
    display: block;
    margin-bottom: 0.3rem;
    transition: color 0.3s ease;
}

.project-link:hover {
    text-decoration: underline;
}

.project-description {
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

/* Back link */
.back-link {
    margin-top: 2rem;
    padding-top: 2rem;
    margin-bottom: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    transition: border-color 0.3s ease;
}

.back-link a {
    color: var(--nav-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-link a:hover {
    color: var(--nav-text);
    text-decoration: underline;
}

/* Sidebar projects */
.sidebar-projects-title {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--section-title);
    border-bottom: 1px solid var(--border-medium);
    padding-bottom: 0.5rem;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.sidebar-project-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    transition: border-color 0.3s ease;
}

.sidebar-project-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    background: var(--special-bg);
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.5rem;
    transition: background-color 0.3s ease;
}

.sidebar-project-link {
    font-size: 1rem;
    font-weight: 500;
    color: var(--link-color);
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.sidebar-project-link:hover {
    text-decoration: underline;
}

.sidebar-project-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.sidebar-project-item:last-child .sidebar-project-link {
    color: var(--link-color);
    font-weight: 600;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding-top: 100px;
    }

    /* Fullscreen landing page mobile adjustments */
    body.fullscreen-landing {
        padding-top: 0;
    }

    /* Mobile system picker adjustments */
    .system-picker {
        top: 120px;
        right: 15px;
        padding: 0.4rem 0.8rem;
    }

    .system-picker label {
        font-size: 0.8rem;
    }

    .system-picker select {
        font-size: 0.8rem;
        padding: 0.3rem 0.6rem;
        min-width: 130px;
    }

    .nav-container {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        max-width: none;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
        flex: 1;
    }

    .dark-mode-toggle {
        margin-left: 1rem;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .nav-links a {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    main {
        padding: 0 1rem;
    }

    .base-header {
        aspect-ratio: 3 / 1;
        max-height: 180px;
        margin-bottom: 1.5rem;
    }

    /* Maintain fullscreen behavior on mobile */
    .fullscreen-header {
        height: 100vh !important;
        max-height: none !important;
        aspect-ratio: unset !important;
        margin-bottom: 0 !important;
    }

    .dynamic-header::after {
        height: 30px;
    }

    .header-overlay h1 {
        font-size: 2.5rem;
    }

    .homepage-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .projects-sidebar {
        order: -1; /* Show projects above main content on mobile */
        position: static;
        padding: 1.5rem;
    }

    body {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    body.fullscreen-landing {
        padding-top: 0;
    }

    .equation-box {
        top: 10px;
        left: 10px;
        padding: 10px 12px;
        max-width: 220px;
    }

    .equation-title {
        font-size: 0.65rem;
        margin-bottom: 4px;
    }

    /* Smaller mobile system picker */
    .system-picker {
        top: 110px;
        right: 12px;
        padding: 0.3rem 0.6rem;
    }

    .system-picker label {
        font-size: 0.75rem;
    }

    .system-picker select {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        min-width: 120px;
    }

    .header-overlay h1 {
        font-size: 2rem;
    }

    .nav-container {
        padding: 0.8rem;
    }

    .nav-links {
        gap: 0.8rem;
    }

    .nav-links a {
        font-size: 0.85rem;
    }

    .dark-mode-toggle {
        width: 32px;
        height: 32px;
        margin-left: 0.8rem;
    }

    .dark-mode-icon {
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    body.fullscreen-landing {
        padding-top: 0;
    }

    /* Smallest mobile system picker */
    .system-picker {
        top: 100px;
        right: 10px;
        padding: 0.25rem 0.5rem;
    }

    .system-picker label {
        display: none; /* Hide label on very small screens */
    }

    .system-picker select {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        min-width: 100px;
    }

    .nav-container {
        padding: 0.6rem 0.5rem;
    }

    .nav-links {
        gap: 0.5rem;
        justify-content: flex-start;
    }

    .nav-links a {
        font-size: 0.8rem;
    }

    .dark-mode-toggle {
        width: 30px;
        height: 30px;
        margin-left: 0.5rem;
    }

    .dark-mode-icon {
        font-size: 14px;
    }

    .header-overlay h1 {
        font-size: 1.8rem;
    }

    .base-header {
        aspect-ratio: 2.5 / 1;
        max-height: 150px;
    }

    /* Maintain fullscreen behavior on very small screens */
    .fullscreen-header {
        height: 100vh !important;
        max-height: none !important;
        aspect-ratio: unset !important;
        margin-bottom: 0 !important;
    }

    body {
        padding-top: 90px;
    }
}

/* CV-specific styles */
.cv-header {
    --header-bg-color: #1a1a1a;
    --header-border: 1px solid var(--border-color);
}

#dejongCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}


.cv-name {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.cv-contact-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.95rem;
}

.cv-contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.cv-contact-item a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.cv-contact-item a:hover {
    text-decoration: underline;
}

.cv-summary {
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: justify;
    transition: color 0.3s ease;
}

.cv-section {
    margin-bottom: 2.5rem;
}

.cv-section-title {
    font-size: 1.5rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    color: var(--section-title);
    transition: color 0.3s ease, border-color 0.3s ease;
}

.cv-job {
    margin-bottom: 2rem;
}

.cv-job-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.cv-company-location {
    font-weight: 600;
    color: var(--section-title);
    transition: color 0.3s ease;
}

.cv-job-title {
    font-style: italic;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.cv-job-date {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.cv-subsection {
    margin-bottom: 1.25rem;
}

.cv-subsection-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--section-title);
    transition: color 0.3s ease;
}

.cv-subsection ul {
    list-style-type: disc;
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.cv-subsection li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.cv-education-item {
    margin-bottom: 1.25rem;
}

.cv-education-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.3rem;
}

.cv-university {
    font-weight: 600;
    color: var(--section-title);
    transition: color 0.3s ease;
}

.cv-degree {
    font-style: italic;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.cv-publication {
    margin-bottom: 1.25rem;
}

.cv-publication-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--section-title);
    transition: color 0.3s ease;
}

.cv-publication-details {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-left: 0.5rem;
    transition: color 0.3s ease;
}

.cv-skills-list {
    line-height: 1.6;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* CV mobile responsiveness */
@media (max-width: 768px) {
    .cv-contact-info {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .cv-job-header,
    .cv-education-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .cv-name {
        font-size: 2rem;
    }
}

/* Interactive Controls for Dynamic Headers */
.henon-controls,
.tinkerbell-controls,
.dejong-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.controls-toggle {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    backdrop-filter: blur(10px);
    transition: background 0.2s ease;
}

.controls-toggle:hover {
    background: rgba(0, 0, 0, 0.85);
}


.control-group {
    margin-bottom: 16px;
}

.control-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
    opacity: 0.8;
    font-weight: 500;
}

.range-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.range-item {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 120px;
}

.control-group input[type="range"] {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group span {
    display: inline-block;
    width: 40px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    opacity: 0.8;
}

.controls-panel button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    transition: background 0.2s ease;
}

.controls-panel button:hover {
    background: rgba(255, 255, 255, 0.25);
}

@media (max-width: 768px) {
    .henon-controls,
    .tinkerbell-controls,
    .dejong-controls {
        top: 5px;
        right: 5px;
    }

    .controls-panel {
        min-width: 240px;
        padding: 12px;
    }

    .control-group input[type="range"] {
        width: 80px;
    }
}

@media (max-width: 360px) {
    .henon-controls,
    .tinkerbell-controls,
    .dejong-controls {
        top: 2px;
        right: 2px;
    }

    .controls-toggle {
        font-size: 14px;
        padding: 6px 10px;
    }
}