/* ============================================
   PROJECT BLOCK — Реклама / Клипы
============================================ */

.project-block {
    background: #e4e4e0;
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    height: 100vh;  /* явно задаём высоту, не полагаемся на stack-card */
}

.project-info {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2rem;
    padding: var(--nav-safe-top, clamp(5.2rem, 8vh, 6.4rem)) 3rem 4rem 5vw;
    height: 100%;
    background: #e4e4e0;
    overflow: hidden;
    position: relative;
}

.project-info::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(0,0,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.project-info .y2k-corner-asset {
    z-index: 1;
}

.project-info__meta {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-family: 'Terminus', 'Courier New', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.35);
    z-index: 1;
}

.project-info__markup {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-family: 'Terminus', 'Courier New', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.28);
    border-top: 1px solid rgba(0,0,0,0.1);
    padding-top: 1rem;
    z-index: 1;
}

.project-label__index,
.project-label__tag {
    font-family: 'Terminus', 'Courier New', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(0,0,0,0.35);
}

.project-label__index {
    color: #0a00ff;
}

.project-label__title {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(2.5rem, 5vw, 5rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 0.9;
    color: #0a0a0a;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.01s;
    z-index: 1;
}
.project-label__title.p-animate { opacity: 1; }

.p-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(50px) skewX(-6deg);
}
.project-label__title.p-animate .p-letter {
    animation: pLetterIn 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes pLetterIn {
    to { opacity: 1; transform: translateY(0) skewX(0deg); }
}

.project-info__desc {
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.65;
    color: rgba(0,0,0,0.55);
    z-index: 1;
}

.p-desc-line {
    display: block;
    clip-path: inset(0 100% 0 0);
    opacity: 0;
}
.project-info__desc.p-animate .p-desc-line {
    animation: pLineReveal 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 1;
}
.project-info__desc.p-animate .p-desc-line:nth-child(1) { animation-delay: 0.5s; }
.project-info__desc.p-animate .p-desc-line:nth-child(2) { animation-delay: 0.85s; }
.project-info__desc.p-animate .p-desc-line:nth-child(3) { animation-delay: 1.15s; }
.project-info__desc.p-animate .p-desc-line:nth-child(4) { animation-delay: 1.45s; }

@keyframes pLineReveal {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0% 0 0); }
}

.project-label__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.9rem, 1.3vw, 1.1rem);
    font-weight: 700;
    color: #0a0a0a;
    text-decoration: none;
    padding-bottom: 0.25rem;
    border-bottom: 1.5px solid rgba(0,0,0,0.3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    align-self: flex-start;
    margin-top: 1.5rem;
    transition: border-color 0.3s;
    z-index: 1;
}
.project-label__cta:hover { border-color: #0a0a0a; opacity: 1; }

/* ============================================
   ПРАВАЯ КОЛОНКА — медиа + слайдер
   overflow: hidden (НЕ clip) — rotate() в анимациях правильно обрезается
============================================ */
.project-media {
    position: relative;
    height: 100%;
    overflow: hidden;
    background: #111;
    transform-style: preserve-3d;
    cursor: pointer;
}

/* ============================================
   СЛАЙДЕР — видео с анимацией угла
============================================ */
.project-slider__videos {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* overflow: hidden здесь позволяет rotate() быть visible внутри контейнера */
    overflow: hidden;
    container-type: size;
}

.project-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    opacity: 0;
    filter: grayscale(15%);
    pointer-events: none;
    transform-origin: center center;
    will-change: transform, opacity;
}

.project-media:focus-visible {
    outline: 2px solid rgba(186, 254, 0, 0.85);
    outline-offset: -6px;
}

.project-media:hover .project-video.is-active {
    filter: grayscale(8%) saturate(1.04);
}
.project-video.is-active { opacity: 1; }

video.project-video::-webkit-media-controls {
    display: none !important;
}

.project-video.is-cover-frame {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: max(100cqw, var(--cover-width-from-height, 177.7778cqh));
    height: max(100cqh, var(--cover-height-from-width, 56.25cqw));
    translate: -50% -50%;
    object-fit: unset;
}

/* ── Анимации перелистывания с углом ─────────────────
   rotate + scale + translateX = живое "броска карты"
   Работает только если overflow: hidden (не clip) на родителе */
.project-video.is-leaving--left {
    animation: slideOutLeft 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 2;
}
.project-video.is-leaving--right {
    animation: slideOutRight 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 2;
}
.project-video.is-entering--left {
    animation: slideInFromRight 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    z-index: 3;
}
.project-video.is-entering--right {
    animation: slideInFromLeft 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    z-index: 3;
}

@keyframes slideOutLeft {
    0%   { opacity: 1; transform: rotate(0deg)   scale(1)    translateX(0);    }
    100% { opacity: 0; transform: rotate(-5deg)  scale(0.92) translateX(-12%); }
}
@keyframes slideOutRight {
    0%   { opacity: 1; transform: rotate(0deg)   scale(1)    translateX(0);   }
    100% { opacity: 0; transform: rotate(5deg)   scale(0.92) translateX(12%); }
}
@keyframes slideInFromRight {
    0%   { opacity: 0; transform: rotate(5deg)   scale(0.92) translateX(12%); }
    100% { opacity: 1; transform: rotate(0deg)   scale(1)    translateX(0);   }
}
@keyframes slideInFromLeft {
    0%   { opacity: 0; transform: rotate(-5deg)  scale(0.92) translateX(-12%); }
    100% { opacity: 1; transform: rotate(0deg)   scale(1)    translateX(0);    }
}

/* Градиенты читаемости */
.project-media::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 38%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
    z-index: 10;
    pointer-events: none;
}
.project-media::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 42%;
    background: linear-gradient(to top, rgba(0,0,0,0.80) 0%, transparent 100%);
    z-index: 10;
    pointer-events: none;
}

/* Оверлеи */
.project-slider__top {
    position: absolute;
    top: clamp(4.8rem, 7vh, 5.8rem); left: 2.4rem; right: 5rem;
    z-index: 20; pointer-events: none;
}
.project-slider__title {
    display: block;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: clamp(1.1rem, 2.2vw, 1.8rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.2;
}
.project-slider__bottom {
    position: absolute;
    bottom: clamp(8rem, 22vh, 16rem); left: 2.4rem; right: 2.4rem;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    pointer-events: none;
}

.project-slider__desc {
    display: block;
    padding: 0.72rem 0.85rem;
    background: rgba(5, 5, 5, 0.68);
    border: 1px solid rgba(186, 254, 0, 0.22);
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
    font-family: 'Terminus', 'Courier New', monospace;
    font-size: clamp(0.58rem, 1vw, 0.75rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.86);
    line-height: 1.6;
    max-width: min(70%, 34rem);
}
.project-slider__counter {
    font-family: 'Terminus', 'Courier New', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: rgba(186, 254, 0, 0.9);
    text-shadow: 0 0 12px rgba(186, 254, 0, 0.42), 0 0 24px rgba(186, 254, 0, 0.18);
    white-space: nowrap;
    flex-shrink: 0;
}

.crop-overlay {
    position: absolute;
    inset: 0;
    z-index: 15;
    pointer-events: none;
}

/* ============================================
   СТРЕЛКИ
============================================ */
.project-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    background:
        radial-gradient(circle at center,
            rgba(10, 0, 255, 0.18) 0%,
            rgba(10, 0, 255, 0.08) 38%,
            rgba(10, 0, 255, 0.00) 72%);
    border: none;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 120px;
    font-size: clamp(5rem, 9vw, 10rem);
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-weight: 100;
    line-height: 1;
    color: rgba(10, 0, 255, 0.78);
    text-shadow:
        0 0 12px rgba(10, 0, 255, 0.26),
        0 0 28px rgba(10, 0, 255, 0.12);
    transition: color 0.2s, text-shadow 0.2s,
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.25s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
    will-change: transform, color, text-shadow;
    animation:
        projectNavBreath 3.8s ease-in-out infinite,
        projectNavGlow 5.6s ease-in-out infinite;
}

.project-nav-btn--prev { left: 0.8rem; }
.project-nav-btn--next {
    right: 0.8rem;
    animation-delay: 0.25s, 1.4s;
}

@keyframes projectNavBreath {
    0%, 100% {
        transform: translateY(-50%) scale(1);
    }
    50% {
        transform: translateY(calc(-50% - 4px)) scale(1.06);
    }
}

@keyframes projectNavGlow {
    0%, 72%, 100% {
        color: rgba(10, 0, 255, 0.78);
        text-shadow:
            0 0 12px rgba(10, 0, 255, 0.26),
            0 0 28px rgba(10, 0, 255, 0.12);
    }
    80% {
        color: rgba(186, 254, 0, 0.98);
        text-shadow:
            0 0 20px rgba(10, 0, 255, 0.92),
            0 0 46px rgba(10, 0, 255, 0.48),
            0 0 72px rgba(10, 0, 255, 0.24);
    }
}

@media (hover: hover) and (pointer: fine) {
    .project-nav-btn--prev:hover {
        animation: none;
        background:
            radial-gradient(circle at center,
                rgba(10, 0, 255, 0.26) 0%,
                rgba(10, 0, 255, 0.12) 40%,
                rgba(10, 0, 255, 0.00) 72%);
        color: rgba(10, 0, 255,1);
        text-shadow: 0 0 20px rgba(10, 0, 255,0.9), 0 0 60px rgba(10, 0, 255,0.5);
        transform: translate(-6px, -50%) scale(1.08);
    }
    .project-nav-btn--next:hover {
        animation: none;
        background:
            radial-gradient(circle at center,
                rgba(10, 0, 255, 0.26) 0%,
                rgba(10, 0, 255, 0.12) 40%,
                rgba(10, 0, 255, 0.00) 72%);
        color: rgba(10, 0, 255,1);
        text-shadow: 0 0 20px rgba(10, 0, 255,0.9), 0 0 60px rgba(10, 0, 255,0.5);
        transform: translate(6px, -50%) scale(1.08);
    }
}

.project-nav-btn:focus-visible {
    animation: none;
    outline: none;
    color: rgba(10, 0, 255, 1);
    text-shadow: 0 0 20px rgba(10, 0, 255,0.9), 0 0 60px rgba(10, 0, 255,0.5);
}

.project-nav-btn:active,
.project-nav-btn.is-pressed {
    animation: none;
    background:
        radial-gradient(circle at center,
            rgba(10, 0, 255, 0.30) 0%,
            rgba(10, 0, 255, 0.16) 42%,
            rgba(10, 0, 255, 0.00) 75%) !important;
    transform: translateY(-50%) scale(0.78) !important;
    color: rgba(10, 0, 255,1) !important;
    text-shadow: 0 0 30px rgba(10, 0, 255,1), 0 0 70px rgba(10, 0, 255,0.8) !important;
    transition: transform 0.08s ease, color 0.08s ease !important;
}

/* ============================================
   МОБИЛЬ
============================================ */
@media (max-width: 768px) {
    .project-block {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .project-block.stack-card {
        background: #050607;
    }

    .project-info {
        height: auto;
        padding: var(--nav-safe-top, 4.35rem) 1.2rem 1.2rem;
        gap: 1.2rem;
        flex-shrink: 0;
    }

    .project-info__desc { font-size: 0.88rem; }
    .project-label__title { font-size: clamp(2rem, 10vw, 3.2rem); }

    .project-info__markup {
        display: none;
    }

    .project-label__cta {
        display: inline-flex;
        margin-top: 0.15rem;
        font-size: 0.84rem;
        position: relative;
        z-index: 3;
    }

    .project-media {
        flex: 1;
        width: 100%;
        min-height: 60vw;
        overflow: hidden;
        position: relative;
    }

    .project-nav-btn {
        font-size: clamp(4.75rem, 11vw, 5.8rem);
        font-weight: 500;
        width: 68px;
        height: 104px;
        color: rgba(186, 254, 0, 0.96);
        text-shadow:
            0 0 18px rgba(10, 0, 255, 0.62),
            0 0 42px rgba(10, 0, 255, 0.24);
    }
    .project-nav-btn--prev { left: 0.3rem; }
    .project-nav-btn--next { right: 0.3rem; }

    .project-slider__top    { top: var(--nav-safe-top, 4.35rem); left: 1rem; right: 3.5rem; }
    .project-slider__bottom { bottom: 1rem; left: 1rem; right: 1rem; }
}

/* Stack surface overrides */
.project-block {
    display: block;
}

.project-block > .stack-card__surface {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    height: 100%;
    min-height: inherit;
    overflow: hidden;
}

@media (max-width: 768px) {
    .project-block {
        display: block;
    }

    .project-block > .stack-card__surface {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }
}
