/* ========================================
   LOTTA WOLFINGER
   3D Glass Beads Network
   ======================================== */

@font-face {
    font-family: 'CMMCoda';
    src: url('../CMMCoda-MonoSerif.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Erode';
    src: url('../Erode-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'InstrumentSerif';
    src: url('../InstrumentSerif-Regular.woff2') format('woff2');
    font-weight: lighter;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'ErodeVar';
    src: url('../Erode-VariableItalic.woff2') format('woff2');
    font-style: italic;
    font-display: swap;
}

:root {
    --black: #00000;
    --white: #ffffff;
    --space: 1rem;
    --font-primary: 'InstrumentSerif', serif;
    --font-mono: 'InstrumentSerif', serif;
}

*, *::before, *::after {
    cursor: none !important;
}

html, body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}

body {
    font-family: 'InstrumentSerif', serif;
    background: var(--white);
    color: var(--black);
}

/* ========================================
   CUSTOM CURSOR
   ======================================== */

.cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    will-change: transform;
    --cursor-scale: 1;
    --cursor-rotate: 0deg;
}

.cursor video {
    display: block;
    width: 60px;
    height: 60px;
    object-fit: contain;
    transform: scale(var(--cursor-scale)) rotate(var(--cursor-rotate));
    transform-origin: center;
    transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.cursor.hover {
    --cursor-scale: 1.06;
}

.cursor.drag {
    --cursor-scale: 0.92;
    --cursor-rotate: -10deg;
}

.cursor.is-project-open {
    --cursor-scale: 1.1;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ========================================
   FULLSCREEN 3D CANVAS
   ======================================== */
#beads-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
    touch-action: none;
}

#beads-canvas:active {
    cursor: grabbing;
}


/* ========================================
   OVERLAY UI
   ======================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--space);
}

body.project-open .overlay,
body.project-open .email-kaiser {
    opacity: 0;
    pointer-events: none;
}

/* Intro Text - Top Left */
.overlay-intro {
    pointer-events: none;
    max-height: calc(100dvh - 4rem);
    overflow: hidden;
}

.expand-trigger {
    pointer-events: auto;
}

.intro-text {
    display: flex;
    flex-direction: column;
    gap: 0.15em;
}

.intro-text span {
    font-size: clamp(1.8rem, 5.5vw, 5rem);
    font-weight: 300;
    line-height: 1;
    font-style: normal;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.intro-text span:nth-child(1) { animation-delay: 0.2s; }
.intro-text span:nth-child(2) { animation-delay: 0.35s; }
.intro-text span:nth-child(3) { animation-delay: 0.5s; }

.curious {
    font-family: 'InstrumentSerif', serif;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Expand Section */
.intro-expand {
    margin-top: 1rem;
    pointer-events: none;
}


.expand-trigger {
    font-family: 'InstrumentSerif', serif;
    font-size: clamp(3.5rem, 9vw, 8rem);
    background: none;
    border: none;
    color: var(--black);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: transform 0.3s, color 0.3s;
}

.intro-expand.open .expand-trigger {
    transform: rotate(45deg);
}

/* Colorful Mode */
body.colorful {
    background: #ffffff;
}

body.colorful #beads-canvas {
    image-rendering: pixelated;
}

body.colorful .intro-text span,
body.colorful .expand-content p {
    color: #010007;
}

body.colorful .filter {
    border-color: #ffffff;
    color: #ffffff;
    outline: #000000;
}

body.colorful .filter:hover,
body.colorful .filter.active {
    background: #DFFF00;
    border-color: #DFFF00;
    color: #A8C8E8;
}

body.colorful .overlay-nav {
    display: none;
}

.expand-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.5s ease;
    overflow: hidden;
}

.intro-expand.open .expand-content {
    grid-template-rows: 1fr;
}

.expand-content > * {
    overflow: hidden;
}

.expand-content p {
    font-size: clamp(1.4rem, 3.8vw, 3.8rem);
    font-weight: 300;
    line-height: 1.2;
    margin-top: 0.15em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s, transform 0.4s;
}

.intro-expand.open .expand-content p {
    opacity: 1;
    transform: translateY(0);
}

.intro-expand.open .expand-content p:nth-child(1) { transition-delay: 0.1s; }
.intro-expand.open .expand-content p:nth-child(2) { transition-delay: 0.2s; }
.intro-expand.open .expand-content p:nth-child(3) { transition-delay: 0.3s; }
.intro-expand.open .expand-content p:nth-child(4) { transition-delay: 0.4s; }

.expand-content a {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Navigation / Filters - Bottom Left */
.overlay-nav {
    position: fixed;
    bottom: var(--space);
    left: var(--space);
    display: flex;
    gap: 0.5rem;
    pointer-events: none;
}

.filter {
    font-family: 'InstrumentSerif', serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: 1px solid var(--black);
    color: var(--black);
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.filter:hover,
.filter.active {
    background: var(--black);
    color: var(--white);
}
/* Email - */
.email-kaiser {
    position: fixed;
    right: var(--space);
    top: var(--space);
    font-size: clamp(0.9rem, 1.8vw, 1.6rem);
    letter-spacing: 0.2em;
    text-transform: none;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: #000000;
    text-decoration: none;
    z-index: 10;
    padding-right: 0.6rem;
    transition: letter-spacing 0.3s, color 0.3s;
}

.email-kaiser:hover {
    letter-spacing: 0.35em;
    color: var(--black);
}

body.colorful .email-kaiser {
    color: #000000;
    border-right-color: #000000;
}

/* Contact - Bottom Right */
.overlay-contact {
    position: fixed;
    bottom: var(--space);
    right: var(--space);
    pointer-events: none;
}

.overlay-contact a {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: relative;
    display: inline-block;
}

.overlay-contact a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 4'%3E%3Cpath d='M0 2 Q10 0, 20 2 T40 2 T60 2 T80 2 T100 2' stroke='%230a0a0a' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") repeat-x;
    background-size: 50px 4px;
    animation: wobble-line 3s ease-in-out infinite;
}

@keyframes wobble-line {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

.overlay-contact a:hover::after {
    animation: wobble-line 0.5s ease-in-out infinite;
}

/* ========================================
   PROJECT OVERLAY
   ======================================== */
.project-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.project-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.project-overlay__content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2.25rem 4rem 1.5rem;
    box-sizing: border-box;
}

.project-overlay__img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    transform: scale(0.92);
    transition: transform 0.4s ease;
}

.project-overlay.visible .project-overlay__img {
    transform: scale(1);
}

.project-overlay__pdf {
    width: 80vw;
    height: 75vh;
    border: none;
}

.project-overlay__media {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    gap: 0.1rem;
    width: min(92vw, 1200px);
}

.project-overlay__media-inner {
    width: 100%;
    height: 100%;
}

.project-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    width: 100%;
    height: 100%;
}

.project-gallery__feature {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-height: 0;
    gap: 2%;
    width: 100%;
    height: min(66vh, 660px);
}

.project-gallery--single-media .project-gallery__feature {
    gap: 0;
}

.project-gallery__main {
    flex: 0 1 auto;
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-gallery--single-media .project-gallery__main {
    flex: 1 1 auto;
    width: 100%;
}

.project-gallery__main-media {
    max-width: min(66vw, 860px);
    max-height: none;
    width: auto;
    height: 100%;
    object-fit: contain;
    display: block;
}

.project-gallery--single-media .project-gallery__main-media {
    max-width: min(76vw, 960px);
    margin-inline: auto;
}

.project-gallery__side {
    flex: 0 0 auto;
    width: auto;
    min-height: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.project-gallery__nav {
    position: relative;
    justify-content: center;
    min-height: 1.5rem;
    width: 100%;
    z-index: 30;
}

.project-gallery__status {
    min-width: 3rem;
    text-align: center;
}

.project-gallery__thumbs {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
    width: 100%;
    scrollbar-width: thin;
}

.project-gallery__thumb {
    position: relative;
    width: min(10vw, 100px);
    height: min(8.5vh, 78px);
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.project-gallery__thumb:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.project-gallery__thumb.is-hidden {
    display: none;
}

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

.project-gallery__thumb-badge {
    position: absolute;
    left: 0.55rem;
    bottom: 0.45rem;
    padding: 0.18rem 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--white);
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

.project-overlay__nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: rgba(0, 0, 0, 0.6);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.project-overlay__nav button {
    background: none;
    border: none;
    color: var(--black);
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
    transition: opacity 0.2s;
}

.project-overlay__nav button:hover {
    opacity: 1;
}

.project-overlay__info {
    display: flex;
    gap: 2rem;
    align-items: baseline;
    margin-top: 0.75rem;
    flex: 0 0 auto;
}

.project-overlay__title {
    font-family: var(--font-primary);
    font-size: 1.4rem;
    color: var(--black);
    letter-spacing: 0.05em;
}

.project-overlay__year {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.45);
}

.project-overlay__link {
    font-family: 'InstrumentSerif', serif;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #000000;
    text-decoration: underline;
    text-underline-offset: 0.15em;
    transition: opacity 0.2s;
}

.project-overlay__link:hover {
    opacity: 0.7;
}

/* ========================================
   TOOLTIP
   ======================================== */
.bead-tooltip {
    position: fixed;
    padding: 1rem 1.5rem;
    background: var(--black);
    color: var(--white);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
}

.bead-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-title {
    display: block;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.tooltip-meta {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Cursor nur auf Geräten mit Maus anzeigen */
@media (hover: none) {
    .cursor {
        display: none !important;
    }

    *, *::before, *::after {
        cursor: auto !important;
    }
}

@media (max-width: 1100px) and (min-width: 769px) {
    .intro-text span {
        font-size: clamp(1.6rem, 4.5vw, 4rem);
    }

    .expand-content p {
        font-size: clamp(1.2rem, 3vw, 3rem);
    }
}

@media (max-width: 768px) {
    :root {
        --space: 0.75rem;
    }

    /* Canvas & Overlay füllen mobile Viewport korrekt */
    #beads-canvas,
    .project-overlay {
        height: 100dvh;
    }

    /* Intro Text kleiner auf Mobile */
    .intro-text span {
        font-size: clamp(1.6rem, 7vw, 3rem);
    }

    .expand-content p {
        font-size: clamp(1rem, 4.5vw, 2rem);
    }

    /* Filter-Leiste: umbrechen, Touch-freundliche Größe */
    .overlay-nav {
        flex-wrap: wrap;
        gap: 0.4rem;
        max-width: calc(100vw - 1.5rem);
    }

    .filter {
        font-size: 0.65rem;
        padding: 0.55rem 1rem;
    }

    /* Email-Link auf Mobile: horizontal unten */
    .email-kaiser {
        writing-mode: horizontal-tb;
        top: auto;
        right: auto;
        bottom: var(--space);
        right: var(--space);
        font-size: clamp(0.7rem, 3vw, 1rem);
        letter-spacing: 0.1em;
        padding-right: 0;
    }

    /* Projekt Overlay: weniger Padding */
    .project-overlay__content {
        padding: 4rem 1rem 1.5rem;
    }

    .project-gallery__main {
        min-height: min(58vh, 500px);
        height: auto;
    }

    .project-gallery__main-media {
        max-width: min(90vw, 360px);
        max-height: min(54vh, 400px);
        height: auto;
    }

    .project-gallery__feature {
        flex-direction: column;
        gap: 0.8rem;
        height: auto;
    }

    .project-gallery__side {
        width: min(56vw, 220px);
        min-height: auto;
        height: auto;
    }

    .project-gallery__side-media {
        max-height: min(24vh, 180px);
        max-width: min(56vw, 220px);
        height: auto;
    }

    .project-gallery__thumb {
        width: min(16vw, 74px);
        height: min(8vh, 60px);
    }

    .project-overlay__info {
        flex-direction: column;
        gap: 0.25rem;
        margin-top: 1rem;
    }

    /* Tooltip auf Touch verstecken */
    .bead-tooltip {
        display: none;
    }
}
