/*
 * Tourbin — story modal (Figma Frame 1984080671).
 */

html.tourbin-story-modal-open {
    overflow: hidden;
}

.tourbin-story-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(0.75rem, env(safe-area-inset-top))
        max(0.75rem, env(safe-area-inset-right))
        max(0.75rem, env(safe-area-inset-bottom))
        max(0.75rem, env(safe-area-inset-left));
    background: rgba(8, 8, 8, 0.72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.22s ease,
        visibility 0.22s ease;
}

.tourbin-story-modal[hidden] {
    display: none;
}

.tourbin-story-modal.is-open {
    display: flex;
}

.tourbin-story-modal.is-visible {
    opacity: 1;
    visibility: visible;
}

.tourbin-story-modal__dialog {
    --story-w: 478;
    --story-h: 810;
    position: relative;
    width: min(478px, 100%, calc(90vh * 478 / 810));
    aspect-ratio: 478 / 810;
    max-height: min(90vh, 810px);
    background: #111;
    border-radius: 20px;
    overflow: hidden;
    container-type: inline-size;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
    transform: translateY(12px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.tourbin-story-modal.is-visible .tourbin-story-modal__dialog {
    transform: translateY(0) scale(1);
}

.tourbin-story-modal__wash {
    position: absolute;
    inset-inline: 0;
    top: 0;
    z-index: 2;
    height: 28.6%;
    pointer-events: none;
    background: linear-gradient(180deg, #f8d004 0%, rgba(248, 208, 4, 0) 100%);
    border-radius: 20px 20px 0 0;
}

.tourbin-story-modal__close {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tourbin-story-modal__close-icon {
    display: block;
    width: 15px;
    height: 15px;
}

.tourbin-story-modal__close-icon line {
    stroke: #fff;
    stroke-width: 2.25;
    stroke-linecap: round;
}

.tourbin-story-modal__topbar {
    position: absolute;
    top: 0;
    inset-inline: 0;
    z-index: 4;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    padding: 24px 25px 0;
    direction: ltr;
    pointer-events: none;
}

.tourbin-story-modal__avatar-wrap {
    position: relative;
    flex: 0 0 45px;
    width: 45px;
    height: 45px;
    border-radius: 50px;
    background: #fff;
    border: 1px solid rgba(255, 207, 1, 0.2);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tourbin-story-modal__avatar {
    position: absolute;
    left: 50%;
    top: 55%;
    width: 47px;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: contain;
    pointer-events: none;
}

.tourbin-story-modal__avatar--fallback {
    inset: 0;
    background: radial-gradient(circle at 30% 30%, #ffe08a, #c9961a 70%);
}

.tourbin-story-modal__progress {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding-inline-end: 2.25rem;
}

.tourbin-story-modal__progress-track {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.27);
    overflow: hidden;
}

.tourbin-story-modal__progress-fill {
    display: block;
    width: 0%;
    height: 100%;
    background: #fff;
    border-radius: inherit;
    transform-origin: left center;
    will-change: width;
}

.tourbin-story-modal__logo,
.tourbin-story-modal__logo-text {
    position: absolute;
    z-index: 4;
    top: 17.16%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

.tourbin-story-modal__logo {
    display: block;
    width: 91px;
    height: auto;
    object-fit: contain;
}

.tourbin-story-modal__logo-text {
    color: #fff;
    font-family: "Vazirmatn", var(--tourbin-font);
    font-weight: 800;
    font-size: 1.125rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.tourbin-story-modal__arrow {
    position: absolute;
    top: 47.5%;
    z-index: 5;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 15px;
    background: #f9fafb;
    color: #1c1c1e;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    opacity: 1;
    direction: ltr;
    transition: opacity 0.2s ease;
}

.tourbin-story-modal__arrow--prev {
    left: 25px;
    right: auto;
}

.tourbin-story-modal__arrow--next {
    right: 25px;
    left: auto;
}

.tourbin-story-modal__arrow.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.tourbin-story-modal__chevron {
    display: block;
    flex-shrink: 0;
}

.tourbin-story-modal__slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.tourbin-story-modal__story {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.tourbin-story-modal__story[hidden] {
    display: none;
}

/* One story can hold several slides (photo/video) — the track stacks them
   absolutely so only the active slide is visible, underneath the labels/CTA
   which live at the .story level (shared across every slide of a story). */
.tourbin-story-modal__slide-track {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.tourbin-story-modal__slide {
    position: absolute;
    inset: 0;
}

.tourbin-story-modal__slide[hidden] {
    display: none;
}

.tourbin-story-modal__media {
    position: absolute;
    inset: 0;
    background-color: #1a1a1a;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.tourbin-story-modal__media::before {
    content: "";
    position: absolute;
    inset: -16%;
    z-index: 1;
    background-image: inherit;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(20px);
    transform: scale(1.1);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.22s ease;
}

.tourbin-story-modal__slide.is-media-ready .tourbin-story-modal__media::before {
    opacity: 0;
}

.tourbin-story-modal__media .imaginit-image-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    aspect-ratio: auto !important;
}

.tourbin-story-modal__media .imaginit-image-wrap__placeholder {
    position: absolute;
    inset: -14%;
    background-size: cover;
    background-position: center;
    filter: blur(18px);
    transform: scale(1.08);
}

.tourbin-story-modal__media picture,
.tourbin-story-modal__media .imaginit-image-wrap img,
.tourbin-story-modal__image {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.tourbin-story-modal__slide.is-media-ready .tourbin-story-modal__media picture,
.tourbin-story-modal__slide.is-media-ready .tourbin-story-modal__image {
    z-index: 2;
    opacity: 1;
}

.tourbin-story-modal__video {
    display: block;
    position: relative;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: transparent;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.tourbin-story-modal__slide.is-media-ready .tourbin-story-modal__video {
    z-index: 2;
    opacity: 1;
}

.tourbin-story-modal__media-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: #2a2a2a;
}

.tourbin-story-modal__labels {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: min(211px, 70%);
    margin-bottom: 1.1rem;
}

.tourbin-story-modal__label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 0.35rem 0.85rem;
    border-radius: 15px;
    background: rgba(126, 21, 255, 0.4);
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    font-family: "Liana", "Liana-soft", "Vazirmatn", var(--tourbin-font);
    font-weight: 700;
    font-size: clamp(0.95rem, 4.2cqw, 1.25rem);
    line-height: 1.5;
    text-align: center;
    text-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(2px);
}

.tourbin-story-modal__label--title {
    color: #fff;
}

.tourbin-story-modal__label--place {
    color: #ffd201;
}

.tourbin-story-modal__actions {
    --story-action-clearance: max(1.25rem, env(safe-area-inset-bottom));
    position: absolute;
    z-index: 5;
    right: 14px;
    left: auto;
    top: auto;
    bottom: var(--story-action-clearance);
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    pointer-events: auto;
}

.tourbin-story-modal__dialog.has-story-cta .tourbin-story-modal__actions {
    --story-action-clearance: calc(
        63px + max(1.15rem, env(safe-area-inset-bottom)) + 16px
    );
}

.tourbin-story-modal__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    background: rgba(12, 12, 14, 0.32);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    -webkit-tap-highlight-color: transparent;
    transition:
        transform 0.16s ease,
        background 0.16s ease,
        border-color 0.16s ease;
}

.tourbin-story-modal__action:hover {
    background: rgba(12, 12, 14, 0.48);
    border-color: rgba(255, 255, 255, 0.5);
}

.tourbin-story-modal__action:active {
    transform: scale(0.92);
}

.tourbin-story-modal__action:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.tourbin-story-modal__action-icon {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.tourbin-story-modal__like-icon,
.tourbin-story-modal__share-icon {
    width: 22px;
    height: 22px;
}

.tourbin-story-modal__like-body {
    fill: transparent;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linejoin: round;
}

.tourbin-story-modal__action--like.is-liked .tourbin-story-modal__like-body {
    fill: #ff375f;
    stroke: #ff375f;
}

.tourbin-story-modal__action--like.is-liked .tourbin-story-modal__like-icon {
    animation: tourbin-story-like-pop 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tourbin-story-like-pop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.18);
    }

    100% {
        transform: scale(1);
    }
}

.tourbin-story-modal__toast {
    position: absolute;
    z-index: 8;
    left: 50%;
    bottom: calc(63px + 5.5rem);
    transform: translateX(-50%);
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-family: "Vazirmatn", var(--tourbin-font);
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
}

.tourbin-story-modal__toast[hidden] {
    display: none;
}

.tourbin-story-modal__dialog.is-paused .tourbin-story-modal__progress-fill {
    transition: none !important;
}

.tourbin-story-modal__cta {
    position: relative;
    z-index: 3;
    width: 100%;
    padding: 0 25px max(1.15rem, env(safe-area-inset-bottom));
}

.tourbin-story-modal__whatsapp.tourbin-whatsapp-cta,
.tourbin-story-modal__cta-btn {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-height: 63px;
    padding: 0 20px;
    border: none;
    border-radius: 12px;
    background: #25d366;
    box-shadow: 0 4px 10px rgba(30, 138, 110, 0.2);
    color: #fff;
    font-family: "Vazirmatn", var(--tourbin-font);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1;
    text-decoration: none;
    text-align: center;
}

.tourbin-story-modal__whatsapp.tourbin-whatsapp-cta:hover,
.tourbin-story-modal__cta-btn:hover {
    filter: brightness(0.96);
    transform: none;
}

.tourbin-story-modal__whatsapp .tourbin-whatsapp-cta__icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
}

.tourbin-story-modal__whatsapp .tourbin-whatsapp-cta__icon svg {
    width: 20px;
    height: 20px;
}

/* --- Mobile: keep Figma proportions, centered --- */

@media (max-width: 900px) {
    .tourbin-story-modal {
        padding: max(0.4rem, env(safe-area-inset-top))
            max(0.5rem, env(safe-area-inset-right))
            max(0.4rem, env(safe-area-inset-bottom))
            max(0.5rem, env(safe-area-inset-left));
        background: rgba(0, 0, 0, 0.84);
    }

    .tourbin-story-modal__dialog {
        width: min(100%, 420px, calc(88dvh * 478 / 810));
        max-height: min(88dvh, 810px);
        border-radius: 18px;
    }

    .tourbin-story-modal__topbar {
        padding: 18px 16px 0;
        gap: 0.5rem;
    }

    .tourbin-story-modal__avatar-wrap {
        flex-basis: 40px;
        width: 40px;
        height: 40px;
    }

    .tourbin-story-modal__logo {
        width: 78px;
    }

    .tourbin-story-modal__arrow {
        width: 36px;
        height: 36px;
        border-radius: 12px;
    }

    .tourbin-story-modal__arrow--prev {
        left: 14px;
        right: auto;
    }

    .tourbin-story-modal__arrow--next {
        right: 14px;
        left: auto;
    }

    .tourbin-story-modal__labels {
        width: min(200px, 72%);
        margin-bottom: 0.85rem;
    }

    .tourbin-story-modal__label {
        min-height: 40px;
        font-size: 1.05rem;
    }

    .tourbin-story-modal__actions {
        right: 10px;
        top: auto;
        gap: 8px;
    }

    .tourbin-story-modal__dialog.has-story-cta .tourbin-story-modal__actions {
        --story-action-clearance: calc(
            54px + max(1.15rem, env(safe-area-inset-bottom)) + 16px
        );
    }

    .tourbin-story-modal__toast {
        bottom: calc(54px + 5rem);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .tourbin-story-modal__cta {
        padding-inline: 16px;
    }

    .tourbin-story-modal__whatsapp.tourbin-whatsapp-cta,
    .tourbin-story-modal__cta-btn {
        min-height: 54px;
        font-size: 1.05rem;
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tourbin-story-modal,
    .tourbin-story-modal__dialog,
    .tourbin-story-modal__action,
    .tourbin-story-modal__media picture,
    .tourbin-story-modal__media .imaginit-image-wrap img,
    .tourbin-story-modal__image,
    .tourbin-story-modal__video {
        transition: none;
    }

    .tourbin-story-modal__dialog {
        transform: none;
    }

    .tourbin-story-modal__action--like.is-liked .tourbin-story-modal__like-icon {
        animation: none;
    }
}
