:root {
    --bg-body: #f5f7fa;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1a1a1a;
    --text-heading: #111111;
    --text-secondary: #555555;
    --text-tertiary: #333333;
    --text-muted: #666666;
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-text: #ffffff;
    --shadow-sidebar: rgba(0,0,0,0.02);
    --shadow-card: rgba(0,0,0,0.08);
    --shadow-hover: rgba(0,0,0,0.12);
    --overlay-bg: rgba(0,0,0,0.9);
    --overlay-backdrop: rgba(0,0,0,0.8);
    
    /* WIP Banner */
    --wip-bg: #fff3cd;
    --wip-border: #ffc107;
    --wip-text: #856404;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-body: #121212;
    --bg-sidebar: #1e1e1e;
    --bg-card: #1e1e1e;
    --text-main: #e0e0e0;
    --text-heading: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #cccccc;
    --text-muted: #888888;
    --accent-primary: #3b82f6;
    --accent-hover: #60a5fa;
    --shadow-sidebar: rgba(0,0,0,0.5);
    --shadow-card: rgba(0,0,0,0.3);
    --shadow-hover: rgba(0,0,0,0.5);
    --overlay-bg: rgba(0,0,0,0.95);
    
    /* WIP Banner Dark Mode */
    --wip-bg: #332b00;
    --wip-border: #665c0e;
    --wip-text: #fff3cd;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: rgba(0,0,0,0.05);
    color: var(--text-main);
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

html:not([data-theme="dark"]) .sun-icon {
    display: none;
}

html:not([data-theme="dark"]) .moon-icon {
    display: block;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 60px;
    left: 20px;
    z-index: 1001;
    background: var(--bg-sidebar);
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 2px 8px var(--shadow-card);
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: var(--bg-card);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-backdrop);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu Close Button */
.mobile-menu-close {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 11;
}

.mobile-menu-close:hover {
    background-color: rgba(0,0,0,0.05);
}

[data-theme="dark"] .mobile-menu-close:hover {
    background-color: rgba(255,255,255,0.1);
}

.mobile-menu-close svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-sidebar);
    padding: 60px 40px;
    border-right: none;
    box-shadow: 4px 0 24px var(--shadow-sidebar);
    position: fixed;
    top: 45px;
    height: calc(100vh - 45px);
    overflow-y: auto;
    z-index: 10;
    transition: background-color 0.3s, box-shadow 0.3s, transform 0.3s ease;
}

.sidebar h1 {
    font-size: 32px;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-heading);
}

.sidebar p {
    margin-bottom: 24px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-weight: 400;
}

.sidebar a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Social Links */
.social-links {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    align-items: center;
}

.social-icon {
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important; /* Force no underline */
}

.social-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.social-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.social-icon[aria-label="Upwork"] img,
.social-icon[aria-label="X"] img {
    border-radius: 6px;
}

.social-icon[aria-label="Upwork"],
.social-icon[aria-label="X"] {
    overflow: hidden;
    border-radius: 6px;
}

.social-icon:hover {
    color: var(--accent-primary);
    transform: translateY(-2px);
}

.social-icon:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Appointment Section */
.appointment-group {
    margin-top: 24px;
}

.appointment-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.appointment-options {
    display: flex;
    gap: 12px;
}

.appointment-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-primary);
    color: var(--accent-text) !important;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.appointment-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.appointment-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1);
}

/* Portfolio Grid */
.portfolio {
    margin-left: 320px;
    flex: 1;
    padding: 80px 60px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 60px;
    max-width: 1400px;
    margin: 0 auto;
}

.portfolio-item {
    aspect-ratio: 16 / 9;
    background: black;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px var(--shadow-card);
    will-change: top, left, width, height;
    position: relative;
    display: flex; /* Enable flex context for side-by-side layout */
}

.portfolio-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-hover);
}

.portfolio-item:focus-visible {
    outline: 3px solid var(--accent-primary);
    outline-offset: 4px;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-hover);
}

.video-wrapper {
    width: 100%; /* Fallback */
    height: 100%;
    position: relative;
    background: black;
    flex: 1; /* Allow video to take available space */
    min-width: 0; /* Allow shrinking if necessary */
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.3s;
    pointer-events: none;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.play-overlay svg {
    width: 32px;
    height: 32px;
    fill: white;
    margin-left: 4px; /* Visual optical adjustment for play triangle */
}

.portfolio-item:hover .play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(0, 0, 0, 0.8);
}

/* Hide play button when expanded */
.portfolio-item.expanded .play-overlay {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.portfolio-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    display: block;
}

.project-details {
    display: block;
    width: 0;
    padding: 0;
    background: var(--bg-card);
    opacity: 0;
    overflow: hidden; /* Hide content during transition */
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                padding 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.3s ease; /* Faster opacity fade out on collapse */
}

/* Prevent text reflow during expansion by enforcing minimum width on children */
.project-details > * {
    min-width: 270px; /* 350px width - 80px padding */
}

.portfolio-item.expanded .project-details {
    width: 350px; /* Fixed width for sidebar */
    padding: 40px;
    opacity: 1;
    border-left: 1px solid rgba(0,0,0,0.05);
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                padding 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.4s ease 0.2s; /* Delay opacity on expand */
}

.portfolio-item.expanded.collapsing .project-details {
    width: 0;
    padding: 0;
    opacity: 0;
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                padding 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.3s ease;
}

.project-details h3 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-heading);
}

.project-meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-description {
    line-height: 1.7;
    color: var(--text-main);
}

/* Remove old keyframe animation */
/* @keyframes fadeInDetails ... removed */

.booking-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.booking-overlay.active {
    display: flex;
}

.booking-content {
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: var(--bg-card);
    border-radius: 8px;
    position: relative;
    animation: fadeInScale 0.3s ease-out;
    overflow: hidden;
}

.booking-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    line-height: 1;
    transition: all 0.2s;
    border-radius: 50%;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.booking-close:hover {
    background: rgba(0,0,0,0.9);
    transform: scale(1.1);
}

.booking-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.booking-fallback {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

.booking-fallback a {
    color: #0066cc; /* Keep as fallback specific color or use accent */
    text-decoration: none;
    font-weight: 500;
}

.booking-fallback a:hover {
    text-decoration: underline;
}

/* Video Expansion Styles */
.video-overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0s linear 0.5s;
    z-index: 998;
    cursor: pointer;
}

.video-overlay-backdrop.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0s linear 0s;
}

.portfolio-item.expanded {
    position: fixed;
    z-index: 999;
    cursor: default;
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin: 0; /* Reset any margins */
    display: flex;
    background: var(--bg-card);
}

.portfolio-item.expanded .video-wrapper {
    flex: 1;
    height: 100%;
}

.portfolio-item.expanded video {
    pointer-events: auto;
}

/* Mobile Layout for Expanded View */
@media (max-width: 900px) {
    .portfolio-item {
        flex-direction: column;
    }

    .portfolio-item.expanded {
        flex-direction: column;
    }
    
    .portfolio-item.expanded .video-wrapper {
        flex: none;
        width: 100%;
        aspect-ratio: 16 / 9;
        height: auto;
    }
    
    .project-details {
        width: 100%; /* Reset width constraint */
        height: 0; /* Animate height on mobile */
        padding: 0;
        opacity: 0;
        transition: height 0.6s cubic-bezier(0.25, 1, 0.5, 1),
                    padding 0.6s cubic-bezier(0.25, 1, 0.5, 1),
                    opacity 0.3s ease;
    }
    
    .project-details > * {
        min-width: 0; /* Reset min-width constraint */
    }
    
    .portfolio-item.expanded .project-details {
        width: 100%;
        height: auto; /* Let it grow naturally, or fix if animation needed */
        padding: 24px;
        border-left: none;
        border-top: 1px solid rgba(0,0,0,0.05);
        flex: 1;
        opacity: 1;
        transition: height 0.6s cubic-bezier(0.25, 1, 0.5, 1),
                    padding 0.6s cubic-bezier(0.25, 1, 0.5, 1),
                    opacity 0.4s ease 0.2s;
    }

    .portfolio-item.expanded.collapsing .project-details {
        width: 100%;
        height: 0;
        padding: 0;
        opacity: 0;
    }
}

.portfolio-item-placeholder {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 768px) {
    .booking-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .booking-overlay {
        padding: 0;
    }
}

/* Work in Progress Indicator */
.wip-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--wip-bg);
    border-bottom: 1px solid var(--wip-border);
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--wip-text);
    z-index: 999;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.wip-banner strong {
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .portfolio {
        margin-left: 280px;
        padding: 60px 40px;
    }
    
    .portfolio-grid {
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .wip-banner {
        font-size: 12px;
        padding: 10px 16px;
    }
    
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Show mobile menu close button */
    .mobile-menu-close {
        display: flex;
    }
    
    .container {
        flex-direction: column;
    }
    
    /* Hide sidebar by default on mobile, slide in when active */
    .sidebar {
        position: fixed;
        top: 45px;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: calc(100vh - 45px);
        padding: 40px 24px;
        transform: translateX(-100%);
        z-index: 1000;
        box-shadow: 4px 0 24px var(--shadow-sidebar);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .portfolio {
        margin-left: 0;
        padding: 40px 24px;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .play-overlay {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(1);
        margin: 0;
    }
    
    .portfolio-item:hover .play-overlay {
        transform: translate(-50%, -50%) scale(1.1);
    }
}
