/* ========== PROJEKTPHASEN PAGE - IMMERSIVE CORPORATE TECH ========== */
/* Depends on styles.css (:root variables, global animations) and home.css (hero, CTA) */

#projektphasen {
    color: var(--neon-blue);
}

.anchor-target {
    display: block;
    position: relative;
    top: -6rem;
    visibility: hidden;
}

/* ----- Hero page modifier ----- */
.hero--phasen .hero-subheadline {
    max-width: 38rem;
}

/* ----- Phases section ----- */
.phasen-section {
    position: relative;
    padding: clamp(4rem, 10vh, 8rem) clamp(1.25rem, 5vw, 4rem);
    overflow: hidden;
}

.phasen-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(129, 55, 255, 0.35), transparent);
}

.phasen-header {
    text-align: center;
    max-width: 44rem;
    margin: 0 auto clamp(3rem, 6vh, 4.5rem);
}

.phasen-header .section-title {
    margin-bottom: 0;
}

/* ----- Timeline wrapper ----- */
.phasen-timeline-wrap {
    position: relative;
    max-width: 72rem;
    margin: 0 auto;
}

.phasen-timeline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: visible;
}

.phasen-timeline-track {
    stroke: rgba(129, 55, 255, 0.22);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.phasen-timeline-progress {
    stroke: url(#phasen-timeline-gradient);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
}

/* ----- Phase cards grid ----- */
.phasen-grid {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: clamp(2rem, 4vw, 3.5rem);
}

.phase-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 10px 36px rgba(19, 4, 234, 0.12), 0 2px 10px rgba(0, 0, 0, 0.06);
    transition:
        border-color var(--transition-normal),
        box-shadow var(--transition-normal),
        transform var(--transition-normal);
    scroll-margin-top: var(--nav-scroll-offset);
    opacity: 0;
    transform: translateY(40px);
}

.phase-card:hover {
    border-color: rgba(19, 4, 234, 0.45);
    box-shadow: 0 16px 56px rgba(19, 4, 234, 0.18);
    transform: translateY(-4px);
}

.phase-card-body {
    padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1.5rem, 3vw, 2.5rem);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.phase-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, rgba(19, 4, 234, 0.2), rgba(129, 55, 255, 0.2));
    color: var(--neon-purple);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.phase-card-title {
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 0.85rem;
    color: var(--text-primary);
}

.phase-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-normal);
}

.phase-card-title a:hover {
    color: var(--neon-purple);
}

.phase-card-text {
    font-size: clamp(0.88rem, 1.8vw, 0.95rem);
    line-height: 1.65;
    color: var(--text-muted);
    margin: 0 0 1.25rem;
}

.phase-situation {
    margin: 0 0 1.25rem;
    padding: 1rem 1.15rem;
    border-left: 3px solid var(--neon-blue);
    border-radius: 0 0.75rem 0.75rem 0;
    background: rgba(19, 4, 234, 0.08);
}

.phase-situation-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--neon-blue);
    margin-bottom: 0.4rem;
}

.phase-situation p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: rgba(20, 20, 40, 0.88);
    font-style: italic;
}

.phase-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--neon-blue);
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: color var(--transition-normal), gap var(--transition-normal);
}

.phase-link:hover {
    color: var(--neon-purple);
    gap: 0.55rem;
}

.phase-link:focus-visible {
    outline: 2px solid var(--neon-purple);
    outline-offset: 3px;
    border-radius: 2px;
}

.phase-card-image {
    position: relative;
    height: clamp(200px, 32vw, 280px);
    overflow: hidden;
    flex-shrink: 0;
}

.phase-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.phase-card:hover .phase-card-image img {
    transform: scale(1.06);
}

.phase-card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, var(--card-overlay) 100%);
    pointer-events: none;
}

/* ----- Desktop zig-zag layout ----- */
@media (min-width: 768px) {
    .phase-card {
        flex-direction: row;
        align-items: stretch;
    }

    .phase-card--reverse {
        flex-direction: row-reverse;
    }

    .phase-card-body {
        flex: 1;
        min-width: 0;
        justify-content: flex-start;
    }

    .phase-card-image {
        flex: 0 0 42%;
        height: auto;
        min-height: 280px;
    }

    .phase-card-image::after {
        background: linear-gradient(90deg, var(--card-overlay) 0%, transparent 35%);
    }

    .phase-card--reverse .phase-card-image::after {
        background: linear-gradient(270deg, var(--card-overlay) 0%, transparent 35%);
    }

    .phasen-timeline {
        left: 50%;
        width: 4px;
        transform: translateX(-50%);
    }
}

/* ----- Mobile: vertical stack, timeline left ----- */
@media (max-width: 767px) {
    .phasen-timeline {
        display: none;
        /* left: 1.25rem;
        width: 3px; */
  
    }

    .phase-card:hover {
        transform: translateY(-2px);
    }
}

/* ----- Landscape mobile ----- */
@media (max-width: 932px) and (orientation: landscape) {
    .phasen-section {
        padding-top: clamp(2.5rem, 6vh, 4rem);
        padding-bottom: clamp(2.5rem, 6vh, 4rem);
    }

    .phase-card {
        flex-direction: row;
        align-items: stretch;
    }

    .phase-card--reverse {
        flex-direction: row-reverse;
    }

    .phase-card-image {
        flex: 0 0 38%;
        height: auto;
        min-height: 200px;
    }

    .phase-card-body {
        padding: 1.25rem 1.5rem;
    }

    .phase-card-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }
}

/* ----- Large screens ----- */
@media (min-width: 1200px) {
    .phase-card-text {
        font-size: 0.95rem;
        line-height: 1.65;
    }

    .phase-card-image {
        flex-basis: 44%;
    }
}

@media (min-width: 1400px) {
    .phasen-timeline-wrap {
        max-width: 80rem;
    }

    .phase-card-title {
        font-size: 1.2rem;
    }

    .phase-card-text {
        font-size: 1rem;
    }
}

@media (min-width: 1901px) {
    .phase-card-title {
        font-size: 1.28rem;
    }

    .phase-card-text {
        font-size: 1.05rem;
    }

    .phase-situation p {
        font-size: 0.95rem;
    }
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
    .phase-card {
        opacity: 1;
        transform: none;
        transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
    }

    .phase-card:hover {
        transform: none;
    }

    .phase-card-image img {
        transition: none;
    }

    .phasen-timeline-progress {
        stroke-dashoffset: 0;
    }
}

/* ----- ScrollTrigger pin sections (shared across projektphasen pages) ----- */
/* Solid background + stacking context prevents hero bleed-through on refresh */
[class$="-pin"],
[class$="-pinwrap"] {
    background-color: var(--dark-base);
    isolation: isolate;
    z-index: 1;
}

.pin-spacer > [class$="-pin"],
.pin-spacer > [class$="-pinwrap"] {
    z-index: 2;
}

/* Robust target: explicit token class on every pinned element. Survives any
   future state classes (is-active, etc.) added to the pinned element. */
.is-pinned {
    background-color: var(--dark-base);
    isolation: isolate;
    z-index: 1;
}

.pin-spacer > .is-pinned {
    z-index: 2;
}

/* ----- Scroll stability (projektphasen detail pages) -----
   Programmatic scrolls (ScrollTrigger refresh, scroll restoration) must be
   instant - a CSS smooth scroll turns them into visible jumps. In-page
   anchor links keep their smooth scroll via main.js. overflow-x: clip
   (instead of hidden) stops <html>/<body> from becoming a nested scroll
   container on iOS Safari, which breaks touch scrolling and fixed layers. */
html {
    scroll-behavior: auto;
}

@supports (overflow: clip) {
    html,
    body {
        overflow-x: clip;
    }
}

/* ----- Free-scroll mode (touch devices + viewports below 1024px) -----
   Scenes are not pinned here (see FREE_SCROLL_MQ in the page scripts), so
   the solid pin backdrop is not needed and would only draw a hard edge
   over the page gradient. */
@media (max-width: 1023px), (hover: none) and (pointer: coarse) {
    .is-pinned {
        background-color: transparent;
        isolation: auto;
        z-index: auto;
    }
}

/* ----- Scroll reveal primitives (phase detail pages) -----
   Page scripts arm an element with .is-reveal-pending (hidden) and swap it
   for .is-reveal-in once it enters the viewport (IntersectionObserver).
   The entrance is a CSS keyframe on the individual `translate` property:
   it never competes with the element's own `transform` (hover lift, 3D
   tilt) or its transition list, runs on the compositor and needs no JS
   per frame. `backwards` fill = nothing lingers after the animation. */
@keyframes pp-reveal-up {
    from {
        opacity: 0;
        translate: 0 var(--reveal-shift, 28px);
    }
}

:root .is-reveal-pending {
    opacity: 0;
}

.is-reveal-in {
    animation: pp-reveal-up 0.85s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: var(--reveal-delay, 0s);
}

@media (prefers-reduced-motion: reduce) {
    :root .is-reveal-pending {
        opacity: 1;
    }

    .is-reveal-in {
        animation: none;
    }
}

/* Stable hero height on mobile: 100dvh follows the address bar as it
   collapses/expands mid-scroll and shifted every section below the hero.
   Only the box height changes - the hero animation is untouched. */
@supports (height: 100svh) {
    .hero {
        min-height: 100svh;
    }
}
