
/**
 * =========================================================
 * Tutorial Studio
 * Presentation Preview
 *
 * 文件：css/main/menu/view/presentation.css
 *
 * 职责：
 * 1. 全屏演示覆盖层
 * 2. 幻灯片等比缩放与入场动画
 * 3. 自动隐藏的控制栏、进度条和提示
 * =========================================================
 */

/* =========================================================
   01. 覆盖层
========================================================= */

.ts-presentation {
    --ts-presentation-bg: #06080c;
    --ts-presentation-text: #eef2f7;
    --ts-presentation-muted: rgba(238, 242, 247, .55);
    --ts-presentation-panel: rgba(17, 20, 27, .8);
    --ts-presentation-line: rgba(255, 255, 255, .09);
    --ts-presentation-accent: #7c89ff;

    position: fixed;
    inset: 0;
    z-index: 2000000;

    display: flex;

    background:
        radial-gradient(120% 85% at 50% 0%,
            rgba(86, 103, 232, .16),
            transparent 62%),
        var(--ts-presentation-bg);

    color: var(--ts-presentation-text);

    overflow: hidden;

    user-select: none;
    -webkit-user-select: none;
}

.ts-presentation[hidden] {
    display: none !important;
}

.ts-presentation.is-open {
    animation: ts-presentation-open .22s ease-out;
}

@keyframes ts-presentation-open {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

body.ts-presentation-open {
    overflow: hidden !important;
}


/* =========================================================
   02. 舞台与幻灯片
========================================================= */

.ts-presentation-stage {
    position: absolute;
    inset: 0;

    overflow: hidden;

    touch-action: none;
}

.ts-presentation-slide {
    position: absolute;
    left: 50%;
    top: 50%;

    width: 1280px;
    height: 720px;

    transform:
        translate(-50%, -50%) scale(var(--ts-presentation-scale, 1));

    transform-origin: center center;

    background: #000;

    border-radius: 4px;

    overflow: hidden;

    box-shadow:
        0 40px 120px rgba(0, 0, 0, .65),
        0 0 0 1px rgba(255, 255, 255, .07);

    will-change: transform, opacity;
}

.ts-presentation-frame {
    display: block;

    width: 100%;
    height: 100%;

    border: 0;

    background: #000;

    opacity: 1;

    transition: opacity .16s ease;
}

.ts-presentation-frame.is-loading {
    opacity: 0;
}

/* ---------- 页面转场 ---------- */

.ts-presentation-slide.is-entering[data-transition="fade"] {
    animation: ts-presentation-fade .32s ease-out;
}

.ts-presentation-slide.is-entering[data-transition="slide"][data-direction="next"] {
    animation: ts-presentation-push-next .36s cubic-bezier(.22, .61, .36, 1);
}

.ts-presentation-slide.is-entering[data-transition="slide"][data-direction="prev"] {
    animation: ts-presentation-push-prev .36s cubic-bezier(.22, .61, .36, 1);
}

.ts-presentation-slide.is-entering[data-transition="zoom"] {
    animation: ts-presentation-zoom .36s ease-out;
}

.ts-presentation-slide.is-entering[data-transition="wipe"][data-direction="next"] {
    animation: ts-presentation-wipe-next .4s cubic-bezier(.22, .61, .36, 1);
}

.ts-presentation-slide.is-entering[data-transition="wipe"][data-direction="prev"] {
    animation: ts-presentation-wipe-prev .4s cubic-bezier(.22, .61, .36, 1);
}

@keyframes ts-presentation-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ts-presentation-push-next {
    from {
        opacity: 0;

        transform:
            translate(-50%, -50%) scale(var(--ts-presentation-scale, 1)) translateX(4%);
    }

    to {
        opacity: 1;

        transform:
            translate(-50%, -50%) scale(var(--ts-presentation-scale, 1));
    }
}

@keyframes ts-presentation-push-prev {
    from {
        opacity: 0;

        transform:
            translate(-50%, -50%) scale(var(--ts-presentation-scale, 1)) translateX(-4%);
    }

    to {
        opacity: 1;

        transform:
            translate(-50%, -50%) scale(var(--ts-presentation-scale, 1));
    }
}

@keyframes ts-presentation-zoom {
    from {
        opacity: 0;
        transform:
            translate(-50%, -50%) scale(var(--ts-presentation-scale, 1)) scale(1.06);
    }

    to {
        opacity: 1;
        transform:
            translate(-50%, -50%) scale(var(--ts-presentation-scale, 1));
    }
}

@keyframes ts-presentation-wipe-next {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0); }
}

@keyframes ts-presentation-wipe-prev {
    from { clip-path: inset(0 0 0 100%); }
    to { clip-path: inset(0); }
}

/* =========================================================
   03. 进度条
========================================================= */

.ts-presentation-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    z-index: 3;

    height: 3px;

    background: rgba(255, 255, 255, .06);

    pointer-events: none;
}

.ts-presentation-progress span {
    display: block;

    width: 0;
    height: 100%;

    background:
        linear-gradient(90deg, #6d7cff, #a379ff);

    box-shadow:
        0 0 12px rgba(124, 137, 255, .55);

    transition:
        width .28s cubic-bezier(.2, .7, .3, 1);
}


/* =========================================================
   04. 控制栏
========================================================= */

.ts-presentation-hud {
    position: absolute;
    left: 50%;
    bottom: 18px;

    z-index: 4;

    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 20px;

    width: min(880px, calc(100vw - 40px));

    padding: 9px 12px;

    border:
        1px solid var(--ts-presentation-line);

    border-radius: 16px;

    background: var(--ts-presentation-panel);

    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);

    box-shadow:
        0 18px 50px rgba(0, 0, 0, .45);

    transform: translateX(-50%);

    transition:
        opacity .2s ease,
        transform .2s ease;
}

.ts-presentation.is-idle .ts-presentation-hud {
    opacity: 0;

    transform:
        translate(-50%, 10px);

    pointer-events: none;
}

.ts-presentation.is-idle {
    cursor: none;
}

/* ---------- 自动播放进度 ---------- */

.ts-presentation-playback {
    position: absolute;
    top: 0;
    left: 18px;
    right: 18px;

    height: 3px;

    overflow: hidden;

    border-radius: 0 0 2px 2px;

    opacity: 0;

    pointer-events: none;

    transition: opacity .2s ease;
}

.ts-presentation.is-playing .ts-presentation-playback {
    opacity: 1;
}

.ts-presentation-playback span {
    display: block;

    width: 0;
    height: 100%;

    border-radius: inherit;

    background:
        linear-gradient(90deg, #8f9cff, #c08bff);

    box-shadow:
        0 0 8px rgba(143, 156, 255, .55);
}

/* ---------- 标题 ---------- */

.ts-presentation-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;

    min-width: 0;

    padding-left: 4px;
}

.ts-presentation-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-presentation-subtitle {
    font-size: 11px;
    color: var(--ts-presentation-muted);

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- 翻页 ---------- */

.ts-presentation-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ts-presentation-counter {
    min-width: 64px;

    font-size: 12px;
    font-variant-numeric: tabular-nums;
    letter-spacing: .06em;
    text-align: center;

    color: rgba(238, 242, 247, .82);
}

.ts-presentation-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

/* ---------- 按钮 ---------- */

.ts-presentation-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    width: 34px;
    height: 34px;

    padding: 0;

    border: 0;
    border-radius: 10px;

    background: transparent;

    color: inherit;

    cursor: pointer;

    transition:
        background .15s ease,
        color .15s ease,
        opacity .15s ease;
}

.ts-presentation-button svg {
    width: 18px;
    height: 18px;

    fill: none;

    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ts-presentation-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, .1);
}

.ts-presentation-button:active:not(:disabled) {
    background: rgba(255, 255, 255, .16);
}

.ts-presentation-button:focus-visible {
    outline: 2px solid var(--ts-presentation-accent);
    outline-offset: 2px;
}

.ts-presentation-button:disabled {
    opacity: .3;
    cursor: default;
}

.ts-presentation-button--exit {
    width: auto;

    padding: 0 11px;

    font-size: 12px;
    letter-spacing: .01em;

    color: rgba(238, 242, 247, .78);
}

.ts-presentation-button--exit:hover {
    background: rgba(255, 96, 96, .16);

    color: #ffd7d7;
}

/* ---------- 播放 ---------- */

.ts-presentation-button--play {
    width: auto;

    padding: 0 12px;

    font-size: 12px;
    letter-spacing: .01em;

    color: rgba(238, 242, 247, .88);
}

.ts-presentation-button--play:hover:not(:disabled) {
    background: rgba(255, 255, 255, .12);
}

.ts-presentation.is-playing .ts-presentation-button--play {
    background: rgba(124, 137, 255, .18);

    color: #d6dbff;
}

.ts-presentation.is-playing .ts-presentation-button--play:hover:not(:disabled) {
    background: rgba(124, 137, 255, .26);
}

.ts-presentation-icon-pause {
    display: none;
}

.ts-presentation.is-playing .ts-presentation-icon-play {
    display: none;
}

.ts-presentation.is-playing .ts-presentation-icon-pause {
    display: block;
}


/* =========================================================
   05. 快捷键提示
========================================================= */

.ts-presentation-hint {
    position: absolute;
    top: 10px;
    left: 50%;

    z-index: 4;

    padding: 8px 14px;

    border:
        1px solid var(--ts-presentation-line);

    border-radius: 999px;

    background: rgba(17, 20, 27, .72);

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    color: rgba(238, 242, 247, .72);

    font-size: 12px;
    letter-spacing: .01em;
    white-space: nowrap;

    transform: translateX(-50%);

    opacity: 0;

    pointer-events: none;

    transition: opacity .3s ease;
}

.ts-presentation.is-hint-visible .ts-presentation-hint {
    opacity: 1;
}


/* =========================================================
   06. 响应式
========================================================= */

@media (max-width: 720px) {
    .ts-presentation-hud {
        bottom: 12px;

        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px;

        width: calc(100vw - 20px);

        padding: 8px 10px;
    }

    .ts-presentation-meta {
        display: none;
    }

    .ts-presentation-controls {
        justify-content: flex-start;
    }

    .ts-presentation-counter {
        min-width: 52px;
    }

    .ts-presentation-play-label {
        display: none;
    }

    .ts-presentation-button--play {
        width: 34px;

        padding: 0;
    }

    .ts-presentation-hint {
        top: 8px;

        max-width: calc(100vw - 24px);

        padding: 7px 12px;

        font-size: 11px;

        white-space: normal;
        text-align: center;
    }
}


/* =========================================================
   07. 降低动态效果
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .ts-presentation,
    .ts-presentation.is-open,
    .ts-presentation-hud,
    .ts-presentation-playback,
    .ts-presentation-progress span,
    .ts-presentation-hint,
    .ts-presentation-slide.is-entering {
        animation: none !important;
        transition: none !important;
    }
}
