@font-face {
    font-family: 'Neue Serie';
    src: url('../fonts/neueSerie57-Medium.woff2') format('woff2'),
         url('../fonts/neueSerie57-Medium.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --text-color: #333;
    --background-color: #000000;
    --transition-duration: 0.1s;
    --stagger-delay: 0.05s;
    --font-family: 'Neue Serie', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
}

.text-element {
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 0.9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-weight: normal;
}

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

body {
    background-color: var(--background-color);
    overflow-x: hidden;
    width: 100%;
    position: fixed;
    transition: background-color 0.5s ease;
}

body.first-image-loaded .project-image:first-of-type {
    opacity: 1;
}

body:not(.first-image-loaded) {
    background: #7A2534;
}

html {
    overflow-x: hidden;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    margin: 10px;
    width: max-content;
}

.site-nav {
    display: flex;
    align-items: left;
}

.site-nav a {
    text-decoration: none;
}

.contact-wrapper {
    display: flex;
}

.contact-content {
    display: flex;
}

.contact-btn {
    display: none;
}

.contact {
    display: flex;
    flex-direction: column;
}

.name,
.email,
.phone,
.social,
.contact-btn,
.index-toggle {
    height: min-content;
    padding: 3px 4px 4px 4px;
}

.grey {
    background-color: #939393;
    color: black;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.grey:hover {
    background-color: #000000;
    color: #939393;
}

.index-toggle {
    border: none;
    text-align: start;
    display: flex;
    align-items: flex-start;
    height: 100%;
}

.project-container {
    height: 100vh;
    width: 100vw;
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 0;
}

.project {
    height: 100vh;
    width: 100vw;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
    background-color: var(--background-color);
    pointer-events: all;
    z-index: 0;
    transition: background-color 0.3s ease;
}

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

.project-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: opacity;
    pointer-events: none;
    object-fit: cover;
}

/* Center contained images on desktop */
.project-image[style*="object-fit: contain"] {
    width: 80%;
    height: 80%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.project-info {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    padding-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    pointer-events: all;
    width: auto;
    mix-blend-mode: difference;
}

.current-project {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.project-details {
    display: flex;
    justify-content: center;
    white-space: nowrap;
    gap: 4px;
}

.image-counter {
    position: fixed;
    z-index: 1;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    mix-blend-mode: difference;
    color: white;
    transition: opacity 0.3s ease;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    gap: 0;
}

.image-counter.hidden {
    opacity: 0;
}

.image-counter.updating {
    animation: counterGap 0.3s ease;
}

@keyframes counterGap {
    0% { gap: 0; }
    50% { gap: 4px; }
    100% { gap: 0; }
}

/* Only apply cursor:none and image counter following on Safari and Firefox */
.is-supported-browser .image-counter {
    top: auto;
    left: auto;
    transform: none;
}

@media (max-width: 768px) {
    .image-counter {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    .project-container {
        height: -webkit-fill-available;
        height: 100dvh;
    }

    .project {
        height: -webkit-fill-available;
        height: 100dvh;
    }

    .project-image[style*="object-fit: contain"] {
        width: 100%;
        height: 90%;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        padding: 0;
    }
}

/* Remove cursor:none from non-supported browsers */
html:not(.is-supported-browser), 
html:not(.is-supported-browser) body,
html:not(.is-supported-browser) .project-container,
html:not(.is-supported-browser) .project,
html:not(.is-supported-browser) .image-container,
html:not(.is-supported-browser) .site-header,
html:not(.is-supported-browser) .site-nav,
html:not(.is-supported-browser) .project-image,
html:not(.is-supported-browser) .project-info,
html:not(.is-supported-browser) .current-project,
html:not(.is-supported-browser) main {
    cursor: e-resize !important;
}

/* Keep cursor:none only for supported browsers */
.is-supported-browser html, 
.is-supported-browser body,
.is-supported-browser .project-container,
.is-supported-browser .project,
.is-supported-browser .image-container,
.is-supported-browser .site-header,
.is-supported-browser .site-nav,
.is-supported-browser .project-image,
.is-supported-browser .project-info,
.is-supported-browser .current-project,
.is-supported-browser main {
    cursor: none !important;
}

/* Keep pointer cursor for interactive elements in all browsers */
.clickable-element,
.index-toggle,
.name,
.email,
.phone,
.social,
.contact-btn {
    cursor: pointer !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.index-list {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    mix-blend-mode: difference;
    color: white;
    z-index: 1;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Webkit browsers (Chrome, Safari, etc.) */
.index-list::-webkit-scrollbar {
    display: none;
}

.index-item {
    display: flex;
    justify-content: center;
    white-space: nowrap;
    width: 100%;
    gap: 4px;
    padding-bottom: 6px;
    opacity: 0;
    will-change: opacity, transform;
}

.index-list.active {
    pointer-events: all;
}

.index-list.active .index-item {
    animation: slideIn var(--transition-duration) ease forwards;
    animation-delay: calc(var(--stagger-delay) * (var(--item-index, 0)));
    transition: gap 0.2s ease;
}

.index-list.active .index-item:hover {
    opacity: 0.4 !important;
    gap: 40px;
}

.index-list:not(.active) .index-item {
    animation: none;
    opacity: 0;
    transform: translateY(-10px);
}

.index-list.active.closing .index-item {
    animation: slideOut var(--transition-duration) ease forwards;
    animation-delay: calc(var(--stagger-delay) * (var(--reverse-index, 0)));
    opacity: 1;
}


.index-item.current {
    opacity: 0;
    pointer-events: none;
    height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.project-number, .title-year {
    color: white;
}

@media (max-width: 768px) {
    .contact-content {
        display: none;
    }
    
    .contact-content.visible {
        display: flex;
    }

    .contact-btn {
        display: block;
    }
    
    .contact-btn.hidden {
        display: none;
    }

    .project-info {
        top: auto;
        bottom: 10px;
        width: calc(100% - 2rem);
    }

    .index-list {
        top: auto;
        bottom: 100%;
        max-height: calc(100vh - 5rem);
        width: 100%;
    }

    .index-list.active {
        display: flex;
        flex-direction: column-reverse;
    }

    @keyframes slideIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    @keyframes slideOut {
        from {
            opacity: 1;
        }
        to {
            opacity: 0;
        }
    }

    .index-list:not(.active) .index-item {
        animation: slideOut var(--transition-duration) ease forwards;
        animation-delay: calc(var(--stagger-delay) * (var(--item-index, 0)));
    }
}

/* Loading states */
.project-image[data-loading="true"] {
    opacity: 0;
}

/* Touch device optimizations */
@media (hover: none) {
    .project {
        -webkit-tap-highlight-color: transparent;
    }
}

.theme-light {
    background-color: white;
    color: black;
    transition: background-color .5s ease, color 0.5s ease;
}

.theme-light:hover {
    color: #939393;
}

.theme-dark {
    background-color: black;
    color: white;
    transition: background-color 0.5s ease, color 0.5s ease;
}

.theme-dark:hover {
    color: #939393;
}