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

/* Override default browser link styles - using specific selectors instead of !important */
a {
    color: inherit;
    text-decoration: none;
}

a:visited {
    color: inherit;
    text-decoration: none;
}

a:link {
    color: inherit;
    text-decoration: none;
}

/* Mobile menu links - specific selector for white color */
.mobile-offcanvas-menu nav a,
.mobile-offcanvas-menu nav a:link,
.mobile-offcanvas-menu nav a:visited {
    color: #ffffff;
}

/* Ensure nav elements don't show default browser styles */
nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav li {
    list-style: none;
    padding: 0;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #ffffff;
    color: #000000;
    display: flex;
    min-height: 100vh;
    height: 100vh;
}

/* Typography - Serif for headers, sans-serif for body */
h1,
.about-title,
.sidebar-brand {
    font-family: 'Playfair Display', 'Lora', Georgia, serif;
    font-weight: 600;
}

/* Body text remains sans-serif for readability */
p,
.about-text,
.nav-links {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Utility classes to replace !important - use these for state management */
.is-hidden {
    display: none;
}

.is-visible {
    display: block;
}

.is-flex {
    display: flex;
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

.mobile-layout {
    display: block;
    height: auto;
}

.mobile-layout body {
    overflow-x: hidden;
}

@media (max-width: 768px) {
    body {
        display: block;
        height: auto;
        overflow-x: hidden;
    }

    /* Mobile-specific overrides using higher specificity instead of !important */
    body .main-container.mobile-hidden {
        display: none;
    }

    body .menu-section.mobile-hidden {
        display: none;
    }

    body .gallery-section.mobile-hidden {
        display: none;
    }

    body .mobile-header.mobile-visible {
        display: block;
        position: relative;
        z-index: 100;
        width: 100%;
        margin: 0;
        padding: 20px;
    }

    body .mobile-gallery-list.mobile-visible {
        display: flex;
        flex-direction: column;
        padding: 0;
        align-items: center;
        width: 100%;
        position: relative;
        margin: 0;
        left: 0;
        right: 0;
        top: 0;
        background: #ffffff;
        clear: both;
    }

    body .mobile-gallery-list.mobile-hidden {
        display: none;
    }

    body .mobile-gallery-item.mobile-layout-item {
        width: 100%;
        max-width: 100%;
        padding: 0 20px;
        margin-bottom: 10px;
        display: flex;
        justify-content: center;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
    }

    body .mobile-gallery-item.mobile-layout-item:last-child {
        margin-bottom: 0;
    }

    body .mobile-gallery-item.mobile-layout-item img {
        width: 100%;
        max-width: 100%;
        height: auto;
        display: block;
    }

    body .about-section.mobile-layout-section {
        position: relative;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        padding: 80px 30px 30px;
        margin: 0;
        background: #1a1a1a;
        min-height: 100vh;
    }

    body .works-section.mobile-layout-section {
        position: relative;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        padding: 80px 20px 30px;
        margin: 0;
        background: #ffffff;
        min-height: 100vh;
    }

    body .project-detail-section.mobile-layout-section {
        position: relative;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        padding: 80px 20px 30px;
        margin: 0;
        background: #ffffff;
        min-height: 100vh;
    }

    body .mobile-menu-btn.mobile-visible {
        display: block;
        position: relative;
        top: auto;
        right: auto;
        visibility: visible;
        opacity: 1;
        z-index: 1002;
        margin-left: auto;
        flex-shrink: 0;
        align-self: flex-start;
        order: 2;
    }
}

:root {
    --color-background: #ffffff;
    --color-surface: #f5f5f5;
    --color-text: #000000;
    --color-text-light: #666666;
    --color-border: transparent;
    --color-primary: #000000;
    --color-hover: #333333;
    --color-background-dark: #1a1a1a;
    --color-text-dark: #ffffff;
    --color-text-light-dark: #b0b0b0;
    --easing-default: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.2s var(--easing-default);
    --transition-medium: 0.3s var(--easing-default);
    --transition-slow: 0.4s var(--easing-default);
}

.main-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

@media (max-width: 768px) {
    .main-container {
        display: none;
    }

    .main-container.mobile-visible {
        display: flex;
    }
}

/* Right Side - Image Gallery */
.gallery-section {
    margin-left: 200px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    position: relative;
    background: #ffffff;
    animation: fadeIn var(--transition-medium) var(--easing-default);
    z-index: 0;
}

.gallery-image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.gallery-image-click-area {
    position: absolute;
    top: 0;
    bottom: 80px;
    width: 50%;
    z-index: 2;
    transition: background-color var(--transition-fast);
}

.gallery-image-left {
    left: 0;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E") 12 12, w-resize;
}

.gallery-image-right {
    right: 0;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M12 5l7 7-7 7'/%3E%3C/svg%3E") 12 12, e-resize;
}

.gallery-image-click-area:hover {
    background-color: transparent;
}

.gallery-image-click-area:active {
    background-color: transparent;
}

/* Ensure click areas don't cover the controls */
.gallery-controls {
    position: relative;
    z-index: 10;
}

.gallery-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-image-container .gallery-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
}

.gallery-image {
    max-width: 80%;
    max-height: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    opacity: 1;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: opacity, transform;
    /* Optimize for animations (sam-gregg.com style) */
    transform: translate(-50%, -50%) scale(1) translateZ(0);
    /* Force GPU acceleration */
    backface-visibility: hidden;
    /* Improve rendering performance */
}

/* Loading Spinner */
.image-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 2;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.gallery-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: none;
    background: #f5f5f5;
    z-index: 10;
}

.gallery-nav {
    display: flex;
    gap: 24px;
}

.gallery-nav button {
    font-size: 13px;
    color: #666666;
    background: none;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--transition-fast), transform var(--transition-fast);
    padding: 0;
    position: relative;
}

.gallery-nav button:hover:not(:disabled) {
    color: #000000;
    transform: translateY(-1px);
}

.gallery-nav button:active:not(:disabled) {
    transform: translateY(0);
}

.gallery-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.image-counter {
    font-size: 13px;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.image-counter span {
    display: inline-block;
    padding: 2px 4px;
    margin: 0 1px;
    border-radius: 2px;
    transition: color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
    cursor: pointer;
}

.image-counter span:hover {
    color: #000000;
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
    text-decoration: underline;
}

/* Left Side - Navigation Menu */
.menu-section {
    width: 200px;
    padding: 40px 32px;
    display: flex;
    flex-direction: column;
    gap: 40px;
    border-right: none;
    background: #ffffff;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.menu-section.dark {
    background: var(--color-background-dark);
}

.sidebar-brand {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--color-text);
}

.sidebar-brand a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.sidebar-brand a:hover {
    opacity: 0.6;
}

.menu-section.dark .sidebar-brand,
.menu-section.dark .sidebar-brand a {
    color: var(--color-text-dark);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-links li {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links a {
    font-size: 13px;
    color: var(--color-text-light);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--transition-fast);
    display: block;
    position: relative;
    padding-bottom: 2px;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-primary);
    transition: width var(--transition-medium);
}

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

.nav-links a:hover::after {
    width: 100%;
}

.nav-links a.active {
    color: var(--color-primary);
    font-weight: 500;
}

.menu-section.dark .nav-links a {
    color: var(--color-text-light-dark);
}

.menu-section.dark .nav-links a:hover,
.menu-section.dark .nav-links a.active {
    color: var(--color-text-dark);
}

.nav-social {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.nav-social-link {
    display: inline-block;
    color: var(--color-text-light);
    transition: color var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
    opacity: 0.7;
    cursor: pointer;
    pointer-events: auto;
    text-decoration: none;
}

.nav-social-link:hover {
    color: var(--color-primary);
    opacity: 1;
    transform: scale(1.1);
}

.nav-social-link svg {
    display: block;
    pointer-events: none;
}

.menu-section.dark .nav-social-link {
    color: var(--color-text-light-dark);
}

.menu-section.dark .nav-social-link:hover {
    color: var(--color-text-dark);
}

.sidebar-footer {
    margin-top: auto;
    font-size: 12px;
    color: var(--color-text-light);
}

.sidebar-footer a {
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

.sidebar-footer a:hover {
    opacity: 0.7;
}

/* Hide show thumbnails button on About page */
.menu-section.dark .sidebar-footer {
    display: none;
}

.sidebar-footer a {
    color: var(--color-text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.menu-section.dark .sidebar-footer {
    color: var(--color-text-light-dark);
}

.menu-section.dark .sidebar-footer a {
    color: var(--color-text-light-dark);
}

.menu-section.dark .sidebar-footer a:hover {
    color: var(--color-text-dark);
}

/* Thumbnail View */
.thumbnails-grid {
    display: none;
    padding: 40px;
    width: calc(100% - 200px);
    min-height: 100vh;
    position: fixed;
    left: 200px;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    box-sizing: border-box;
    z-index: 2;
    margin: 0;
    padding-left: 0;
    /* CSS Column Layout - Replaces masonry */
    column-count: 4;
    column-gap: 20px;
}

.thumbnails-grid.active {
    display: block;
}

.thumbnail-item {
    width: 100%;
    margin-bottom: 20px;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 1;
    transition: opacity var(--transition-fast), transform var(--transition-medium), box-shadow var(--transition-medium);
    background: transparent;
    padding: 0;
    box-sizing: border-box;
    display: inline-block;
    position: relative;
    animation: fadeInUp 0.4s var(--easing-default) backwards;
    will-change: transform, opacity;
    /* Optimize for animations (sam-gregg.com style) */
    transform: translateZ(0);
    /* Force GPU acceleration */
    break-inside: avoid;
    page-break-inside: avoid;
}

.thumbnail-item:hover {
    opacity: 1;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.thumbnail-item.active {
    opacity: 1;
    border: 2px solid #000000;
    box-sizing: border-box;
}

.thumbnail-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    will-change: transform, opacity;
    /* Optimize for animations */
    transform: translateZ(0);
    /* Force GPU acceleration */
    backface-visibility: hidden;
    /* Improve rendering performance */
    cursor: pointer;
}

/* Thumbnail Preview Overlay */
.thumbnail-preview {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
    padding: 40px;
}

.thumbnail-preview-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: default;
}

.thumbnail-preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
    padding: 0;
}

.thumbnail-preview-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .menu-section {
        width: 200px;
        padding: 40px 32px;
    }

    .gallery-section {
        margin-left: 200px;
        padding: 30px;
    }

    .thumbnails-grid {
        padding: 30px;
        column-count: 3;
        column-gap: 20px;
    }

    .thumbnail-item {
        width: 100%;
        margin-bottom: 15px;
    }
}

@media (max-width: 768px) {
    .thumbnails-grid {
        padding: 15px;
        margin-left: 0;
        width: 100%;
        left: 0;
        position: relative;
        column-count: 1;
        column-gap: 0;
    }

    .thumbnail-item {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .menu-section {
        display: none;
    }

    .about-section {
        display: none !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 100px 20px 40px !important;
        margin: 0 !important;
        background: #1a1a1a !important;
        min-height: 100vh !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        transform: none !important;
        z-index: 5 !important;
    }

    .about-section.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* When menu is open, about section moves down naturally with the flow */
    body.menu-open .about-section {
        position: relative !important;
    }

    .about-content {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        float: none !important;
        clear: both !important;
    }

    /* Ensure all child elements also respect full width */
    .about-section * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .about-title {
        font-size: clamp(24px, 6vw, 32px);
        margin-bottom: 30px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .about-text {
        font-size: clamp(14px, 3.5vw, 16px);
        line-height: 1.7;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .about-text p {
        margin-bottom: 18px;
    }

    .about-text strong {
        font-size: clamp(16px, 4vw, 18px);
        margin-top: 30px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .about-contact {
        margin-top: 40px;
        padding-top: 30px;
    }

    .about-contact h3 {
        font-size: clamp(16px, 4vw, 18px);
        margin-bottom: 15px;
    }

    .about-contact a {
        font-size: clamp(14px, 3.5vw, 16px);
        margin-bottom: 12px;
        word-break: break-word;
    }

    /* Mobile Off-Canvas Menu (Top) - Slides down and pushes content */
    .mobile-offcanvas-menu {
        position: relative;
        width: 100%;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 0 20px;
        display: block;
        opacity: 1;
        z-index: 1001;
        margin: 0;
    }

    .mobile-offcanvas-menu.active {
        max-height: 500px;
        padding: 40px 20px 40px;
    }

    /* Ensure header stays visible above menu */
    .mobile-header {
        z-index: 1002;
        position: relative;
        background: #ffffff;
    }

    .mobile-header.dark {
        background: #1a1a1a;
    }

    /* When menu is open, ensure content flows naturally */
    body.menu-open {
        overflow: hidden;
    }

    .mobile-offcanvas-nav {
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: center;
        text-align: center;
    }

    .mobile-offcanvas-nav a {
        font-size: 14px;
        color: #ffffff;
        text-decoration: none;
        text-transform: uppercase;
        letter-spacing: 1px;
        transition: color 0.2s ease;
        display: block;
        width: 100%;
        padding: 10px 0;
        text-align: center;
    }

    .mobile-offcanvas-nav a:hover,
    .mobile-offcanvas-nav a.active {
        color: #ffffff;
        opacity: 0.8;
    }

    .gallery-section {
        display: none;
    }

    .main-container {
        display: none;
    }

    .main-container.show-menu {
        display: flex;
    }

    .about-section.active {
        display: block;
    }

    .sidebar-brand {
        font-size: 24px;
        margin-bottom: 30px;
    }

    .nav-links {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 30px;
    }

    .nav-links a {
        font-size: 14px;
    }

    .sidebar-footer {
        margin-top: auto;
        padding-top: 30px;
    }
}

@media (max-width: 480px) {
    .mobile-menu-btn {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
    }

    .menu-section {
        padding: 50px 20px 20px;
    }

    .sidebar-brand {
        font-size: 20px;
    }

    .nav-links {
        gap: 15px;
    }

    .nav-links a {
        font-size: 13px;
    }

    .mobile-title {
        font-size: 18px;
    }

    .mobile-social-link {
        font-size: 12px;
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: relative;
    z-index: 1001;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 10px 15px;
    transition: opacity 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
    align-self: flex-start;
    order: 2;
    /* Ensure button is always on the right */
}

/* Hide mobile off-canvas menu on desktop */
@media (min-width: 769px) {
    .mobile-offcanvas-menu {
        display: none !important;
    }
}

.mobile-menu-btn:hover {
    opacity: 0.6;
}

/* Mobile Header */
.mobile-header {
    display: none;
    padding: 20px;
    background: #ffffff;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
    z-index: 100;
}

.mobile-header.active {
    display: flex;
}

.mobile-header.dark {
    background: #1a1a1a;
}

.mobile-header.dark .mobile-title,
.mobile-header.dark .mobile-title a {
    color: #ffffff;
}

.mobile-header.dark .mobile-social-link {
    color: #ffffff;
}

.mobile-header.dark .mobile-menu-btn {
    color: #ffffff;
}

.mobile-header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    width: 100%;
    gap: 20px;
}

.mobile-header-left {
    flex: 1;
    min-width: 0;
    /* Allow flex item to shrink */
    order: 1;
    /* Ensure left content is on the left */
    max-width: calc(100% - 80px);
    /* Reserve space for button */
}

.mobile-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
    color: #000000;
}

.mobile-title a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.mobile-title a:hover {
    opacity: 0.6;
}

.mobile-social {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.mobile-social-link {
    font-size: 13px;
    color: #666666;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
}

.mobile-social-link:hover {
    color: #000000;
}

/* Mobile Gallery List */
.mobile-gallery-list {
    display: none;
    flex-direction: column;
    background: #ffffff;
    min-height: calc(100vh - 120px);
    padding: 0;
    align-items: center;
    width: 100%;
    margin-top: 0;
}

.mobile-gallery-list.active {
    display: flex;
}

.mobile-gallery-item {
    width: 100%;
    max-width: 100%;
    margin-bottom: 10px;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
}

.mobile-gallery-item img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    will-change: transform, opacity;
    /* Optimize for lazy loading */
    transform: translateZ(0);
    /* Force GPU acceleration */
    backface-visibility: hidden;
    /* Improve rendering performance */
}

/* About Page */
.about-section {
    display: none;
    position: fixed;
    left: 200px;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 60px 80px;
    background: var(--color-background-dark);
    color: var(--color-text-dark);
    overflow-y: auto;
    height: 100vh;
    z-index: 5;
}

.about-section.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeIn var(--transition-medium) var(--easing-default);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.about-title {
    font-size: 48px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 40px;
    color: var(--color-text-dark);
}

.about-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text-light-dark);
    margin-bottom: 30px;
}

.about-text p {
    margin-bottom: 20px;
}

.about-text ul {
    list-style: none;
    padding-left: 0;
    margin: 20px 0;
}

.about-text ul li {
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
}

.about-text ul li:before {
    content: "-";
    position: absolute;
    left: 0;
}

.about-text strong {
    color: #ffffff;
    font-weight: 600;
    display: block;
    margin-top: 40px;
    margin-bottom: 10px;
    font-size: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

/* Exhibitions and Featured sections */
.about-text p:has(+ ul) {
    margin-top: 30px;
}

.about-text ul {
    margin-bottom: 20px;
}

.about-contact {
    margin-top: 60px;
    padding-top: 40px;
}

.about-contact h3 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--color-text-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.about-contact a {
    color: var(--color-text-light-dark);
    text-decoration: none;
    transition: color 0.2s ease;
    display: block;
    margin-bottom: 10px;
}

.about-contact a:hover {
    color: var(--color-text-dark);
}

/* Works Page - Grid View */
.works-section {
    display: none;
    position: fixed;
    left: 200px;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 60px 80px;
    background: #ffffff;
    color: #000000;
    overflow-y: auto;
    height: 100vh;
    z-index: 100;
}

.works-section.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeIn var(--transition-medium) var(--easing-default);
}

/* Ensure gallery section is hidden when works or project detail sections are active */
.works-section.active~.gallery-section,
.project-detail-section.active~.gallery-section,
body:has(.works-section.active) .gallery-section,
body:has(.project-detail-section.active) .gallery-section {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -1 !important;
}

.works-section.loading,
.project-detail-section.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.works-section.loading::before,
.project-detail-section.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #000000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 1000;
}

/* Smooth loader transitions */
.image-loader.show {
    display: block;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.image-loader {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.works-content {
    max-width: 1400px;
    margin: 0 auto;
}

.works-title {
    font-size: 48px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 40px;
    color: #000000;
    font-family: 'Playfair Display', 'Lora', Georgia, serif;
}

/* Works Filter Menu */
.works-filter-menu {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.works-filter-btn {
    background: transparent;
    border: 1px solid #000000;
    color: #000000;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-transform: uppercase;
    border-radius: 0;
}

.works-filter-btn:hover {
    background: #000000;
    color: #ffffff;
}

.works-filter-btn.active {
    background: #000000;
    color: #ffffff;
}

/* Works Grid */
.works-grid {
    margin-top: 40px;
}

/* Category Grid */
.works-category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    grid-auto-flow: row;
    /* Ensure items flow row by row to maintain order */
}

@media (max-width: 1200px) {
    .works-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

.work-preview-card {
    cursor: pointer;
    transition: transform var(--transition-medium), opacity var(--transition-medium);
    opacity: 1;
}

.work-preview-card:hover {
    transform: translateY(-4px);
    opacity: 0.9;
}

.work-preview-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 125%;
    /* 4:5 aspect ratio (portrait) */
    overflow: hidden;
    background: #f5f5f5;
}

.work-preview-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-medium);
}

/* For Sydney Night project - make images fill height while maintaining aspect ratio */
.work-preview-card[data-project-id="nightclubs-sydney"] .work-preview-image {
    object-fit: contain;
    object-position: center;
}

.work-preview-card:hover .work-preview-image {
    transform: scale(1.05);
}

.work-preview-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 30px 20px 20px;
    opacity: 0;
    transition: opacity var(--transition-medium);
}

.work-preview-card:hover .work-preview-overlay {
    opacity: 1;
}

.work-preview-info {
    color: #ffffff;
}

.work-preview-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    font-family: 'Playfair Display', 'Lora', Georgia, serif;
    color: #ffffff;
}

.work-preview-year {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Project Detail Page */
.project-detail-section {
    display: none;
    position: fixed;
    left: 200px;
    right: 0;
    top: 0;
    bottom: 0;
    padding: 60px 80px;
    background: #ffffff;
    color: #000000;
    overflow-y: auto;
    height: 100vh;
    z-index: 100;
}

.project-detail-section.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: fadeIn var(--transition-medium) var(--easing-default);
}

/* Additional rule to ensure gallery is hidden */
.gallery-section.is-hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -1 !important;
}

.project-detail-content {
    max-width: 1000px;
    margin: 0 auto;
}

.project-back-btn {
    background: transparent;
    border: 1px solid #666666;
    color: #666666;
    padding: 12px 24px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    margin-bottom: 40px;
    transition: all var(--transition-fast);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.project-back-btn:hover {
    border-color: #000000;
    color: #000000;
    background: rgba(0, 0, 0, 0.05);
}

.project-detail-title {
    font-size: 48px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 20px;
    color: #000000;
    font-family: 'Playfair Display', 'Lora', Georgia, serif;
}

.project-detail-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    font-size: 14px;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-detail-intro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 20px;
    margin: 10px 0 24px;
    font-size: 14px;
}

.project-detail-intro-row {
    display: flex;
    gap: 6px;
    align-items: baseline;
    color: #4a4a4a;
}

.project-detail-intro-label {
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.project-detail-intro-value {
    color: #000000;
}

.project-detail-year,
.project-detail-role {
    padding: 4px 0;
}

.project-detail-description {
    font-size: 16px;
    line-height: 1.8;
    color: #666666;
    margin-bottom: 60px;
}

.project-detail-description p {
    margin-bottom: 20px;
}

.project-detail-media {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.project-detail-image-wrapper {
    width: 100%;
    position: relative;
}

.project-detail-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Full-bleed images in rows (for Sydney Night) - each image maintains its natural aspect ratio */
.project-detail-images-row {
    align-items: start;
}

.project-detail-images-row .project-detail-image-wrapper {
    width: 100%;
    position: relative;
    padding: 0;
    margin: 0;
    display: block;
}

.project-detail-images-row .project-detail-image {
    width: 100%;
    height: auto;
    display: block;
}

.project-detail-videos-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
}

/* Single video should take full width to match text */
.project-detail-videos-row:has(.project-detail-video-wrapper:only-child),
.project-detail-videos-row:has(.project-detail-video-wrapper:only-of-type) {
    grid-template-columns: 1fr;
    max-width: 100%;
}

.project-detail-video-wrapper {
    width: 100%;
    position: relative;
}

.project-detail-video {
    width: 100%;
    height: auto;
    display: block;
    background: #000000;
    border-radius: 2px;
}

.project-detail-youtube-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    border-radius: 2px;
}

.project-detail-vimeo-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    border-radius: 2px;
}

.project-detail-section-label {
    font-size: 18px;
    font-weight: 600;
    color: #000000;
    margin-top: 30px;
    margin-bottom: 15px;
    font-family: 'Playfair Display', 'Lora', Georgia, serif;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-detail-section-label:first-child {
    margin-top: 0;
}

/* Masonry Gallery (for St.Patricks) */
/* CSS Column Layout Gallery - Unified gallery layout for all projects */
.project-detail-column-gallery {
    width: 100%;
    margin-bottom: 0;
    position: relative;
    column-count: 2;
    column-gap: 20px;
}

.project-detail-column-item {
    width: 100%;
    margin-bottom: 20px;
    break-inside: avoid;
    page-break-inside: avoid;
    display: inline-block;
    box-sizing: border-box;
}

/* Desktop: 4 columns */
@media (min-width: 1201px) {
    .project-detail-column-gallery {
        column-count: 4;
        column-gap: 20px;
    }
}

/* Tablet: 2 columns */
@media (max-width: 1200px) and (min-width: 769px) {
    .project-detail-column-gallery {
        column-count: 2;
        column-gap: 20px;
    }
}

/* Mobile: 1 column */
@media (max-width: 768px) {
    .project-detail-column-gallery {
        column-count: 1;
        column-gap: 0;
    }

    .project-detail-column-item {
        margin-bottom: 15px;
    }
}

.project-detail-column-item .project-detail-image-wrapper {
    width: 100%;
    position: relative;
    padding: 0;
    margin: 0;
    display: block;
    background: #f5f5f5;
}

.project-detail-column-item .project-detail-image {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-detail-column-item .project-detail-image.loaded {
    opacity: 1;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Justified Gallery Layout (for Landscape and People) */
.project-detail-justified-gallery {
    width: 100% !important;
    max-width: 1000px !important;
    margin: 0 auto !important;
    margin-bottom: 0;
    padding: 0 !important;
    box-sizing: border-box;
    display: block;
}

/* Ensure gallery matches text content width on all screen sizes */
@media (max-width: 1200px) {
    .project-detail-justified-gallery {
        max-width: calc(100% - 160px);
        /* Match text content padding */
        padding: 0;
    }
}

@media (max-width: 768px) {
    .project-detail-content {
        max-width: 100%;
        padding: 0 15px;
        /* Reduced padding for wider gallery */
    }

    .project-detail-justified-gallery {
        max-width: 100%;
        padding: 0;
        /* No extra padding - gallery uses full width within content area */
        width: 100%;
    }
}

.project-detail-justified-row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    margin-bottom: 5px;
    /* Reduced spacing between rows */
}

.project-detail-justified-item {
    flex-shrink: 0;
    display: block;
    opacity: 1;
    visibility: visible;
}

.project-detail-justified-row .project-detail-justified-item {
    display: block;
    opacity: 1;
    visibility: visible;
}

.project-detail-justified-item .project-detail-image-wrapper {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
    display: block;
}

.project-detail-justified-item .project-detail-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Fill container - dimensions already match aspect ratio */
    cursor: pointer;
    transition: opacity 0.3s ease;
    opacity: 0;
    visibility: hidden;
}

.project-detail-justified-item .project-detail-image.layout-ready {
    opacity: 1;
    visibility: visible;
}

.project-detail-justified-item .project-detail-image:hover {
    opacity: 0.9;
}

/* For mobile, reduce image quality visually (actual reduction handled by lazy loading) */
@media (max-width: 768px) {
    .project-detail-justified-item .project-detail-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Ensure images start hidden on mobile too */
    .project-detail-justified-item .project-detail-image {
        opacity: 0;
        visibility: hidden;
    }

    .project-detail-justified-item .project-detail-image.layout-ready {
        opacity: 1;
        visibility: visible;
    }
}

.project-detail-images-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    width: 100%;
    margin-bottom: 0;
    padding: 0;
}

@media (max-width: 1200px) {
    .project-detail-images-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .project-detail-images-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-detail-masonry-item {
        margin-bottom: 15px;
    }
}

/* Mobile styles for works section - consolidated from works.css */
@media (max-width: 768px) {
    .works-section {
        position: relative;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        padding: 80px 20px 30px;
        margin: 0;
        display: none;
        background: #ffffff;
        min-height: 100vh;
    }

    .works-section.active {
        display: block;
    }

    .works-title {
        font-size: 32px;
        margin-bottom: 30px;
        color: #000000;
    }

    .works-filter-menu {
        gap: 10px;
        margin-bottom: 30px;
        padding-bottom: 15px;
    }

    .works-filter-btn {
        padding: 8px 16px;
        font-size: 12px;
        flex: 1;
        min-width: calc(50% - 5px);
    }

    .works-grid {
        margin-top: 20px;
    }

    .works-category-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        grid-auto-flow: row;
        /* Ensure items maintain source order on mobile */
    }

    .work-preview-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    }

    .project-detail-section {
        position: relative;
        left: 0;
        right: 0;
        top: 0;
        width: 100%;
        padding: 80px 20px 30px;
        margin: 0;
        display: none;
        background: #ffffff;
        min-height: 100vh;
    }

    .project-detail-section.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 100 !important;
    }

    /* Ensure gallery and mobile gallery are hidden when project detail is active */
    .project-detail-section.active~.gallery-section,
    .project-detail-section.active~.mobile-gallery-list,
    body:has(.project-detail-section.active) .gallery-section,
    body:has(.project-detail-section.active) .mobile-gallery-list,
    body:has(.project-detail-section.active) .main-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        z-index: -1 !important;
    }

    /* Ensure mobile gallery list is hidden when project detail is active */
    .mobile-gallery-list.is-hidden,
    .mobile-gallery-list.hidden {
        display: none !important;
        visibility: hidden !important;
    }

    .project-detail-title {
        font-size: 28px;
        color: #000000;
    }

    .project-detail-description {
        font-size: 15px;
        color: #666666;
    }

    .project-detail-media {
        gap: 30px;
    }

    .project-detail-videos-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .project-detail-video {
        border-radius: 0;
    }

    /* Mobile touch targets - minimum 44x44px for better usability */
    .gallery-nav button,
    .mobile-menu-btn,
    .nav-links a,
    .project-back-btn,
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }
}

/* Keyboard navigation indicator */
.keyboard-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 11px;
    color: #999999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.keyboard-hint.show {
    opacity: 1;
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
    line-height: 1;
    padding: 0;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 50px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
    line-height: 1;
    padding: 0;
    user-select: none;
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10001;
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 30px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 40px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
    }

    .lightbox-content img {
        max-height: 85vh;
    }

    .lightbox-counter {
        bottom: 20px;
        font-size: 12px;
        padding: 6px 12px;
    }
}