.ap-shorts-shell {
    --ap-shorts-card-width: 285px;
    --ap-shorts-bg: #f3f8fc;
    --ap-shorts-accent: #1976b9;
    --ap-shorts-title: #17334a;
    position: relative;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    padding: 28px 28px 22px;
    background-color: var(--ap-shorts-bg);
    background:
        radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--ap-shorts-accent) 11%, transparent) 0, transparent 38%),
        var(--ap-shorts-bg);
    color: var(--ap-shorts-title);
    isolation: isolate;
}

.ap-shorts-heading {
    position: relative;
    z-index: 30;
    margin: 0 0 10px;
    color: var(--ap-shorts-title);
    text-align: center;
    font-size: clamp(30px, 4vw, 58px);
    line-height: 1.08;
    font-weight: 800;
}

.ap-shorts-stage {
    position: relative;
    min-height: calc((var(--ap-shorts-card-width) * 1.7778) + 112px);
    touch-action: pan-y;
    user-select: none;
    perspective: 1400px;
}

.ap-shorts-track {
    position: absolute;
    inset: 0;
}

.ap-shorts-card {
    position: absolute;
    top: 48%;
    left: 50%;
    width: var(--ap-shorts-card-width);
    margin: 0;
    opacity: calc(1 - (var(--ap-shorts-absolute) * .22));
    transform:
        translate(-50%, -50%)
        translateX(calc(var(--ap-shorts-distance) * var(--ap-shorts-card-width) * .73))
        translateZ(calc(var(--ap-shorts-absolute) * -72px))
        rotateY(calc(var(--ap-shorts-direction) * var(--ap-shorts-absolute) * -7deg))
        scale(calc(1 - (var(--ap-shorts-absolute) * .095)));
    transform-origin: center;
    transition: transform .62s cubic-bezier(.2,.82,.18,1), opacity .48s ease, filter .48s ease;
    filter: saturate(calc(1 - (var(--ap-shorts-absolute) * .13)));
    pointer-events: auto;
    will-change: transform, opacity;
}

.ap-shorts-card.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.ap-shorts-card-inner {
    transition: transform .28s ease, box-shadow .35s ease;
}

.ap-shorts-card.is-active .ap-shorts-card-inner {
    filter: none;
}

.ap-shorts-card.is-active:hover .ap-shorts-card-inner {
    transform: translateY(-4px) scale(1.012);
}

.ap-shorts-media-link {
    display: block;
    color: inherit;
    text-decoration: none;
    outline: none;
}

.ap-shorts-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--ap-shorts-accent) 36%, #fff);
    border-radius: 19px;
    background: #d8d4d1;
    box-shadow: 0 13px 34px rgba(44, 31, 35, .13);
    transition: box-shadow .35s ease, border-color .35s ease;
}

.ap-shorts-card.is-active .ap-shorts-media {
    border-color: color-mix(in srgb, var(--ap-shorts-accent) 64%, #fff);
    box-shadow: 0 22px 52px rgba(44, 31, 35, .2), 0 0 0 3px color-mix(in srgb, var(--ap-shorts-accent) 16%, transparent);
}

.ap-shorts-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.01);
}

.ap-shorts-placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, color-mix(in srgb, var(--ap-shorts-accent) 55%, #d7d0cb), #ece7e3);
}

.ap-shorts-placeholder .dashicons {
    width: auto;
    height: auto;
    color: rgba(255,255,255,.82);
    font-size: 64px;
}

.ap-shorts-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(20,16,18,.02) 45%, rgba(20,16,18,.42) 100%);
    pointer-events: none;
}

.ap-shorts-label {
    position: absolute;
    top: 14px;
    right: 14px;
    max-width: calc(100% - 28px);
    padding: 5px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ap-shorts-accent) 84%, #22161b);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.ap-shorts-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.68);
    border-radius: 50%;
    background: rgba(122, 73, 96, .88);
    background: color-mix(in srgb, var(--ap-shorts-accent) 78%, rgba(38,22,30,.66));
    box-shadow: 0 9px 24px rgba(20,12,16,.24);
    transform: translate(-50%, -50%);
    transition: transform .25s ease, background .25s ease;
}

.ap-shorts-card.is-active .ap-shorts-media-link:hover .ap-shorts-play {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--ap-shorts-accent);
}

.ap-shorts-play span {
    width: 0;
    height: 0;
    margin-left: 5px;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid #fff;
}

[dir="rtl"] .ap-shorts-play span {
    margin-right: 5px;
    margin-left: 0;
}

.ap-shorts-copy {
    min-height: 88px;
    padding: 13px 8px 0;
    text-align: center;
    opacity: .24;
    transform: translateY(-4px);
    transition: opacity .4s ease, transform .4s ease;
}

.ap-shorts-card.is-active .ap-shorts-copy {
    opacity: 1;
    transform: none;
}

.ap-shorts-title {
    margin: 0;
    color: var(--ap-shorts-title);
    font-size: 17px;
    line-height: 1.28;
    font-weight: 750;
}

.ap-shorts-subtitle {
    margin: 4px 0 0;
    color: color-mix(in srgb, var(--ap-shorts-title) 72%, transparent);
    font-size: 13px;
    line-height: 1.35;
}

.ap-shorts-rating {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-top: 6px;
    color: #d8cbc2;
    font-size: 16px;
}

.ap-shorts-rating .is-filled {
    color: #f39a0a;
}

.ap-shorts-arrow {
    position: absolute;
    top: 48%;
    z-index: 40;
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--ap-shorts-accent) 22%, #d7d0cc);
    border-radius: 50%;
    background: rgba(255,255,255,.78);
    color: var(--ap-shorts-title);
    box-shadow: 0 7px 20px rgba(42,30,35,.08);
    cursor: pointer;
    transform: translateY(-50%);
    transition: transform .22s ease, background .22s ease, color .22s ease;
}

.ap-shorts-arrow:hover,
.ap-shorts-arrow:focus-visible {
    background: var(--ap-shorts-accent);
    color: #fff;
    transform: translateY(-50%) scale(1.06);
}

.ap-shorts-arrow span {
    display: block;
    width: 10px;
    height: 10px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
}

/* CSS shapes do not get mirrored by the RTL text algorithm. */
.ap-shorts-prev span { transform: rotate(135deg); }
.ap-shorts-next span { transform: rotate(-45deg); }

.ap-shorts-prev { left: max(18px, 4%); }
.ap-shorts-next { right: max(18px, 4%); }

.ap-shorts-dots {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 18px;
    margin-top: -18px;
}

.ap-shorts-dots button {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ap-shorts-accent) 22%, #d8d0ca);
    cursor: pointer;
    transition: width .28s ease, background .28s ease;
}

.ap-shorts-dots button.is-active {
    width: 30px;
    background: var(--ap-shorts-accent);
}

.ap-shorts-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ap-shorts-modal.is-open { display: flex; }
.ap-shorts-backdrop { position: absolute; inset: 0; border: 0; background: rgba(12,8,10,.84); cursor: pointer; }
.ap-shorts-dialog { position: relative; z-index: 1; width: min(92vw, 430px); }
.ap-shorts-player { position: relative; width: 100%; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 18px; background: #080808; box-shadow: 0 25px 80px rgba(0,0,0,.45); }
.ap-shorts-player iframe,
.ap-shorts-player video { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; }
.ap-shorts-close { position: absolute; top: -16px; right: -16px; z-index: 2; width: 42px; height: 42px; padding: 0; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; background: #fff; color: #21171b; font-size: 30px; line-height: 38px; cursor: pointer; }
.ap-shorts-modal-open { overflow: hidden; }
.ap-shorts-empty { padding: 24px; text-align: center; }

@media (max-width: 900px) {
    .ap-shorts-shell { padding-inline: 10px; }
    .ap-shorts-stage { min-height: calc((min(var(--ap-shorts-card-width), 68vw) * 1.7778) + 105px); }
    .ap-shorts-card {
        width: min(var(--ap-shorts-card-width), 68vw);
        transform:
            translate(-50%, -50%)
            translateX(calc(var(--ap-shorts-distance) * min(var(--ap-shorts-card-width), 68vw) * .70))
            translateZ(calc(var(--ap-shorts-absolute) * -65px))
            rotateY(calc(var(--ap-shorts-direction) * var(--ap-shorts-absolute) * -6deg))
            scale(calc(1 - (var(--ap-shorts-absolute) * .105)));
    }
    .ap-shorts-arrow { width: 40px; height: 40px; }
    .ap-shorts-prev { left: 4px; }
    .ap-shorts-next { right: 4px; }
}

@media (max-width: 560px) {
    .ap-shorts-shell { padding-top: 22px; }
    .ap-shorts-heading { font-size: 32px; }
    .ap-shorts-stage { min-height: calc((76vw * 1.7778) + 104px); }
    .ap-shorts-card {
        width: min(var(--ap-shorts-card-width), 76vw);
        transform:
            translate(-50%, -50%)
            translateX(calc(var(--ap-shorts-distance) * 62vw))
            translateZ(calc(var(--ap-shorts-absolute) * -80px))
            scale(calc(1 - (var(--ap-shorts-absolute) * .13)));
    }
    .ap-shorts-card.is-far { opacity: 0; pointer-events: none; }
    .ap-shorts-copy { min-height: 82px; }
    .ap-shorts-arrow { top: 45%; width: 36px; height: 36px; background: rgba(255,255,255,.68); }
    .ap-shorts-arrow span { width: 8px; height: 8px; }
    .ap-shorts-dots { gap: 6px; overflow: hidden; }
    .ap-shorts-dots button { width: 8px; height: 8px; }
    .ap-shorts-dots button.is-active { width: 23px; }
}

@media (prefers-reduced-motion: reduce) {
    .ap-shorts-card,
    .ap-shorts-card-inner,
    .ap-shorts-dots button { transition-duration: .01ms !important; }
}
