/* ============================================================
   maryruths — CTA 按区块分色（per-section CTA colors）
   ------------------------------------------------------------
   依据：源站 https://p0bvkm-e1.myshopify.com/ 1440×900 实测
        （2026-11-30，Chrome 131；原始数据见 measure-src-*.json）
   站点：https://maryrutthorganics.shop（主题 themes/p0bvkm）
   挂载：functions.php 中 wp_enqueue_scripts 优先级 100，
       依赖 cta-unify（几何：49px / 8px / 700 / 0 30px）先加载。

   ── 源站为什么是"多套颜色" ─────────────────────────────────
   源站每个商品用的是不同的 product 模板，模板里各自设定
   --color-button / --color-button-text（Shopify 主题方案变量）：
     liquid-morning-multivitamin-hair-growth      → 168,7,6   （红）
     daily-liquid-hair-formula-maryruth-organics  → 46,62,78  （深蓝）
     maryruths-hair-growth-max-liposomal-...      → 168,7,6   （红）
   首页 slideshow / image_with_text 区块：红底白字；第 3 张 slide
   用 .color-accent-1 反色方案 → 白底红字；页脚 newsletter → 白底深字。
   抽屉 / 购物车按钮跟随所在商品的颜色方案。

   ── 与 WooCommerce 的优先级冲突（关键） ───────────────────
   WooCommerce 的 woocommerce-general 里有 `button.button`
   （特异性 0,0,2,1）以及 `.woocommerce a.button` 等规则，把
   `button.newsletter__solid-btn`（0,0,1,0）、`a.button.wc-backward`
   （0,0,2,0）压成 #e9e6ed / #515151 / 3px。本文件用
   「更高特异性 + !important」压回去，例如
     html body footer .newsletter-form button.newsletter__solid-btn.button
   = 0,2,4,2（2 个 class + 4 个元素），远高于 0,0,2,1。
   这里刻意不用 :where()：:where() 会把特异性归零（0,0,0,0），
   在 WC 默认皮肤之后仍然会被 button.button 压住，只剩 !important
   一层保险，后续任何一次 WC 升级都可能翻盘；用显式高特异性 +
   !important 才是双保险。几何属性同理。

   ── 分色来源（每个区块一条） ───────────────────────────────
   ① 首页 hero 主 CTA / image_with_text CTA → 168,7,6 / 255,255,255
   ② 首页第 3 张 slide（.color-accent-1 反色）→ 255,255,255 / 168,7,6
   ③ 页脚 newsletter「Sign up」→ 255,255,255 / 18,18,18
   ④ 列表页卡片 CTA（.mr-btn）→ 168,7,6 / 255,255,255
   ⑤ PDP 主 CTA + 吸底 CTA：pdp1/pdp3 红、pdp2 深蓝（底部变量）
   ⑥ 抽屉 / 购物车按钮：跟随 ⑤
   ⑦ 购物车页 Return to shop（= 源站 Continue shopping）→ 红 / 白
   ⑧ PDP bundle（BUNDLE & SAVE）选中描边/角标：跟随 ⑤ 的强调色
   ============================================================ */

:root {
  --mr-red: 168, 7, 6;        /* 源站红  #a80706 */
  --mr-navy: 46, 62, 78;      /* 源站深蓝 #2e3e4e */
  --mr-ink: 18, 18, 18;       /* 源站正文黑 #121212 */
  --mr-cream: 253, 251, 247;  /* 源站米白 #fdfbf7 */
  --mr-white: 255, 255, 255;
}

/* ── 默认底色：整站红（首页 / 列表 / 购物车 / 大多数 PDP） ── */
body {
  --mr-cta-bg: var(--mr-red);
  --mr-cta-fg: var(--mr-white);
}

/* ── ⑤ PDP 分产品配色（源站 product 模板变量实测） ───────── */
body.postid-426 {                      /* liquid-morning-multivitamin… */
  --mr-cta-bg: var(--mr-red);
  --mr-cta-fg: var(--mr-white);
}
body.postid-440 {                      /* daily-liquid-hair-formula…  */
  --mr-cta-bg: var(--mr-navy);
  --mr-cta-fg: var(--mr-cream);
}
body.postid-433 {                      /* maryruths-hair-growth-max… */
  --mr-cta-bg: var(--mr-red);
  --mr-cta-fg: var(--mr-white);
}

/* ============================================================
   ① 首页 hero 主 CTA / 各 section CTA
   源站实测：149.2×49 / 16px / 700 / 8px / 0 30px / 红底白字
   ============================================================ */
html body .hero__buttons .button--primary,
html body .image-with-text .button--primary,
html body .image-with-text__content .button--primary {
  background-color: rgb(var(--mr-red)) !important;
  background-image: none !important;
  color: rgb(var(--mr-white)) !important;
  border: 0 !important;
  border-radius: 8px !important;
  height: 49px !important;
  min-height: 49px !important;
  max-height: 49px !important;
  padding: 0 30px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  box-shadow: none !important;
  transition: background-color .3s ease, color .3s ease !important;
}
html body .hero__buttons .button--primary:hover,
html body .image-with-text .button--primary:hover,
html body .image-with-text__content .button--primary:hover {
  background-color: rgb(var(--mr-white)) !important;
  color: rgb(var(--mr-red)) !important;
}

/* ============================================================
   ② 首页第 3 张 slide：.color-accent-1 反色方案
   源站实测：137.9×49 / 16px / 700 / 8px / 白底红字
   ============================================================ */
html body .hero-slide__content.color-accent-1 .hero__buttons .button--primary {
  background-color: rgb(var(--mr-white)) !important;
  color: rgb(var(--mr-red)) !important;
}
html body .hero-slide__content.color-accent-1 .hero__buttons .button--primary:hover {
  background-color: rgb(var(--mr-red)) !important;
  color: rgb(var(--mr-white)) !important;
}

/* ============================================================
   ③ 页脚 newsletter「Sign up」
   源站实测：406.2×49 / 16px / 700 / 8px / 白底 rgb(18,18,18)
   改前（shop / PDP / cart 页）：#e9e6ed 底 / #515151 字 / 3px
   —— 被 WooCommerce `button.button` 压制的典型位置
   ============================================================ */
html body footer .newsletter-form button.newsletter__solid-btn,
html body footer .newsletter-form button.newsletter__solid-btn.button,
html body footer .newsletter-form button#Subscribe {
  background-color: rgb(var(--mr-white)) !important;
  background-image: none !important;
  color: rgb(var(--mr-ink)) !important;
  border: 0 !important;
  border-radius: 8px !important;
  height: 49px !important;
  min-height: 49px !important;
  max-height: 49px !important;
  padding: 0 30px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  box-shadow: none !important;
}
html body footer .newsletter-form button.newsletter__solid-btn:hover,
html body footer .newsletter-form button.newsletter__solid-btn.button:hover,
html body footer .newsletter-form button#Subscribe:hover {
  background-color: rgb(var(--mr-red)) !important;
  color: rgb(var(--mr-white)) !important;
}

/* ============================================================
   ④ 列表页卡片 CTA（.mr-card__cta .mr-btn，<span>）
   源站实测：249×49 / 16px / 700 / 8px / 红底白字
   几何由 cta-unify 统一，这里只把颜色改成红（inline #241f3f 也被压掉）
   ============================================================ */
html body.post-type-archive-product .mr-card__cta .mr-btn,
html body.post-type-archive .mr-card__cta .mr-btn {
  --mr-cta-bg: var(--mr-red);
  --mr-cta-fg: var(--mr-white);
}

/* ============================================================
   ⑤ PDP 吸底条高度：源站 52.25px（主 CTA 是 49px，两者不同）
   cta-unify 把两者都锁成 49px，这里只把吸底条放回 52px
   ============================================================ */
html body .sticky-atc__button,
html body .sticky-atc .button.main-product-atc {
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
}

/* ============================================================
   ⑦ 购物车页「Return to shop」（= 源站 Continue shopping）
   源站实测：234.2×49 / 16px / 700 / 8px / 红底白字
   改前：#e9e6ed / #515151 / 3px（WooCommerce `a.button` 压制）
   ============================================================ */
html body a.button.wc-backward,
html body .wc-backward.button,
html body .cart-empty .button {
  background-color: rgb(var(--mr-red)) !important;
  background-image: none !important;
  color: rgb(var(--mr-white)) !important;
  border: 0 !important;
  border-radius: 8px !important;
  height: 49px !important;
  min-height: 49px !important;
  max-height: 49px !important;
  padding: 0 30px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
}
html body a.button.wc-backward:hover,
html body .wc-backward.button:hover,
html body .cart-empty .button:hover {
  background-color: rgb(var(--mr-white)) !important;
  color: rgb(var(--mr-red)) !important;
}

/* ============================================================
   ⑧ PDP bundle「BUNDLE & SAVE」选中描边 / 角标
   源站随商品强调色（pdp1/pdp3 红、pdp2 深蓝）；
   这里只改强调色变量，不动该区块的几何与布局
   ============================================================ */
body.postid-426 .quantity-breaks,
body.postid-433 .quantity-breaks {
  --color-base-accent-1: 168, 7, 6;
  --color-base-outline-button-labels: 168, 7, 6;
}
body.postid-440 .quantity-breaks {
  --color-base-accent-1: 46, 62, 78;
}

/* ============================================================
   PDP「More payment options」（源站唯一的 ghost 文字按钮）
   源站实测：535×18 / 12px / 无底无边 / pdp1 rgb(18,18,18)、pdp2 rgb(46,42,57)
   ============================================================ */
html body .shopify-payment-button__more-options {
  color: rgb(var(--mr-ink)) !important;
  background: transparent !important;
  border: 0 !important;
}
body.postid-440 .shopify-payment-button__more-options {
  color: rgb(46, 42, 57) !important;
}

/* ============================================================
   ⑨ 吸底条容器（源站实测：整条 1440×72，缩略图 39×52，按钮 52 高）
   改前本站：<img width="auto" height="auto"> 没有尺寸约束，
   被撑成 1420×1893 → .sticky-atc 变成 1913px 高的 fixed 层，
   top:-1013px 把整条推到视口外（DOM 里有按钮，人眼看不见）。
   这里只给容器 / 缩略图定尺寸，不动按钮、价格、加购逻辑。
   ============================================================ */
html body .sticky-atc {
  top: auto !important;
  bottom: 0 !important;
  height: auto !important;
}
html body .sticky-atc-container {
  height: 52px !important;
  min-height: 52px !important;
}
html body .sticky-atc__image {
  width: 39px !important;
  height: 52px !important;
  flex: 0 0 39px !important;
  min-width: 39px !important;
}
html body .sticky-atc__image img {
  width: 39px !important;
  height: 52px !important;
  object-fit: contain !important;
}
html body .sticky-atc__left {
  height: 52px !important;
}
