/* ==========================================================================
   layout.css — 重置、容器、栅格、页头 / 页脚骨架、响应式
   ========================================================================== */

/* ---------- 1. 重置 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface-1);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ---------- 2. 标题排版 ---------- */
.fs-display { font-size: var(--fs-display); line-height: var(--lh-tight); letter-spacing: -.02em; font-weight: 700; }
h1, .h1 { font-size: var(--fs-h1); line-height: var(--lh-heading); letter-spacing: -.015em; font-weight: 700; }
h2, .h2 { font-size: var(--fs-h2); line-height: var(--lh-heading); letter-spacing: -.012em; font-weight: 700; }
h3, .h3 { font-size: var(--fs-h3); line-height: var(--lh-heading); letter-spacing: -.008em; font-weight: 700; }
h4, .h4 { font-size: var(--fs-h4); line-height: var(--lh-heading); font-weight: 700; }
.subtitle { font-size: var(--fs-h4); font-weight: 700; line-height: var(--lh-heading); }

p + p { margin-top: var(--sp-4); }

.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-inverse   { color: var(--text-inverse); }
.center         { text-align: center; }

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

.grid { display: grid; gap: var(--sp-6); }
.grid--1 { grid-template-columns: 1fr; }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 700px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .grid { gap: var(--sp-8); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* 区块纵向节奏 */
.section { padding-block: var(--sp-12); }
.section--sm { padding-block: var(--sp-8); }
.section--lg { padding-block: var(--sp-16); }
@media (min-width: 1024px) {
  .section { padding-block: var(--sp-20); }
  .section--sm { padding-block: var(--sp-12); }
  .section--lg { padding-block: var(--sp-24); }
}

.section--muted { background: var(--surface-2); }
/* 相邻区块间距减半（用于导航→内容等紧凑衔接） */
.section--half-b { padding-bottom: calc(var(--sp-8) / 2); }
.section--half-t { padding-top: calc(var(--sp-12) / 2); }
@media (min-width: 1024px) {
  .section--half-b { padding-bottom: calc(var(--sp-12) / 2); }
  .section--half-t { padding-top: calc(var(--sp-20) / 2); }
}
.section--dark { background: var(--surface-dark); color: var(--text-inverse); }
.section--dark .text-secondary { color: rgba(255, 255, 255, .72); }

.section-head { margin-bottom: var(--sp-8); max-width: 780px; }
.section-head p { margin-top: var(--sp-4); }

/* 页面顶部留白（内容区） */
.page-main { padding-top: var(--sp-2); }

/* ---------- 4. 顶部信息条 ---------- */
.topbar {
  background: var(--surface-2);
  position: relative;
  z-index: var(--z-topbar);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  min-height: var(--topbar-h);
}
.topbar__loc {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  letter-spacing: .02em;
}
.topbar__loc strong { color: var(--text-primary); font-weight: 700; }

/* ---------- 5. 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--surface-1);
  border-bottom: 1px solid transparent;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.site-header.is-stuck {
  box-shadow: var(--shadow-1);
  border-bottom-color: var(--border);
}
.header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: var(--header-h);
}
.header__brand { display: flex; align-items: center; flex: 0 0 auto; }
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.main-nav { display: none; }

@media (min-width: 1024px) {
  .main-nav { display: block; margin-left: var(--sp-6); }
  .main-nav__list { display: flex; align-items: stretch; height: var(--header-h); }
  .main-nav__item { display: flex; position: static; }
  .main-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-inline: var(--sp-4);
    font-size: var(--fs-sm);
    font-weight: 500;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    border-top: 3px solid transparent;
    transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .main-nav__link:hover,
  .main-nav__item.is-open > .main-nav__link { border-bottom-color: var(--brand); }
  .main-nav__link[aria-current="page"] { border-bottom-color: var(--brand); font-weight: 700; }
  .main-nav__chev { transition: transform var(--dur) var(--ease); }
  .main-nav__item.is-open .main-nav__chev { transform: rotate(180deg); }
}

/* ---------- 6. 页脚骨架 ---------- */
.site-footer { margin-top: 0; }
.footer__card {
  background: var(--surface-2);
  border-radius: 0;
  overflow: hidden;
}

/* 底部 CTA 条（品牌 + 二维码 + 订阅） */
.footer__cta {
  background: var(--ink);
  border-radius: 0;
}
.footer__cta-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5) var(--sp-8);
  padding-block: var(--sp-6);
}
.footer__cta-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: var(--fs-h3);
  font-weight: 800;
  letter-spacing: .06em;
  white-space: nowrap;
}
.footer__cta-mark {
  display: inline-block;
  height: 38px;
  width: auto;
}
.footer__cta-qr { display: flex; gap: var(--sp-3); }
.footer__cta-qr img {
  width: 76px;
  height: 76px;
  padding: 5px;
  background: #fff;
  border-radius: var(--r-sm);
  transition: transform var(--dur) var(--ease);
}
.footer__cta-qr img:hover { transform: translateY(-3px) scale(1.05); }
.footer__cta-form {
  display: flex;
  flex: 0 1 380px;
  min-width: 260px;
}
.footer__cta-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  font-size: var(--fs-sm);
  color: #fff;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .18);
  border-right: 0;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}
.footer__cta-input::placeholder { color: rgba(255, 255, 255, .5); }
.footer__cta-input:focus { outline: none; border-color: var(--brand-light); }
.footer__cta-btn {
  height: 46px;
  padding: 0 26px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  transition: background var(--dur) var(--ease);
}
.footer__cta-btn:hover { background: var(--brand-hover); }
.footer__cta-msg { width: 100%; font-size: var(--fs-sm); color: var(--brand-light); }
@media (max-width: 900px) {
  .footer__cta-inner { flex-direction: column; align-items: flex-start; }
  .footer__cta-form { width: 100%; flex-basis: auto; }
}
@media (min-width: 1024px) {
  .site-footer { margin-top: 0; }
  /* 顶部两角为直角（与深色 CTA 条平齐），底部保留圆角 */
  .footer__card { border-radius: 0 0 var(--r-xl) var(--r-xl); }
}
.footer__social {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding-block: var(--sp-8) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.footer__social-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-6);
}
@media (min-width: 900px) {
  .footer__social { flex-direction: row; align-items: flex-start; justify-content: space-between; }
}
.footer__cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-8);
  padding-block: var(--sp-8);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) { .footer__cols { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer__cols { grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); } }

.footer__col { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer__col-title { font-size: var(--fs-h4); font-weight: 700; margin-bottom: var(--sp-1); }
.footer__col-link { color: inherit; text-decoration: none; transition: color .2s ease; }
.footer__col-link:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }

.footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-8);
  padding-block: var(--sp-6) var(--sp-8);
}
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-8);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* ---------- 7. 面包屑 ---------- */
.breadcrumb { padding-block: var(--sp-5); }
.breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--text-tertiary); }
.breadcrumb li + li::before { content: "/"; margin-right: var(--sp-2); color: var(--border-strong); }
.breadcrumb a:hover { color: var(--brand); text-decoration: underline; }

/* ---------- 8. 通用工具 ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mt-12 { margin-top: var(--sp-12); }
.hide-mobile { display: none; }
.show-mobile { display: block; }
@media (min-width: 1024px) {
  .hide-mobile { display: block; }
  .hide-desktop { display: none !important; }
  .show-mobile { display: none; }
}

/* ---------- 9. 滚动进场动画（仅在 JS 可用时启用，避免无 JS 时内容不可见） ---------- */
html.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
html.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
