/* ==========================================================
   8 Amazing Tricks: a video stage with a playlist beside it.
   Videos play in place (see assets/js/tricks.js).
   ========================================================== */

.voila-tricks {
    --vt-grad: linear-gradient(80deg, #89f0f5, #95c3f7, #f2cbea);
    --vt-grad-soft: linear-gradient(80deg, rgba(137, 240, 245, 0.22), rgba(149, 195, 247, 0.22), rgba(242, 203, 234, 0.22));
    --vt-ink: #4c5462;
    --vt-muted: #8a93a3;
    --vt-focus: #95c3f7;
    --vt-shadow: rgba(79, 108, 176, 0.45);

    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 32px;
    align-items: start;
    margin-top: 48px;
    text-align: left;
    color: var(--vt-ink);
}

/* ---------- Stage ---------- */

.voila-tricks__screen {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 18px;
    overflow: hidden;
    background: var(--vt-grad);
    box-shadow: 0 30px 60px -24px var(--vt-shadow), 0 0 0 1px rgba(149, 195, 247, 0.35);
    isolation: isolate;
}

.voila-tricks__poster,
.voila-tricks__screen iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.voila-tricks__poster {
    object-fit: cover;
    transition: opacity 0.35s ease, transform 0.6s ease;
}

.voila-tricks__poster.is-switching {
    opacity: 0;
}

/* The whole screen is the play target; the pill is its visible label. */
.voila-tricks__play {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 7%;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.voila-tricks__play:focus {
    outline: none;
}

.voila-tricks__play:focus-visible {
    box-shadow: inset 0 0 0 3px var(--vt-focus);
    border-radius: 18px;
}

.voila-tricks__pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 22px 8px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: 0 14px 30px -12px var(--vt-shadow);
    color: var(--vt-ink);
    font: 700 15px/1 "Raleway", sans-serif;
    letter-spacing: 0.02em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.voila-tricks__pill-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--vt-grad);
}

.voila-tricks__pill-icon svg {
    width: 14px;
    height: 14px;
    margin-left: 2px;
    fill: #fff;
}

.voila-tricks__play:hover .voila-tricks__pill,
.voila-tricks__play:focus-visible .voila-tricks__pill {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 18px 34px -12px var(--vt-shadow);
}

.voila-tricks__screen:hover .voila-tricks__poster {
    transform: scale(1.02);
}

/* Once a video has started, the player replaces poster and play button. */
.voila-tricks.is-started .voila-tricks__poster,
.voila-tricks.is-started .voila-tricks__play {
    opacity: 0;
    visibility: hidden;
}

.voila-tricks__caption {
    padding: 22px 4px 0;
}

.voila-tricks__meta {
    margin: 0 0 6px;
    color: var(--vt-muted);
    font: 700 12px/1.4 "Raleway", sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.voila-tricks__title {
    margin: 0 0 8px;
    color: var(--vt-ink);
    font-size: 26px;
    font-weight: 700;
}

.voila-tricks__desc {
    max-width: 62ch;
    margin: 0;
    color: #6b7382;
    font-size: 16px;
    line-height: 1.6;
}

/* ---------- Playlist ---------- */

.voila-tricks__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.voila-tricks__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 12px 8px 8px;
    border-radius: 14px;
    color: var(--vt-ink);
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.voila-tricks__item:hover,
.voila-tricks__item:focus {
    background-color: #f4f7fc;
    color: var(--vt-ink);
    text-decoration: none;
    opacity: 1;
}

.voila-tricks__item:focus {
    outline: none;
}

.voila-tricks__item:focus-visible {
    box-shadow: 0 0 0 2px var(--vt-focus);
}

.voila-tricks__item.is-active {
    background: var(--vt-grad-soft);
    box-shadow: inset 0 0 0 1px rgba(149, 195, 247, 0.5);
}

.voila-tricks__item.is-active:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(149, 195, 247, 0.5), 0 0 0 2px var(--vt-focus);
}

.voila-tricks__icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 23%;
    box-shadow: 0 6px 14px -6px rgba(79, 108, 176, 0.45);
}

.voila-tricks__icon--round {
    border-radius: 50%;
}

.voila-tricks__label {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.voila-tricks__name {
    display: flex;
    align-items: center;
    gap: 8px;
    font: 700 15px/1.2 "Raleway", sans-serif;
}

.voila-tricks__year {
    color: var(--vt-muted);
    font-size: 13px;
}

/* "Now playing" bars next to the active trick's name */
.voila-tricks__eq {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.voila-tricks__eq i {
    width: 3px;
    height: 30%;
    border-radius: 2px;
    background: linear-gradient(#95c3f7, #f2cbea);
    animation: voila-tricks-eq 0.9s ease-in-out infinite;
}

.voila-tricks__eq i:nth-child(2) { animation-delay: -0.3s; }
.voila-tricks__eq i:nth-child(3) { animation-delay: -0.6s; }

.voila-tricks.is-playing .voila-tricks__item.is-active .voila-tricks__eq {
    display: inline-flex;
}

@keyframes voila-tricks-eq {
    0%, 100% { height: 30%; }
    50% { height: 100%; }
}

/* ---------- Tablet & mobile: stage on top, swipeable playlist ---------- */

@media (max-width: 991px) {
    .voila-tricks {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
        margin-top: 32px;
    }

    .voila-tricks__list {
        flex-direction: row;
        gap: 12px;
        margin: 0 -15px;
        padding: 4px 15px 12px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 15px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .voila-tricks__list::-webkit-scrollbar {
        display: none;
    }

    .voila-tricks__list > li {
        flex: 0 0 112px;
        scroll-snap-align: start;
    }

    .voila-tricks__item {
        flex-direction: column;
        gap: 10px;
        padding: 14px 8px 12px;
        text-align: center;
    }

    .voila-tricks__icon {
        flex-basis: auto;
        width: 56px;
        height: 56px;
    }

    .voila-tricks__label {
        align-items: center;
    }

    .voila-tricks__caption {
        padding-top: 16px;
    }

    .voila-tricks__title {
        font-size: 22px;
    }
}

@media (max-width: 575px) {
    .voila-tricks__screen {
        border-radius: 14px;
    }

    .voila-tricks__pill {
        gap: 10px;
        padding: 6px 16px 6px 6px;
        font-size: 14px;
    }

    .voila-tricks__pill-icon {
        width: 30px;
        height: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .voila-tricks *,
    .voila-tricks *::before,
    .voila-tricks *::after {
        transition: none !important;
        animation: none !important;
    }
}
