/* GLOBAL PRESETS */
* {
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
}

/* FONT FACES */
@font-face {
    font-family: 'PPMori';
    src: url('PPMori-Regular.woff2') format('woff2'), url('PPMori-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'PPMori';
    src: url('PPMori-SemiBold.woff2') format('woff2'), url('PPMori-SemiBold.woff') format('woff');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'PPAcma';
    src: url('PP Acma - Free for Personal Use v2-2.0/otf/PPAcma-SemiboldItalic.otf') format('opentype');
    font-weight: 600;
    font-style: italic;
}

@font-face {
    font-family: 'PPMori';
    src: url('PPMori-Extralight.woff2') format('woff2');
    font-weight: 200;
    font-style: normal;
}

/* BASE STYLES & LAYOUT */
html {
    background-color: #ffffff;
    height: 100dvh;
    width: 100%;
    overflow: hidden;
    touch-action: manipulation;
}

body {
    background-color: #ffffff;
    color: #1e1e1e;
    font-family: 'PPMori', sans-serif;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-y: hidden;
    overflow-x: hidden;
    height: 100dvh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
}

body.no-scroll {
    overflow: hidden;
}

:root {
    --edge-pad: clamp(20px, 4vw, 40px);
    --bar-height: 60px;
    --bar-color: #141414;
    --bar-line: #FFFFFF;
}

/* ============================================================
   FRAME BARS (window effect around card area)
   ============================================================ */
.frame-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    background: var(--bar-color);
    z-index: 90;
    pointer-events: none;
}

.frame-bar--top {
    top: 0;
    height: var(--bar-height);
    border-bottom: 1px solid var(--bar-line);
}

.frame-bar--bottom {
    bottom: 0;
    height: var(--bar-height);
    border-top: 1px solid var(--bar-line);
}

/* ============================================================
   HAMBURGER BUTTON (mobile only)
   ============================================================ */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: var(--bar-height);
    width: 56px;
    z-index: 115;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.hamburger-btn span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: #e5e5e5;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-btn.is-open span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
}

.hamburger-btn.is-open span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.is-open span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
}

/* ============================================================
   HAMBURGER BACKDROP — blocks all touches/clicks behind open menu
   ============================================================ */
.hamburger-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 106;
    pointer-events: all;
    background: transparent;
}

.hamburger-backdrop.is-open {
    display: block;
}

body.hamburger-open {
    overflow: hidden;
    touch-action: none;
}

/* ============================================================
   HAMBURGER MENU (mobile only)
   ============================================================ */
.hamburger-menu {
    display: none;
    position: fixed;
    top: var(--bar-height);
    left: 0;
    width: 100%;
    background: #ffffff;
    z-index: 107;
    flex-direction: column;
    padding: 1.5rem 1.5rem 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid #141414;
    border-left: 1px solid #141414;
    border-right: 1px solid #141414;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.hamburger-menu.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.hamburger-menu-item {
    font-family: 'PPMori', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: lowercase;
    color: #141414;
    cursor: pointer;
}

.mobile-search-input {
    width: 100%;
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-transform: lowercase;
    color: #141414;
    outline: none;
    margin-bottom: 0.5rem;
}

.mobile-search-input::placeholder {
    color: #666;
}

.mobile-filter-panel {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-left: 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), margin-top 0.3s ease;
}

#hamburger-filter.is-open .mobile-filter-panel {
    max-height: 400px;
    margin-top: 0.8rem;
}

/* Filter heading: show toggle arrow */
#hamburger-filter > span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

#hamburger-filter > span::after {
    content: '↓';
    font-size: 1rem;
    font-weight: 200;
    transition: transform 0.3s ease;
}

#hamburger-filter.is-open > span::after {
    transform: rotate(180deg);
}

/* ============================================================
   MOBILE BOTTOM ARROWS
   ============================================================ */
.mobile-arrows {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bar-height);
    z-index: 100;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    pointer-events: auto;
}

.mobile-arrow-btn {
    color: #e5e5e5;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.8rem;
    line-height: 1;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.mobile-arrow-btn svg {
    width: 28px;
    height: 28px;
    display: block;
}

.mobile-arrow-btn:active {
    opacity: 0.5;
}

.name-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: #e5e5e5;
    z-index: 1000;
    pointer-events: none;
    color: #141414;
    --overlay-pad: var(--edge-pad);
    transform: translateY(-100%);
    visibility: hidden;
}

body.overlay-open .name-mark {
    z-index: 1200;
}

/* Removed overlay-open color overrides since difference mode handles inversion */


body.ui-hidden .sidebar,
body.ui-hidden .nav-bar,
body.ui-hidden .frame-bar,
body.ui-hidden .mobile-arrows,
body.ui-hidden .hamburger-btn,
body.ui-hidden .hamburger-menu {
    opacity: 0;
    pointer-events: none;
}

.name-mark {
    position: fixed;
    top: 0;
    left: clamp(10px, 1.5vw, 20px);
    height: var(--bar-height);
    display: inline-flex;
    align-items: center;
    gap: 0.06em;
    z-index: 100;
    font-size: clamp(1.4rem, 3.5vw, 4.3rem);
    line-height: 1.05;
    white-space: nowrap;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    text-shadow: none;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), left 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    perspective: 1000px;
}

.name-mark.intro-loader-active {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: clamp(80px, 15vh, 240px); /* huge but responsive */
    font-size: 0; /* SVG size natively responds to flex height */
    z-index: 10005;
}

/* On mobile the logo stays at its final bar height during intro — no resize, only position animates */
@media (max-width: 900px) {
    .name-mark.intro-loader-active {
        height: var(--bar-height);
    }
}

.name-logo {
    height: 80%;
    display: block;
    transition: transform 0.3s ease;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    position: relative;
    /* Aspect ratio for the logo to avoid manual width setting */
    aspect-ratio: 397.85 / 62.01;
}

.name-logo svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    display: block;
}

.name-logo .logo-front {
    transform: rotateY(0deg);
}

.name-logo .logo-back {
    transform: rotateY(180deg);
    opacity: 0; /* Hidden by default */
}

.name-logo.is-spinning {
    animation: spin3D 6s linear;
}

.name-logo.is-spinning .logo-front {
    animation: hideFront 6s linear;
}

.name-logo.is-spinning .logo-back {
    animation: hideBack 6s linear;
}

@keyframes spin3D {
    0% { transform: rotateY(0deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes hideFront {
    0%, 24.999% { opacity: 1; }
    25%, 74.999% { opacity: 0; }
    75%, 100% { opacity: 1; }
}

@keyframes hideBack {
    0%, 24.999% { opacity: 0; }
    25%, 74.999% { opacity: 1; }
    75%, 100% { opacity: 0; }
}

#intro-percent {
    position: fixed;
    bottom: clamp(24px, 4vh, 60px);
    right: clamp(20px, 3vw, 50px);
    font-family: 'PPMori', sans-serif;
    font-weight: 200;
    font-size: clamp(13px, 1.4vw, 22px);
    line-height: 1;
    letter-spacing: -0.03em;
    color: #111;
    opacity: 0;
    z-index: 10006;
    pointer-events: none;
    transition: opacity 0.5s ease;
    user-select: none;
}

#intro-disclaimer {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'PPMori', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #ff0000;
    white-space: nowrap;
    z-index: 10006;
    pointer-events: none;
    opacity: 0;
    animation: disclaimerFade 6s linear forwards;
}

@keyframes disclaimerFade {
    0%   { opacity: 0; }
    10%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { opacity: 0; }
}

@media (max-width: 768px) {
    /* Layout props that always apply */
    .name-mark {
        width: auto;
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
        box-sizing: border-box;
        gap: 0.06em;
    }

    /* Position/size only AFTER intro — don't override .intro-loader-active centering */
    .name-mark:not(.intro-loader-active) {
        left: 50% !important;
        transform: translateX(-50%);
        top: 0 !important;
        height: var(--bar-height) !important;
        font-size: clamp(1rem, 6vw, 2.1rem);
    }

    /* When overlay is open, GSAP controls position */
    body.overlay-open .name-mark {
        transform: none !important;
        left: var(--overlay-pad) !important;
    }
}


.overlay-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    padding-top: 80px;
    padding-bottom: 220px;
    /* Space to clear the name */
    mask-image: linear-gradient(to bottom,
            black 0%,
            black calc(100% - 200px),
            transparent calc(100% - 140px));
    -webkit-mask-image: linear-gradient(to bottom,
            black 0%,
            black calc(100% - 200px),
            transparent calc(100% - 140px));
    z-index: 1;
    /* Leave space to scroll past the name */
    padding-left: var(--overlay-left, var(--overlay-pad));
    padding-right: var(--edge-pad);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    color: #141414;
}

.overlay-close {
    position: absolute;
    right: var(--overlay-pad);
    bottom: var(--overlay-pad);
    font-family: 'PPMori', sans-serif;
    font-size: 2.4rem;
    color: #141414;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    z-index: 1200;
}

.slot-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    /* Prevent cropping */
    display: block;
    position: relative;
    /* Restored to flow so parent doesn't collapse */
}

/* Align images to screen edges */
.slot--03 .slot-image,
.slot--06 .slot-image {
    object-position: left center;
}

.slot--02 .slot-image,
.slot--04 .slot-image,
.slot--08 .slot-image,
.block-3 .slot--03 .slot-image {
    object-position: right center;
}

.slot--01 .slot-image,
.slot--05 .slot-image,
.slot--07 .slot-image {
    object-position: center center;
}

/* No special cover for full-width slots to prevent cropping */
.slot--05 .slot-image {
    object-fit: contain;
}

.overlay-title {
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.cv-sheet {
    background: transparent;
    color: #141414;
    border: none;
    padding: 0;
    min-height: 100%;
    box-sizing: border-box;
    font-family: 'PPMori', sans-serif;
}

.cv-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 26px 36px;
}

.cv-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 14px;
}

.cv-skills {
    grid-column: 1 / 7;
}

.cv-languages {
    grid-column: 7 / 10;
}

.cv-skill-list,
.cv-lang-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cv-skill-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 1rem;
}

.cv-lang-list li {
    margin-bottom: 6px;
    font-size: 1rem;
}

.skill-dots {
    display: inline-flex;
    gap: 6px;
}

.dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 1.5px solid rgba(20, 20, 20, 0.7);
    box-sizing: border-box;
}

.dot.filled {
    background: #141414;
}

.dot.empty {
    background: transparent;
}

.cv-experience {
    grid-column: 1 / 13;
    margin-top: 8px;
}

.cv-experience-list {
    display: flex;
    flex-direction: column;
    gap: 34px;
}

.cv-exp-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1rem;
}

.cv-exp-role {
    font-weight: 500;
}

.cv-exp-line {
    flex: 1;
    height: 1px;
    background: rgba(20, 20, 20, 0.6);
}

.cv-exp-date {
    white-space: nowrap;
}

.cv-exp-place {
    margin-top: 6px;
    color: rgba(20, 20, 20, 0.7);
}

@media (max-width: 900px) {
    .frame-bar {
        display: block;
        background: transparent;
    }

    .frame-bar--top {
        border-bottom: none;
    }

    .frame-bar--bottom {
        border-top: none;
    }

    /* Hamburger lines: dark on transparent bar */
    .hamburger-btn span {
        background: #141414;
    }

    /* Mobile arrows: dark on transparent bar */
    .mobile-arrow-btn {
        color: #141414;
    }

    .overlay-content {
        padding-top: 60px;
        padding-bottom: 200px;
        padding-left: var(--overlay-pad);
        padding-right: var(--overlay-pad);
        left: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .cv-sheet {
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .cv-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .cv-skills,
    .cv-languages,
    .cv-experience {
        grid-column: 1 / -1;
    }
}



.sidebar {
    display: none;
}

/* Unused fullscreen nav buttons — remove from flex flow */
.fs-nav-btn {
    display: none;
}

/* Nav Bar (Bottom Right) */
.nav-bar {
    position: fixed;
    bottom: 0;
    right: 2rem;
    height: var(--bar-height);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    z-index: 1000;
    pointer-events: auto;
    transition: opacity 0.4s ease;
}


.nav-item {
    cursor: pointer;
    font-family: inherit;
    font-size: clamp(0.8rem, 1.5vw, 1.5rem);
    font-weight: 600;
    text-transform: lowercase;
    color: #1e1e1e;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    padding: 0;
    border: none;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.nav-item:hover {
    color: #555555;
}

.search-toggle {
    display: flex;
    align-items: center;
}

.search-input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-transform: lowercase;
    color: #1e1e1e;
    outline: none;
    opacity: 0;
    pointer-events: none;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), padding 0.4s, opacity 0.3s, background 0.3s;
}

.search-input::placeholder {
    color: #999;
}

.search-toggle:hover .search-input,
.search-toggle.active .search-input,
.search-input:focus {
    width: 200px;
    padding: 0;
    margin-right: 1.5rem;
    /* Push label to the right */
    opacity: 1;
    pointer-events: auto;
    background: transparent;
    border-radius: 0;
    border-bottom: 1px solid #1e1e1e;
    /* Add a subtle line for the input */
}


@media (max-width: 900px) {
    /* Hide desktop nav on mobile */
    .nav-bar {
        display: none !important;
    }

    /* Show hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* Show hamburger menu container */
    .hamburger-menu {
        display: flex;
    }

    /* Show mobile bottom arrows */
    .mobile-arrows {
        display: flex;
    }

    /* Disable hover effects on mobile */
    .nav-item:hover {
        color: #e5e5e5;
    }

}

/* Filter Panel */
.filter-toggle {
    position: relative;
    display: flex;
    align-items: center;
}



.filter-panel {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: transparent;
    padding-bottom: 1.5rem;
    /* bridge the gap so hover isn't lost */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: auto;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0);
    transition: opacity 0.3s ease;
    align-items: flex-end;
}

.filter-toggle:hover .filter-panel,
.filter-toggle.active .filter-panel {
    opacity: 1;
    pointer-events: auto;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: lowercase;
    color: #1e1e1e;
    cursor: pointer;
}

.filter-item:hover {
    color: #555555;
}

.filter-item .nav-label {
    position: relative;
    display: inline-flex;
}

.filter-item .nav-label::after {
    content: '';
    position: absolute;
    bottom: -2px;
    /* Positioned very close to the text */
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #e5e5e5;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.filter-item.active .nav-label::after {
    transform: scaleX(1);
}

.filter-label {
    font-family: inherit;
}

.filter-dot {
    display: none;
}

.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 100;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
}

.category-filter {
    position: fixed;
    right: 40px;
    bottom: 40px;
    z-index: 220;
    pointer-events: none;
}

.category-filter-panel {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    width: 200px;
    /* Fixed width for stability */
    overflow: hidden;
}

.category-filter-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s;
}

.category-filter-title:hover {
    opacity: 0.7;
}

.category-filter-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.category-filter-icon svg {
    width: 100%;
    height: 100%;
}

.category-filter-toggle-text {
    font-family: 'PPMori', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.category-filter-items-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 4px;
    padding: 0 6px 6px 6px;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.category-filter.is-open .category-filter-items-container {
    max-height: 400px;
    opacity: 1;
    visibility: visible;
    margin-top: 4px;
}

.category-filter-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.category-filter-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-4px);
}

.category-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-filter-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #aaa;
    position: relative;
    display: inline-block;
}

.category-filter-label::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1.5px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.category-filter-item.is-active .category-filter-label {
    color: #fff;
    font-weight: 700;
}

.category-filter-item.is-active .category-filter-label::after {
    transform: scaleX(1);
    transform-origin: left;
}

.category-filter-item.is-active {
    background: rgba(255, 255, 255, 0.15);
}


.corner-instructions {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-size: 1.4rem;
    line-height: 1;
    color: #666;
    margin: 0;
}

.corner-instructions .arrow-row {
    display: flex;
    gap: 14px;
    justify-content: flex-end;
    letter-spacing: 0.08em;
}

/* 3D STACKS AND CARDS */
.content-area {
    width: 100%;
    height: 100%;
    position: relative;
}

#three-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    touch-action: none;
    /* Promote to own compositor layer for smoother rendering */
    will-change: contents;
    contain: strict;
}

body.intro-rain-active .name-mark {
    z-index: 100;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* CARD LABELS */
.card-label {
    font-family: 'PPMori', sans-serif;
    color: #111;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 24px;
    text-align: center;
}

/* FULLSCREEN VIEW */
.fullscreen-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background-color: transparent;
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    pointer-events: none;
    /* GPU layer for smooth open/close transitions */
    will-change: transform, opacity;
    contain: layout style;
}

.fullscreen-veil {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.45);
    opacity: 0;
    backdrop-filter: blur(6px) saturate(1.1);
    -webkit-backdrop-filter: blur(6px) saturate(1.1);
    z-index: 0;
    pointer-events: none;
}

.fullscreen-burst {
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.2) 35%, rgba(255, 255, 255, 0) 70%);
    opacity: 0;
    transform: scale(0.4);
    transform-origin: center;
    mix-blend-mode: screen;
    z-index: 1;
    pointer-events: none;
}

.fullscreen-content {
    position: relative;
    width: 100%;
    height: 100dvh;
    z-index: 2;
    transform: translateY(0);
    transform-origin: center top;
    transition: border-radius 0.28s ease, box-shadow 0.28s ease;
    flex-shrink: 0;
}

.fullscreen-content.is-paper-lifted {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    overflow: hidden;
    box-shadow: none;
}

.fullscreen-content.project-media-content {
    width: 100%;
    height: 100dvh;
}

.fullscreen-content.project-html-content {
    width: 100%;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.fullscreen-content.project-html-content::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* project-content uses flex-column layout — right column is the scroll container */
.fullscreen-content.project-content {
    width: 100%;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Durchgehende vertikale Gridlinie bei 2/3 (Spalte 8/9 von 12) */
.fullscreen-content.project-html-content::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 0;
    /* 8/12 = 66.667% of viewport width */
    left: 66.667%;
    width: 1px;
    background: rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 10;
}

.fullscreen-content.project-html-content::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.fullscreen-content.project-iframe-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.project-media-content {
    width: 100%;
    height: 100%;
    padding: clamp(20px, 4vh, 40px) 0;
    /* Horizontal padding removed to allow full-bleed images */
    box-sizing: border-box;
    display: block;
    /* Change from flex to block for standard flow */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background-color: var(--bg);
}

.project-iframe-content {
    width: 100%;
    height: 100%;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.project-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: transparent;
}



.project-media-frame {
    width: 100%;
    max-width: 100%;
    height: auto;
    background: transparent;
    border: none;
    box-shadow: none;
}

.project-media-frame.is-pdf {
    height: 100%;
}

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

.project-media-pdf {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.content-html-container {
    width: 100%;
}

.content-html-loading,
.content-html-error {
    padding: 32px;
    text-align: center;
    color: #222;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 12px;
}

.content-page {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.content-page--single {
    gap: 0;
}

.content-page__inner {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.content-page__page {
    margin: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    padding: 16px;
}

.content-page__page img {
    width: 100%;
    height: auto;
    display: block;
}

.content-page__long {
    width: 100%;
    height: auto;
    display: block;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    border-radius: 8px;
}

.pdf-pages {
    width: min(1200px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-bottom: 6vh;
}

.pdf-page {
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    padding: 14px 14px 18px;
}

.pdf-page-image {
    width: 100%;
    height: auto;
    display: block;
}

.pdf-error {
    padding: 24px;
    font-size: 1rem;
    color: #222;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    text-align: center;
}

.project-grid {
    width: min(1200px, 92vw);
    height: min(640px, 70vh);
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 18px 22px;
    padding: 36px 40px;
    box-sizing: border-box;
    background-color: var(--card-bg, #fff);
    background-image:
        linear-gradient(90deg, rgba(150, 150, 150, 0.18) 1px, transparent 1px),
        linear-gradient(rgba(150, 150, 150, 0.18) 1px, transparent 1px);
    background-size: calc(100% / 12) calc(100% / 6);
    background-position: 0 0;
}

.project-title {
    grid-column: 1 / 9;
    grid-row: 1 / 3;
    font-size: clamp(2.4rem, 4.8vw, 4.6rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #222;
}

.project-subtitle {
    grid-column: 1 / 5;
    grid-row: 3 / 4;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #444;
}

.project-meta {
    grid-column: 9 / 13;
    grid-row: 1 / 4;
    display: grid;
    gap: 10px;
    font-size: 0.9rem;
    color: #333;
}

.project-meta div {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(80, 80, 80, 0.18);
    padding-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.project-meta span:last-child {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
}

.project-body {
    grid-column: 1 / 9;
    grid-row: 4 / 7;
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
}

.project-tags {
    grid-column: 9 / 13;
    grid-row: 4 / 7;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #444;
}

.project-tags span {
    padding-top: 6px;
    border-top: 1px solid rgba(80, 80, 80, 0.18);
}

.close-btn {
    position: absolute;
    top: -8px;
    right: 0;
    font-family: 'PPMori', sans-serif;
    font-size: clamp(36px, 4.5vw, 68px);
    line-height: 1;
    cursor: pointer;
    z-index: 50;
    opacity: 0.45;
    padding: 10px;
    transition: opacity 0.2s ease;
    user-select: none;
    color: inherit;
    background: none;
    border: none;
}
.close-btn:hover { opacity: 1; }

/* ==========================================================================
   PROJECT HTML CONTENT BLOCKS (Migrated from Inhalt_TEMPLATE.html)
   ========================================================================== */

.project-html-content {
    --bg: #ffffff;
    --text: #111111;
    --line: #111111;
    --frame-inset: 10px;
    --gutter: clamp(10px, 1.2vw, 22px);
    --text-inset: clamp(12px, 1.6vw, 28px);
    --slot-a: #d8d8d8;
    --slot-b: #c8c8c8;
}

.page {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    padding: var(--frame-inset);
    padding-top: calc(var(--frame-inset) + 40px);
    padding-bottom: calc(var(--frame-inset) + 40px);
    display: flex;
    flex-direction: column;
    gap: calc(var(--gutter) * 4);
    /* Large vertical spacing between blocks */
    color: var(--text);
    overflow-x: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
}

.page::after {
    content: "";
    display: block;
    width: 100%;
}


.title-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-inline: var(--edge-pad);
}

/* TYPOGRAPHY SYSTEM: NEUFERT STIFTUNG INSPIRED */
.project-html-content h1,
.project-html-content .title {
    font-family: "PPMori", sans-serif;
    font-weight: 700;
    /* Bolder for H1 */
    font-size: clamp(42px, 7.5vw, 110px);
    /* Bold impact */
    letter-spacing: -0.07em;
    /* Very tight as per Neufert */
    line-height: 0.9;
    text-transform: uppercase;
    margin: 0 0 0.2em 0;
    color: #000;
}

.project-html-content h2,
.project-html-content .subtitle {
    font-family: "PPMori", sans-serif;
    font-weight: 400;
    /* Regular clean weight */
    font-size: clamp(24px, 3.5vw, 52px);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0 0 0.5em 0;
    color: #000;
}

.project-html-content h3,
.project-html-content .project-body,
.project-html-content p {
    font-family: "PPMori", sans-serif;
    font-weight: 400;
    font-size: clamp(16px, 1.4vw, 22px);
    letter-spacing: 0.01em;
    line-height: 1.5;
    margin: 0 0 1em 0;
    color: #111;
}

.project-html-content em,
.project-html-content .italic-text {
    font-style: italic;
}

.project-html-content strong {
    font-weight: 600;
}

.project-html-content .inline-h1 {
    font-weight: 700;
    font-size: clamp(24px, 4vw, 52px);
    /* Scale down for inline use */
    letter-spacing: -0.05em;
    text-transform: uppercase;
    display: inline;
}

.project-html-content .inline-h2 {
    font-weight: 700;
    font-size: clamp(18px, 2.5vw, 32px);
    letter-spacing: -0.02em;
    display: inline;
}

.project-html-content .inline-h3 {
    font-weight: 400;
    font-style: italic;
    font-size: clamp(14px, 1.8vw, 24px);
    display: inline;
}

.title-row>* {
    min-width: 0;
}

.block {
    --block-rgb: 17, 17, 17;
    display: grid;
    gap: var(--gutter);
    width: 100%;
}

.block-1 {
    --block-rgb: 17, 17, 17;
}

.block-2 {
    --block-rgb: 17, 17, 17;
}

.block-3 {
    --block-rgb: 17, 17, 17;
}

.block-4 {
    --block-rgb: 17, 17, 17;
}

.block-5 {
    --block-rgb: 17, 17, 17;
}

.block .title,
.block .subtitle,
.block .block-2-text h2,
.block .block-3-text h2,
.block .block-4-item h2,
.block .title-row h1,
.block .title-row h2 {
    color: #111111;
}

.rich-text-content {
    width: 100%;
}

.rich-text-content p {
    margin: 0 0 1em 0;
}

.rich-text-content p:last-child {
    margin-bottom: 0;
}

.rich-text-content h1,
.rich-text-content h2,
.rich-text-content h3 {
    margin-bottom: 0.5em;
}

/* Explicit mapping for consistency */
.block-1 .title {
    grid-area: auto;
}

.block-1 h1 {
    font-weight: 600;
}

.block-1 h2 {
    font-weight: 400;
}

.block-1 h3 {
    font-style: italic;
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--gutter);
}

.slot {
    position: relative;
    background: transparent;
    overflow: hidden;
    min-height: 0;
    height: auto;
    isolation: isolate;
}

/* Ensure all images in a slider behave identically */
.slider-inline-container .slider-slide {
    object-fit: contain;
    object-position: center center !important;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.pdf-inline-container .pdf-page {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-inline-container .pdf-page-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.block-2-text {
    grid-column: 9 / 13;
    align-self: end;
    justify-self: stretch;
    display: flex;
    align-items: flex-end;
    padding: 0 var(--edge-pad);
    border: 0;
    background: transparent;
    min-height: 0;
    min-width: 0;
    grid-row: 1;
}

.block-3 .slot--03 {
    grid-column: 5 / 13;
    grid-row: 1;
}

.block-3-text {
    grid-column: 1 / 5;
    align-self: end;
    justify-self: stretch;
    display: flex;
    align-items: flex-end;
    padding: 0 var(--edge-pad);
    border: 0;
    background: transparent;
    min-height: 0;
    min-width: 0;
    grid-row: 1;
}

.block-4-item {
    display: grid;
    gap: clamp(8px, 0.9vw, 14px);
    align-content: start;
}

.block-4-item h2 {
    margin: 0;
    padding-inline: var(--edge-pad);
    font-family: "PPMori", sans-serif;
    font-weight: 600;
    font-size: clamp(18px, 1.55vw, 28px);
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-align: left;
}

.block-4-item--06 {
    grid-column: 1 / 5;
}

.block-4-item--07 {
    grid-column: 5 / 9;
}

.block-4-item--08 {
    grid-column: 9 / 13;
}

.block-4-item .slot {
    aspect-ratio: auto;
    width: 100%;
    min-height: 100px;
}

.slot--01 {
    grid-column: 1 / 9;
    grid-row: 1;
}

.slot--02 {
    grid-column: 9 / 13;
}

.slot--03 {
    grid-column: 1 / 7;
}

.slot--04 {
    grid-column: 7 / 13;
}

.slot--05 {
    grid-column: 1 / 13;
}

.slot--06 {
    grid-column: 1 / 5;
}

.slot--07 {
    grid-column: 5 / 9;
}

.slot--08 {
    grid-column: 9 / 13;
}

.slot img,
.slot video {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    /* Prevent cropping */
    background: transparent;
}

/* PROJECT INFO BLOCK STYLING */
.block-info {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gutter);
    padding-inline: var(--edge-pad);
    margin-top: 40px;
}

.info-title {
    grid-column: 1 / 5;
    font-size: clamp(14px, 1.2vw, 18px);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
    font-weight: 600;
}

.info-table {
    grid-column: 5 / 13;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.info-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-size: clamp(14px, 1.1vw, 16px);
}

.info-label {
    font-weight: 600;
    color: #666;
}

.info-value {
    color: #111;
}

@media (max-width: 1280px) {

    .block-2 .slot--01,
    .block-3 .slot--03 {
        grid-column: 1 / 13;
        grid-row: 1;
    }

    .block-2-text,
    .block-3-text {
        grid-column: 1 / 13;
        align-self: start;
        justify-self: start;
        grid-row: 2;
        padding-top: 10px;
    }
}

@media (max-width: 768px) {

    .project-html-content {
        --frame-inset: 4px;
        --edge-pad: 14px;
        --gutter: 10px;
    }

    .page {
        padding-top: calc(var(--frame-inset) + 20px);
        padding-left: 0;
        padding-right: 0;
        gap: calc(var(--gutter) * 2.5);
    }

    .title-row {
        gap: 8px;
        padding-inline: var(--edge-pad);
    }

    .block {
        padding-inline: var(--edge-pad);
    }

    .block-2 .slot--01,
    .block-3 .slot--03,
    .slot--01,
    .slot--02,
    .slot--03,
    .slot--04,
    .slot--05,
    .slot--06,
    .slot--07,
    .slot--08 {
        grid-column: 1 / 13;
        aspect-ratio: auto;
        /* Remove rigid mobile ratios */
        padding-inline: 0;
        margin-left: calc(var(--edge-pad) * -1);
        margin-right: calc(var(--edge-pad) * -1);
        width: calc(100% + calc(var(--edge-pad) * 2));
    }

    .block-2-text,
    .block-3-text {
        grid-column: 1 / 13;
        align-self: start;
        justify-self: start;
    }

    .block-4-item--06,
    .block-4-item--07,
    .block-4-item--08 {
        grid-column: 1 / 13;
    }

    /* CV / Info Block Fixes */
    .block-info {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .info-title,
    .info-table {
        grid-column: 1 / -1;
    }

    .info-row {
        grid-template-columns: 1fr;
        /* Stack label and value vertically on very small screens */
        gap: 4px;
        padding: 10px 0;
    }
}

/* Aggressive edge-to-edge for smaller phones */
@media (max-width: 600px) {
    .project-html-content {
        --frame-inset: 2px;
        --edge-pad: 8px;
        --gutter: 8px;
    }

    .page {
        padding-top: calc(var(--frame-inset) + 15px);
        gap: calc(var(--gutter) * 2);
    }

    .title-row {
        gap: 6px;
    }

    .block-info {
        margin-top: 20px;
    }
}

/* .close-btn is always visible when its parent (.fullscreen-view) is shown */

.index-close-btn {
    position: fixed;
    top: -8px;
    right: 0;
    background: none;
    border: none;
    font-family: 'PPMori', sans-serif;
    font-size: clamp(36px, 4.5vw, 68px);
    line-height: 1;
    cursor: pointer;
    z-index: 5010;
    opacity: 0.45;
    padding: 10px;
    transition: opacity 0.2s ease;
    user-select: none;
    color: #111;
    display: none;
}
.index-close-btn:hover { opacity: 1; }

.overlay-close-hint {
    display: none !important;
}

/* --- Fullscreen Content Loader --- */
.fullscreen-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.fullscreen-view.is-loading .fullscreen-loader {
    opacity: 1;
}

.loader-line {
    width: 240px;
    height: 1.5px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.loader-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 60%;
    background: #ffffff;
    animation: loader-slide 2.2s cubic-bezier(0.65, 0.05, 0.36, 1) infinite;
}

@keyframes loader-slide {
    0% {
        transform: translateX(-110%);
    }

    60% {
        transform: translateX(110%);
    }

    100% {
        transform: translateX(110%);
    }
}

.fullscreen-content {
    opacity: 1;
    /* transition removed to allow GSAP full control */
}


.fullscreen-view.is-loading .fullscreen-content {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(12px);
}

/* ── INDEX VIEW ─────────────────────────────────────────────────── */
#index-view {
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 5000;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
    display: none;
    padding: 2.5rem 2rem 5rem;
    transition: opacity 0.35s ease;
}

#index-view.is-open {
    opacity: 1;
    pointer-events: auto;
}

.index-project-row {
    margin-bottom: 2.2rem;
}

.index-project-header {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    margin-bottom: 0.2rem;
    gap: 0.75rem;
}

.index-project-title {
    font-family: 'PPMori', sans-serif;
    font-weight: 600;
    font-size: clamp(0.6rem, 0.85vw, 0.75rem);
    color: #1e1e1e;
    letter-spacing: 0.01em;
}

.index-project-date {
    font-family: 'PPMori', sans-serif;
    font-size: 0.6rem;
    color: #888;
    font-weight: 400;
    white-space: nowrap;
}

.index-project-images {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
}

.index-thumb {
    flex: 0 0 auto;
    height: 57px;
    width: auto;
    cursor: pointer;
    object-fit: cover;
    display: block;
    opacity: 1;
    transition: opacity 0.2s ease;
    background: #e8e6e0;
}
.index-thumb:hover { opacity: 0.7; }

#index-btn.active .nav-label { opacity: 0.45; }

@media (max-width: 900px) {
    #index-view { padding: 2rem 1rem 5rem; }
    .index-thumb { height: 40px; }
}
