@font-face {
    font-family: 'PP Neue Montreal Mono';
    src: url('fonts/Neue Montreal Mono/web/PPNeueMontrealMono-Regular.woff2') format('woff2'),
         url('fonts/Neue Montreal Mono/web/PPNeueMontrealMono-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'PP Neue Montreal Mono';
    src: url('fonts/Neue Montreal Mono/web/PPNeueMontrealMono-Medium.woff2') format('woff2'),
         url('fonts/Neue Montreal Mono/web/PPNeueMontrealMono-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'PP Neue Montreal Mono';
    src: url('fonts/Neue Montreal Mono/web/PPNeueMontrealMono-Light.woff2') format('woff2'),
         url('fonts/Neue Montreal Mono/web/PPNeueMontrealMono-Light.woff') format('woff');
    font-weight: 300;
    font-style: normal;
}

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

body {
    background-color: #ffffff;
    min-height: 100vh;
    font-family: 'PP Neue Montreal Mono', monospace;
    text-transform: lowercase;
    overflow-x: clip;
    --card-radius: 3px;
}

html {
    overflow-x: clip;
    overflow-anchor: none;
}

body,
main,
.home-about,
.projects-feed,
.project-card {
    overflow-anchor: none;
}

#three-container {
    position: fixed;
    top: 100px;
    left: 100px;
    right: 100px;
    bottom: 100px;
    z-index: 0;
    cursor: grab;
}

#three-container:active {
    cursor: grabbing;
}

.menu-bar {
    position: fixed;
    z-index: 9999;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    font-size: clamp(7px, 1.9vw, 13.33px);
    height: 2.65em;
    border-radius: 1.65em;
    border: clamp(0.8px, 0.13vw, 1.8px) solid #000000;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    transition: top 1.1s cubic-bezier(0.76, 0, 0.24, 1),
                transform 1.1s cubic-bezier(0.76, 0, 0.24, 1);
}

.menu-bar.project-open {
    top: 28px;
    transform: translate(-50%, 0);
}

.menu-bar.archive-open {
    top: 63px;
    transform: translate(-50%, 0);
}

.menu-bar.home-lower {
    top: calc(100vh - 28px - 2.65em);
    transform: translate(-50%, 0);
}

.menu-bar.home-lower.home-top,
.menu-bar.home-lower.project-open {
    top: 28px;
    transform: translate(-50%, 0);
}

.menu-left {
    display: flex;
    align-items: center;
    margin-left: 1.5em;
    margin-right: 1.5em;
    white-space: nowrap;
}

/* ── Corner navigation links ──────────────────────────────────────────────── */
.corner-nav,
.return-nav,
.copyright-nav {
    position: fixed;
    top: 20px;
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    font-size: clamp(7px, 1.9vw, 13.33px);
    color: #000000;
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    z-index: 9999;
    user-select: none;
    white-space: nowrap;
    transition: opacity 0.5s ease;
}

.corner-nav.card-open,
.copyright-nav.card-open,
.corner-favicon.card-open {
    opacity: 0;
    pointer-events: none;
}

.corner-left {
    left: 20px;
}

.return-nav {
    left: 20px;
    top: 28px;
    opacity: 0;
    pointer-events: none;
    cursor: pointer;
}

.copyright-nav {
    top: auto;
    bottom: 20px;
    left: 20px;
    font-size: clamp(5px, 0.95vw, 8px);
}

.copyright-break {
    display: inline;
}

.corner-favicon {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 30px;
    height: 30px;
    z-index: 9999;
    user-select: none;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.corner-left::before,
.return-nav::before {
    content: '←';
    margin-right: 0.45em;
}

.return-nav.visible {
    opacity: 1;
    pointer-events: auto;
}

.corner-right {
    right: 20px;
}

.corner-right::after {
    content: '→';
    margin-left: 0.45em;
}

.corner-nav:hover,
.return-nav:hover {
    color: #3463FF;
}

.corner-nav:hover::before,
.corner-nav:hover::after,
.return-nav:hover::before {
    animation: flash 1.2s ease-in-out infinite;
    display: inline-block; /* animation requires a block/inline-block context */
}

@keyframes flash {
    0%, 100% { opacity: 1;   }
    50%       { opacity: 0.3; }
}

.menu-name {
    font-family: 'PP Neue Montreal Mono', monospace;
    font-weight: 500;
    color: #3463FF;
    user-select: none;
    white-space: nowrap;
}


/* Page sections */
.page {
    display: none;
}

.page.active-page {
    display: block;
}

/* Projects feed */
.projects-feed {
    position: relative;
}

.projects-feed:not(.is-laid-out) .project-card,
.archive-feed:not(.is-laid-out) .archive-item {
    visibility: hidden;
}

.project-card {
    display: inline-flex;
    flex-direction: column;
    border: 1.8px solid #000000;
    border-radius: var(--card-radius);
    padding: 5px;
    background: #ffffff;
    overflow: hidden;
    position: absolute;
    z-index: 1;
    cursor: pointer;
    user-select: none;
    transition: width  1.1s cubic-bezier(0.76, 0, 0.24, 1),
                height 1.1s cubic-bezier(0.76, 0, 0.24, 1),
                left   1.1s cubic-bezier(0.76, 0, 0.24, 1),
                top    1.1s cubic-bezier(0.76, 0, 0.24, 1),
                border-color 1.1s ease;
}

.project-card.bg-faded {
    border-color: transparent;
}

.project-card.expanded {
    cursor: pointer;
    z-index: 100;
}

.project-card.vertical.expanded {
    align-items: flex-start;
}

.project-card.horizontal img:not(.card-grid-img):not(.hover-img-preview) {
    display: block;
    width: auto;
    max-width: 90vw;
    height: auto;
    transition: width  1.1s cubic-bezier(0.76, 0, 0.24, 1),
                height 1.1s cubic-bezier(0.76, 0, 0.24, 1);
}

.project-card.vertical img:not(.card-grid-img):not(.hover-img-preview) {
    display: block;
    width: auto;
    max-width: 90vw;
    height: auto;
    transition: width 1.1s cubic-bezier(0.76, 0, 0.24, 1),
                height 1.1s cubic-bezier(0.76, 0, 0.24, 1);
}

/* ── Preview image size transitions ──────────────────────────────────────── */
.project-card > img:not(.card-grid-img):not(.hover-img-preview) {
    transition: width  1.1s cubic-bezier(0.76, 0, 0.24, 1),
                height 1.1s cubic-bezier(0.76, 0, 0.24, 1);
}

.card-detail img:not(.hover-img-preview) {
    background-color: #f4f4f4;
    transition: filter 0.85s ease, opacity 0.85s ease;
}

.card-detail img.project-detail-image-loading:not(.hover-img-preview) {
    filter: blur(14px);
    opacity: 0.45;
}

.card-detail img.project-detail-image-loaded:not(.hover-img-preview) {
    filter: blur(0);
    opacity: 1;
}

.menu-active-area {
    position: relative;
    display: inline-block;
    white-space: nowrap;
}

.menu-active-sizer {
    display: inline-block;
    visibility: hidden;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

.menu-active-label {
    position: absolute;
    left: 0;
    top: 0;
    font-family: 'PP Neue Montreal Mono', monospace;
    color: #3463FF;
    white-space: nowrap;
    display: inline-block;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.menu-hover-area {
    position: relative;
    display: inline-block;
    white-space: nowrap;
}

.menu-hover-sizer {
    display: inline-block;
    visibility: hidden;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

.menu-hover-label {
    position: absolute;
    left: 0;
    top: 0;
    color: #3463FF;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.menu-hover-label.visible {
    opacity: 1;
}


/* ── PP Neue Montreal (non-mono) ──────────────────────────────────────────── */
@font-face {
    font-family: 'PP Neue Montreal';
    src: url('fonts/Neue Montreal /PPNeueMontreal-Regular.woff2') format('woff2'),
         url('fonts/Neue Montreal /PPNeueMontreal-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
}

/* ── Expanded card detail layout ─────────────────────────────────────────── */
.card-detail {
    display: none;
    opacity: 0;
    transition: opacity 0.45s ease;
    padding: 20px 0 24px 0;
    width: 100%;
}

.card-detail.visible {
    opacity: 1;
}

.card-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-top: 32px;
    border: none;
}

.project-card[data-title="PURPLE_PAGES"] > img:not(.card-grid-img):not(.hover-img-preview),
.project-card[data-title="PURPLE_PAGES"] .card-video {
    border-radius: 0 0 4px 4px;
    overflow: hidden;
}

.pp-clip-wrap {
    display: contents;
}

.pp-clip-wrap:has(> img) {
    display: block;
    border-radius: 0 0 4px 4px;
    overflow: hidden;
    line-height: 0;
}

.pp-clip-wrap:has(> .card-video) {
    display: block;
    border-radius: 0 0 4px 4px;
    overflow: hidden;
    margin-top: 32px;
}

.pp-clip-wrap > .card-video {
    margin-top: 0;
}
.card-img-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 32px;
    width: 100%;
}

.card-grid-img {
    display: block;
    width: 100%;
    height: auto;
}

.card-img-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 32px;
    width: 100%;
    padding-left: 32px;
    padding-right: 32px;
    box-sizing: border-box;
}

.card-img-row .card-grid-img {
    flex: 1 1 0;
    width: 0;
    height: auto;
    object-fit: cover;
}

.card-video-duo {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 32px;
    width: 100%;
}

.card-video-duo .card-video {
    width: 100%;
    margin-top: 0;
}

@media (min-width: 768px) {
    .card-video-duo {
        margin-top: 24px;
    }
}

@media (max-width: 767px) {
    .card-video-duo {
        padding-left: 0;
        padding-right: 0;
    }
}

.card-video-pair {
    display: flex;
    flex-direction: row;
    gap: 8px;
    margin-top: 32px;
    width: 100%;
}

.card-video-pair-item {
    min-width: 0;
}

.card-video-pair-item .card-video {
    display: block;
    width: 100%;
    height: 100%;
    margin-top: 0;
    aspect-ratio: unset;
}

.card-video-gap {
    display: block;
    height: 24px;
}

/* Rotation wrapper: contains a portrait iframe rotated 90° to appear landscape */
.card-video-rotate-wrap {
    position: relative;
    overflow: hidden;
    margin-top: 32px;
    width: 100%;
}

.card-video--rotated {
    position: absolute;
    transform: rotate(90deg);
    transform-origin: center center;
    margin-top: 0;
    border: none;
}

.card-image-grid {
    display: flex;
    gap: 25px;
    margin-top: 25px;
    margin-left: auto;
    padding-right: 3px;
}

.card-image-grid-col {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.card-image-grid-col--span2 {
    flex: 2;
}

.card-grid-img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.card-grid-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
}

.card-title {
    font-family: 'PP Neue Montreal Mono', monospace;
    font-weight: 400;
    letter-spacing: -0.09em;
    line-height: 1;
    white-space: nowrap;
    text-transform: uppercase;
    color: #3463FF;
    margin-bottom: 24px;
    padding-left: 3px;
}

.card-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 50px;
    padding: 0 3px 0 12px;
    align-items: start;
}

.card-labels-col {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-label-item {
    font-family: 'PP Neue Montreal Mono', monospace;
    font-weight: 400;
    font-size: 6pt;
    text-transform: none;
    color: #3463FF;
}

.card-body-col {
    grid-column: 2 / 4;
    margin-top: -3px;
}

.card-body-text {
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    font-size: 10pt;
    line-height: 1.5;
    text-transform: none;
    color: #3463FF;
}

.card-body-link {
    color: inherit;
    text-decoration: none;
}

.hover-img-trigger {
    position: relative;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: default;
}

.hover-img-preview {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: auto;
    border: 1.8px solid #3463FF;
    pointer-events: none;
    z-index: 999;
}

@media (max-width: 767px) {
    .hover-img-preview {
        display: none !important;
    }
}

/* hover preview visibility controlled by JS */

/* ── Vertical card: image + detail side by side ──────────────────────────── */
.project-card.expanded.vertical {
    flex-direction: row;
    align-items: flex-start;
    gap: 25px;
}

.project-card.expanded.vertical .card-detail {
    flex: 1;
    min-width: 0;
    padding: 0 0 24px 0;
    align-self: flex-start;
}

.project-card.expanded.vertical .card-info-grid {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: 20px;
    padding-left: 5px;
}

.project-card.expanded.vertical .card-labels-col {
    grid-column: 1;
    grid-row: 1;
}

.project-card.expanded.vertical .card-body-col {
    grid-column: 1;
    grid-row: 2;
    margin-top: 0;
}

.project-card.expanded.vertical .card-title {
    margin-bottom: 12px;
}

@media (min-width: 768px) {
    .project-card.expanded.vertical .card-detail .card-video-pair,
    .project-card.expanded.vertical .card-detail .card-video {
        margin-top: 40px;
    }

    .project-card[data-title="SCI_AM"].expanded.vertical .card-detail > .card-video:not(.card-video--vertical) {
        margin-top: 56px;
    }

    .project-card[data-title="SCI_AM"].expanded.vertical .card-detail > .card-video-pair {
        margin-top: 24px;
    }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .corner-nav,
    .return-nav {
        top: 12px;
    }

    .return-nav {
        top: 63px;
        width: 2.65em;
        height: 2.65em;
        border-radius: 50%;
        border: clamp(0.8px, 0.13vw, 1.8px) solid #000000;
        background-color: rgba(255, 255, 255, 0.8);
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        overflow: hidden;
        font-size: clamp(7px, 2.3vw, 10px);
        color: transparent;
        text-indent: -9999px;
    }

    .return-nav::before {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin-right: 0;
        color: #000000;
        text-indent: 0;
    }

    .return-nav:hover::before {
        color: #3463FF;
    }

    .corner-left,
    .return-nav,
    .copyright-nav {
        left: 12px;
    }

    .copyright-nav {
        bottom: 12px;
        font-size: 5px;
    }

    .corner-favicon {
        right: 8px;
        bottom: 8px;
        width: 15px;
        height: 15px;
    }

    .copyright-break {
        display: block;
    }

    .corner-right {
        right: 12px;
    }

    .menu-bar {
        font-size: clamp(7px, 2.3vw, 10px);
        max-width: calc(100vw - 24px);
    }

    .menu-bar.home-lower {
        top: calc(100vh - 92px - 2.65em);
    }

    .menu-bar.home-lower.home-top,
    .menu-bar.home-lower.project-open {
        top: 63px;
    }

    /* Vertical expanded card: stack detail below image instead of side by side */
    .project-card.expanded.vertical {
        flex-direction: column;
        gap: 0;
    }

    .project-card.expanded.vertical .card-detail {
        padding: 14px 0 28px 0;
        align-self: stretch;
    }

    /* Smaller detail typography */
    .card-detail {
        padding: 14px 0 28px 0;
    }

    .card-info-grid {
        column-gap: 20px;
        grid-template-columns: 1fr;
        row-gap: 12px;
        padding-left: 6px;
    }

    .card-labels-col {
        grid-column: 1;
        grid-row: 1;
    }

    .card-body-col {
        grid-column: 1;
        grid-row: 2;
    }

    .card-label-item {
        font-size: 5pt;
    }

    .card-body-text {
        font-size: 8pt;
        line-height: 1.4;
    }

    .card-title {
        margin-bottom: 16px;
    }
}

/* ── About page ───────────────────────────────────────────────────────────── */
.about-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.home-about {
    position: relative;
    min-height: 100vh;
    padding-bottom: 104px;
    box-sizing: border-box;
}

.home-about.about-pixelated > :not(.about-pixel-canvas) {
    visibility: hidden;
}

.about-pixel-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    image-rendering: pixelated;
    z-index: 2;
}

/* Top half: portrait sits above the centred menu bar */
.about-above {
    height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0 38px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.about-card {
    border: 1.8px solid #000000;
    border-radius: var(--card-radius);
    padding: 5px;
    background: #ffffff;
    display: inline-flex;
    overflow: hidden;
    max-height: 100%;
    box-sizing: border-box;
}

.about-card img {
    display: block;
    width: auto;
    height: auto;
    max-height: calc(50vh - 96px - 12px); /* 96px = top+bottom padding, 12px = card padding */
    max-width: min(90vw, 400px);
    object-fit: contain;
}

/* Bottom half: text appears below the menu bar */
.about-below {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4px 24px 0;
    box-sizing: border-box;
}

.about-text {
    font-family: 'PP Neue Montreal', sans-serif;
    font-weight: 400;
    font-size: 10pt;
    line-height: 1.5;
    color: #000000;
    text-align: center;
    text-transform: none;
    max-width: 400px;
}

.about-text p {
    margin: 0;
}

.about-text p + p {
    margin-top: 0.6em;
}

.about-scroll-arrow {
    width: 24px;
    height: var(--about-arrow-height, 80px);
    margin-top: 24px;
    color: #3463FF;
    flex: 0 0 auto;
    opacity: 1;
    transition: opacity 0.45s ease;
}

.about-scroll-arrow.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.about-scroll-arrow svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.about-scroll-arrow path {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8px;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.about-greeting {
    font-family: 'PP Neue Montreal Mono', monospace;
    font-weight: 400;
    letter-spacing: -0.09em;
    line-height: 1;
    color: #3463FF;
    text-transform: lowercase;
    font-size: 52px;
    white-space: nowrap;
    margin: 0;
    padding: 0;
    text-align: center;
}

.about-description-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 60px;
}

@media (max-width: 767px) {
    .about-above {
        height: 35vh;
        padding-bottom: 16px;
    }

    .about-card img {
        max-height: calc(35vh - 96px - 12px);
        max-width: min(60vw, 220px);
    }

    .about-greeting {
        font-size: 28px;
    }

    .about-below {
        padding: 0px calc(12px + 10.5vw) 0;
    }

    .about-description-wrap {
        margin-top: 40px;
    }

    .about-text {
        max-width: 100%;
        width: 100%;
    }
}

.archive-feed {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.archive-item {
    position: absolute;
    width: 400px;
    border: 1.8px solid #000000;
    border-radius: var(--card-radius);
    padding: 5px;
    background: #ffffff;
    overflow: hidden;
    box-sizing: border-box;
    cursor: default;
    display: block;
}

.archive-item img {
    display: block;
    width: 100%;
    height: auto;
}

.archive-video {
    display: block;
    width: 100%;
    border: none;
}

@media (max-width: 767px) {
    .archive-item {
        width: 200px;
    }
}

@media (max-width: 767px) {
    .about-text {
        font-size: 8.5pt;
    }
}

.about-footer {
    position: fixed;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 2em;
    z-index: 9999;
}

.about-footer-link {
    font-family: 'PP Neue Montreal Mono', monospace;
    font-weight: 500;
    font-size: 8pt;
    text-transform: uppercase;
    color: #3463FF;
    text-decoration: none;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.about-footer-link:hover {
    animation: flash 1.2s ease-in-out infinite;
}

.home-about-footer {
    position: static;
    padding: 96px 0 20px;
    box-sizing: border-box;
}

@media (max-width: 767px) {
    .about-footer-link {
        font-size: 6.5pt;
    }

    .home-about-footer {
        padding: 72px 0 14px;
    }

    .project-card,
    .archive-item,
    .about-card {
        border: clamp(0.8px, 0.13vw, 1.8px) solid #000000;
    }
}
