:root {
    --black: #0c0c0e;
    --white: #f9f9f6;
    --grey: #9B9BA0;
    --blue: #698fff;
    --green: #00ee94;
}

body, html {
    margin: 0; padding: 0;
    background: var(--black);
    color: var(--white);
    font-family: "InterDisplay", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    cursor: none;
    -webkit-tap-highlight-color: transparent;
}

.lauftext-project {
    color: var(--white);
    font-size: 1rem;
    line-height: 1.5;
}

.lauftext-project .figcaption {
    font-family: "InterDisplay", monospace;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.main-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 80px;
    min-height: 100vh;
    padding: 10px;
}

.grid-right {
    align-self: start;
    justify-self: start;
    line-height: 0.9rem;
    position: relative;
}

.grid-left {
    align-self: start;
    justify-self: start;
    line-height: 1rem;
    max-width: 150px;
    word-wrap: break-word;
}

.grid-tools {
    align-self: start;
    justify-self: start;
    line-height: 0.9rem;
}

.grid-section-title {
    font-size: 10px;
    color: var(--grey);
    margin-top: 2px;
    margin-bottom: 7px;
}

.project-list {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 4px 12px;
    align-items: baseline;
}

.project-num, .project-year {
    font-size: 14px;
    color: var(--white);
}

.project-link {
    font-size: 14px;
    color: var(--white);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    touch-action: manipulation;
}

.project-link:hover { color: var(--grey); }

.preview-container {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
    transform-origin: top left;
    left: 0;
    top: 100%;
    transform: scale(0.9);
    width: calc(33vw - 20px);
    margin-top: 20px;
}
.preview-container.visible { opacity: 1; transform: scale(1); }

.preview-container img {
    display: block;
    width: 100%;
    height: auto;
}

#overlay-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s;
    z-index: 999;
}
#overlay-backdrop.visible { opacity: 1; visibility: visible; }

#project-overlay {
    position: fixed;
    inset: 0;
    max-width: 100%;
    max-height: 100%;
    background: rgba(12, 12, 14, 0.95);
    backdrop-filter: blur(12px) saturate(150%); 
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: none;
    border-radius: 0;
    padding: 30px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    z-index: 1000;
    color: var(--white); 
}

#project-overlay.visible {
    opacity: 1;
    visibility: visible;
    cursor: none;
}

body.overlay-open {
    overflow: hidden;
}

#project-overlay .close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    font-size: 3rem;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#overlay-content {
    transition: opacity 0.3s ease;
}

#overlay-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1200px;  
    width: 90vw;
    margin: 0 auto;
}

#overlay-content img,
#overlay-content video {
    max-width: 100%;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
}

#overlay-content img, #overlay-content video { max-width: 100%; display: block; margin: 20px auto; }

#overlay-content { transition: opacity 0.3s ease; }

.container-project {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.container-project img,
.container-project video,
.container-project iframe {
    width: 100%;        
    border-radius: 10px;
    display: block;
}

.p5 {
    max-width: 50%;
}

.container-project iframe {
    background: rgba(12,12,14,0.8);
    width: 100%;
    min-height: 80vh;
    border: none;
}

.back-arrow {
    position: fixed;
    pointer-events: none;
    font-size: 1.5rem;
    color: var(--white);
    z-index: 1100;
    display: none;
    user-select: none;
    left: 20px;
    top: 20px;
}

.back-arrow.active {
    display: block;
    cursor: none;
}

.gradient-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    font-size: 12px;
    color: var(--grey);
}

.gradient-footer a {
    color: var(--grey);
    text-decoration: none;
}

.gradient-footer a:hover {
    color: var(--white);
}

.figcaption-mono {
    font-family: "IBMPlexMono", monospace;
    font-size: 12px;
    color: var(--grey);
}

/* Video player wrapper */
.video-wrapper {
    position: relative;
    width: 100%;
    cursor: none;
}

.video-wrapper video {
    width: 100%;
    display: block;
    border-radius: 10px;
}

a {
    color: var(--white);
    user-select: none;
    cursor: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    draggable: false;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.contact-section {
    margin: 0;
    padding: 0;
    line-height: 1.35rem;
    display: flex;
    flex-direction: column;
}

.contact-section p {
    margin-top: 0;
}

@media (max-width: 768px) {
    .grid-contact {
        order: 1;
        width: auto;
        display: none;
    }

    .main-grid {
        grid-template-columns: 1fr;
        gap: 0px;
        padding: 15px;
        box-sizing: border-box;
    }

    .grid-right {
        justify-self: start;
        align-items: center;
        width: 100%;
        order: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .grid-left {
        justify-self: start;
        align-items: center;
        width: 100%;
        max-width: 50vw;
        order: 0;
        margin-left: 0;
        margin-right: 0;
        word-wrap: break-word;
        box-sizing: border-box;
    }

    .grid-tools {
        grid-template-columns: auto 1fr auto;
        gap: 10px 20px;
        justify-self: start;
        align-items: center;
        width: 100%;
        order: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .grid-section-title {
        font-size: 10px;
        color: var(--grey);
        margin-top: 2px;
        margin-bottom: 10px;
    }

    .project-list {
        display: grid;
        grid-template-columns: auto 1fr auto;
        gap: 10px 28px;
        align-items: baseline;
    }

    .project-num, .project-year {
        font-size: 10px;
        color: var(--white);
    }

    .project-link {
        font-size: 16px;
        color: var(--white);
        text-decoration: none;
        cursor: pointer;
        transition: color 0.2s;
        line-height: 1.3;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .contact-section p,
    .contact-links a {
        font-size: 16px;
        line-height: 22px;
        width: 100%;
    }

    .project-link:hover {
        color: var(--white);
    }

    .preview-container {
        display: none;
    }

    .back-arrow {
        position: fixed;
        top: 10px;
        left: 10px;
        transform: none;
        font-size: 1.2rem;
        pointer-events: none;
        cursor: pointer;
        display: none;
        align-items: center;
        justify-content: center;
        z-index: 1200;
        background: rgba(12, 12, 14, 0.85);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        min-width: 20px;
        min-height: 20px;
        opacity: 1 !important;
        touch-action: manipulation;
    }

    .back-arrow.active {
        display: flex;
        pointer-events: auto;
    }

    .gradient-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        line-height: 1rem;
    }

    .contact-section {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 12px;
        line-height: 1.7rem;
        align-items: flex-start;
    }

    .contact-links {
        order: -1;
    }

    .lauftext-project .figcaption {
    font-family: "InterDisplay", monospace;
    font-size: 1rem;
    margin-bottom: 1rem;
    }
}

.custom-cursor {
    position: fixed;
    width: 10px;
    height: 16px;
    background: var(--white);
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
}

@media (max-width: 768px) {
    .container-project iframe,
    #overlay-content iframe {
        width: 100%;
        min-height: 70vh;
    }

    #project-overlay {
        padding: 15px;
        overflow-x: hidden;
        overflow-y: scroll;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    #project-overlay::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    #overlay-content {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    #overlay-content img,
    #overlay-content video {
        max-width: 100%;
        width: 100%;
    }

    .container-project {
        width: 100%;
        box-sizing: border-box;
    }

    body {
        overflow-x: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    body::-webkit-scrollbar {
        display: none;
    }
}

/* ── Overlay title (desktop: fixed right; mobile: fixed top-center) ── */
.overlay-title {
    display: none;
}

.overlay-title.visible {
    display: block;
    position: fixed;
    right: 20px;
    top: 20px;
    font-family: "InterDisplay", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    color: var(--white);
    background: rgba(12, 12, 14, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 4px 14px;
    white-space: nowrap;
    z-index: 1150;
    pointer-events: none;
}

@media (max-width: 768px) {
    .overlay-title.visible {
        position: fixed;
        right: auto;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(12, 12, 14, 0.85);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: 2px 6px;
        border-radius: 0;
        z-index: 1200;
    }

    /* Hide desktop cursor on mobile */
    .custom-cursor {
        display: none;
    }
}

/* ── Page loader ── */
#page-loader {
    position: fixed;
    inset: 0;
    background: var(--black);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

#page-loader.loader-done {
    opacity: 0;
    pointer-events: none;
}

#loader-track {
    position: relative;
    width: 200px;
    height: 16px;
}

#loader-cursor-el {
    position: absolute;
    left: 0;
    top: 0;
    width: 10px;
    height: 16px;
    background: var(--white);
}

/* ── Centered 50% images ── */
.img-summercamp,
.gradient-flyer {
    width: 50%;
    display: block;
    margin: 0 auto;
}

/* ── Landing page grid: 11px font (desktop only) ── */
@media (min-width: 769px) {
    .project-num,
    .project-year,
    .project-link {
        font-size: 11px;
    }
}

/* ── All figcaptions: IBMPlexMono 10px ── */
figcaption,
.figcaption,
.lauftext-project .figcaption,
.figcaption-mono {
    font-family: "IBMPlexMono", monospace;
    font-size: 10px;
}

/* ── Grid alignment ── */
.main-grid {
    align-items: start;
}

@media (max-width: 768px) {
    /* iframes: ensure full width and proper height on mobile */
    .img-fa {
        width: 100%;
        overflow: hidden;
    }

    .img-fa iframe,
    .container-project iframe,
    #overlay-content iframe {
        width: 100% !important;
        height: 50vh !important;
        min-height: unset !important;
        max-height: 420px;
        border: none;
    }

    /* Technophobia: override fixed 400px inline sizes */
    .img-technophobia img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
    }

    /* Summercamp & gradient: full width on mobile */
    .img-summercamp,
    .gradient-flyer {
        width: 100%;
    }
}

/* ── Disable custom cursor on touch/non-hover devices ── */
@media (hover: none) {
    body, html {
        cursor: auto;
    }
    a {
        cursor: pointer;
    }
    .project-link {
        cursor: pointer;
    }
    .custom-cursor {
        display: none !important;
    }
}