/* ============================================
   High-Performance Split-Screen Portfolio CSS
   Inspired by Brittany Chiang's Design
   - Dark theme with teal accents
   - Fixed left sidebar, scrollable right content
   - GPU-accelerated animations
   - Zero CLS (Cumulative Layout Shift)
   ============================================ */

/* ============================================
   CSS Variables - Dark Theme
   ============================================ */
:root {
    /* Colors - Deep Logic High-Contrast Palette */
    --primary-color: #2F81F7;
    /* GitHub Blue (Accent) */
    --primary-hover: #58a6ff;
    /* Lighter Blue */
    --text-primary: #E6EDF3;
    /* Off-White (High Contrast) */
    --text-secondary: #8B949E;
    /* Muted Grey */
    --text-muted: #6e7681;
    /* Darker Grey */
    --bg-primary: #0B0E14;
    /* Soft Black (Main BG) */
    --bg-secondary: #161B22;
    /* Code BG (Cards) */
    --bg-hover: #1f2937;
    --border-color: #30363d;
    --accent-color: #2F81F7;
    --success-color: #3FB950;
    /* Success Green */

    /* Spacing */
    --section-spacing: 6rem;

    /* Transitions - GPU optimized */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================
   Base Styles
   ============================================ */
/* scroll-behavior handled by JavaScript for better control */

body {
    overflow-x: hidden;
}

::selection {
    background-color: var(--primary-color);
    color: var(--bg-primary);
}

/* ============================================
   Split Screen Layout
   ============================================ */
.split-container {
    display: flex;
    min-height: 100vh;
}

/* Left Sidebar - Fixed */
.left-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 50%;
    height: 100vh;
    padding: 6rem 4rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 10;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* Right Content - Scrollable */
.right-content {
    margin-left: 50%;
    width: 50%;
    padding: 6rem 4rem 4rem;
}

/* ============================================
   Typography
   ============================================ */
.header-content h1 {
    font-size: clamp(2.5rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.header-content .subtitle {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.header-content .tagline {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.7;
}

.section-heading {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    padding: 1.5rem 0;
    z-index: 5;
}

/* ============================================
   Navigation - Left Sidebar
   ============================================ */
.main-nav {
    margin-top: 2rem;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: color 0.4s var(--ease-natural);
    position: relative;
}

.nav-link::before {
    content: '';
    display: block;
    width: 2rem;
    height: 1px;
    background-color: var(--text-muted);
    transition: width 0.5s var(--ease-natural),
        background-color 0.4s var(--ease-natural);
    will-change: width, background-color;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--accent-color);
}

.nav-link:hover::before {
    width: 4rem;
    background-color: var(--text-primary);
}

.nav-link.active::before {
    width: 4rem;
    background-color: var(--accent-color);
}

/* ============================================
   Social Links
   ============================================ */
.social-links {
    display: flex;
    gap: 1.5rem;
    margin-top: auto;
}

.social-link {
    color: var(--text-muted);
    transition: color 0.4s var(--ease-natural),
        transform 0.4s var(--ease-natural);
    will-change: transform;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    text-decoration: none;
}

.social-link:hover {
    color: var(--text-primary);
    transform: translateY(-4px);
}

.social-link:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.social-link svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   Content Sections
   ============================================ */
/* Complex linear easing for natural motion */
:root {
    --ease-natural: linear(0, 0.0002, 0.001, 0.0022, 0.0039, 0.0062, 0.0089, 0.012, 0.0157, 0.0199, 0.0245, 0.0296, 0.0351, 0.0411,
            0.0476, 0.0545, 0.0618, 0.0696, 0.0778, 0.0865, 0.0955, 0.1049, 0.1147, 0.1249, 0.1355, 0.1464, 0.1577,
            0.1693, 0.1813, 0.1935, 0.2061, 0.219, 0.2321, 0.2455, 0.2591, 0.273, 0.2871, 0.3014, 0.3159, 0.3306,
            0.3455, 0.3605, 0.3757, 0.3909, 0.4063, 0.4218, 0.4373, 0.4529, 0.4686, 0.4843, 0.5, 0.5157, 0.5314,
            0.5471, 0.5627, 0.5782, 0.5937, 0.6091, 0.6243, 0.6395, 0.6545, 0.6694, 0.6841, 0.6986, 0.7129, 0.727,
            0.7409, 0.7545, 0.7679, 0.781, 0.7939, 0.8065, 0.8187, 0.8307, 0.8423, 0.8536, 0.8645, 0.8751, 0.8853,
            0.8951, 0.9045, 0.9135, 0.9222, 0.9304, 0.9382, 0.9455, 0.9524, 0.9589, 0.9649, 0.9704, 0.9755, 0.9801,
            0.9843, 0.988, 0.9911, 0.9938, 0.9961, 0.9978, 0.999, 0.9998, 1);
}

.content-section {
    margin-bottom: var(--section-spacing);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s var(--ease-natural) forwards;
}

.content-section:nth-child(1) {
    animation-delay: 0.1s;
}

.content-section:nth-child(2) {
    animation-delay: 0.2s;
}

.content-section:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Experience Section
   ============================================ */
.experience-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    transition: background-color 0.4s var(--ease-natural),
        box-shadow 0.4s var(--ease-natural),
        transform 0.3s var(--ease-natural);
    cursor: pointer;
}

.experience-item:hover {
    background-color: var(--bg-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.experience-date {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding-top: 0.25rem;
}

.experience-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition-base);
}

.experience-item:hover .experience-title {
    color: var(--primary-color);
}

.experience-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.experience-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.external-link-icon {
    width: 16px;
    height: 16px;
    opacity: 0;
    transform: translate(0, 0);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.experience-item:hover .external-link-icon,
.project-item:hover .external-link-icon {
    opacity: 1;
    transform: translate(4px, -4px);
}

/* ============================================
   Tech Tags
   ============================================ */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
    background-color: rgba(94, 234, 212, 0.1);
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    transition: background-color var(--transition-base);
}

.tech-tag:hover {
    background-color: rgba(94, 234, 212, 0.2);
}

/* ============================================
   Projects Section
   ============================================ */
.project-item {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    transition: background-color 0.4s var(--ease-natural),
        box-shadow 0.4s var(--ease-natural),
        transform 0.3s var(--ease-natural);
    cursor: pointer;
}

.project-item:hover {
    background-color: var(--bg-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.project-image {
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: border-color var(--transition-base);
    background-color: var(--bg-secondary);
    aspect-ratio: 400 / 225;
}

.project-item:hover .project-image {
    border-color: var(--text-muted);
}

.project-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform var(--transition-slow), opacity 0.3s ease-out;
    will-change: transform;
    opacity: 0;
}

.project-image img[data-loaded="true"] {
    opacity: 1;
}

.project-item:hover .project-image img {
    transform: scale(1.05);
}

.project-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition-base);
}

.project-item:hover .project-title {
    color: var(--primary-color);
}

.project-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* ============================================
   View Resume Link
   ============================================ */
.view-resume {
    margin-top: 2rem;
}

.resume-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-base);
}

.resume-link:hover {
    color: var(--primary-color);
}

.resume-link svg {
    transition: transform var(--transition-base);
}

.resume-link:hover svg {
    transform: translateX(4px);
}

/* ============================================
   Footer
   ============================================ */
.content-footer {
    margin-top: 8rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.content-footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.content-footer strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ============================================
   Links
   ============================================ */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--primary-hover);
}

/* ============================================
   Scrollbar Styling
   ============================================ */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {

    .left-sidebar,
    .right-content {
        width: 100%;
        padding: 3rem 2rem;
    }

    .left-sidebar {
        position: relative;
        height: auto;
        min-height: auto;
    }

    .right-content {
        margin-left: 0;
    }

    .split-container {
        flex-direction: column;
    }

    .sidebar-content {
        gap: 2rem;
    }

    .main-nav {
        margin-top: 1rem;
    }

    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .social-links {
        margin-top: 2rem;
    }

    .section-heading {
        position: static;
    }

    .experience-item,
    .project-item {
        grid-template-columns: 1fr;
    }

    .experience-date {
        padding-top: 0;
    }
}

@media (max-width: 640px) {

    .left-sidebar,
    .right-content {
        padding: 2rem 1.5rem;
    }

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

    .header-content .subtitle {
        font-size: 1.125rem;
    }

    .project-image {
        max-width: 100%;
    }
}

/* ============================================
   Accessibility - Focus States
   ============================================ */
a:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 4px;
}

a:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   Performance Optimizations
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

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

/* ============================================
   GPU Acceleration Hints
   ============================================ */
.nav-link::before,
.social-link,
.project-image img,
.experience-item,
.project-item {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .left-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        page-break-after: always;
    }

    .right-content {
        margin-left: 0;
        width: 100%;
    }

    .social-links,
    .main-nav {
        display: none;
    }

    body {
        color: #000;
        background: #fff;
    }
}