/* ── StoneLink video player (sl-video.js) ─────────────────────────
   Chrome sits on the picture, so it is always light-on-dark glass — in both themes.
   The video itself is never filtered. */

.sl-video {
    --sl-video-ink: #f5f5f5;
    --sl-video-ink-mute: rgba(245, 245, 245, 0.66);
    --sl-video-track: rgba(255, 255, 255, 0.22);
    --sl-video-glass: rgba(18, 18, 18, 0.46);
    --sl-video-line: rgba(255, 255, 255, 0.16);
    position: relative;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    border-radius: inherit;
    background: #000;
    color: var(--sl-video-ink);
    line-height: 0;
    vertical-align: middle;
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
}

.sl-video[hidden] { display: none !important; }

.sl-video:focus {
    outline: none;
}

.sl-video:focus-visible {
    box-shadow: 0 0 0 3px var(--interactive-ring);
}

.sl-video > video {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: var(--sl-video-max-h, none);
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

/* Fixed media boxes (messages lightbox, team update modal): fill and letterbox. */
.sl-video.is-fill {
    display: block;
    width: 100%;
    height: 100%;
}

.sl-video.is-fill > video {
    width: 100%;
    height: 100%;
    max-height: none;
}

.sl-video.is-idle,
.sl-video.is-idle .sl-video-surface {
    cursor: none;
}

.sl-video-surface {
    position: absolute;
    inset: 0;
    z-index: 1;
    cursor: pointer;
}

/* Big centre button while paused. */
.sl-video-big {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: -34px 0 0 -34px;
    padding: 0 0 0 3px;
    border: 0.5px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    background: var(--sl-video-glass);
    color: var(--sl-video-ink);
    cursor: pointer;
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.32);
    transition: opacity var(--dur) var(--ease), transform var(--dur-slow) var(--ease-out), box-shadow var(--dur) var(--ease);
}

.sl-video-big svg {
    width: 24px;
    height: 24px;
}

.sl-video-big:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08), 0 16px 40px rgba(0, 0, 0, 0.38);
}

.sl-video-big:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--interactive-ring), 0 12px 34px rgba(0, 0, 0, 0.32);
}

.sl-video.is-playing .sl-video-big {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

/* Buffering ring. */
.sl-video-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--sl-video-ink);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease);
}

.sl-video.is-waiting .sl-video-spinner {
    opacity: 1;
    animation: sl-video-spin 0.9s linear infinite;
}

@keyframes sl-video-spin {
    to { transform: rotate(360deg); }
}

/* Control bar. */
.sl-video-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: grid;
    gap: 2px;
    padding: 28px 14px 10px;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.36) 42%, rgba(0, 0, 0, 0.66));
    line-height: 1;
    transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease-out);
}

.sl-video.is-idle .sl-video-bar {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

.sl-video-row {
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
}

.sl-video-spacer {
    flex: 1;
    min-width: 4px;
}

.sl-video-btn {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 980px;
    background: transparent;
    color: var(--sl-video-ink);
    font: inherit;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease-out);
}

.sl-video-btn svg {
    width: 19px;
    height: 19px;
}

.sl-video-btn:hover {
    box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.1);
}

.sl-video-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--sl-video-ink);
}

.sl-video-btn[hidden] { display: none !important; }

.sl-video-time {
    display: inline-flex;
    gap: 5px;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    color: var(--sl-video-ink);
    white-space: nowrap;
}

.sl-video-time-sep,
.sl-video-time [data-duration] {
    color: var(--sl-video-ink-mute);
}

/* Sliders: scrubber + volume share the track look. */
.sl-video-scrub,
.sl-video-volume {
    --sl-video-value: 0;
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}

.sl-video-scrub {
    height: 18px;
    margin: 0 4px;
}

.sl-video-track {
    position: relative;
    display: block;
    width: 100%;
    height: 3px;
    overflow: hidden;
    border-radius: 980px;
    background: var(--sl-video-track);
    transition: transform var(--dur) var(--ease-out);
}

.sl-video-scrub:hover .sl-video-track,
.sl-video-scrub.is-dragging .sl-video-track,
.sl-video-scrub:focus-visible .sl-video-track {
    transform: scaleY(1.67);
}

.sl-video-buffer,
.sl-video-progress,
.sl-video-level {
    position: absolute;
    inset: 0;
    transform-origin: left center;
}

.sl-video-buffer {
    background: rgba(255, 255, 255, 0.26);
    transform: scaleX(var(--sl-video-buffer, 0));
}

.sl-video-progress,
.sl-video-level {
    background: var(--sl-video-ink);
    transform: scaleX(var(--sl-video-value));
}

.sl-video-knob {
    position: absolute;
    top: 50%;
    left: calc(var(--sl-video-value) * 100%);
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: var(--sl-video-ink);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
    transform: scale(0);
    transition: transform var(--dur) var(--ease-out);
    pointer-events: none;
}

.sl-video-scrub:hover .sl-video-knob,
.sl-video-scrub.is-dragging .sl-video-knob,
.sl-video-scrub:focus-visible .sl-video-knob,
.sl-video-volume:hover .sl-video-knob,
.sl-video-volume.is-dragging .sl-video-knob,
.sl-video-volume:focus-visible .sl-video-knob {
    transform: scale(1);
}

.sl-video-scrub:focus-visible,
.sl-video-volume:focus-visible {
    outline: none;
}

.sl-video-scrub:focus-visible .sl-video-track,
.sl-video-volume:focus-visible .sl-video-track {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.sl-video-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    padding: 5px 8px;
    border: 0.5px solid var(--sl-video-line);
    border-radius: 7px;
    background: rgba(18, 18, 18, 0.82);
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--sl-video-ink);
    white-space: nowrap;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: opacity var(--dur-fast) var(--ease);
}

.sl-video-scrub:hover .sl-video-tip {
    opacity: 1;
}

/* Volume slider beside the speaker — fine pointers only; touch uses the hardware keys. */
.sl-video-sound {
    display: inline-flex;
    align-items: center;
}

.sl-video-volume {
    width: 64px;
    height: 28px;
    margin: 0 6px 0 2px;
}

@media (hover: none), (pointer: coarse) {
    .sl-video-volume {
        display: none;
    }
}

/* Speed popover. */
.sl-video-speed {
    position: relative;
}

.sl-video-speed-btn {
    width: auto;
    min-width: 36px;
    padding: 0 9px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--sl-video-ink-mute);
}

.sl-video-speed-btn.is-changed {
    color: var(--sl-video-ink);
}

.sl-video-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: grid;
    min-width: 112px;
    padding: 4px;
    border: 0.5px solid var(--sl-video-line);
    border-radius: 12px;
    background: rgba(22, 22, 22, 0.88);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.sl-video-menu[hidden] { display: none !important; }

.sl-video-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--sl-video-ink-mute);
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.sl-video-menu-item:hover,
.sl-video-menu-item:focus-visible {
    outline: none;
    color: var(--sl-video-ink);
    box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.08);
}

.sl-video-menu-item[aria-checked="true"] {
    color: var(--sl-video-ink);
    font-weight: 600;
}

.sl-video-menu-item[aria-checked="true"]::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.sl-video.is-fullscreen {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.sl-video.is-fullscreen > video {
    width: 100%;
    height: 100%;
    max-height: none;
}

/* Small players (set by sl-video.js): drop the extras, keep play / time / fullscreen. */
.sl-video.is-compact .sl-video-speed,
.sl-video.is-compact .sl-video-pip,
.sl-video.is-compact .sl-video-volume {
    display: none;
}

@media (max-width: 480px) {
    .sl-video-bar {
        padding: 24px 8px 6px;
    }

    .sl-video-big {
        width: 58px;
        height: 58px;
        margin: -29px 0 0 -29px;
    }
}

/* ── Play badge on video thumbnails (grid tiles, chat, feeds) ─── */

.sl-video-badge {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    padding-left: 3px;
    border: 0.5px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    background: rgba(18, 18, 18, 0.42);
    color: #f5f5f5;
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
    transition: transform var(--dur-slow) var(--ease-out), box-shadow var(--dur) var(--ease);
}

.sl-video-badge svg {
    width: 20px;
    height: 20px;
}

.sl-video-badge.is-small {
    width: 40px;
    height: 40px;
    padding-left: 2px;
}

.sl-video-badge.is-small svg {
    width: 15px;
    height: 15px;
}

@media (prefers-reduced-motion: reduce) {
    .sl-video-bar,
    .sl-video-big,
    .sl-video-track,
    .sl-video-knob,
    .sl-video-badge {
        transition: none;
    }

    .sl-video.is-idle .sl-video-bar,
    .sl-video.is-playing .sl-video-big,
    .sl-video-big:hover {
        transform: none;
    }

    .sl-video.is-waiting .sl-video-spinner {
        animation-duration: 2.4s;
    }
}

/* ── Audio card (SLAudioPlayer) — sits on the page, so it follows the theme ── */

.sl-audio {
    --sl-video-ink: var(--text);
    --sl-video-track: color-mix(in srgb, var(--text) 16%, transparent);
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: 0.5px solid var(--line-strong);
    border-radius: calc(var(--radius) + 4px);
    background: var(--card);
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.sl-audio[hidden] { display: none !important; }

.sl-audio > audio {
    display: none;
}

.sl-audio .sl-video-btn {
    color: var(--text);
}

.sl-audio .sl-video-btn:hover {
    box-shadow: inset 0 0 0 100px color-mix(in srgb, var(--text) 8%, transparent);
}

.sl-audio .sl-video-btn:focus-visible {
    box-shadow: 0 0 0 3px var(--interactive-ring);
}

.sl-audio-play {
    width: 48px;
    height: 48px;
    background: var(--text);
    color: var(--bg) !important;
    padding-left: 2px;
}

.sl-audio-play:hover {
    transform: scale(1.04);
    box-shadow: 0 0 0 5px var(--interactive-glow-soft) !important;
}

.sl-audio.is-playing .sl-audio-play {
    padding-left: 0;
}

.sl-audio-body {
    display: grid;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.sl-audio-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.015em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sl-audio-scrub {
    margin: 0;
}

.sl-audio-time {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
    .sl-audio-play:hover {
        transform: none;
    }
}
