/* video */
.xtpb-element,
.xtpb-addon-node {
    position: relative;
}

.xtpb-element img,
.xtpb-addon-node img {
    max-width: 100%;
}

/* 只给有视频或列遮罩的容器建立堆叠层，让背景留在底色之上、内容之下。 */
:where(.xtpb-section, .xtpb-inner-section, .xtpb-column):has(> :is(.xtpb-video-bg-wrap, .xtpb-youtube-video-bg)),
:where(.xtpb-column.xtpb-column-has-overlay) {
    position: relative;
    isolation: isolate;
}
:where(.xtpb-column.xtpb-column-has-overlay)::after {
    z-index: -1;
}
.xtpb-video-bg-wrap {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.xtpb-video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    -webkit-transform: translateX(-50%) translateY(-50%);
    transform: translateX(-50%) translateY(-50%);
    background-size: cover;
    -webkit-transition: 1s opacity;
    transition: 1s opacity;
}

.xtpb-video-bg-wrap iframe {
    position: absolute;
    top: 0;
    left: 0%;
    width: 200%;
    height: 240px;
}

@media (min-width: 320px) {
    .xtpb-video-bg-wrap iframe {
        top: -150px;
        height: 550px;
    }
}

@media (min-width: 480px) {
    .xtpb-video-bg-wrap iframe {
        top: -200px;
        height: 700px;
    }
}

@media (min-width: 768px) {
    .xtpb-video-bg-wrap iframe {
        top: -200px;
        height: 850px;
    }
}

@media (min-width: 992px) {
    .xtpb-video-bg-wrap iframe {
        top: -250px;
        height: 900px;
    }
}

@media (min-width: 1200px) {
    .xtpb-video-bg-wrap iframe {
        top: -400px;
        height: 1300px;
    }
}

@media (min-width: 2000px) {
    .xtpb-video-bg-wrap iframe {
        top: -500px;
        height: 1500px;
    }
}

@media (min-width: 3000px) {
    .xtpb-video-bg-wrap iframe {
        top: -600px;
        height: 1700px;
    }
}

.xtpb-builder-container > .xtpb-section .xtpb-section__inner,
.xtpb-builder-container > .xtpb-inner-section .xtpb-inner-section__inner,
.xtpb-builder-container > .xtpb-inner-section.xtpb-inner-section__grid {
    position: relative;
    transition: 300ms;
    -webkit-transition: 300ms;
    -o-transition: 300ms;
}
.xtpb-builder-container .xtpb-section,
.xtpb-builder-container.xtpb-section,
.xtpb-builder-container .xtpb-inner-section {
    position: relative;
    overflow: initial;
}
.xtpb-section > .xtpb-section__inner,
.xtpb-inner-section > .xtpb-inner-section__grid,
.xtpb-inner-section.xtpb-inner-section__grid,
.xtpb-builder-container .xtpb-column,
.xtpb-element,
.xtpb-addon-node {
    transition: box-shadow 300ms, border-radius 300ms, background 300ms,
        border-color 300ms;
    -webkit-transition: box-shadow 300ms, border-radius 300ms, background 300ms,
        border-color 300ms;
    -moz-transition: box-shadow 300ms, border-radius 300ms, background 300ms,
        border-color 300ms;
    -o-transition: box-shadow 300ms, border-radius 300ms, background 300ms,
        border-color 300ms;
}
.xtpb-section > .xtpb-section__inner {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    position: relative;
}
.xtpb-inner-section > .xtpb-inner-section__grid,
.xtpb-inner-section.xtpb-inner-section__grid {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    position: relative;
}
.xtpb-section > .xtpb-section__inner.xtpb-container-no-gutter,
.xtpb-inner-section > .xtpb-inner-section__grid,
.xtpb-inner-section.xtpb-inner-section__grid {
    padding-left: 0;
    padding-right: 0;
}

/* image addons */
.xtpb-image-addon-content.xtpb-imginlineblock {
    display: inline-block;
    vertical-align: top;
}

.xtpb-section__inner > .xtpb-section__grid,
.xtpb-section__inner.xtpb-section__grid,
.xtpb-inner-section__inner > .xtpb-inner-section__grid,
.xtpb-inner-section > .xtpb-inner-section__grid,
.xtpb-inner-section.xtpb-inner-section__grid {
    display: grid;
    gap: var(--xtpb-gap, 30px);
    position: relative;
}
.xtpb-section__grid > .xtpb-column,
.xtpb-inner-section__grid > .xtpb-column {
    min-height: 1px;
    display: flex;
    flex-direction: column;
    height: auto;
    min-width: 0;
    width: auto !important;
}

/* 滚动跟随只在平板和桌面端启用，手机单列布局保持自然文档流。 */
@media (min-width: 768px) {
    .xtpb-section__grid > .xtpb-column.xtpb-column-sticky,
    .xtpb-inner-section__grid > .xtpb-column.xtpb-column-sticky {
        position: sticky;
        top: var(--xtpb-column-sticky-top, 20px);
        align-self: start;
    }
}
.xtpb-row-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}
.xtpb-youtube-video-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}
.xtpb-element,
.xtpb-addon-node.xtpb-addon {
    transition: 400ms;
    -webkit-transition: 400ms;
    position: relative;
}
/* 列内组件可以随可用宽度收缩，但默认不建立堆叠层，允许菜单等浮层跨过相邻组件。 */
.xtpb-builder-container .xtpb-column > .xtpb-element,
.xtpb-builder-container .xtpb-column > .xtpb-addon-node,
.xtpb-builder-container .xtpb-column > .xtpb-inner-section {
    min-width: 0;
    position: relative;
}

/* 头部整体高于正文；吸顶及透明头部仍由对应状态控制定位。 */
:where(.xtpb-builder-container.xtpb-site-header) {
    position: relative;
    z-index: 10;
}
/* 把轮播按钮、形状等层级留在正文或页脚文档内，不压住头部下拉。头部内的超级菜单不匹配。 */
:where(.xtpb-site-header ~ .xtpb-builder-container, .xtpb-site-header ~ * .xtpb-content-editor) {
    isolation: isolate;
}

.xtpb-infinit-spinner {
    border: 10px solid #f3f3f3; /* Light grey */
    border-top: 10px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.xtpb-form-field-has-error {
    border: 1px solid #d8000c !important;
}

/* 行宽度模式同时覆盖“容器自身”和“容器包裹 section”两种挂载方式，保证编辑器画布与前端一致。 */
.xtpb-builder-container .xtpb-section > .xtpb-section__inner.xtpb-container-full,
.xtpb-builder-container.xtpb-section > .xtpb-section__inner.xtpb-container-full {
    max-width: none !important;
}
.xtpb-builder-container .xtpb-section > .xtpb-section__inner.xtpb-container-no-gutter,
.xtpb-builder-container.xtpb-section > .xtpb-section__inner.xtpb-container-no-gutter {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* 自定义宽度在安全留白以内对齐。把全局边距移到外层，既不缩窄背景，也不与内层行内边距叠加默认值。 */
.xtpb-section.xtpb-section--custom-width {
    box-sizing: border-box;
    padding-inline: var(--xtpb-content-side-gap, 0px);
}
.xtpb-builder-container .xtpb-section.xtpb-section--custom-width > .xtpb-section__inner,
.xtpb-builder-container.xtpb-section.xtpb-section--custom-width > .xtpb-section__inner {
    padding-inline: 0;
}
/* 正文已由详情模板限宽和留白，内部行默认不再重复加入全局页面左右内边距；实例样式仍可覆盖。 */
.xtpb-builder-container.xtpb-content-editor > .xtpb-section > .xtpb-section__inner{max-width:100%;padding-left:0;padding-right:0}
.xtpb-content-editor > .xtpb-section.xtpb-section--custom-width {
    padding-inline: 0;
}
