/* Player */

yurba-vp {
    --y-vp-accent: var(--yurba-brand-color, #2289ff);
    --y-vp-ratio: 16 / 9;
    --y-vp-radius: 0px;
    --y-vp-bg: #000;
    --y-vp-control: #fff;
    --y-vp-active: var(--yurba-red-color, #ff3b47);
    --y-vp-hover: rgb(255 255 255 / 16%);
    --y-vp-on-media: rgb(0 0 0 / 45%);
    --y-vp-on-media-hover: rgb(76 76 76 / 54%);
    --y-vp-surface: rgb(32 32 32 / 92%);
    --y-vp-focus: var(--yurba-brand-color, #3b6fff);

    position: relative;
    display: block;
    overflow: clip;
    background: var(--y-vp-bg);
    border-radius: var(--y-vp-radius);
    color: var(--y-vp-control);
    font-family: inherit;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

yurba-vp [hidden] {
    display: none !important;
}

.y-vp__video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.y-vp__video::-webkit-media-controls {
    display: none !important;
}

/* Zero specificity, so pages can let clicks through */
.y-vp__overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

:where(.y-vp__overlay) > * {
    pointer-events: auto;
}

yurba-vp.is-fullscreen {
    width: 100%;
    height: 100%;
    border-radius: 0;
    aspect-ratio: auto;
}

/* Short */

.y-vp--short {
    aspect-ratio: var(--y-vp-ratio);
    cursor: pointer;
}

.y-vp--short .y-vp__video {
    position: absolute;
    inset: 0;
}

.y-vp__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(32px) brightness(.5);
    transform: scale(1.2);
}

.y-vp__state {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--y-vp-on-media);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 40px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.8);
    transition: opacity .15s ease, transform .15s ease;
    pointer-events: none;
}

.y-vp__state .material-symbols-rounded {
    font-size: inherit;
    font-variation-settings: 'FILL' 1;
}

.y-vp--short.is-paused .y-vp__state {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    transition-duration: .2s;
    transition-timing-function: cubic-bezier(.05, .7, .1, 1);
}

.y-vp__burst {
    position: absolute;
    z-index: 3;
    display: flex;
    color: var(--y-vp-active);
    opacity: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: y-vp-burst .9s ease-out forwards;
}

.y-vp__burst .material-symbols-rounded {
    font-size: 100px;
    font-variation-settings: 'FILL' 1;
}

@keyframes y-vp-burst {
    0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--y-vp-tilt, 0deg)) scale(.4); }
    15% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--y-vp-tilt, 0deg)) scale(1.15); }
    30% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--y-vp-tilt, 0deg)) scale(1); }
    60% { opacity: 1; transform: translate(-50%, -60%) rotate(var(--y-vp-tilt, 0deg)) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -140%) rotate(var(--y-vp-tilt, 0deg)) scale(1.3); }
}

@keyframes y-vp-fade {
    0%, 60% { opacity: 1; }
    100% { opacity: 0; }
}

.y-vp__info {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 60px 16px 20px;
    background: linear-gradient(to top, rgb(0 0 0 / 70%), transparent);
    color: #fff;
    pointer-events: none;
}

.y-vp__info:has(~ .y-vp__actions:not([hidden])) {
    padding-right: 72px;
}

:where(.y-vp__info) :is(a, button, input, label) {
    pointer-events: auto;
}

.y-vp__info.is-expanded {
    max-height: 70%;
    overflow-y: auto;
    background: linear-gradient(to top, rgb(0 0 0 / 85%), rgb(0 0 0 / 55%));
    pointer-events: auto;
    scrollbar-width: none;
}

.y-vp__actions {
    position: absolute;
    right: 12px;
    bottom: 24px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.y-vp__action-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.y-vp__action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--y-vp-on-media);
    backdrop-filter: blur(8px);
    color: #fff;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .3s ease, scale .15s ease;
}

.y-vp__action:hover {
    background: var(--y-vp-on-media-hover);
}

.y-vp__action:active {
    scale: .92;
}

.y-vp__action:focus-visible {
    outline: 2px solid var(--y-vp-focus);
    outline-offset: 2px;
}

.y-vp__action--fill .material-symbols-rounded,
.y-vp__action.is-active .material-symbols-rounded {
    font-variation-settings: 'FILL' 1;
}

.y-vp__action.is-active {
    color: var(--y-vp-active);
}

.y-vp__count {
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-shadow: 0 1px 2px rgb(0 0 0 / 50%);
    font-variant-numeric: tabular-nums;
}

.y-vp__volume-popup {
    position: absolute;
    top: 24px;
    right: 100%;
    display: flex;
    align-items: center;
    height: 40px;
    margin-right: 8px;
    padding: 0 14px;
    border-radius: var(--yurba-radius-pill, 100px);
    background: var(--y-vp-on-media);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transform: translate(6px, -50%);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
}

.y-vp__volume-popup::after {
    content: "";
    position: absolute;
    top: 0;
    right: -8px;
    bottom: 0;
    width: 8px;
}

@media (hover: hover) and (pointer: fine) {
    .y-vp__action-item--volume:hover .y-vp__volume-popup,
    .y-vp__action-item--volume:focus-within .y-vp__volume-popup {
        opacity: 1;
        visibility: visible;
        transform: translate(0, -50%);
        transition-duration: .2s;
        transition-timing-function: cubic-bezier(.05, .7, .1, 1);
    }
}

.y-vp--short .y-vp__volume-slider {
    width: 96px;
    opacity: 1;
}

.y-vp__progress {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 4;
    height: 4px;
    background: rgb(255 255 255 / 30%);
    touch-action: none;
    cursor: pointer;
    transition: height .15s ease;
}

.y-vp__progress:hover,
.y-vp--short.is-scrubbing .y-vp__progress {
    height: 8px;
}

.y-vp__progress::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 20px;
}

.y-vp__progress .y-vp__progress-fill {
    display: block;
    width: 0;
    height: 100%;
    background: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .y-vp__burst {
        animation-name: y-vp-fade;
    }

    .y-vp__state,
    .y-vp--short.is-paused .y-vp__state {
        transform: translate(-50%, -50%);
    }
}

/* Hold */

.y-vp__hold {
    position: absolute;
    top: 16px;
    left: 50%;
    z-index: 5;
    display: none;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    max-width: calc(100% - 32px);
    min-height: 32px;
    padding: 6px 14px;
    border: none;
    border-radius: var(--yurba-radius-pill, 100px);
    background: var(--y-vp-on-media);
    backdrop-filter: blur(8px);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    transform: translateX(-50%);
    transition: background-color .3s ease;
    pointer-events: none;
}

.y-vp__hold b {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.y-vp__hold .material-symbols-rounded {
    font-size: 20px;
    font-variation-settings: 'FILL' 1;
}

.y-vp__hold-hint {
    min-width: 0;
    margin-left: 4px;
    overflow: hidden;
    font-size: 12px;
    font-weight: 500;
    text-overflow: ellipsis;
    opacity: .8;
}

.y-vp__hold-lock {
    display: none;
}

yurba-vp.is-holding .y-vp__hold,
yurba-vp.is-speed-locked .y-vp__hold {
    display: flex;
}

yurba-vp.is-hold-locking .y-vp__hold-lock,
yurba-vp.is-speed-locked .y-vp__hold-lock {
    display: flex;
}

yurba-vp.is-hold-locking .y-vp__hold {
    background: var(--y-vp-accent);
}

yurba-vp.is-speed-locked .y-vp__hold {
    cursor: pointer;
    pointer-events: auto;
}

yurba-vp.is-speed-locked .y-vp__hold:hover {
    background: var(--y-vp-on-media-hover);
}

yurba-vp.is-speed-locked .y-vp__hold:focus-visible {
    outline: 2px solid var(--y-vp-focus);
    outline-offset: 2px;
}

yurba-vp.is-speed-locked .y-vp__hold-hint {
    display: none;
}

/* Classic */

.y-vp--classic {
    aspect-ratio: var(--y-vp-ratio);
    outline: none;
    cursor: none;
}

.y-vp--classic.is-active {
    cursor: default;
}

.y-vp--classic.y-vp--wide {
    aspect-ratio: auto;
    height: 500px;
}

.y-vp__controls {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 3;
    padding: 0 10px;
    opacity: 0;
    transition: opacity .2s ease;
}

.y-vp--classic.is-active .y-vp__controls,
.y-vp--classic.is-scrubbing .y-vp__controls {
    opacity: 1;
}

/* Hidden controls must not take the revealing tap */
.y-vp--classic:not(.is-active):not(.is-scrubbing) .y-vp__controls,
.y-vp--classic:not(.is-active):not(.is-scrubbing) .y-vp__speed-menu.is-open {
    pointer-events: none;
}

.y-vp--classic:not(.is-active):not(.is-scrubbing) .y-vp__controls:has(:focus-visible) {
    opacity: 1;
    pointer-events: auto;
}

.y-vp__controls::before {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    height: calc(100% + 35px);
    background: linear-gradient(to top, rgb(0 0 0 / 80%), transparent);
    pointer-events: none;
}

.y-vp__timeline {
    position: relative;
    display: flex;
    align-items: center;
    height: 12px;
    cursor: pointer;
    touch-action: none;
}

.y-vp__track {
    position: relative;
    flex: 1;
    height: 4px;
    border-radius: var(--yurba-radius-pill, 100px);
    background: rgb(255 255 255 / 30%);
    transition: height .15s ease;
}

.y-vp__timeline:hover .y-vp__track,
.y-vp--classic.is-scrubbing .y-vp__track {
    height: 6px;
}

.y-vp__buffered {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    background: rgb(255 255 255 / 30%);
}

.y-vp__track .y-vp__progress-fill {
    position: relative;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--y-vp-accent);
}

.y-vp__track .y-vp__progress-fill::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--y-vp-accent);
    transform: translateY(-50%) scale(0);
    opacity: 0;
    transition: transform .15s ease, opacity .15s ease;
}

/* Keep compact: JS pins its centre 20px from the ends */
.y-vp__hover-time {
    position: absolute;
    bottom: 18px;
    padding: 4px 8px;
    border-radius: var(--yurba-radius-m, 10px);
    background: var(--y-vp-surface);
    box-shadow: var(--yurba-shadow-menu, 0 6px 24px rgb(0 0 0 / 14%));
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
}

.y-vp__timeline:hover .y-vp__hover-time,
.y-vp--classic.is-scrubbing .y-vp__hover-time {
    opacity: 1;
}

.y-vp__timeline:hover .y-vp__progress-fill::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.y-vp--classic.is-scrubbing .y-vp__progress-fill::after {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
}

.y-vp__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
}

.y-vp__group {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.y-vp__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--y-vp-control);
    font-family: inherit;
    cursor: pointer;
    transition: background-color .3s ease;
}

.y-vp__btn:hover,
.y-vp__speed:has(.y-vp__speed-menu.is-open) .y-vp__btn {
    background: var(--y-vp-hover);
}

.y-vp__btn:focus-visible {
    outline: 2px solid var(--y-vp-focus);
    outline-offset: -2px;
}

.y-vp__btn .material-symbols-rounded {
    font-size: 24px;
    transition: transform .15s ease;
}

.y-vp__btn:active .material-symbols-rounded {
    transform: scale(.9);
}

.y-vp__btn[data-vp="play"] .material-symbols-rounded {
    font-size: 28px;
    font-variation-settings: 'FILL' 1;
}

.y-vp__volume {
    display: flex;
    align-items: center;
}

.y-vp__volume-slider {
    --y-vp-fill: 100%;
    width: 0;
    height: 4px;
    margin: 0;
    border-radius: var(--yurba-radius-pill, 100px);
    background: linear-gradient(to right, #fff var(--y-vp-fill), rgb(255 255 255 / 30%) var(--y-vp-fill));
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    opacity: 0;
    transition: width .2s ease, opacity .2s ease, margin .2s ease;
}

.y-vp__volume:hover .y-vp__volume-slider,
.y-vp__volume:focus-within .y-vp__volume-slider {
    width: 70px;
    margin-right: 8px;
    opacity: 1;
}

.y-vp__volume-slider:focus-visible {
    outline: 2px solid var(--y-vp-focus);
    outline-offset: 4px;
}

.y-vp__volume-slider::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: #fff;
    -webkit-appearance: none;
    transition: transform .15s ease;
}

.y-vp__volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s ease;
}

.y-vp__volume-slider:hover::-webkit-slider-thumb,
.y-vp__volume-slider:active::-webkit-slider-thumb {
    transform: scale(1.2);
}

.y-vp__volume-slider:hover::-moz-range-thumb,
.y-vp__volume-slider:active::-moz-range-thumb {
    transform: scale(1.2);
}

.y-vp__time {
    margin-left: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 540px) {
    .y-vp__btn {
        width: 36px;
        height: 36px;
    }

    .y-vp__btn .material-symbols-rounded {
        font-size: 22px;
    }

    .y-vp__btn[data-vp="play"] .material-symbols-rounded {
        font-size: 26px;
    }

    .y-vp__volume,
    .y-vp__hover-time {
        display: none;
    }
}

/* Speed */

.y-vp__speed {
    position: relative;
}

.y-vp__speed-menu {
    position: absolute;
    right: 0;
    bottom: 48px;
    display: flex;
    flex-direction: column;
    min-width: 180px;
    margin: 0;
    padding: 6px;
    list-style: none;
    border-radius: var(--yurba-radius-l, 14px);
    background: var(--y-vp-surface);
    backdrop-filter: blur(12px);
    box-shadow: var(--yurba-shadow-menu, 0 6px 24px rgb(0 0 0 / 14%));
    transform: scale(.96);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}

.y-vp__speed-menu.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition-duration: .2s;
    transition-timing-function: cubic-bezier(.05, .7, .1, 1);
}

.y-vp__speed-menu li {
    display: flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 12px;
    border-radius: var(--yurba-radius-m, 10px);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .3s ease;
}

.y-vp__speed-menu li:hover {
    background: rgb(255 255 255 / 8%);
}

.y-vp__speed-menu li.is-active {
    background: color-mix(in srgb, var(--y-vp-accent) 28%, transparent);
    font-weight: 600;
}

.y-vp__speed-menu li:focus-visible {
    outline: 2px solid var(--y-vp-focus);
    outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
    .y-vp__speed-menu {
        transform: none;
    }
}

/* Loader */

.y-vp__loader {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    border: 4px solid rgb(255 255 255 / 30%);
    border-top-color: #fff;
    border-radius: 50%;
    animation: y-vp-spin .8s linear infinite;
    pointer-events: none;
}

.y-vp.is-error .y-vp__loader {
    display: none;
}

@keyframes y-vp-spin {
    to { transform: rotate(360deg); }
}

/* Ripple */

.y-vp__ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 50%;
    background: var(--y-vp-on-media);
    backdrop-filter: blur(8px);
    font-size: 13px;
    font-weight: 600;
    animation: y-vp-ripple .8s ease forwards;
    pointer-events: none;
}

.y-vp__ripple .material-symbols-rounded {
    font-size: 28px;
    font-variation-settings: 'FILL' 1;
}

.y-vp__ripple--left {
    left: 20%;
}

.y-vp__ripple--right {
    left: 80%;
}

@keyframes y-vp-ripple {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(1.5); }
}

@media (prefers-reduced-motion: reduce) {
    .y-vp__ripple {
        animation-name: y-vp-fade;
    }
}

/* Slides */

.y-vp__slides {
    overflow: hidden;
    background: #000;
    touch-action: pan-y;
}

.y-vp__slides-track {
    display: flex;
    height: 100%;
    transition: transform .35s cubic-bezier(.25, 1, .3, 1);
}

.y-vp__slide {
    display: flex;
    flex: 0 0 100%;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 100%;
}

.y-vp__slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
}

.y-vp__segments {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 2;
    display: flex;
    gap: 3px;
    pointer-events: none;
}

.y-vp__segment {
    flex: 1;
    height: 3px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, .35);
}

.y-vp__segment > span {
    display: block;
    height: 100%;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left;
}

.y-vp__slide-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .4);
    color: #fff;
    transform: translateY(-50%);
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s;
}

.y-vp:hover .y-vp__slide-arrow {
    opacity: 1;
}

.y-vp__slide-arrow[hidden] {
    display: none;
}

.y-vp__slide-arrow--prev {
    left: 10px;
}

.y-vp__slide-arrow--next {
    right: 10px;
}

.y-vp--slides .y-vp__progress {
    display: none;
}

@media (hover: none) {
    .y-vp__slide-arrow {
        display: none;
    }
}
