/* ==========================================================================
   门面页「返回商家目录」按钮样式（2026-12-02）
   ──────────────────────────────────────────────────────────────────────────
   ★ 设计取舍：

     ① 为什么是悬浮而不是塞进 topbar
        topbar 由各页面 render 自己生成，塞进去要改四处、容易漏。
        悬浮按钮只注入一次，靠 body class 让开位置。

     ② 为什么按钮做成「半透明胶囊 + 模糊」
        门面头图是品牌色插画，深浅不定。纯色按钮要么在深色上消失、
        要么在浅色上突兀。毛玻璃 + 半透明白字 + 阴影，两种底色都能读。

     ③ 为什么给 topbar 让位而不是盖住它
        topbar 左边是「在售 N 个产品」，被盖住就是信息丢失。
        `.from-directory .topbar{padding-left:...}` 让开，简单可靠。

     ④ 安全区
        iPhone 刘海屏 `env(safe-area-inset-top)`，不给的话按钮会压到刘海下面。
   ========================================================================== */

#backToDir {
  /* ★ box-sizing 必须显式写：store 页面没有全局 border-box 复位，
     不给的话 height:34 + padding + border 实际渲染成 44px（真实踩到，按钮比设计大一圈）。 */
  box-sizing: border-box;

  position: fixed;
  z-index: 90;

  /* 安全区 + 12px 呼吸 */
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: calc(env(safe-area-inset-left, 0px) + 12px);

  display: inline-flex;
  align-items: center;
  gap: 4px;

  /* ★ 高度就让它 44px —— tokens.css 里有
       `button { min-height: var(--tap-min) }` = 44px（iOS HIG 最小可点区域）。
     我第一版写 height:32px 想改小，被它顶掉（渲染还是 44），
     那不是 bug，是**规范**：手指点得准比省 12px 重要。
     所以显式写 44，并把视觉做轻（细边、浅底、小字），不跟规范对抗。 */
  min-height: 44px;
  padding: 0 14px 0 10px;
  border: 1px solid rgba(20, 16, 28, 0.10);
  border-radius: 999px;

  /* ★ 浅色胶囊，不是深色：
     按钮位于 topbar 之上，topbar 是白底（--surface）。深色胶囊压在白条上
     像一块贴错位置的色块（第一版就是这样）。浅色 + 细边 + 柔阴影，
     在白顶栏上「融进去」，滚到彩色头图上也能读。 */
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);

  color: #2B2438;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  font-family: inherit;
  line-height: 1;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 6px rgba(20, 16, 28, 0.10);
  transition: background 0.16s, transform 0.12s, opacity 0.16s;
}

#backToDir svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-left: -2px;
}

#backToDir:active {
  transform: scale(0.94);
  background: rgba(240, 236, 246, 0.95);
}

/* 顶部有 topbar 时给它让位（topbar 的 padding 由各页面定，这里只推左内边距） */
.from-directory .topbar {
  padding-left: max(calc(env(safe-area-inset-left, 0px) + 84px), 84px) !important;
}

/* 少量页面顶部是自定义结构（如订单详情），也统一让位 */
.from-directory .page-wrap > .topbar:first-child,
.from-directory .page-wrap > .hd:first-child {
  padding-left: max(calc(env(safe-area-inset-left, 0px) + 84px), 84px) !important;
}

/* 滚动后稍微变淡，不挡内容 */
/* 滚下去之后（头图区域）把胶囊换成半透明深色更好读 —— 但简单起见只降不透明度 */
.from-directory.is-scrolled #backToDir {
  background: rgba(255, 255, 255, 0.72);
}
