/* ==========================================================================
   layout.css — 容器、栅格、section 节奏、header、抽屉、footer
   ========================================================================== */

/* ---------- 容器 ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }

/* ---------- section 节奏（深浅交替） ---------- */
.section { padding-block: var(--section-y); position: relative; }

.section--dark {
  background: var(--ink-900);
  color: var(--steel-300);
}
.section--darker {
  background: var(--ink-950);
  color: var(--steel-300);
}
.section--light {
  background: var(--mist-100);
  color: var(--ink-800);
}
.section--white { background: var(--white); color: var(--ink-800); }

.section--dark h2, .section--dark h3, .section--darker h2, .section--darker h3 {
  color: var(--white);
}

/* ---------- section 头部 ----------
   注意用 px 而不是 ch：ch 跟随 body 字号，而 h2 是 clamp 到 36px 的大字，
   用 68ch 会把标题挤成两三行。 */
.section-head { max-width: min(100%, 820px); margin-bottom: var(--sp-8); }
.section-head--center { margin-inline: auto; text-align: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ember-500);
  margin-bottom: var(--sp-3);
}
.section--light .eyebrow, .section--white .eyebrow { color: var(--ember-600); }
.eyebrow::before {
  content: "";
  width: 24px; height: 1px;
  background: currentColor;
  flex: none;
}

.section-lead {
  margin-top: var(--sp-4);
  font-size: var(--fs-lead);
  color: var(--steel-400);
  max-width: 62ch;
}
.section--light .section-lead, .section--white .section-lead { color: var(--ink-700); }

/* ---------- 栅格 ---------- */
.grid { display: grid; gap: var(--sp-5); }
/* 网格项默认 min-width:auto，会被内容的 min-content 撑开导致整页横向溢出。
   统一压成 0，宽度由轨道决定。 */
.grid > * { min-width: 0; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid--split {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-8);
}
@media (min-width: 900px) {
  .grid--split { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: start; }
}

/* ==========================================================================
   顶部导航
   ========================================================================== */

/* sticky 状态哨兵：header 上方 1px，用 IO 观察它是否离屏（不用 scroll 事件） */
.nav-sentinel { position: absolute; top: 0; left: 0; width: 100%; height: 1px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  /* 实底深色：sticky header 占据文档流，透明会露出下方浅色页面背景。
     深色实底与页面顶部的深色 hero / page-head 无缝衔接，视觉上等同于透明。 */
  background: var(--ink-900);
  border-bottom: 1px solid transparent;
  transition:
    background-color var(--dur-3) var(--ease-out),
    border-color var(--dur-3) var(--ease-out);
}
.site-header.is-stuck {
  background: rgba(10, 13, 16, .78);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--line);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
  color: var(--white);
}
.brand__mark { width: 34px; height: 34px; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__zh {
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: .06em;
}
.brand__en {
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--steel-500);
}

.nav__list {
  display: none;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
}
.nav__link {
  display: block;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--steel-300);
  border-radius: var(--r-sm);
  transition: color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}
.nav__link:hover { color: var(--white); background: rgba(255, 255, 255, .06); }
.nav__link[aria-current="page"] { color: var(--ember-400); }

.nav__tel {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.nav__tel:hover { border-color: var(--ember-500); color: var(--ember-300); }
.nav__tel svg { width: 15px; height: 15px; flex: none; }

/* 汉堡按钮 */
.nav__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  margin-left: auto;
  color: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  flex: none;
}
.nav__toggle svg { width: 20px; height: 20px; }
.nav__toggle .icon-close { display: none; }
.nav__toggle[aria-expanded="true"] .icon-close { display: block; }
.nav__toggle[aria-expanded="true"] .icon-menu { display: none; }

@media (min-width: 1024px) {
  .nav__list, .nav__tel { display: flex; }
  .nav__toggle { display: none; }
}

/* ==========================================================================
   移动抽屉
   ========================================================================== */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  background: var(--ink-950);
  padding: var(--sp-5) 0 var(--sp-8);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* 无 JS 时抽屉不存在于视觉流（由 hidden 属性控制） */
.drawer[hidden] { display: none; }

.js .drawer {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
}
.js .drawer.is-open { opacity: 1; transform: none; }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  margin-bottom: var(--sp-5);
}
.drawer__list { display: grid; gap: var(--sp-1); }
.drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--steel-300);
  border-bottom: 1px solid var(--line-soft);
}
.drawer__link[aria-current="page"] { color: var(--ember-400); }
.drawer__link span { font-size: var(--fs-xs); color: var(--steel-500); font-weight: 500; }

.drawer__foot {
  margin-top: var(--sp-7);
  display: grid;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--steel-400);
}
.drawer__foot a { color: var(--ember-400); font-family: var(--font-mono); font-weight: 700; }

@media (min-width: 1024px) {
  .drawer { display: none !important; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--ink-950);
  color: var(--steel-400);
  padding-block: var(--sp-9) var(--sp-5);
  font-size: var(--fs-sm);
}
.footer__grid {
  display: grid;
  gap: var(--sp-7);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  padding-bottom: var(--sp-7);
  border-bottom: 1px solid var(--line-soft);
}
@media (min-width: 900px) {
  .footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; }
}
.footer__brand { max-width: 34ch; }
.footer__brand .brand { margin-bottom: var(--sp-4); }
.footer__desc { color: var(--steel-500); line-height: 1.7; }

.footer__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: var(--sp-4);
}
.footer__list { display: grid; gap: var(--sp-3); }
.footer__list a { color: var(--steel-400); transition: color var(--dur-2) var(--ease-out); }
.footer__list a:hover { color: var(--ember-400); }

.footer__contact { display: grid; gap: var(--sp-3); }
.footer__contact dt {
  font-size: var(--fs-xs);
  color: var(--steel-500);
  letter-spacing: .06em;
}
.footer__contact dd { color: var(--steel-300); line-height: 1.6; }
.footer__contact dd a { color: var(--ember-400); font-family: var(--font-mono); font-weight: 700; }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  align-items: center;
  justify-content: space-between;
  padding-top: var(--sp-5);
  font-size: var(--fs-xs);
  color: var(--steel-500);
}
.footer__bottom a { color: var(--steel-400); }
.footer__bottom a:hover { color: var(--ember-400); }
.footer__legal { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }

/* 回到顶部 */
.to-top {
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  z-index: var(--z-header);
  width: 46px; height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  background: rgba(18, 23, 28, .88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out);
}
.to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.to-top svg { width: 18px; height: 18px; }
.to-top:hover { border-color: var(--ember-500); color: var(--ember-300); }

