/* =========================================================
   zb-show-02 固定画幅3D百叶窗
   - 画面始终限制在1300 × 700区域内
   - 不改变原有DIV结构
   - 百叶片由JS临时生成，结束后自动删除
   ========================================================= */

.zb-show-02-container {
    --zb-blind-width: 1300px;
    --zb-blind-height: 700px;
    --zb-blind-button-size: 66px;
    width: var(--zb-blind-width);
    max-width: 100%;
    aspect-ratio: 13 / 7;
    height: auto;
    margin: 0 auto;
    position: relative;
    display: block;
    /* 最外层允许按钮伸到图片外；图片与百叶窗层各自继续裁切 */
    overflow: visible;
    isolation: isolate;
    box-sizing: border-box;
}

.zb-show-02-container *,
.zb-show-02-container *::before,
.zb-show-02-container *::after {
    box-sizing: border-box;
}

.zb-show-02-container[data-zb-blind-gallery="1"] {
    cursor: pointer;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.zb-show-02-container[data-zb-blind-gallery="1"].is-zb-blind-switching {
    cursor: progress;
}

/* 原始图片全部叠放在同一个1300×700画面里，不再纵向占位 */
.zb-show-02-container[data-zb-blind-gallery="1"] > .zb-show-02-item {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    inset: 0 !important;
    z-index: 1;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1) !important;
    transform-origin: 50% 50%;
    transition: transform .34s cubic-bezier(.22, .72, .25, 1) !important;
}

/* 切换开始时画面平滑缩小10%，翻页完成移除此状态后自动恢复原尺寸 */
.zb-show-02-container[data-zb-blind-gallery="1"].is-zb-blind-switching > .zb-show-02-item {
    transform: scale(.9) !important;
}

.zb-show-02-container[data-zb-blind-gallery="1"] > .zb-show-02-item.is-zb-blind-active {
    z-index: 3;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.zb-show-02-container[data-zb-blind-gallery="1"] > .zb-show-02-item.is-zb-blind-under {
    z-index: 2;
    opacity: 1;
    visibility: visible;
}

.zb-show-02-container[data-zb-blind-gallery="1"] > .zb-show-02-item > img {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    inset: 0;
    display: block !important;
    object-fit: cover;
    transform: none !important;
    transition: none !important;
    filter: none !important;
    box-shadow: none !important;
    -webkit-user-drag: none;
}

/* ------------------------ 百叶窗动画层 ------------------------ */
.zb-blind-overlay {
    position: absolute;
    inset: 0;
    z-index: 30;
    overflow: hidden;
    pointer-events: none;
    perspective: 1500px;
    perspective-origin: 50% 50%;
    transform-style: preserve-3d;
    transform-origin: 50% 50%;
    animation: zb-blind-stage-shrink .34s cubic-bezier(.22, .72, .25, 1) both;
    /*
     * #9 — 不用 contain:strict：strict 会创建新的包含块并裁切 overflow，
     * 导致叶片翻转时 3D 溢出被剪掉（视觉穿帮）。
     * 改为 layout+style，只隔离布局和样式计算，不裁切内容。
     */
    contain: layout style;
}

@keyframes zb-blind-stage-shrink {
    from { transform: scale(1); }
    to { transform: scale(.9); }
}

.zb-blind-slat {
    position: absolute;
    top: 0;
    bottom: 0;
    min-width: 2px;
    transform: rotateY(0deg);
    transform-origin: 50% 50%;
    transform-style: preserve-3d;
    will-change: transform;
}

/*
 * 横条叶片（上下翻转模式）。
 * 必须把 top/bottom 都写进来覆盖 .zb-blind-slat 的 top:0/bottom:0，
 * 否则 top/bottom 由哪条规则生效取决于 CSS 加载顺序，不稳定。
 */
.zb-blind-slat-h {
    top: auto;         /* JS 写入具体百分比 */
    bottom: auto;
    left: 0;
    right: 0;
    min-width: unset;
    min-height: 2px;
    transform: rotateX(0deg);
    transform-origin: 50% 50%;
}

/*
 * 横条叶片专用的正面/背面：沿 X 轴翻转，
 * 所以背面要用 rotateX(180deg) 才能在翻转时正确朝外。
 * 竖条叶片继续使用 .zb-blind-face-front / .zb-blind-face-back（rotateY）。
 */
.zb-blind-face-front-x {
    transform: rotateX(0deg) translateZ(.2px);
}

.zb-blind-face-back-x {
    transform: rotateX(180deg) translateZ(.2px);
}

/* 随机模式：叶片按各自随机延迟翻转，JS 写 animation-delay */
.zb-blind-slat.is-random,
.zb-blind-slat-h.is-random {
    /* 延迟由 JS 内联写入，class 只做标记 */
}

.zb-blind-face {
    position: absolute;
    /* 左右各溢 1px 盖住叶片接缝（竖条用） */
    top: 0;
    bottom: 0;
    left: -1px;
    right: -1px;
    overflow: hidden;
    background-repeat: no-repeat;
    background-color: #07132e;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* 横条专用 face：上下各溢 1px，左右不溢 */
.zb-blind-face-front-x,
.zb-blind-face-back-x {
    top: -1px;
    bottom: -1px;
    left: 0;
    right: 0;
}

.zb-blind-face-front {
    transform: rotateY(0deg) translateZ(.2px);
}

.zb-blind-face-back {
    transform: rotateY(180deg) translateZ(.2px);
}

/* 竖条叶片边缘微光（右侧） */
.zb-blind-slat::after {
    content: "";
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 0;
    z-index: 5;
    width: 2px;
    pointer-events: none;
    opacity: .72;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(92, 221, 255, .72) 18%,
        rgba(117, 150, 255, .38) 55%,
        transparent
    );
    box-shadow: 0 0 7px rgba(61, 199, 255, .36);
}

/* 横条叶片边缘微光（底边） */
.zb-blind-slat-h::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    z-index: 5;
    height: 2px;
    width: auto;
    pointer-events: none;
    opacity: .72;
    background: linear-gradient(
        to right,
        transparent,
        rgba(92, 221, 255, .72) 18%,
        rgba(117, 150, 255, .38) 55%,
        transparent
    );
    box-shadow: 0 0 7px rgba(61, 199, 255, .36);
}

/* -------------------------- 切换按钮 -------------------------- */
.zb-blind-button {
    width: var(--zb-blind-button-size);
    height: var(--zb-blind-button-size);
    position: absolute;
    top: 50%;
    z-index: 50;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(114, 222, 255, .72);
    border-radius: 50%;
    outline: 0;
    color: #e7fbff;
    background:
        radial-gradient(circle, rgba(38, 151, 255, .88), rgba(5, 36, 92, .92) 64%, rgba(0, 9, 34, .96));
    box-shadow:
        inset 0 0 14px rgba(105, 224, 255, .42),
        0 0 12px rgba(42, 173, 255, .34);
    cursor: pointer;
    opacity: .72;
    /* 统一用 translate3d，避免与切换态 translate3d 之间的类型跳跃 */
    transform: translate3d(0, -50%, 0) scale(.92);
    transition: opacity .24s ease, filter .24s ease, transform .24s ease, box-shadow .24s ease;
}

.zb-blind-button-prev {
    left: calc(0px - var(--zb-blind-button-size) - 20px);
}

.zb-blind-button-next {
    right: calc(0px - var(--zb-blind-button-size) - 20px);
}

.zb-blind-button::before {
    content: "";
    width: 15px;
    height: 15px;
    border-top: 3px solid currentColor;
    border-right: 3px solid currentColor;
    filter: drop-shadow(0 0 4px rgba(116, 235, 255, .92));
}

.zb-blind-button-prev::before {
    margin-left: 6px;
    transform: rotate(-135deg);
}

.zb-blind-button-next::before {
    margin-right: 6px;
    transform: rotate(45deg);
}

.zb-blind-button:hover:not(:disabled),
.zb-blind-button:focus-visible:not(:disabled) {
    opacity: 1;
    filter: brightness(1.32) saturate(1.25);
    transform: translate3d(0, -50%, 0) scale(1.06);
    box-shadow:
        inset 0 0 18px rgba(133, 236, 255, .66),
        0 0 12px rgba(77, 207, 255, .78),
        0 0 28px rgba(63, 121, 255, .52);
}

.zb-blind-button:active:not(:disabled) {
    transform: translate3d(0, -50%, 0) scale(.96);
}

.zb-blind-button:disabled {
    opacity: 0;
    pointer-events: none;
}

/*
 * #10 — 切换时按钮收边。
 * 正常态与切换态都用 translate3d，避免浏览器在
 * translateY(-50%) ↔ translate3d 之间插值时产生跳跃。
 * 正常态基准已在 .zb-blind-button 里改为 translate3d(0,-50%,0)。
 */
.is-zb-blind-switching .zb-blind-button-prev {
    transform: translate3d(-10px, -50%, 0) scale(.92);
}

.is-zb-blind-switching .zb-blind-button-next {
    transform: translate3d(10px, -50%, 0) scale(.92);
}

/* --------------------------- 加载提示 --------------------------- */
.zb-blind-loading {
    position: absolute;
    left: 50%;
    bottom: 24px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(110, 222, 255, .34);
    border-radius: 18px;
    color: #d9f8ff;
    background: rgba(3, 23, 63, .76);
    font: 12px/1 Arial, sans-serif;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(8px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
    pointer-events: none;
}

.zb-blind-loading::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid rgba(126, 224, 255, .30);
    border-top-color: #7ce9ff;
    border-radius: 50%;
    animation: zb-blind-loading-spin .72s linear infinite;
}

.zb-blind-loading.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

@keyframes zb-blind-loading-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
    .zb-show-02-container {
        --zb-blind-button-size: 48px;
    }

    .zb-blind-button::before {
        width: 11px;
        height: 11px;
        border-width: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zb-blind-slat,
    .zb-blind-button,
    .zb-blind-loading,
    .zb-blind-overlay,
    .zb-show-02-container[data-zb-blind-gallery="1"] > .zb-show-02-item {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
