/* PC / H5 双外壳。
 *
 * 背景：以前 #app 固定 max-width:430px，而 groww.css 里所有桌面规则都挂在
 * @container groww-app (min-width:701px) 上。容器永远只有 430px 宽，
 * 那些断点一次都没命中过——所谓「桌面版」从来不显示。
 *
 * 现在改成两层：
 *   body.gw-pc  宽视口（≥900px）：装 1240px 宽的 PC 容器，growwHeader 生效
 *   body.gw-h5  窄视口：装 430px 手机容器，h5TopBar + h5TabBar 生效
 *
 * 断点用 @media 判视口——必须这样，因为此时容器宽度本身就是我们要切换的对象，
 * 用 @container 判断会陷入「容器宽度取决于容器宽度」的循环。
 * 容器内的组件级响应式仍用 @container groww-app（那时容器宽度已确定）。
 */

/* ---------- 外壳容器的默认形态：手机优先 ---------- */
#app {
  /* 手机壳：维持原有 430px 居中 */
  max-width: 430px;
  margin: auto;
  box-shadow: 0 0 30px #11111108;
}

/* H5 外壳相关元素：宽视口下隐藏 */
@media (min-width: 900px) {
  body.gw-pc .h5-head,
  body.gw-pc .h5-tabbar,
  body.gw-pc .gw-tabbar {
    display: none !important;
  }

  /* PC 壳：放开宽度，抬起底栏留出的空间 */
  body.gw-pc #app {
    max-width: 1240px;
    margin: 0 auto;
    padding-bottom: 0;
    box-shadow: none;
    border-radius: 0;
    background: #fff;
  }

  /* PC 下内容区不再被手机壳的 430 约束，按容器宽度自然流动 */
  body.gw-pc .app-content {
    max-width: none;
    padding-bottom: 32px;
  }

  /* 桌面端不需要底栏的预留内边距 */
  body.gw-pc .app-content.compact,
  body.gw-pc .app-content.wide {
    padding-bottom: 32px;
  }

  /* 页面主体的常见宽度约束放到 PC 容器里 */
  body.gw-pc .app-content > main,
  body.gw-pc .app-content > .site-page {
    max-width: 1184px;
    margin: 0 auto;
  }
}

/* 窄视口：PC 头部不参与布局。
 * 用 body 类判断而不是 @media——外壳由 body.gw-pc / body.gw-h5 决定，
 * 两处必须同源，否则窗口宽度和实际渲染的壳可能不一致。 */
body.gw-h5 .groww-header {
  display: none;
}

/* ── PC 壳下顶栏与内容区对齐 ──────────────────────────────
 * official-parity.css 把 .groww-header-inner 固定成 1084px（那是官方站实测值），
 * 而页面内容区是 1184px，两者左右各差 50px，看起来顶栏和内容没对齐。
 * PC 壳里统一到 1184px，让顶部导航和下面的内容共用同一条左边线。
 */
@media (min-width: 900px) {
  body.gw-pc .groww-header .groww-header-inner {
    max-width: 1184px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
  }
}
