/* =========================================================
   Moallem Pars Stories — Version 1
========================================================= */

.mp-story {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto 0;
    direction: rtl;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    position: relative;
    z-index: 2;
}

.mp-story__viewport {
    width: 100%;
    overflow: hidden;
}

.mp-story__track {
    display: flex;
    flex-direction: row;
    gap: 14px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    cursor: grab;
    user-select: none;
}

.mp-story__track::-webkit-scrollbar {
    display: none;
}

.mp-story__track.is-dragging {
    cursor: grabbing;
}

.mp-story__item {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    margin: 0;
    flex: 0 0 94px;
    width: 94px;
    min-width: 94px;
    cursor: pointer;
    text-align: center;
}

.mp-story__ring {
    width: 76px;
    height: 76px;
    padding: 3px;
    display: block;
    margin: 0 auto 6px;
    border-radius: 50%;
    background: conic-gradient(
        from 205deg,
        #f58529 0deg,
        #feda77 45deg,
        #dd2a7b 105deg,
        #8134af 165deg,
        #515bd4 220deg,
        #dd2a7b 285deg,
        #f58529 360deg
    );
    box-shadow: 0 3px 12px rgba(77, 124, 15, .14);
    transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}

.mp-story__item:hover .mp-story__ring,
.mp-story__item:focus-visible .mp-story__ring {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(77, 124, 15, .20);
}

.mp-story__cover {
    display: block;
    width: 100%;
    height: 100%;
    padding: 2px;
    border-radius: 50%;
    background: #fff;
}

.mp-story__cover img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.mp-story__title {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.6;
    font-weight: 500;
}

.mp-story__item.is-seen .mp-story__ring {
    background: #b8bec5;
    box-shadow: none;
}

.mp-story__item:focus-visible {
    outline: 2px solid #A44AFF;
    outline-offset: 4px;
    border-radius: 10px;
}

.mp-story-viewer[hidden] {
    display: none !important;
}

.mp-story-viewer {
    position: fixed;
    inset: 0;
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
}

.mp-story-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 13, 16, .92);
    backdrop-filter: blur(5px);
}

.mp-story-viewer__dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 430px);
    height: min(92vh, 765px);
    max-height: 92vh;
    border-radius: 18px;
    overflow: hidden;
    background: #101214;
    box-shadow: 0 20px 70px rgba(0,0,0,.42);
    touch-action: pan-y;
    user-select: none;
}

.mp-story-viewer__media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #101214;
}

.mp-story-viewer__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #101214;
}

.mp-story-viewer__timeline {
    position: absolute;
    top: 13px;
    left: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    gap: 4px;
}

.mp-story-viewer__progress {
    display: block;
    height: 3px;
    flex: 1 1 0;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255,255,255,.34);
}

.mp-story-viewer__progress-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #fff;
}

.mp-story-viewer__close {
    position: absolute;
    top: 28px;
    right: 13px;
    left: auto;
    z-index: 7;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.34);
    color: #fff;
    font-size: 27px;
    line-height: 32px;
    cursor: pointer;
}

.mp-story-viewer__nav {
    position: absolute;
    top: 50%;
    z-index: 6;
    width: 38px;
    height: 38px;
    margin-top: -19px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0,0,0,.35);
    color: #fff;
    font-size: 29px;
    line-height: 34px;
    cursor: pointer;
    opacity: .9;
}

.mp-story-viewer__nav--prev {
    left: 12px;
}

.mp-story-viewer__nav--next {
    right: 12px;
}

.mp-story-viewer__nav:hover,
.mp-story-viewer__close:hover {
    background: rgba(164,74,255,.86);
    color: #132007;
}

.mp-story-viewer__touch-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 32%;
    z-index: 4;
}

.mp-story-viewer__touch-zone--prev {
    left: 0;
}

.mp-story-viewer__touch-zone--next {
    right: 0;
}

.mp-story-viewer__link {
    position: absolute;
    z-index: 8;
    right: 50%;
    bottom: 18px;
    transform: translateX(50%);
    min-width: 120px;
    padding: 9px 18px;
    border-radius: 999px;
    background: #A44AFF;
    color: #1f2b0d;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 7px 20px rgba(0,0,0,.24);
}

.mp-story__item,
.mp-story-viewer button,
.mp-story-viewer a {
    -webkit-tap-highlight-color: transparent;
}

html.mp-story-viewer-open,
body.mp-story-viewer-open {
    overflow: hidden !important;
}

@media (min-width: 769px) {
    .mp-story__item {
        flex-basis: 100px;
        width: 100px;
        min-width: 100px;
    }

    .mp-story__ring {
        width: 82px;
        height: 82px;
    }

    .mp-story__title {
        font-size: 12px;
    }

    .mp-story-viewer__dialog {
        width: min(430px, 90vw);
    }
}

@media (max-width: 768px) {
    .mp-story {
        width: 100%;
        max-width: none;
        margin-top: 0;
        padding: 0 12px;
    }

    .mp-story__track {
        gap: 10px;
        padding-left: 1px;
        padding-right: 1px;
    }

    /* Six complete stories are visible on mobile.
       Additional stories remain available through the Story track scroll. */
    .mp-story__item {
        flex: 0 0 calc((100vw - 24px - 50px) / 6);
        width: calc((100vw - 24px - 50px) / 6);
        min-width: calc((100vw - 24px - 50px) / 6);
        max-width: 58px;
    }

    .mp-story__ring {
        width: min(58px, 100%);
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .mp-story__title {
        font-size: 11px;
    }

    .mp-story-viewer {
        padding: 0;
    }

    .mp-story-viewer__dialog {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    .mp-story-viewer__nav {
        display: none;
    }

    .mp-story-viewer__timeline {
        top: max(10px, env(safe-area-inset-top));
        left: 10px;
        right: 10px;
    }

    .mp-story-viewer__close {
        top: max(28px, calc(env(safe-area-inset-top) + 20px));
        left: 12px;
    }

    .mp-story-viewer__link {
        bottom: max(18px, calc(env(safe-area-inset-bottom) + 14px));
    }
}

@media (max-width: 360px) {
    .mp-story__item {
        flex-basis: calc((100vw - 20px - 50px) / 6);
        width: calc((100vw - 20px - 50px) / 6);
        min-width: calc((100vw - 20px - 50px) / 6);
    }

    .mp-story__ring {
        width: 58px;
        height: 58px;
    }
}


/* =========================================================
   Story UI — Version 2 visual fixes only
========================================================= */
.mp-story-viewer-open .mp-header {
    visibility: hidden !important;
    pointer-events: none !important;
}

.mp-story-viewer__close {
    right: 13px !important;
    left: auto !important;
}

@media (min-width: 769px) {
    .mp-story {
        margin-top: 0;
        margin-bottom: -2px;
    }
}

@media (max-width: 768px) {
    .mp-story {
        margin-top: 0;
        margin-bottom: -7px;
    }
}

@media (max-width: 360px) {
    .mp-story {
        margin-bottom: -6px;
    }
}


/* =========================================================
   Story V3 — homepage spacing refinement
   Scoped to the Story + homepage hero relationship only.
========================================================= */
@media (min-width: 769px) {
    .mp-story + main .hero.slider-hero {
        margin-top: 10px !important;
        margin-bottom: 12px !important;
    }
}

@media (max-width: 768px) {
    .mp-story + main .hero.slider-hero {
        margin-top: -16px !important;
        margin-bottom: 10px !important;
    }
}

/* Story V4 — content actions */
.mp-story-viewer__actions {
    position: absolute;
    z-index: 9;
    right: 50%;
    bottom: 18px;
    transform: translateX(50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mp-story-viewer__like {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 58px;
    min-height: 38px;
    padding: 7px 11px;
    border: 0;
    border-radius: 999px;
    background: rgba(0,0,0,.42);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.mp-story-viewer__like-icon {
    font-size: 21px;
    line-height: 1;
}

.mp-story-viewer__like.is-liked {
    background: rgba(164,74,255,.94);
    color: #162208;
}

.mp-story-viewer__like:disabled {
    opacity: .65;
    cursor: wait;
}

.mp-story-viewer__actions .mp-story-viewer__link {
    position: static;
    transform: none;
    min-width: 120px;
    margin: 0;
}

.mp-story-viewer__message {
    position: absolute;
    z-index: 10;
    right: 50%;
    bottom: 68px;
    transform: translateX(50%);
    width: min(88%, 330px);
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(0,0,0,.76);
    color: #fff;
    font-size: 12px;
    line-height: 1.8;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,.25);
}

.mp-story-viewer__message[hidden] {
    display: none !important;
}

@media (max-width: 768px) {
    .mp-story-viewer__actions {
        bottom: 16px;
        gap: 6px;
    }

    .mp-story-viewer__like {
        min-height: 40px;
    }

    .mp-story-viewer__message {
        bottom: 68px;
    }
}


/* Story V5 — UI refinement */
@media (min-width: 769px) {
    .mp-story { width: 100%; max-width: var(--mp-container-max, 1200px); box-sizing: border-box; }
    .mp-story__track { gap: 14px; box-sizing: border-box; }
    .mp-story__item { flex: 0 0 calc((100% - 126px) / 10); width: calc((100% - 126px) / 10); min-width: calc((100% - 126px) / 10); box-sizing: border-box; }
    .mp-story__ring { width: min(82px, 100%); height: auto; aspect-ratio: 1 / 1; }
}
.mp-story-viewer__nav--prev { right: 12px; left: auto; }
.mp-story-viewer__nav--next { left: 12px; right: auto; }
.mp-story-viewer__nav[hidden] { display: none !important; }
.mp-story-viewer__actions { right: 0; left: 0; bottom: 18px; transform: none; width: 100%; box-sizing: border-box; justify-content: flex-start; pointer-events: none; }
.mp-story-viewer__like { margin-right: 18px; pointer-events: auto; }
.mp-story-viewer__actions .mp-story-viewer__link { position: absolute; right: 50%; transform: translateX(50%); pointer-events: auto; }
@media (max-width: 768px) {
    .mp-story__item { flex-basis: calc((100vw - 24px - 40px) / 5); width: calc((100vw - 24px - 40px) / 5); min-width: calc((100vw - 24px - 40px) / 5); max-width: 62px; }
    .mp-story-viewer__nav { display: block; }
    .mp-story-viewer__nav--prev { right: 12px; left: auto; }
    .mp-story-viewer__nav--next { left: 12px; right: auto; }
    .mp-story-viewer__actions { bottom: max(16px, calc(env(safe-area-inset-bottom) + 14px)); }
    .mp-story-viewer__like { margin-right: 14px; }
}
@media (max-width: 360px) {
    .mp-story__item { flex-basis: calc((100vw - 20px - 36px) / 5); width: calc((100vw - 20px - 36px) / 5); min-width: calc((100vw - 20px - 36px) / 5); }
}


/* Story V6 — desktop scroll + refined like UI + viewer details */
@media (min-width: 769px) {
    .mp-story__track {
        cursor: grab;
        scroll-behavior: smooth;
        overscroll-behavior-x: contain;
    }

    .mp-story__track.is-dragging {
        cursor: grabbing;
        user-select: none;
    }
}

.mp-story-viewer__like {
    min-width: 58px;
    width: auto;
    min-height: 40px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.46);
    color: #fff;
    box-shadow: 0 6px 18px rgba(0,0,0,.20);
}

.mp-story-viewer__like-icon {
    display: block;
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.mp-story-viewer__like.is-liked {
    background: rgba(0,0,0,.46);
    color: #ef4444;
}

.mp-story-viewer__like.is-liked .mp-story-viewer__like-icon {
    fill: currentColor;
    stroke: currentColor;
}

.mp-story-viewer__like-count {
    min-width: 1.2em;
    line-height: 1;
}

.mp-story-viewer__actions {
    align-items: center;
}

@media (max-width: 768px) {
    .mp-story-viewer__like {
        min-height: 42px;
    }
}


/* Story V7 — ordinary heart, same SVG shape before/after Like */
.mp-story-viewer__like {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    appearance: none;
    -webkit-appearance: none;
}
.mp-story-viewer__like-icon {
    display: block;
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}
.mp-story-viewer__like.is-liked {
    background: transparent !important;
    color: #ff1744;
}
.mp-story-viewer__like.is-liked .mp-story-viewer__like-icon {
    fill: currentColor;
    stroke: currentColor;
}
.mp-story-viewer__like-count {
    display: none !important;
}
.mp-story-viewer__like:disabled {
    opacity: .65;
    cursor: wait;
}
