/* --- RESET & BASICS --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Frutiger Neue', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    overflow: hidden;
}

/* --- GLOBAL WRAPPER --- */
main {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 2400px;
    margin: 0 auto;
}

/* --- HEADER --- */
header {
    position: absolute;
    top: 2rem;
    right: 0;
    padding-right: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 100;
}

header, header a, header span {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    text-decoration: none;
    color: black;
    line-height: 1;
}

.header-icon img {
    height: 1em;
    width: auto;
    vertical-align: middle;
    margin-top: -4px;
}

/* --- BACKGROUND IMAGE CONTAINER --- */
#image-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    aspect-ratio: 3 / 2;
    z-index: 0;
    pointer-events: auto; 
    display: flex;
    justify-content: center;
    align-items: center;
}

.bg-img-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    cursor: pointer;
}

.bg-img-link.active {
    opacity: 1;
    z-index: 1;
}

.bg-img-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    will-change: transform;
    transform-style: preserve-3d;
}

/* --- PROJECT LIST CONTAINER --- */
.projectList {
    position: relative;
    z-index: 10;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 5px 15px;
    pointer-events: none; 
}

.projectLink {
    pointer-events: auto;
    background-color: white;
    padding: 0px 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.projectLink a {
    color: blue;
    text-decoration: none;
    font-style: normal;
    border-bottom: 1px solid transparent;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    cursor: pointer;
}

.projectLink a em {
    font-style: italic;
}

.projectLink a:hover {
    text-decoration: underline;
}

::selection {
    background: blue;
    color: white;
}

/* --- DESKTOP HOVER LOGIC --- */
@media (min-width: 769px) {
    .projectList:hover .projectLink {
        background-color: transparent;
    }

    .projectList .projectLink:hover {
        background-color: white;
    }
}

/* --- LOCK NAV ON VERY LARGE SCREENS --- */
@media (min-width: 2400px) {
    header {
        right: calc(50vw - 1200px);
        padding-right: 2rem;
    }
}

/* --- MOBILE LAYOUT (Max-width 768px) --- */
@media (max-width: 768px) {
    body, html {
        overflow-y: auto;
        height: auto;
    }

    main {
        max-width: 100%;
        height: auto;
        position: relative;
    }

    header {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        padding: 1.5rem;
        justify-content: flex-end;
        box-sizing: border-box;
    }

    header, header a, header span {
        font-size: 1.2rem;
    }

    #image-container {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        height: auto;
        padding: 0 1rem;
        margin-top: 2.8rem;
        margin-bottom: 2rem;
        box-sizing: border-box;
    }

    .bg-img-link {
        position: relative;
        display: none;
        opacity: 1;
    }

    #img-default {
        display: block;
    }

    .bg-img-link:not(#img-default) {
        display: none !important;
    }

    .projectList {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        padding: 0 1.5rem 3rem 1.5rem;
        gap: 1.5rem;
        box-sizing: border-box;
        pointer-events: auto;
    }

    .projectLink {
        background-color: transparent;
        padding: 0;
    }

    .projectLink a {
        font-size: 1.2rem;
    }
}
