@font-face {
    font-family: 'Soehne';
    src: url('fonts/soehne-buch.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Soehne';
    src: url('fonts/soehne-halbfett.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
}

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

html {
    background-color: #0f1110;
    height: 100%;
    height: 100dvh;
    overscroll-behavior-y: none;
}

html,
body,
a,
button,
.site-title,
.about-btn,
.selection-player-container,
.timeline-item {
    cursor: none !important;
}

body {
    background-color: #0f1110;
    color: #ffffff;
    font-family: 'Soehne', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-y: hidden;
    height: 100%;
    height: 100dvh;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

#custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 36px;
    height: 50px;
    /* Center the container on the mouse point */
    margin-left: -18px;
    margin-top: -25px;
    pointer-events: none;
    z-index: 2147483647;
    display: block;
    opacity: 0;
    transition: opacity 0.2s ease;
    will-change: transform;
    /* Move parent exactly to mouse point */
    transform: translate3d(0, 0, 0);
    mix-blend-mode: difference;
}

.cursor-circle {
    /* Circle cursor - the only cursor style used */
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    background-color: rgba(255, 255, 255, 1);
    border-radius: 50%;
    opacity: 1;
    transform: translate(-50%, -50%);
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
}

#custom-cursor.active {
    opacity: 1;
}

/* Link hover - enlarge circle */
#custom-cursor.is-link .cursor-circle {
    transform: translate(-50%, -50%) scale(1.5);
}

/* Pressed State - consistent everywhere */
#custom-cursor.is-pressed .cursor-circle {
    transform: translate(-50%, -50%) scale(0.8);
}

a {
    color: #ffffff;
    text-decoration: underline;
    text-decoration-color: #444444;
    text-underline-offset: 6px;
    transition: text-decoration-color 0.25s ease;
}

a:hover {
    text-decoration-color: #ffffff;
}

.site-branding {
    position: absolute;
    top: 1.75rem;
    left: 2rem;
    z-index: 1000;
    display: block;
    text-decoration: none;
    mix-blend-mode: difference;
}

.site-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-icon {
    display: block;
    width: 45px;
    height: 50px;
}

.nav {
    position: absolute;
    top: 2.25rem;
    right: 2rem;
    z-index: 1000;
    mix-blend-mode: difference;
    pointer-events: none;
}

.nav button {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1.25;
    /* Tightest line height for precise underline control */
    color: #ffffff;
    pointer-events: auto;
    padding: 0;
    position: relative;
}

/* Hit area expansion for Nav Buttons */
.nav button::before {
    content: '';
    position: absolute;
    top: -15px;
    left: -20px;
    right: -20px;
    bottom: -10px;
}

.about-btn::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    /* Adjusted to match visual offset of other links */
    width: 100%;
    height: 2px;
    background: #ffffff;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

body.info-active .about-btn::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Selection View */
.selection-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: #0f1110;
    overflow: hidden;
    transition: background-color 0.6s ease;
}

.selection-view.info-active {
    background: transparent;
    pointer-events: none;
}

.selection-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* Use 100% or bottom:0 to match the stabilized container exactly */
    bottom: 0;
    transition: opacity 1s ease, transform 0.75s cubic-bezier(0.4, 0, 0.2, 1), filter 0.75s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    will-change: transform;
    background-color: #0f1110;
    opacity: 0;
    cursor: pointer;
    /* Disable selection and callouts for Safari */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    filter: brightness(1);
    /* Ensure container clips to bounds */
    overflow: hidden;
    z-index: 0;
}

.selection-player-container.intro-visible {
    opacity: 1;
}

.selection-player-container.info-active {
    transform: translate3d(0, -120vh, 0);
    filter: brightness(0.2);
}

.selection-player {
    position: absolute;
    /* Use inset for absolute stretching */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Explicit sizing to prevent any sizing issues */
    width: 100% !important;
    height: 100% !important;
    min-width: 100%;
    min-height: 100%;
    max-width: none;
    max-height: none;
    /* ENFORCED: Always cover to prevent black bars */
    object-fit: cover !important;
    -o-object-fit: cover !important;
    -webkit-object-fit: cover !important;
    object-position: center center;
    z-index: 1;
    opacity: 0;
    background-color: #0f1110;
    background-size: cover;
    background-position: center;
    transition: opacity 0.25s ease;
}

.selection-player[poster],
.selection-player.video-contain,
.selection-player.video-cover {
    object-fit: cover !important;
}

.selection-timeline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(11dvh + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 10;
    display: flex;
    align-items: center;
    overflow: visible;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

.timeline-track {
    display: flex;
    height: 100%;
    align-items: center;
    padding-left: 2rem;
    will-change: transform;
}

.timeline-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10;
    pointer-events: none;
    mix-blend-mode: difference;
}

.timeline-progress-fill {
    height: 100%;
    width: 0%;
    background: rgba(200, 200, 200, .3);
    transform: scaleX(1);
    transform-origin: left;
    contain: strict;
}

.timeline-item {
    height: 100%;
    aspect-ratio: 16/9;
    margin: 0;
    margin-right: -1px;
    flex-shrink: 0;
    filter: none;
    transition: transform var(--t-dur, 0s) var(--t-ease, cubic-bezier(0.4, 0, 0.2, 1)), box-shadow 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    background: #0f1110;
    isolation: isolate;
    --intro-y: 0px;
    --exit-y: 0px;
    --t-dur: 0s;
    --t-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --reveal-multiplier: 1;
    contain: content;

    /* Math-based Fractional Scaling & Shifting */
    --dist: calc(var(--i) - var(--active-idx));
    --abs-dist: max(var(--dist), calc(-1 * var(--dist)));
    --s: calc(1 + 0.2 * clamp(0, calc(1 - var(--abs-dist)), 1) * var(--reveal-multiplier));
    --shift: calc(clamp(0%, calc(var(--dist) * 20%), 20%) * var(--reveal-multiplier));

    transform: translate3d(var(--shift), calc(var(--intro-y) + var(--exit-y)), 0) scale(var(--s));
    transform-origin: left bottom;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}

.timeline-track.intro-active .timeline-item {
    --reveal-multiplier: 0;
}

.timeline-item.intro,
.timeline-item.is-starting,
.timeline-track.is-revealing .timeline-item {
    --t-dur: 0.9s;
    --t-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.timeline-item.intro {
    --intro-y: 100vh;
}

.timeline-item.intro img {
    opacity: 0;
}

.timeline-item:hover {
    z-index: 5;
}

.timeline-item:hover img {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.timeline-item.info-exit {
    --exit-y: 150vh;
    --t-dur: 0.85s;
}

.timeline-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate3d(-50%, -50%, 0);
    transform-origin: center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    opacity: 0.6;
    transition: opacity 1s ease;
}

.timeline-item.active {
    filter: none;
    z-index: 20;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.timeline-item.active img {
    opacity: 1;
}

/* Loading indicator for buffering videos */
.timeline-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -18px 0 0 -18px;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 30;
    transform: scale(0.8);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.timeline-item.is-loading::after {
    opacity: 1;
    transform: scale(1);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: scale(1) rotate(360deg);
    }
}

/* Play/Pause indicator pulse */
.timeline-item .play-pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 40;
    filter: drop-shadow(0 1px 8px rgba(0, 0, 0, 0.75));
    transition: none;
    overflow: visible;
}

.timeline-item .play-pause-indicator.pulse {
    animation: indicatorPulse 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes indicatorPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.6);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Play icon */
.play-pause-indicator .icon-play {
    width: 18px;
    height: 24px;
    display: none;
}

/* Pause icon (two bars) */
.play-pause-indicator .icon-pause {
    display: none;
    gap: 6px;
}

.play-pause-indicator .icon-pause span {
    width: 6px;
    height: 24px;
    background: #ffffff;
    border-radius: 2px;
}

/* Show correct icon based on state */
.timeline-item.show-play .play-pause-indicator .icon-play {
    display: block;
}

.timeline-item.show-pause .play-pause-indicator .icon-pause {
    display: flex;
}

/* z-index handling for overlapping scaled items */
.timeline-item.active~.timeline-item {
    z-index: 1;
}

.active-video-title {
    position: absolute;
    left: 2rem;
    bottom: calc(13.2dvh + 1rem + env(safe-area-inset-bottom));
    font-size: 2rem;
    font-weight: 600;
    mix-blend-mode: difference;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.6s ease 0.4s;
}

.selection-view.is-intro .active-video-title {
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0s;
}

.active-video-title.visible {
    opacity: 1;
}

.countdown-timer {
    position: absolute;
    left: 2rem;
    bottom: calc(13.2dvh + 4rem + env(safe-area-inset-bottom));
    font-size: 1rem;
    font-family: 'Soehne', monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 400;
    mix-blend-mode: difference;
    z-index: 100;
    pointer-events: none;
    margin: 0;
    opacity: 0;
    transition: opacity 0.6s ease 0.4s;
}

.selection-view.is-intro .countdown-timer {
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0s;
}

.countdown-timer.visible {
    opacity: 0.75;
}

.selection-view.info-active .active-video-title,
.selection-view.info-active .countdown-timer {
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease 0s, visibility 0.25s ease 0s;
}

.about-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    z-index: 1;
    padding: 10rem 2rem 6rem;
    overflow: hidden;
    overflow-y: auto;
    background-color: #0f1110;
    pointer-events: none;
}

.about-view.active {
    pointer-events: auto;
}

.about-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.about-row {
    display: flex;
    width: 100%;
    align-items: flex-start;
}

.about-row h2 {
    width: 25%;
    font-size: 1.5rem;
    font-weight: 400;
    color: #666666;
    text-transform: none;
    margin: 0;
}

.about-text {
    width: 52%;
    max-width: 800px;
    /* Cap width for optimal readability */
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.5;
}

.about-text p {
    margin-bottom: 2rem;
}

.about-row:first-of-type .about-text p:first-of-type {
    font-size: 2.5rem;
    line-height: 1.3;
    margin-bottom: 3rem;
    color: #ffffff;
}

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

.social-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.social-links a {
    display: inline-block;
    color: #ffffff;
    font-weight: 400;
}

.status-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    background-color: #00ff00;
    border-radius: 50%;
    margin-right: 0.8rem;
    margin-top: -0.2rem;
    vertical-align: middle;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.no-transition,
.no-transition * {
    transition: none !important;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    #custom-cursor {
        display: none !important;
    }

    html,
    body,
    a,
    button,
    .site-title,
    .about-btn,
    .selection-player-container,
    .timeline-item {
        cursor: auto !important;
    }

    /* Mobile stability optimizations */
    .selection-view,
    .selection-player-container {
        height: auto !important;
        bottom: 0 !important;
    }

    .about-view {
        height: 100dvh !important;
        bottom: 0 !important;
    }

    .selection-player {
        will-change: auto;
        object-fit: cover !important;
        -webkit-object-fit: cover !important;
        width: 100% !important;
        height: 100% !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        min-width: 100% !important;
        min-height: 100% !important;
    }

    .timeline-track,
    .timeline-item img {
        will-change: auto;
    }

    .timeline-item.active {
        box-shadow: none;
    }

    .timeline-item {
        transform-style: flat;
        backface-visibility: visible;
        -webkit-backface-visibility: visible;
    }

    .site-title,
    .active-video-title,
    .countdown-timer {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .selection-player-container {
        transform-style: flat;
    }

    .timeline-item[style*="visibility: hidden"] {
        content-visibility: hidden;
    }

    .timeline-item.info-exit {
        --t-dur: 0.5s;
    }

    /* iPad & Mobile bottom UI fixes */
    .selection-timeline {
        position: fixed !important;
        bottom: 0 !important;
        left: 0;
        right: 0;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        height: 11dvh;
        /* Remove all safe-area spacing to eliminate gap */
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .active-video-title,
    .countdown-timer {
        position: fixed !important;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    .active-video-title {
        bottom: calc(11dvh + 1rem) !important;
    }

    .countdown-timer {
        bottom: calc(11dvh + 3.5rem) !important;
        font-size: 1rem !important;
    }

    /* Portrait specific adjustment for a bit more distance */
    @media (orientation: portrait) {
        .active-video-title {
            bottom: calc(11dvh + 1.5rem) !important;
        }

        .countdown-timer {
            bottom: calc(11dvh + 3.25rem) !important;
        }
    }
}

/* Mobile/Tablet Layout Adjustments */
@media screen and (max-width: 1024px) {
    .site-branding {
        left: 1.25rem;
    }

    .nav {
        right: 1.25rem;
    }

    .selection-player-container {
        height: 100dvh !important;
        width: 100%;
    }

    .timeline-track {
        padding-left: 1.25rem;
    }

    .active-video-title {
        left: 1.25rem;
        bottom: calc(11dvh + 2rem);
    }

    .countdown-timer {
        left: 1.25rem;
        bottom: calc(11dvh + 5rem);
        font-size: 1rem;
    }

    .about-view {
        padding: 10rem 1.25rem 4rem;
    }

    .about-text {
        width: 70%;
        font-size: 1.75rem;
    }

    .about-row h2 {
        width: 20%;
        font-size: 1.25rem;
    }

    .about-row:first-of-type .about-text p:first-of-type {
        font-size: 2.5rem;
    }
}

/* Phone-only About layout - keep desktop layout on tablets */
@media screen and (max-width: 600px) {
    .about-content {
        gap: 3rem;
    }

    .about-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .about-row h2 {
        width: 100%;
        margin-bottom: 0.25rem;
        font-size: 1rem;
        opacity: 0.6;
    }

    .about-text {
        width: 100%;
        font-size: 1.25rem;
    }

    .about-row:first-of-type .about-text p:first-of-type {
        font-size: 1.75rem;
        margin-bottom: 2rem;
    }

    .site-branding {
        top: 1.25rem;
        left: 1.25rem;
    }

    .site-icon {
        width: 38px;
        height: 42px;
    }

    .nav {
        top: 1.75rem;
        right: 1.25rem;
    }

    .nav button {
        font-size: 1.25rem;
    }

    .active-video-title {
        font-size: 1.25rem;
        bottom: calc(13.2dvh + 0.75rem + env(safe-area-inset-bottom));
    }

    .countdown-timer {
        font-size: 0.8rem;
        bottom: calc(13.2dvh + 2.75rem + env(safe-area-inset-bottom));
    }
}