
/* --buy-glass-rgb 若渲染成空值（用户没设过底色时可能出现 "--buy-glass-rgb: , , ;"），
   自定义属性会是「已定义但非法」—— 这种情况下 var() 的兜底参数不生效，
   整条 background-image 作废，按钮会变成完全没有底色。
   @property 声明类型后，非法值会退回 initial-value，而不是让声明作废。 */
@property --buy-glass-rgb {
  syntax: "<number>#";
  inherits: true;
  initial-value: 20, 20, 34;
}

@property --buy-glass-opacity {
  syntax: "<number>";
  inherits: true;
  initial-value: 0.82;
}
/* 加购按钮：黑色液态毛玻璃 + 虹边
 *
 * 只在后台开启「液态玻璃风」时加载（见 blocks/buy_buttons.html 的守卫）。
 * 全部规则挂在 .pp-glass-buy 下，关掉开关即完全回到原样。
 *
 * 锚点用 .product-form__submit：5 种按钮样式(normal/style_2..style_5)分属
 * 三个不同组件，但按钮元素都带这个类 —— 挂它就不用为每种样式各写一遍。
 */

.pp-glass-buy .product-form__submit {
  position: relative;
  isolation: isolate;
  border: none !important;
  border-radius: var(--buy-glass-radius, 14px) !important;
  /* 底色接一个独立的 color setting，不接 --color-page-background：
     叠加层接页面背景色，在同色系站点上会直接隐形（踩过）。 */
  background-color: transparent !important;
  background-image: linear-gradient(
    160deg,
    rgba(var(--buy-glass-rgb, 20, 20, 34), calc(var(--buy-glass-opacity, 0.82) - 0.06)),
    rgba(var(--buy-glass-rgb, 20, 20, 34), var(--buy-glass-opacity, 0.82))
  ) !important;
  -webkit-backdrop-filter: blur(var(--buy-glass-blur, 18px)) saturate(180%);
  backdrop-filter: blur(var(--buy-glass-blur, 18px)) saturate(180%);
  color: #fff !important;
  /* 立体感来自「外部辉光 + 内部顶光」，不是单纯的半透明 */
  box-shadow:
    0 8px 28px rgba(90, 70, 200, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.22);
  overflow: visible;
  transition: box-shadow 0.25s ease, transform 0.15s ease;
}

/* 虹边：渐变铺底 + mask 挖空中心，只留描边。
   不用 border-image —— 它和 border-radius 不兼容，圆角会被切成直角。 */
.pp-glass-buy .product-form__submit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(
    135deg,
    #a8d8ff 0%,
    #c9b6ff 25%,
    #ffc2e8 50%,
    #b6e3ff 75%,
    #d4c2ff 100%
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}

/* 外圈柔光：虹边往外洇一层，暗底上才有「发光」感 */
.pp-glass-buy .product-form__submit::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--buy-glass-radius, 14px) + 2px);
  background: linear-gradient(135deg, #a8d8ff, #c9b6ff 45%, #ffc2e8);
  filter: blur(9px);
  opacity: 0.4;
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.25s ease;
}

.pp-glass-buy .product-form__submit:hover {
  box-shadow:
    0 10px 34px rgba(90, 70, 200, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.pp-glass-buy .product-form__submit:hover::after {
  opacity: 0.65;
}

.pp-glass-buy .product-form__submit:active {
  transform: translateY(1px);
}

/* 售罄/禁用态：虹边和辉光都收掉，否则「不可点」读不出来 */
.pp-glass-buy .product-form__submit[disabled] {
  opacity: 0.5;
}

.pp-glass-buy .product-form__submit[disabled]::after {
  opacity: 0;
}

/* 降级：不支持 backdrop-filter 的浏览器给不透明底，否则暗底会糊成一片 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pp-glass-buy .product-form__submit {
    background-image: linear-gradient(
      160deg,
      rgb(var(--buy-glass-rgb, 20, 20, 34)),
      rgb(var(--buy-glass-rgb, 20, 20, 34))
    ) !important;
  }
}

/* ---- 按钮内三段式：锁头 | 文字（居中） | 价格（靠右） ---- */
.pp-glass-buy .product-form__submit {
  display: flex;
  align-items: center;
  gap: 10px;
  /* 按钮高度是 .full-width 写死的（桌面 56px / 手机 45px），
     所以图标能有多高，取决于这里的垂直内边距 ——
     15px 时内容区只剩 26px。收到 8px 让图标撑得起来。 */
  padding: 8px 18px;
}

.pp-glass-buy .product-form__submit .button-text-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

/* 锁头：fill="currentColor"，跟着按钮的 color:#fff 自动变白，不用改图标本身。
   （别换成 icons/sell-lock —— 它没设 stroke，直接用只会剩中间一个圆点。） */
.pp-glass-buy .pp-buy-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  /* 不压透明度：图标是 fill="currentColor" 的实心图形，
     压 0.9 就比同色的文字轻一档，「粗细一致」做不到 */
  opacity: 1;
}

/* 图标撑满按钮内容区（按钮高度 - 上下 padding），
   width:auto 让 SVG 按 viewBox 保持比例，不会被压扁。

   max-height 是必要的：桌面按钮 56px、手机 45px，纯按比例撑的话
   桌面会得到 40px、手机 29px —— 但图标要的是「两端看起来一样大」，
   不是「跟着按钮高度缩放」。30px 的上限让手机(29px)不受影响、桌面收到 30px。 */
.pp-glass-buy .pp-buy-icon {
  align-self: stretch;
}

.pp-glass-buy .pp-buy-icon svg {
  width: auto;
  height: 100%;
  max-height: 30px;
}

.pp-glass-buy .pp-buy-price {
  flex-shrink: 0;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -0.01em;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

@media screen and (max-width: 768px) {
  .pp-glass-buy .product-form__submit {
    padding: 13px 12px;
    gap: 7px;
  }
  .pp-glass-buy .pp-buy-price {
    font-size: 13px;
    padding-left: 7px;
  }

}

/* ---- 浮动条：顶部跟随 ----
 * 原实现写死了 bottom:0 + translateY(100%)（从下方滑入）。
 * 顶部跟随要把两者一起翻过来 —— 只改 top/bottom 不改 transform，
 * 收起时它会往下滑到屏幕中间，而不是缩回顶部。
 */
product-float-buy-buttons.pp-float-top {
  top: 0;
  bottom: auto;
  transform: translateY(-100%);
  padding: 10px 20px 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}

/* .show 的 translateY(0) 是原有规则，两个方向共用，这里不用重复 */

/* 原 JS 会在 body 末尾插一个和浮动条等高的占位块（避免底部浮动条盖住页脚）。
   顶部跟随时那块占位纯属浪费，页面底部会多出一段空白。 */
body:has(product-float-buy-buttons.pp-float-top) #product-float-buy-buttons-placeholder {
  height: 0 !important;
}

/* 浮动条：整条底板全部去掉，只留胶囊按钮浮在内容上（同玻璃胶囊导航）。
   原样式是 rgba(var(--color-page-background)) 实色底 + 40px 投影，
   在透明按钮下面会显出一条白板。 */
.pp-glass-buy-float {
  background-color: transparent !important;
  background-image: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  padding: 12px 16px 16px;
  /* 底板去掉背景后仍是一个全宽的透明层压在内容上，会吃掉底下的点击。
     自己不收事件，只把按钮放回可点。 */
  pointer-events: none;
}

.pp-glass-buy-float * {
  pointer-events: auto;
}

/* 胶囊浮在内容上，投影要比嵌入态更实一点，否则在杂乱背景上会糊掉 */
.pp-glass-buy-float .product-form__submit {
  box-shadow:
    0 10px 30px rgba(31, 38, 135, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.22);
}

.pp-glass-buy-float.pp-float-top {
  padding: 16px 16px 12px;
}

/* ---- 滚回选择区后的注意力提示 ----
 * 只加外发光，不动布局：用 outline 而不是 border/padding，
 * 否则元素会在动画里抖一下尺寸。 */
.pp-attention {
  animation: pp-attention-pulse 1.4s ease-out;
  border-radius: var(--pp-glass-radius, 24px);
}

@keyframes pp-attention-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(140, 120, 255, 0);
  }
  25% {
    box-shadow: 0 0 0 6px rgba(140, 120, 255, 0.28);
  }
  60% {
    box-shadow: 0 0 0 3px rgba(140, 120, 255, 0.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pp-attention {
    animation: none;
  }
}


/* ================= PC 端也跟随 =================
   原实现 .bottom-float-button 只在 @media (max-width:768px) 里 display:block，
   桌面完全不出现。这里只放开玻璃风那一份，不动原样式 ——
   其它品类站/其它按钮样式的行为保持不变。

   选择器写成 元素名+类 是必要的：product-float-buy-buttons.css 在本文件之后加载，
   它的 .bottom-float-button{display:none} 是 (0,1,0)，
   我这条也只有 (0,1,0) 的话会因为源码顺序输掉。 */
product-float-buy-buttons.pp-glass-buy-float {
  display: block;
}

@media screen and (min-width: 769px) {
  .pp-glass-buy-float {
    padding: 16px 24px 20px;
  }
  /* 桌面整条通栏的按钮太笨重，收到接近内容宽度 */
  .pp-glass-buy-float .product-buy-buttons-style2-container {
    max-width: 560px;
    margin-inline: auto;
  }
}
