/* ============================================================
   page-template.css — 全屏滚动卡片页 · 通用骨架样式
   ------------------------------------------------------------
   适用：任何「<main> 直接子元素全是 <section>，每屏一张圆角卡片，
        滑过首屏后子导航接管主导航、滚动驱动入场动画」的页面。

   使用：在页面 <style> 之前引入本文件：
        <link rel="stylesheet" href="/assets/css/page-template.css?v=1117a">
   页面级 <style> 只需覆写 --cp-* 参数 + 写该页特有内容样式。

   可覆写参数（页面级 :root 里改即可，无需动本文件）：
        --cp-gutter   容器左右留白        默认 24 / ≤980:48 / ≤720:32
        --cp-edge     卡片离屏幕左右距离   默认 22 / ≤720:12
        --cp-gap      相邻卡片间距         默认 18 / ≤720:12
        --cp-radius   卡片圆角             默认 30 / ≤720:20
        --cp-subnav-h 子导航高度           默认 64 / ≤720:48
        --cp-screen-h 每屏最小高度         由 page-template.js 运行时写入，勿手改

   全站变量（--bg/--ink/--plush/--r-*/--maxw 等）来自 styles.css / theme.css，
   本文件只引用不重定义。不要在本文件用 !important。
   ============================================================ */

/* ---- 锚点避让吸顶导航 ---- */
[id] { scroll-margin-top: 78px; }

/* ---- 容器左右留白：补回 .hero-inner padding 简写清掉的 gutter ---- */
:root { --cp-gutter: 24px; }
@media (max-width: 980px) { :root { --cp-gutter: 48px; } }
@media (max-width: 720px) { :root { --cp-gutter: 32px; } }
main .container, main .hero-inner, .site-footer .container {
  padding-left: var(--cp-gutter);
  padding-right: var(--cp-gutter);
}

/* ---- 兜底：即使个别元素超宽也不产生横向滚动条。clip 不创建滚动容器，
   不影响吸顶导航与锚点滚动（不要同时设 overflow-y:auto，否则 clip 退化成 hidden）。 ---- */
html { overflow-x: clip; }
/* mega 面板关闭态已由全站 styles.css 统一改为 display:none（不再占布局盒），
   原先 721–980px 的局部补丁已冗余，移除。 */

/* ---- 每屏高度基准：以首屏 Hero 自然高度为统一基准（--cp-screen-h 由 JS 写入）。
   内容少的屏补齐到同高并垂直居中；内容多的屏自然更高、不裁剪。 ---- */
main > section:not(:first-child) {
  min-height: var(--cp-screen-h, 0px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---- 每一屏 = 一张圆角矩形背景卡片：左右离屏留白、屏间留缝、四角圆角。
   overflow:clip 让屏内背景图与滚动动画裁在圆角内。 ---- */
:root {
  --cp-edge: 22px;
  --cp-gap: 18px;
  --cp-radius: 30px;
}
main {
  padding: var(--cp-edge) var(--cp-edge) 0;
  background: var(--bg-soft);
}
main > section {
  margin: 0 0 var(--cp-gap);
  border-radius: var(--cp-radius);
  overflow: clip;
  background: var(--bg);
}
@media (max-width: 720px) {
  :root { --cp-edge: 12px; --cp-gap: 12px; --cp-radius: 20px; }
}

/* ---- 深色屏里「白底内容卡」把继承色文字复位，否则浅字落白卡看不见 ---- */
main > section.section--dark .card,
main > section.section--dark .form-card,
main > section.section--dark .acc { color: var(--ink); }
main > section.section--dark .card .eyebrow { color: var(--plush); }

/* ---- 原生 dialog 通用外观（阶梯表等弹窗复用） ---- */
.gallery-modal { border: 0; padding: 0; width: min(1000px, 92vw); max-height: 88vh; border-radius: var(--r-xl); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.gallery-modal::backdrop { background: rgba(17,17,20,.66); }
.gallery-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 26px; border-bottom: 1px solid var(--line); }
.gallery-close { font: inherit; font-size: 20px; line-height: 1; width: 36px; height: 36px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--ink); }
.gallery-close:hover { border-color: var(--ink-soft); }
/* 弹窗 / bottom sheet 打开时锁滚动 */
html.is-locked { overflow: hidden; }

/* ---- 滚动驱动入场动画：每屏 --p 由 JS 写入；.cp-anim 由脚本写 --t(0→1)，不滑不动 ---- */
main > section { --p: 0; }
.cp-anim { opacity: var(--t, 0); transform: translateY(calc((1 - var(--t, 0)) * 20px)); transition: none; }
@media (prefers-reduced-motion: reduce) { .cp-anim { opacity: 1; transform: none; } }

/* ---- 子菜单导航：滑过首屏后从顶部滑入，顶掉全站主导航。
   主导航保持 sticky 占位、只做视觉滑出，避免 display:none 造成布局跳动。 ---- */
:root { --cp-subnav-h: 64px; }
.cp-subnav {
  position: fixed; left: 0; right: 0; top: 0; z-index: 110;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  transform: translateY(-100%);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .28s ease, opacity .2s ease, visibility .28s;
}
body.cp-subnav-on .cp-subnav {
  transform: translateY(0); opacity: 1; visibility: visible; pointer-events: auto;
}
#site-header { transition: transform .28s ease, opacity .2s ease; }
body.cp-subnav-on #site-header {
  transform: translateY(-100%); opacity: 0; visibility: hidden; pointer-events: none;
}
.cp-subnav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: var(--cp-subnav-h); display: flex; align-items: center; gap: 18px;
}
.cp-subnav__brand { flex: 0 0 auto; font-size: 15px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.cp-subnav__menu { position: relative; flex: 0 0 auto; margin-left: auto; }
.cp-subnav__toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  color: var(--ink-2); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.cp-subnav__toggle:hover { border-color: var(--blue); color: var(--blue); }
.cp-subnav__toggle svg { width: 16px; height: 16px; }
.cp-subnav__panel {
  position: absolute; top: calc(100% + 12px); right: 0; z-index: 1;
  width: 274px; max-height: 70vh; overflow-y: auto; padding: 10px;
  display: grid; gap: 2px;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 14px 44px rgba(0,0,0,.14);
}
.cp-subnav__panel[hidden] { display: none; }
.cp-subnav__panel a {
  display: flex; align-items: baseline; gap: 10px; padding: 8px 10px;
  border-radius: 9px; font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.cp-subnav__panel a:hover, .cp-subnav__panel a.is-active { background: var(--bg-soft); color: var(--blue); }
.cp-subnav__panel a span { flex: 0 0 auto; font-size: 11px; color: var(--ink-soft); }
.cp-subnav__inquiry { flex: 0 0 auto; display: inline-flex; align-items: center; }
@media (max-width: 980px) {
  .cp-subnav__inner { padding: 0 16px; gap: 12px; }
}
@media (max-width: 720px) {
  :root { --cp-subnav-h: 48px; }
  .cp-subnav__inner { padding: 0 14px; gap: 9px; }
  .cp-subnav__brand { font-size: 13px; }
  .cp-subnav__inquiry { padding: 8px 14px; font-size: 13px; }
  .cp-subnav__panel { width: min(274px, calc(100vw - 28px)); }
}
