/* ============================================================
   UCVPN 首页 hero 使用流程演示动画
   替代原来的 static/image/vpn-index.png
   资源：static/image/ucvpn-demo/*.webp（8 张，共 176KB）
   ============================================================ */

/* hero 右栏本身。
   站点原有的 ._asqHW 在 1024px 以下写死了高度（768–1023px: 407px，768px 以下: 302px），
   那是为原来那张横图准备的；竖版手机演示会超出并压住左侧文案。
   这里只对本栏解除固定高度，让它按内容撑开，不影响 ._asqHW 的其他用法。 */
@media only screen and (max-width: 1023px) {
    .ucv-hero-col {
        height: auto;
        align-items: center;
        padding: 20px 0 4px;
    }
}

/* hero 右栏的容纳槽：撑满列宽列高并居中 */
.ucv-hero-slot {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 1px;
}

/* 背后的光环，呼应原插图里的白色轨道圈 */
.ucv-hero-slot::before,
.ucv-hero-slot::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.ucv-hero-slot::before {
    width: 108%;
    aspect-ratio: 1;
    max-width: 520px;
    border: 2px solid rgba(255, 255, 255, .30);
}
.ucv-hero-slot::after {
    width: 84%;
    aspect-ratio: 1;
    max-width: 404px;
    background: radial-gradient(circle, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, .10) 55%, rgba(255, 255, 255, 0) 72%);
}

.ucvpn-demo {
    --w: 260px;
    /* 演示宽度：改这一个值就能整体缩放 */
    --dur: 17s;
    /* 整段动画时长 */
    position: relative;
    z-index: 1;
    width: var(--w);
    margin: 0 auto;
    -webkit-user-select: none;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

/* ---------- 手机外框 ---------- */
.ucv-phone {
    position: relative;
    width: 100%;
    padding: calc(var(--w) * .028);
    box-sizing: border-box;
    border-radius: calc(var(--w) * .155);
    /* 浅色机身，在橙色 hero 上更透亮 */
    background: linear-gradient(160deg, #ffffff 0%, #eceff4 38%, #ffffff 68%, #e2e6ed 100%);
    box-shadow:
        0 calc(var(--w)*.06) calc(var(--w)*.12) rgba(70, 24, 0, .26),
        0 calc(var(--w)*.012) calc(var(--w)*.03) rgba(70, 24, 0, .16),
        inset 0 0 0 1px rgba(255, 255, 255, .85);
}

.ucv-screen {
    position: relative;
    width: 100%;
    padding-top: 216.79%;
    /* 1179 : 2556 */
    border-radius: calc(var(--w) * .128);
    overflow: hidden;
    background: #f7f7f8;
    transform: translateZ(0);
}

.ucv-screen>* {
    position: absolute;
}

/* ---------- 全屏截图层 ---------- */
.ucv-frame {
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    z-index: 1;
    max-width: none;
}

.ucv-f5 { z-index: 2; opacity: 0; animation: ucvF5 var(--dur) linear infinite }
.ucv-f6 { z-index: 3; opacity: 0; animation: ucvF6 var(--dur) linear infinite }
.ucv-f7 { z-index: 4; opacity: 0; animation: ucvF7 var(--dur) linear infinite }
.ucv-f1 { z-index: 12; animation: ucvF1 var(--dur) linear infinite }

@keyframes ucvF1 { 0%, 12.35% { opacity: 1 } 14.41%, 100% { opacity: 0 } }
@keyframes ucvF5 { 0%, 60%    { opacity: 0 } 60.9%, 100%  { opacity: 1 } }
@keyframes ucvF6 { 0%, 72.35% { opacity: 0 } 73.53%, 100% { opacity: 1 } }
@keyframes ucvF7 { 0%, 80.6%  { opacity: 0 } 82%, 100%    { opacity: 1 } }

/* ---------- 连接进度条：盖住截图里的静态条，改为真实推进 ---------- */
.ucv-bar {
    z-index: 5;
    opacity: 0;
    left: 24.51%;
    top: 20.38%;
    width: 50.89%;
    height: .55%;
    min-height: 2px;
    background: #e0e0e0;
    border-radius: 99px;
    overflow: hidden;
    animation: ucvBar var(--dur) linear infinite;
}

.ucv-bar i {
    display: block;
    height: 100%;
    width: 26%;
    background: #9ad0bf;
    border-radius: 99px;
    animation: ucvBarFill var(--dur) linear infinite;
}

@keyframes ucvBar { 0%, 60.3% { opacity: 0 } 60.9%, 80.3% { opacity: 1 } 81%, 100% { opacity: 0 } }
@keyframes ucvBarFill {
    0%, 60.9% { width: 26% }
    72.35%    { width: 58% }
    80.3%     { width: 95% }
    81%, 100% { width: 100% }
}

/* ---------- 连接成功波纹 ---------- */
.ucv-pulse {
    z-index: 6;
    left: 49.87%;
    top: 40.61%;
    width: 33.6%;
    aspect-ratio: 1;
    margin-left: -16.8%;
    margin-top: -16.8%;
    /* margin 的百分比按宽度解算，正好等于半径 */
    border-radius: 50%;
    border: 2px solid #6fc4a8;
    opacity: 0;
    pointer-events: none;
}

.ucv-pulse1 { animation: ucvPulse1 var(--dur) linear infinite }
.ucv-pulse2 { animation: ucvPulse2 var(--dur) linear infinite }

@keyframes ucvPulse1 { 0%, 81.8% { opacity: 0; transform: scale(.75) } 82.6% { opacity: .55; transform: scale(.95) } 88%, 100% { opacity: 0; transform: scale(2.05) } }
@keyframes ucvPulse2 { 0%, 84.6% { opacity: 0; transform: scale(.75) } 85.4% { opacity: .45; transform: scale(.95) } 91%, 100% { opacity: 0; transform: scale(2.05) } }

/* ---------- 点击高亮块 ---------- */
.ucv-hl {
    opacity: 0;
    border-radius: 99px;
    background: rgba(20, 22, 28, .10);
    pointer-events: none;
}

.ucv-hl-card {
    z-index: 6;
    left: 10.52%;
    top: 69.33%;
    width: 76.17%;
    height: 8.06%;
    animation: ucvHlCard var(--dur) linear infinite;
}

.ucv-hl-update {
    z-index: 9;
    left: 67.35%;
    top: 25.74%;
    width: 24.51%;
    height: 2.82%;
    background: rgba(255, 255, 255, .28);
    animation: ucvHlUpd var(--dur) linear infinite;
}

.ucv-hl-fast {
    z-index: 9;
    left: 6.62%;
    top: 34.04%;
    width: 86.68%;
    height: 5.28%;
    border-radius: calc(var(--w)*.02);
    animation: ucvHlFast var(--dur) linear infinite;
}

@keyframes ucvHlCard { 0%, 20.06% { opacity: 0 } 20.29%, 21.5% { opacity: 1 } 22.6%, 100% { opacity: 0 } }
@keyframes ucvHlUpd  { 0%, 27.7%  { opacity: 0 } 27.94%, 29.2% { opacity: 1 } 30.3%, 100% { opacity: 0 } }
@keyframes ucvHlFast { 0%, 50.05% { opacity: 0 } 50.29%, 51.5% { opacity: 1 } 52.6%, 100% { opacity: 0 } }

/* ---------- 点击涟漪 ---------- */
.ucv-rip {
    width: 22%;
    aspect-ratio: 1;
    border-radius: 50%;
    margin-left: -11%;
    margin-top: -11%;
    transform: scale(.25);
    border: 2px solid rgba(22, 24, 29, .4);
    background: radial-gradient(circle, rgba(22, 24, 29, .12) 0%, rgba(22, 24, 29, 0) 70%);
    opacity: 0;
    pointer-events: none;
}

.ucv-rip-card   { z-index: 6; left: 35%;   top: 73.4%; animation: ucvRipA var(--dur) linear infinite }
.ucv-rip-update { z-index: 9; left: 79.6%; top: 27.2%; animation: ucvRipB var(--dur) linear infinite }
.ucv-rip-fast   { z-index: 9; left: 42.4%; top: 36.7%; animation: ucvRipC var(--dur) linear infinite }

.ucv-rip-power {
    z-index: 6;
    left: 50%;
    top: 40.6%;
    width: 30%;
    margin-left: -15%;
    margin-top: -15%;
    border-color: rgba(111, 196, 168, .85);
    background: radial-gradient(circle, rgba(111, 196, 168, .20) 0%, rgba(111, 196, 168, 0) 70%);
    animation: ucvRipD var(--dur) linear infinite;
}

@keyframes ucvRipA { 0%, 20.2%  { opacity: 0; transform: scale(.25) } 20.4%  { opacity: .6;  transform: scale(.4) }  23.82%, 100% { opacity: 0; transform: scale(2.6) } }
@keyframes ucvRipB { 0%, 27.85% { opacity: 0; transform: scale(.25) } 28.05% { opacity: .6;  transform: scale(.4) }  31.47%, 100% { opacity: 0; transform: scale(2.6) } }
@keyframes ucvRipC { 0%, 50.2%  { opacity: 0; transform: scale(.25) } 50.4%  { opacity: .6;  transform: scale(.4) }  53.82%, 100% { opacity: 0; transform: scale(2.6) } }
@keyframes ucvRipD { 0%, 58.73% { opacity: 0; transform: scale(.3) }  58.95% { opacity: .75; transform: scale(.45) } 62.35%, 100% { opacity: 0; transform: scale(2.4) } }

/* ---------- 弹层遮罩 ---------- */
.ucv-scrim {
    z-index: 7;
    inset: 0;
    background: #000;
    opacity: 0;
    animation: ucvScrim var(--dur) linear infinite;
}

@keyframes ucvScrim { 0%, 21.29% { opacity: 0 } 23.53%, 51.76% { opacity: .5 } 54.71%, 100% { opacity: 0 } }

/* ---------- 选择位置弹层 ---------- */
.ucv-sheet {
    z-index: 8;
    left: 4.07%;
    top: 10.92%;
    width: 91.86%;
    height: 78.17%;
    transform: translateY(118%);
    animation: ucvSheet var(--dur) both infinite;
    will-change: transform;
}

.ucv-sheet-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
}

.ucv-s4 { opacity: 0; animation: ucvS4 var(--dur) linear infinite }

@keyframes ucvSheet {
    0%, 21.29%     { transform: translateY(118%); animation-timing-function: cubic-bezier(.22, 1, .36, 1) }
    25.29%, 51.47% { transform: translateY(0);    animation-timing-function: cubic-bezier(.5, 0, .75, .3) }
    55.29%, 100%   { transform: translateY(118%) }
}

@keyframes ucvS4 { 0%, 36.18% { opacity: 0 } 37.94%, 100% { opacity: 1 } }

/* ---------- 更新线路时的加载遮罩 ---------- */
.ucv-veil {
    position: absolute;
    left: 0;
    right: 0;
    top: 29%;
    bottom: 0;
    background: rgba(255, 255, 255, .86);
    border-radius: 0 0 calc(var(--w)*.022) calc(var(--w)*.022);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 14%;
    opacity: 0;
    animation: ucvVeil var(--dur) linear infinite;
}

@keyframes ucvVeil { 0%, 27.94% { opacity: 0 } 29.12%, 35.29% { opacity: 1 } 36.76%, 100% { opacity: 0 } }

.ucv-spin {
    width: 14%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: calc(var(--w)*.011) solid rgba(22, 24, 29, .14);
    border-top-color: #33363d;
    animation: ucvSpin .78s linear infinite;
}

@keyframes ucvSpin { to { transform: rotate(360deg) } }

/* ---------- 线路更新成功提示条 ---------- */
.ucv-toast {
    z-index: 10;
    left: 3.05%;
    top: 83.8%;
    width: 93.89%;
    height: auto;
    display: block;
    max-width: none;
    transform: translateY(170%);
    opacity: 0;
    animation: ucvToast var(--dur) both infinite;
}

@keyframes ucvToast {
    0%, 37.06%     { transform: translateY(170%); opacity: 0; animation-timing-function: cubic-bezier(.18, 1.1, .4, 1) }
    38.82%, 46.5%  { transform: translateY(0);    opacity: 1; animation-timing-function: cubic-bezier(.5, 0, .75, .3) }
    48.8%, 100%    { transform: translateY(170%); opacity: 0 }
}

/* ---------- 手指指示 ---------- */
.ucv-cursor {
    z-index: 11;
    left: 35%;
    top: 92%;
    width: 0;
    height: 0;
    animation: ucvCur var(--dur) both infinite;
    will-change: left, top;
}

.ucv-cursor span {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(var(--w)*.115);
    aspect-ratio: 1;
    margin-left: calc(var(--w)*-.0575);
    margin-top: calc(var(--w)*-.0575);
    border-radius: 50%;
    background: rgba(28, 30, 36, .30);
    border: 2px solid rgba(255, 255, 255, .9);
    box-shadow: 0 calc(var(--w)*.008) calc(var(--w)*.025) rgba(0, 0, 0, .28);
    animation: ucvTap var(--dur) linear infinite;
}

@keyframes ucvCur {
    0%, 15.88%    { left: 35%;   top: 92%;   opacity: 0 }
    16.6%         { left: 35%;   top: 88%;   opacity: 1; animation-timing-function: cubic-bezier(.3, .8, .3, 1) }
    19.41%, 22.06%{ left: 35%;   top: 73.4%; opacity: 1; animation-timing-function: cubic-bezier(.5, 0, .2, 1) }
    26.76%, 41.18%{ left: 79.6%; top: 27.2%; opacity: 1; animation-timing-function: cubic-bezier(.5, 0, .2, 1) }
    46.18%, 51.76%{ left: 42.4%; top: 36.7%; opacity: 1; animation-timing-function: cubic-bezier(.5, 0, .2, 1) }
    55.59%, 59.41%{ left: 50%;   top: 40.6%; opacity: 1 }
    60.6%, 100%   { left: 50%;   top: 40.6%; opacity: 0 }
}

@keyframes ucvTap {
    0%, 19.76%     { transform: scale(1) }
    20.29%         { transform: scale(.68) }
    21.11%, 27.41% { transform: scale(1) }
    27.94%         { transform: scale(.68) }
    28.76%, 49.76% { transform: scale(1) }
    50.29%         { transform: scale(.68) }
    51.11%, 58.29% { transform: scale(1) }
    58.82%         { transform: scale(.68) }
    59.64%, 100%   { transform: scale(1) }
}

/* ---------- 循环衔接白场 ---------- */
.ucv-fade {
    z-index: 13;
    inset: 0;
    background: #fff;
    pointer-events: none;
    animation: ucvFade var(--dur) linear infinite;
}

@keyframes ucvFade { 0% { opacity: 1 } 2.4%, 97.6% { opacity: 0 } 100% { opacity: 1 } }


/* ---------- 不在视口时暂停，省电省 CPU ---------- */
.ucvpn-demo.ucv-paused * { animation-play-state: paused !important }

/* ---------- 响应式 ---------- */
@media only screen and (max-width: 1200px) {
    .ucvpn-demo { --w: 248px }
}

@media only screen and (max-width: 1023px) {
    /* 栅格在这里换行，右栏变成整行，可以放大一点 */
    .ucvpn-demo { --w: 268px }
    .ucv-hero-slot { padding: 8px 0 4px }
    .ucv-hero-slot::before { max-width: 460px }
    .ucv-hero-slot::after  { max-width: 360px }
}

@media only screen and (max-width: 480px) {
    .ucvpn-demo { --w: min(244px, 66vw) }
    .ucv-hero-slot::before { display: none }
}

/* ---------- 无障碍：用户关闭动效时，直接显示已连接状态 ---------- */
/* ----------------------------------------------------------------
   无障碍：系统开启「减弱动态效果」时（iOS 设置→辅助功能→动态效果，
   macOS 辅助功能→显示，Windows 设置→辅助功能→视觉效果）。

   注意：不要把动画全部关掉再定格一帧——那样看起来就是坏了。
   这里只去掉会引起前庭不适的成分（位移、缩放、旋转、跟随手指），
   保留纯淡入淡出，流程照样走完一遍。
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {

    /* 位移/缩放/旋转类的装饰，以及没有手指就失去意义的点击反馈，一并隐藏 */
    .ucvpn-demo .ucv-cursor,
    .ucvpn-demo .ucv-rip,
    .ucvpn-demo .ucv-pulse,
    .ucvpn-demo .ucv-hl,
    .ucvpn-demo .ucv-veil,
    .ucvpn-demo .ucv-bar { display: none }

    /* 弹层：不再从底部滑入，改为原地淡入淡出 */
    .ucvpn-demo .ucv-sheet {
        transform: none;
        animation-name: ucvSheetFade;
    }

    @keyframes ucvSheetFade {
        0%, 21.29%     { opacity: 0 }
        23.53%, 51.47% { opacity: 1 }
        54.71%, 100%   { opacity: 0 }
    }

    /* 提示条：同样去掉上滑，只留淡入淡出 */
    .ucvpn-demo .ucv-toast {
        transform: none;
        animation-name: ucvToastFade;
    }

    @keyframes ucvToastFade {
        0%, 37.06%    { opacity: 0 }
        38.82%, 46.5% { opacity: 1 }
        48.8%, 100%   { opacity: 0 }
    }

    /* 其余（启动页、匹配/验证/已连接三帧、遮罩、列表刷新、循环白场）
       本来就只有 opacity 变化，无需改动，继续正常播放。 */
}
