/*
 * nested-carousel.css — 嵌套轮播（Nested Carousel）的自有实现。
 *
 * 替代 elementor-pro/assets/css/widget-nested-carousel.min.css（9,752 B，商业授权）。
 * **不是抄它的规则**，是照渲染结果重写：`tools/derive-css.mjs` 量出原件在本站元素上
 * 贡献的全部计算属性，自有实现逐条对齐（判据是那份完整差集相同）。
 *
 * ⚠️ 原件 36 条规则里只有 14 条可能命中，其余服务于本站没用到的档位
 *（垂直轮播、分数式分页的另外几种位置、编辑器预览态）。
 *
 * ⚠️ 轮播的**行为**由 Swiper（MIT，已在 `public/kepha/vendor/`）承担，
 * 这份文件只负责它的**变量与定位**。两件事分开：换掉商业 CSS 不需要动行为层。
 *
 * ⚠️ 试删实验对这个组件判 **⊘ 不可判**（"轮播的切换只在动起来时可见 —— 交互门不推轮播"）。
 * 那是关于"能不能删"的判词；这里做的是**替换**，判据是计算样式逐条相同 ——
 * 不需要能判"删了会怎样"，只需要能判"换了之后一模一样"。**两个问题，两套判据。**
 */

/* ── 基本变量与骨架 ───────────────────────────────────────────────── */
.elementor-widget-n-carousel {
  --e-n-carousel-slides-to-show: 3;
  --e-n-carousel-swiper-slides-gap: 10px;
  --e-n-carousel-swiper-slides-to-display: 3;
  --e-n-carousel-swiper-pagination-size: 0;
  --e-n-carousel-swiper-pagination-spacing: 10px;
  --e-n-carousel-swiper-offset-size: 0;
  height: -moz-fit-content;
  height: fit-content;
}
.elementor-widget-n-carousel .e-n-carousel {
  display: flex;
  min-width: 0;
}
/* 幻灯片不许被 flex 压缩 —— 压缩了就不是"每屏 N 张"而是"挤成一排"。 */
.elementor-widget-n-carousel .e-n-carousel > .swiper-wrapper > .swiper-slide {
  flex-shrink: 0;
  height: var(--e-n-carousel-slide-height, initial);
}
.elementor-widget-n-carousel .e-n-carousel > .swiper-wrapper > .swiper-slide > .e-con {
  height: var(--e-n-carousel-slide-container-height, initial);
  max-width: calc(100% - var(--margin-inline-start, var(--margin-left)) - var(--margin-inline-end, var(--margin-right)));
}
/* 整片可点时容器是 <a> —— 显示方式跟随它自己的 --display。 */
.elementor-widget-n-carousel .e-n-carousel > .swiper-wrapper .swiper-slide a.e-con {
  display: var(--display);
}

/* ── 左右箭头 ─────────────────────────────────────────────────────── */
/* 位置 = 对齐基准 + 偏移，再减去标题让出的空间；平移单独一层变量，
   这样"贴边/居中"与"微调"互不干扰。 */
.elementor-widget-n-carousel {
  --e-n-carousel-arrow-prev-top-align: 50%;
  --e-n-carousel-arrow-prev-top-position: 0px;
  --e-n-carousel-arrow-prev-caption-spacing: 15px;
  --e-n-carousel-arrow-next-top-align: 50%;
  --e-n-carousel-arrow-next-top-position: 0px;
  --e-n-carousel-arrow-next-caption-spacing: 15px;
  --e-n-carousel-arrow-prev-left-align: 0px;
  --e-n-carousel-arrow-prev-left-position: 0px;
  --e-n-carousel-arrow-next-right-align: 0px;
  --e-n-carousel-arrow-next-right-position: 0px;
  --e-n-carousel-arrow-next-translate-x: 0px;
  --e-n-carousel-arrow-next-translate-y: 0px;
  --e-n-carousel-arrow-prev-translate-x: 0px;
  --e-n-carousel-arrow-prev-translate-y: 0px;
}
/* `:is(.swiper,.swiper-container)` 覆盖 Swiper 新旧两代的容器类名 ——
   少一个，那一代的箭头就没有定位、堆到左上角去。 */
.elementor-widget-n-carousel.elementor-element :is(.swiper, .swiper-container) ~ .elementor-swiper-button-prev {
  left: calc(var(--e-n-carousel-arrow-prev-left-align) + var(--e-n-carousel-arrow-prev-left-position));
  top: calc(var(--e-n-carousel-arrow-prev-top-align) + var(--e-n-carousel-arrow-prev-top-position) - var(--e-n-carousel-arrow-prev-caption-spacing));
  transform: translate(var(--e-n-carousel-arrow-prev-translate-x), var(--e-n-carousel-arrow-prev-translate-y));
}
.elementor-widget-n-carousel.elementor-element :is(.swiper, .swiper-container) ~ .elementor-swiper-button-next {
  right: calc(var(--e-n-carousel-arrow-next-right-align) + var(--e-n-carousel-arrow-next-right-position));
  top: calc(var(--e-n-carousel-arrow-next-top-align) + var(--e-n-carousel-arrow-next-top-position) - var(--e-n-carousel-arrow-next-caption-spacing));
  transform: translate(var(--e-n-carousel-arrow-next-translate-x), var(--e-n-carousel-arrow-next-translate-y));
}

/* ── 分页 ─────────────────────────────────────────────────────────── */
/* 底部留白 = 分页点尺寸 + 间距。分页关掉时尺寸是 0 ⇒ 留白自动归零，
   **不需要另写一条"没有分页时"的规则**。 */
.elementor-widget-n-carousel {
  --e-n-carousel-swiper-padding-bottom: calc(var(--e-n-carousel-swiper-pagination-size) + var(--e-n-carousel-swiper-pagination-spacing));
}
.elementor-widget-n-carousel.elementor-pagination-type-bullets {
  --e-n-carousel-swiper-pagination-size: 6px;
}
.elementor-widget-n-carousel .swiper-pagination,
.elementor-widget-n-carousel .swiper-pagination-custom,
.elementor-widget-n-carousel .swiper-pagination-fraction,
.elementor-widget-n-carousel .swiper-horizontal > .swiper-pagination-bullets,
.elementor-widget-n-carousel .swiper-pagination-bullets.swiper-pagination-horizontal {
  font-size: var(--e-n-carousel-swiper-pagination-size);
  line-height: var(--e-n-carousel-swiper-pagination-size);
}
/* 分页在外侧时，留白加在轮播容器上（两种外壳形状都要覆盖）。 */
.elementor-widget-n-carousel.elementor-pagination-position-outside:not(:has(> .elementor-widget-container)) > .swiper,
.elementor-widget-n-carousel.elementor-pagination-position-outside:not(:has(> .elementor-widget-container)) > .swiper-container,
.elementor-widget-n-carousel.elementor-pagination-position-outside > .elementor-widget-container > .swiper,
.elementor-widget-n-carousel.elementor-pagination-position-outside > .elementor-widget-container > .swiper-container {
  padding-bottom: var(--e-n-carousel-swiper-padding-bottom);
}
/*
 * 🔴 **配套复位：轮播里嵌的「容器背景幻灯片」不吃这份底部留白。**
 * 它也是 `.swiper`，所以上面那条会连它一起罩住 —— 而那份留白是**给分页点让的位**，
 * 背景幻灯片没有分页点，多出来的 30px 直接压掉幻灯片高度（实测 287.391 → 257.391px）。
 *
 * ⚠️ **我第一版漏了这一条，而它在原件里就紧挨着上面那条。**
 * 同一形状栽第二次了（上一次是抄了一条规则的两个声明里的一个）：
 * **重写时最危险的不是难懂的规则，是紧挨着的那条"看起来是补丁"的规则** ——
 * 它没有自己的语义标题，读起来像上一条的边角料。
 * ⚠️ 而它躲过静态检查的原因是：`.elementor-background-slideshow` 在标记里
 * **出现 0 次**（容器背景幻灯片整个由 JS 在运行时建），
 * ⇒ 任何"这个类在不在标记里"的判据都会把这条规则判死。
 */
.elementor-widget-n-carousel.elementor-pagination-position-outside:not(:has(> .elementor-widget-container)) > .swiper .elementor-background-slideshow,
.elementor-widget-n-carousel.elementor-pagination-position-outside:not(:has(> .elementor-widget-container)) > .swiper-container .elementor-background-slideshow,
.elementor-widget-n-carousel.elementor-pagination-position-outside > .elementor-widget-container > .swiper .elementor-background-slideshow,
.elementor-widget-n-carousel.elementor-pagination-position-outside > .elementor-widget-container > .swiper-container .elementor-background-slideshow {
  padding-bottom: 0;
}
.elementor-widget-n-carousel {
  --e-n-carousel-dots-vertical-position: 100%;
  --e-n-carousel-dots-vertical-offset: 0px;
  --e-n-carousel-dots-horizontal-position: 50%;
  --e-n-carousel-dots-horizontal-offset: 0px;
  --e-n-carousel-dots-horizontal-transform: -50%;
  --e-n-carousel-dots-vertical-transform: -100%;
  --e-n-carousel-fraction-vertical-position: 100%;
  --e-n-carousel-fraction-vertical-offset: 0px;
  --e-n-carousel-fraction-horizontal-position: 50%;
  --e-n-carousel-fraction-horizontal-offset: 0px;
  --e-n-carousel-fraction-horizontal-transform: -50%;
  --e-n-carousel-fraction-vertical-transform: -100%;
}

/*
 * ── 分页圆点 ──────────────────────────────────────────────────────
 * ⚠️ **这一族我第一版整个漏了，而漏的理由是一句猜测。**
 * 我把原件里没抄的 27 条选择器判成"多半是本站用不到的档位"就放过了 ——
 * 计算样式对账当场证伪：圆点高度 6px 被我做成 7px、分页条位置差 12px。
 * **判词永远是量出来的贡献集，不是"看起来像不像用得上"。**
 * 本站用 bullets + position-outside（fraction / progressbar 在标记里 0 次，故不抄）。
 */
.elementor-widget-n-carousel .swiper-pagination-bullet {
  width: var(--e-n-carousel-swiper-pagination-size);
  height: var(--e-n-carousel-swiper-pagination-size);
  background: var(--e-n-carousel-dots-normal-color, #000);
}
.elementor-widget-n-carousel .swiper-pagination-bullet:hover {
  background: var(--e-n-carousel-dots-hover-color, #000);
  opacity: 1;
}
/* 分页条自身的定位：位置 = 基准 + 偏移，再平移。`max-content` 让它只占圆点那么宽，
   否则它会铺满整行、把点击区扩到与内容重叠。 */
.elementor-widget-n-carousel .swiper-pagination-bullets {
  z-index: 3;
  top: calc(var(--e-n-carousel-dots-vertical-position) + var(--e-n-carousel-dots-vertical-offset));
  inset-inline-start: calc(var(--e-n-carousel-dots-horizontal-position) + var(--e-n-carousel-dots-horizontal-offset));
  width: -moz-max-content;
  width: max-content;
  height: -moz-max-content;
  height: max-content;
  transform: translate(
    calc(var(--e-n-carousel-dots-horizontal-transform) * var(--direction-multiplier, 1)),
    var(--e-n-carousel-dots-vertical-transform));
}
/* 分页在外侧时圆点按顶对齐 —— 默认基线对齐会让它们比行框矮一点点、整条歪下去。 */
.elementor-widget-n-carousel.elementor-pagination-position-outside:not(:has(> .elementor-widget-container)) .swiper-pagination-bullet,
.elementor-widget-n-carousel.elementor-pagination-position-outside > .elementor-widget-container .swiper-pagination-bullet {
  vertical-align: top;
}

/*
 * ── Swiper 初始化之前的那一帧 ─────────────────────────────────────
 * 🔴 **没有组件前缀是有意的**（原件也没有）：这两条要在 Swiper 接手**之前**就生效，
 * 而那时元素上还没有任何 Swiper 加的类。作用是让"还没变成轮播的那一排"
 * 已经按最终的每屏张数与间距排好 —— 否则首帧会闪一下"竖着堆在一起的全部幻灯片"。
 * ⚠️ 我第一版把它们当成"编辑器预览态"漏掉了；对账量出 `column-gap` 与 `overflow-*`
 * 有贡献 ⇒ **量测时页面上确实存在未初始化的 swiper**。
 */
.swiper:not(.swiper-initialized) > .swiper-wrapper,
.swiper-container:not(.swiper-container-initialized) > .swiper-wrapper {
  gap: var(--e-n-carousel-swiper-slides-gap);
  overflow: hidden;
}
.swiper:not(.swiper-initialized) > .swiper-wrapper > .swiper--slide,
.swiper-container:not(.swiper-container-initialized) > .swiper-wrapper > .swiper--slide {
  --e-n-carousel-number-of-gaps: max(calc(var(--e-n-carousel-swiper-slides-to-display) - 1), 0);
  --e-n-carousel-gaps-width-total: calc(var(--e-n-carousel-number-of-gaps) * var(--e-n-carousel-swiper-slides-gap));
  max-width: calc((100% - var(--e-n-carousel-gaps-width-total)) / var(--e-n-carousel-swiper-slides-to-display, 1));
}

/* Elementor core 3.16+ 的容器内边距在幻灯片里要交回给幻灯片自己控制。
   属性选择器挂在 <html> 上，由 core 写入 —— 沿用原件的判据，别改成类名。 */
[data-core-v316-plus="true"] .elementor-widget-n-carousel .e-n-carousel .swiper-slide > .e-con {
  --padding-top: initial;
  --padding-right: initial;
  --padding-bottom: initial;
  --padding-left: initial;
}
