/* ============================================
   TEAM — horizontaler Portrait-Slider
   Cursor-Reveal: Owl-Hero-Maske → echtes Portrait

   Der eigentliche Reveal läuft in js/team-slider.js als
   WebGL-Shader auf .tm-fx. Ohne WebGL greift automatisch
   der Opacity-Crossfade weiter unten (.tm-stage:not(.is-webgl)).
   ============================================ */

.tm {
    position: relative;
}

/* --- Intro über dem Slider --- */
.tm-intro {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 6vw, 6rem) clamp(1.5rem, 4vh, 2.5rem);
}

.tm-intro .team-title {
    font-family: 'Geist', 'Inter', sans-serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.04em;
    line-height: 0.95;
    text-transform: uppercase;
    color: #f5f1e8;
}

.tm-intro .team-location {
    margin-top: 0.75rem;
    font-family: 'Geist', 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: rgba(245, 241, 232, 0.45);
}

/* ============================================
   VIEWPORT — bricht aus dem 1400px-Raster von <main> aus
   ============================================ */

.tm-viewport {
    margin-inline: calc(50% - 50vw);
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.tm-viewport::-webkit-scrollbar {
    display: none;
}

.tm-viewport.is-dragging {
    cursor: grabbing;
    scroll-behavior: auto;
    scroll-snap-type: none;
}

.tm-viewport.is-dragging * {
    pointer-events: none;
}

.tm-viewport:focus-visible {
    outline: 1px solid var(--purple-primary);
    outline-offset: -4px;
}

/* ============================================
   SLIDE
   ============================================ */

.tm-slide {
    position: relative;
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    overflow: hidden;
    min-height: min(86svh, 840px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    align-items: end;
    justify-content: center;
    gap: clamp(1.5rem, 4vw, 4.5rem);
    padding: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 6vw, 6rem) clamp(2.5rem, 6vw, 5rem);
}

/* Riesiger Outline-Wordmark hinter allem */
.tm-bigname {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 0;
    font-family: 'Geist', 'Inter', sans-serif;
    font-weight: 800;
    font-size: clamp(4.5rem, 18vw, 16rem);
    line-height: 0.78;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(181, 124, 255, 0.15);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

/* Vertikales "Hover to reveal"-Label rechts */
.tm-side-label {
    position: absolute;
    top: 50%;
    right: clamp(14px, 3vw, 46px);
    transform: translateY(-50%) rotate(180deg);
    z-index: 5;
    writing-mode: vertical-rl;
    font-family: 'Geist', 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: rgba(245, 241, 232, 0.4);
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    transition: color 0.4s ease;
}

.tm-slide:hover .tm-side-label {
    color: var(--purple-accent);
}

/* ============================================
   STAGE — Canvas + <img>-Fallback exakt deckungsgleich
   ============================================ */

/* Die Bühne ist bewusst deutlich breiter als die Figur (object-fit: contain
   begrenzt sie über die Höhe). Der Überstand ist die Hover-Fläche — wie in
   der Vorlage, wo .portrait-stage ebenfalls weit über die Figur hinausgeht. */
.tm-stage {
    position: relative;
    z-index: 2;
    width: min(72svh, 54vw, 620px);
    height: min(78svh, 740px);
    justify-self: center;
    /* Radius des Reveal-Spots; hält den CSS-Fallback deckungsgleich mit dem
       Shader (uBlobSize × Bühnenhöhe, siehe js/team-slider.js). */
    --tm-r: clamp(94px, 15.6svh, 148px);
}

.tm-fx,
.tm-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.tm-fx {
    z-index: 2;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.tm-stage.is-webgl .tm-fx {
    opacity: 1;
}

.tm-fallback {
    z-index: 1;
}

/* Sobald WebGL läuft, rendert der Shader beide Ebenen selbst */
.tm-stage.is-webgl .tm-fallback {
    opacity: 0;
}

.tm-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    user-select: none;
    -webkit-user-select: none;
}

/* CSS-Fallback ohne WebGL: ebenfalls ein Spot am Cursor, kein Crossfade des
   ganzen Bildes. --tm-mx/--tm-my setzt js/team-slider.js bei jeder Bewegung. */
.tm-layer--reveal {
    opacity: 0;
    transition: opacity 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-mask-image: radial-gradient(circle var(--tm-r) at var(--tm-mx, 50%) var(--tm-my, 32%),
                        #000 0%, #000 72%, transparent 100%);
    mask-image: radial-gradient(circle var(--tm-r) at var(--tm-mx, 50%) var(--tm-my, 32%),
                #000 0%, #000 72%, transparent 100%);
}

.tm-stage:not(.is-webgl):hover .tm-layer--reveal,
.tm-stage:not(.is-webgl).is-revealed .tm-layer--reveal {
    opacity: 1;
}

/* Klick-/Hover-Fläche über der Stage */
.tm-zone {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    background: none;
    border: 0;
    cursor: crosshair;
    -webkit-tap-highlight-color: transparent;
}

.tm-zone:focus-visible {
    outline: 1px solid var(--purple-primary);
    outline-offset: 6px;
}

/* Purple-Glow hinter dem Portrait */
.tm-stage::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 6%;
    width: 120%;
    aspect-ratio: 1;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(142, 68, 255, 0.22) 0%, transparent 66%);
    filter: blur(60px);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.tm-slide.is-active .tm-stage::before {
    opacity: 1;
}

/* --- Stage-Variante: Bild folgt noch (Christian) --- */
.tm-stage--pending .tm-layer--base {
    object-fit: contain;
    object-position: center center;
    filter: grayscale(0.35) brightness(0.92);
    transition: filter 0.5s ease, transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tm-stage--pending:hover .tm-layer--base {
    filter: grayscale(0) brightness(1);
    transform: scale(1.025);
}

/* --- Stage-Variante: bewusst kein Bild (Contributor) --- */
.tm-stage--classified {
    display: grid;
    place-items: center;
}

.tm-silhouette {
    position: relative;
    width: 62%;
    aspect-ratio: 3 / 4;
    align-self: end;
    margin-bottom: 8%;
    background:
        radial-gradient(ellipse 44% 26% at 50% 22%, rgba(142, 68, 255, 0.5) 0%, transparent 70%),
        radial-gradient(ellipse 70% 52% at 50% 88%, rgba(142, 68, 255, 0.38) 0%, transparent 72%);
    filter: blur(14px);
    opacity: 0.75;
}

.tm-classified-chip {
    position: absolute;
    left: 50%;
    bottom: 12%;
    transform: translateX(-50%);
    z-index: 3;
    white-space: nowrap;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(142, 68, 255, 0.35);
    border-radius: 999px;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'Geist', 'Inter', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--purple-accent);
}

/* ============================================
   INFO — fett, eng, editorial
   ============================================ */

.tm-info {
    position: relative;
    z-index: 3;
    justify-self: end;
    max-width: 30rem;
    padding-bottom: clamp(0.5rem, 3vh, 2.5rem);
}

.tm-index {
    display: block;
    font-family: 'Geist', 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    color: rgba(245, 241, 232, 0.35);
}

.tm-name {
    margin-top: 0.85rem;
    font-family: 'Geist', 'Inter', sans-serif;
    font-weight: 800;
    font-size: clamp(1.9rem, 4.6vw, 3.4rem);
    line-height: 0.94;
    letter-spacing: -0.042em;
    text-transform: uppercase;
    color: #f5f1e8;
}

.tm-role {
    margin-top: 0.9rem;
    font-family: 'Geist', 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--purple-accent);
}

.tm-tagline {
    margin-top: 1.35rem;
    font-family: 'Geist', 'Inter', sans-serif;
    font-weight: 600;
    font-size: clamp(1.02rem, 1.8vw, 1.4rem);
    line-height: 1.35;
    letter-spacing: -0.015em;
    color: rgba(245, 241, 232, 0.78);
    max-width: 34ch;
}

/* ============================================
   CONTROLS
   ============================================ */

.tm-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: clamp(1.5rem, 3vh, 2.5rem) 1.5rem clamp(2rem, 5vh, 4rem);
}

.tm-nav {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: rgba(10, 10, 15, 0.6);
    color: rgba(245, 241, 232, 0.8);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.35s ease, color 0.35s ease,
                box-shadow 0.35s ease, transform 0.35s ease;
}

.tm-nav:hover:not(:disabled) {
    border-color: rgba(142, 68, 255, 0.55);
    color: #f5f1e8;
    box-shadow: 0 0 32px rgba(142, 68, 255, 0.18);
    transform: translateY(-2px);
}

.tm-nav:disabled {
    opacity: 0.28;
    cursor: default;
}

.tm-nav:focus-visible {
    outline: 1px solid var(--purple-primary);
    outline-offset: 3px;
}

.tm-dots {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.tm-dot {
    width: 28px;
    height: 3px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: rgba(245, 241, 232, 0.2);
    cursor: pointer;
    transition: background 0.35s ease, width 0.35s ease;
}

.tm-dot:hover {
    background: rgba(245, 241, 232, 0.4);
}

.tm-dot[aria-current='true'] {
    width: 46px;
    background: var(--purple-primary);
}

.tm-dot:focus-visible {
    outline: 1px solid var(--purple-primary);
    outline-offset: 4px;
}

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

@media (max-width: 900px) {
    .tm-slide {
        grid-template-columns: 1fr;
        align-items: center;
        justify-items: center;
        text-align: center;
        gap: clamp(1rem, 3vh, 2rem);
        min-height: auto;
        padding: clamp(1rem, 4vw, 2rem) 1.25rem clamp(2rem, 5vw, 3rem);
    }

    .tm-stage {
        order: -1;
        width: min(72vw, 340px);
        height: min(52svh, 460px);
        /* Bühne ist hier deutlich kleiner — Spot-Radius mitskalieren,
           sonst passt der CSS-Fallback nicht zum Shader-Blob. */
        --tm-r: clamp(56px, 10.4svh, 92px);
    }

    .tm-info {
        justify-self: center;
        max-width: 32rem;
        padding-bottom: 0;
    }

    .tm-tagline {
        margin-inline: auto;
    }

    .tm-side-label {
        display: none;
    }

    .tm-bigname {
        font-size: clamp(3.5rem, 22vw, 8rem);
        -webkit-text-stroke-width: 1px;
    }
}

@media (max-width: 480px) {
    .tm-controls {
        gap: 1rem;
    }

    .tm-nav {
        width: 40px;
        height: 40px;
    }
}

/* Touch: kein Hover — Tap toggelt den Reveal, Cursor bleibt normal */
@media (hover: none), (pointer: coarse) {
    .tm-zone {
        cursor: pointer;
    }

    .tm-nav:hover:not(:disabled) {
        transform: none;
    }
}

/* Reduced motion: kein WebGL (siehe team-slider.js), nur harter Crossfade */
@media (prefers-reduced-motion: reduce) {
    .tm-viewport {
        scroll-behavior: auto;
    }

    .tm-layer--reveal,
    .tm-stage::before,
    .tm-side-label,
    .tm-nav,
    .tm-dot,
    .tm-stage--pending .tm-layer--base {
        transition: none;
    }

    .tm-stage--pending:hover .tm-layer--base {
        transform: none;
    }
}
