/* POPUP */
.popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease;
    z-index: 10000;
}

.popup.active {
    opacity: 1;
    pointer-events: auto;
}

.popup-content {
    width: 90%;
    height: 90%;
    border-radius: 16px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    transform: scale(.9);
    transition: .4s ease;
    background: #FAF9F6;
}

.popup.active .popup-content {
    transform: scale(1);
}

/* Close button */
.popup-close {
    position: absolute;
    top: 18px;
    right: 25px;
    font-size: 32px;
    cursor: pointer;
    color: #000;
    z-index: 20;
}

/* SLIDER BASE */
.popup .slides-container {
    width: 100%;
    height: 100%;
    display: flex;
    position: relative;
    overflow: visible;
    transition: transform 0.5s ease-in-out;
}

.popup .slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    opacity: 0;
    transition: opacity 0.4s ease;
    position: absolute;
    inset: 0;
    transform: translateX(100%); /* старт за экраном */
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

.popup .slide.active {
    opacity: 1;
    transform: translateX(0);
}

.popup .slide.prev {
    opacity: 0;
    transform: translateX(-100%);
}

.popup .slide.active {
    opacity: 1;
    position: absolute;
}

/* LEFT PHOTO */
.popup .slide-left {
    width: 30%;
    overflow: hidden;
}

.popup .slide-left img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* RIGHT TEXT + MINI PHOTOS */
.popup .slide-right {
    flex: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    max-height: 100%; /* чтобы текст не выходил за границы */
    overflow-y: auto;
    overflow-x: hidden;
}

.slide-title{
    margin: 0;
    margin-bottom: 1vh;
    text-transform: uppercase;
    font-size: clamp(24px, 1.8vw, 32px);
    color: #4C3B34;
    font-family: 'Playfair';
    font-style: normal;
    font-weight: 700;
}

.popup .slide-text {
    display: inline;
    font-size: clamp(16px, 1.4vw, 24px);
    line-height: 1.85;
    letter-spacing: 0.15em;
    margin-top: 10px;
    color: #817773;
    font-family: 'Playfair';
    font-style: normal;
    font-weight: 400;
}

.popup .read-more-text {
  display: inline;
  font-size: clamp(16px, 1.4vw, 24px);
  margin-left: 4px;
  color: #4C3B34;
  line-height: 1.85;
letter-spacing: 0.15em;
  cursor: pointer;
  font-family: 'Playfair';
    font-style: normal;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}


.popup .slide-text-wrapper {
    display: inline;         /* сколько строк показывать */
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.popup .slide-text-wrapper.expanded {
    -webkit-line-clamp: unset;
    max-height: 55%;
    overflow-y: auto;
}

/* THUMBS */
.popup .slide-thumbs {
    display: flex;
    gap: 10px;
    height: 40%;
}

.popup .slide-thumbs img {
    width: calc(33.33% - 6px);
    border-radius: 8px;
    object-fit: cover;
}


/* ARROWS */
.popup .slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 38px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 15;
    transition: .3s;
    color: #4C3B34
}


.popup .slider-arrow.left {
    left: 20px;
}

.popup .slider-arrow.right {
    right: 20px;
}
.popup .slide-left {
    position: relative;
    overflow: hidden;
}

/* Отзыв занимает всё изображение при открытии */
.popup .review-content-popup {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: #4C3B34;
    padding: 2.5vw;
    box-sizing: border-box;
    transition: bottom 0.5s ease;
    z-index: 1;
    overflow-y: auto;
}

/* Overlay с кнопкой */
.popup .bottom-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 10%;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(360deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    color: #FAF9F6;
    transition: all 0.5s ease;
    z-index: 2;
}

/* Pulse animation from top to bottom for text - using translate3d for hardware acceleration */
@keyframes pulseTopToBottom {
    0% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -10px, 0); /* Move up more */
    }
    100% {
        transform: translate3d(0, 3px, 0); /* Move down less */
    }
}

/* Pulse animation for arrow - using translate3d for hardware acceleration */
@keyframes pulseTopToBottomArrow {
    0% {
        transform: translate3d(0, 0, 0) rotate(90deg);
    }
    50% {
        transform: translate3d(0, -10px, 0) rotate(90deg); /* Move up more */
    }
    100% {
        transform: translate3d(0, 3px, 0) rotate(90deg); /* Move down less */
    }
}

/* Стрелка */
.popup .review-arrow{
    transform: rotate(90deg);
    width: clamp(15px, 1.4vw, 25px);
    height: auto;
    fill: none;
    transition: transform 0.5s ease;
    display: inline-block;
    transform-origin: center center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Apply pulse animation to text only - only when closed */
.popup .slide-left:not(.bottom-open) .review-overlay-popup.bottom-overlay .review-text,
.popup .slide-left:not(.bottom-open) .review-overlay.bottom-overlay .review-text {
    animation: pulseTopToBottom 3s ease-in-out infinite;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Apply pulse animation to arrow only - only when closed */
.popup .slide-left:not(.bottom-open) .review-overlay-popup.bottom-overlay .review-arrow,
.popup .slide-left:not(.bottom-open) .review-overlay.bottom-overlay .review-arrow {
    animation: pulseTopToBottomArrow 3s ease-in-out infinite;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Stop animation when open */
.popup .bottom-open .review-arrow,
.popup .bottom-open .review-text {
    animation: none;
}

/* Класс при открытии */
.popup .bottom-open .review-content-popup {
    bottom: 0;
}

/* Поворот стрелки и скрытие текста */
.popup .bottom-open .review-arrow {
    transform: rotate(270deg); /* исходно 90, при открытии 270 = 180° поворот */
}

.popup .bottom-open .review-text {
    opacity: 0;
    visibility: hidden;
}

/* Стрелка перемещается наверх при открытии */
.popup .bottom-open .bottom-overlay {
    top: 0;
    bottom: auto;
    background: none;
}

.popup .review-open-text{
    font-family: 'Playfair';
    font-style: normal;
    font-weight: 400;
    font-size: clamp(12px, 1.2vw, 20px);
    line-height: 1.8;
    letter-spacing: 0.1em;
    color: #FAF9F6;
}

.popup .read-more-text-review{
    font-family: 'Playfair';
    font-style: normal;
    font-weight: 700;
    font-size:  clamp(12px, 1.5vw, 20px);
    line-height: 180%;
    letter-spacing: 0.1em;
    color: #FAF9F6;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

/* Story Popup Styles */
.story-popup-content {
    width: 80%;
    max-width: 900px;
    max-height: 80vh;
    padding: 40px;
    box-sizing: border-box;
}

.story-popup-text {
    font-family: 'Playfair';
    font-style: normal;
    font-weight: 400;
    font-size: clamp(16px, 1.4vw, 24px);
    line-height: 1.85;
    letter-spacing: 0.15em;
    color: #817773;
    text-align: justify;
}

.story-popup-close {
    position: absolute;
    top: 18px;
    right: 25px;
    font-size: 32px;
    cursor: pointer;
    color: #817773;
    z-index: 20;
}

/* Portfolio Review Text Styles */
.portfolio-review-text {
    max-height: none;
    overflow: visible;
    transition: max-height 0.3s ease;
}

.main-event-subtext-wrapper.expanded .portfolio-review-text {
    max-height: 400px;
    overflow-y: auto;
}

.btn-story-popup {
    font-family: 'Playfair';
    font-style: normal;
    font-weight: 400;
    font-size: clamp(16px, 1.3vw, 24px);
    color: #817773;
    background-color: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    letter-spacing: 0.1em;
    text-decoration: underline;
    transition: transform 0.25s ease, text-shadow 0.25s ease;
    padding: 0;
}

.btn-story-popup:hover {
    transform: scale(1.04);
    text-shadow: 0 0 1px currentColor;
}
