/* Modern CSS Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* CSS Variables for theming */
:root {
    --color-bg: #0a0e27;
    --color-surface: rgba(20, 25, 50, 0.85);
    --color-primary: #00d9ff;
    --color-secondary: #ff006e;
    --color-accent: #8338ec;
    --color-text: #e8f0ff;
    --color-text-dim: #a0b0d0;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    --border-radius: 12px;
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-glow: 0 0 20px rgba(0, 217, 255, 0.3);
    --backdrop-blur: blur(12px);
}

/* Base styles */
html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Canvas */
#fluid-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: crosshair;
    touch-action: none;
    /* Prevent default touch behaviors */
}

/* Loading indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.loading.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 217, 255, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading p {
    color: var(--color-text-dim);
    font-size: 14px;
    letter-spacing: 0.5px;
}

/* UI Overlay */
.ui-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Unified Sticky Header for About/Blog pages */
.unified-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: rgba(20, 25, 50, 0.9);
    /* Slightly more opaque for readability */
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 217, 255, 0.5);
}

.unified-header .brand {
    display: flex;
    flex-direction: column;
}

.unified-header h1 {
    font-size: 1.5rem;
    /* More compact than main splash */
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.unified-header .subtitle {
    font-size: 0.8rem;
    margin: 0;
    opacity: 0.8;
}

/* Nav inside header */
.unified-header .nav-buttons {
    display: flex;
    gap: 12px;
}

/* Reusing existing .nav-link styles but ensuring no fixed positioning */
.unified-header .nav-link {
    /* Styles inherited from global .nav-link, layout handled by flex parent */
}

/* Existing Header Styles (kept for Main Page) */
.header {
    padding: 30px 40px;
    background: linear-gradient(180deg, var(--color-surface) 0%, transparent 100%);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
}

.header h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: clamp(0.875rem, 2vw, 1rem);
    color: var(--color-text-dim);
    font-weight: 400;
}


/* Navigation */
.nav {
    position: fixed;
    top: 30px;
    right: 40px;
    display: flex;
    gap: 12px;
    pointer-events: auto;
    z-index: 20;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--color-surface);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--border-radius);
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.nav-link:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.nav-link .icon {
    width: 18px;
    height: 18px;
}

/* Simulation Controls (positioned separately from main nav) */
.simulation-controls {
    position: fixed;
    bottom: 30px;
    right: 40px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    pointer-events: auto;
    z-index: 20;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--color-surface);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--border-radius);
    color: var(--color-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.control-btn:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.control-btn .icon {
    width: 18px;
    height: 18px;
}


/* Info Panel */
.info-panel {
    position: fixed;
    top: 50%;
    right: 40px;
    transform: translateY(-50%);
    width: min(400px, calc(100vw - 80px));
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
    background: var(--color-surface);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 100;
    pointer-events: auto;
    transition: all var(--transition-smooth);
}

.info-panel.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(20px);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--color-text-dim);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.close-btn:hover {
    color: var(--color-primary);
}

.info-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--color-primary);
}

.info-panel h3 {
    font-size: 1.125rem;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--color-text);
}

.info-panel p {
    line-height: 1.6;
    color: var(--color-text-dim);
    margin-bottom: 12px;
}

.info-panel ul {
    list-style: none;
    margin: 12px 0;
}

.info-panel li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    color: var(--color-text-dim);
    line-height: 1.5;
}

.info-panel li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--color-primary);
}

.info-panel strong {
    color: var(--color-text);
    font-weight: 600;
}

.info-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.info-footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.info-footer a:hover {
    color: var(--color-secondary);
}

/* Performance Stats */
.stats {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 16px 20px;
    background: var(--color-surface);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--border-radius);
    font-family: var(--font-mono);
    font-size: 12px;
    z-index: 10;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}

.stats.hidden {
    opacity: 0;
    visibility: hidden;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0;
}

.stat-label {
    color: var(--color-text-dim);
}

.stat-value {
    color: var(--color-primary);
    font-weight: 600;
}

/* Scrollbar styling for info panel */
.info-panel::-webkit-scrollbar {
    width: 8px;
}

.info-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.info-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 4px;
}

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

/* Mobile optimizations */
@media (max-width: 768px) {
    .header {
        padding: 20px 20px;
    }

    /* Unified Header - Stack vertically on mobile */
    .unified-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 15px 20px;
        gap: 15px;
    }

    .unified-header .brand {
        width: 100%;
    }

    .unified-header h1 {
        font-size: 1.25rem;
    }

    .unified-header .subtitle {
        font-size: 0.7rem;
    }

    .unified-header .nav-buttons {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .unified-header .nav-link {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 auto;
        justify-content: center;
        min-width: fit-content;
    }

    .unified-header .nav-link .icon {
        width: 14px;
        height: 14px;
    }

    /* Hide "Old Website" text on very small screens, keep icon */
    @media (max-width: 480px) {
        .unified-header .nav-link {
            padding: 8px 10px;
            font-size: 11px;
        }
    }

    .nav {
        top: auto;
        bottom: 20px;
        right: 20px;
        flex-direction: column;
    }

    .nav-link {
        padding: 10px 16px;
        font-size: 13px;
    }

    .simulation-controls {
        bottom: 20px;
        left: 20px;
        right: auto;
    }

    .control-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .info-panel {
        right: 20px;
        left: 20px;
        width: auto;
        max-height: 70vh;
        padding: 24px;
    }

    .stats {
        bottom: 100px;
        font-size: 11px;
    }

    /* About page mobile */
    .about-container {
        grid-template-columns: 1fr;
        padding: 20px;
        top: auto;
        position: relative;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
    }

    .profile-name {
        font-size: 1.5rem;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #00f;
        --color-text: #fff;
        --color-bg: #000;
    }
}

/* Settings Panel */
.panel {
    position: fixed;
    top: 50%;
    right: 40px;
    transform: translateY(-50%);
    width: min(380px, calc(100vw - 80px));
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 100;
    pointer-events: auto;
    transition: all var(--transition-smooth);
}

.panel.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%) translateX(20px);
}

/* Sticky panel header */
.panel-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 30px 20px 30px;
    background: var(--color-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--color-primary);
}

/* Scrollable panel content */
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 30px 30px 30px;
}

/* Scrollbar styling for settings panel */
.panel-content::-webkit-scrollbar {
    width: 8px;
}

.panel-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 4px;
}

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

.panel h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--color-primary);
}

.settings-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-section h3 {
    font-size: 0.875rem;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    font-weight: 600;
}

.checkbox-label {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    color: var(--color-text-dim);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.checkbox-label:hover {
    color: var(--color-text);
}

.slider-control {
    margin-bottom: 20px;
}

.slider-control label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--color-text-dim);
    font-size: 0.875rem;
}

.slider-control label span {
    color: var(--color-primary);
    font-weight: 600;
    font-family: var(--font-mono);
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-text);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.5);
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.7);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-text);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 217, 255, 0.5);
    transition: all 0.2s;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(0, 217, 255, 0.7);
}

.btn-secondary {
    width: 100%;
    padding: 12px 20px;
    background: transparent;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

.btn-secondary:hover {
    background: rgba(0, 217, 255, 0.1);
    transform: translateY(-2px);
}

/* Scrollbar for settings panel */
.panel::-webkit-scrollbar {
    width: 8px;
}

.panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

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

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

/* About Me Page Styles */
.about-container {
    position: absolute;
    top: 80px;
    /* Below nav */
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    width: 100%;
    /* max-width: 1200px; Removed to fill screen */
    margin: 0;
    padding: 40px;
    display: grid;
    grid-template-columns: 350px 1fr;
    /* Slightly wider sidebar */
    gap: 60px;
    /* More breathing room */
    overflow-y: auto;
    z-index: 5;
    /* Below UI overlay but above canvas */
    pointer-events: auto;
}

.about-container::-webkit-scrollbar {
    width: 8px;
}

.about-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.about-container::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.3);
    border-radius: 4px;
}

/* Profile Sidebar */
.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    align-items: center;
    text-align: center;
    background: transparent;
    /* Remove boxy background */
    backdrop-filter: none;
    border: none;
    padding: 0;
    height: fit-content;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(0, 217, 255, 0.3);
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.2);
}

.profile-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.profile-title {
    font-size: 1rem;
    color: var(--color-primary);
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    transition: all 0.2s;
}

.social-btn:hover {
    background: var(--color-primary);
    color: #000;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 217, 255, 0.3);
}

.download-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    width: 100%;
    background: transparent;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.download-btn:hover {
    background: rgba(0, 217, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 217, 255, 0.2);
}

.download-btn.primary {
    background: var(--color-primary);
    color: #000;
    border: none;
}

.download-btn.primary:hover {
    background: var(--color-secondary);
    color: #fff;
}

/* CV Content / Embed */
.cv-section {
    background: var(--color-surface);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: var(--border-radius);
    padding: 2px;
    /* Small padding for the iframe border look */
    height: 100%;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
}

.cv-embed {
    width: 100%;
    height: 100%;
    min-height: 800px;
    border: none;
    border-radius: calc(var(--border-radius) - 2px);
    background: #fff;
    /* PDF background usually white */
}

/* Fallback if embedding fails or on mobile */
.cv-fallback {
    padding: 40px;
    text-align: center;
    color: var(--color-text-dim);
}

@media (max-width: 900px) {
    .about-container {
        grid-template-columns: 1fr;
        padding: 20px;
        top: 60px;
    }

    .profile-section {
        margin-bottom: 20px;
    }

    .cv-embed {
        min-height: 500px;
    }
}

/* Overrides for Technical Report Style (Full Width) */
.cv-section {
    background: transparent !important;
    backdrop-filter: none !important;
    border: none !important;
    padding: 0 !important;
    min-height: 85vh;
}

.cv-embed {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    background: #fff;
}

/* Typography Overrides for consistency with Blog */
h2 {
    font-size: 2rem;
    color: var(--color-primary);
    /* Colorful Cyan Header */
    margin-bottom: 24px;
    margin-top: 48px;
}

h3 {
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 16px;
    margin-top: 32px;
}

section {
    margin-bottom: 60px;
}

/* Experience List Indentation */
.experience-item ul {
    padding-left: 20px;
    list-style-position: outside;
    margin-left: 4px;
    /* Slight extra bump */
}