/* ==========================================================================
   layout.css —— 顶部导航 / 区块外壳 / 页脚
   ========================================================================== */

/* -------------------------------------------------------------- 顶部导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease),
    background-color 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand__logo {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.brand__name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-soft);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav__link {
  position: relative;
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.nav__link:hover {
  color: var(--text);
  background: var(--surface-3);
}

.nav__link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav__toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.nav__toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.nav__toggle svg {
  width: 20px;
  height: 20px;
}

/* 顶部滚动进度条 */
.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--gradient);
  transition: width 0.1s linear;
}

/* -------------------------------------------------------------- 区块外壳 */
.section {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 52px 48px;
  margin-bottom: 30px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 18px);
}

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.section__title {
  position: relative;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  padding-left: 18px;
}

.section__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 5px;
  border-radius: var(--radius-pill);
  background: var(--gradient);
}

.section__subtitle {
  margin-top: 8px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.98rem;
}

/* ------------------------------------------------------------------ 页脚 */
.site-footer {
  margin-top: 40px;
  padding: 48px 0 32px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.footer__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer__brand img {
  height: 30px;
  width: auto;
}

.footer__slogan {
  color: var(--muted);
  font-size: 0.92rem;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.footer__links a {
  color: var(--text-soft);
  font-size: 0.92rem;
  transition: color 0.2s var(--ease);
}

.footer__links a:hover {
  color: var(--accent);
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 22px;
  color: var(--muted);
  font-size: 0.86rem;
}

.beian {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.beian a,
.beian span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  transition: color 0.2s var(--ease);
}

.beian a:hover {
  color: var(--accent);
}

.beian__icon {
  width: 15px;
  height: auto;
}

/* ------------------------------------------------------------ 回到顶部 */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.28s var(--ease);
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.to-top svg {
  width: 18px;
  height: 18px;
}

/* ------------------------------------------------------------ 响应式导航 */
@media (max-width: 900px) {
  .nav__toggle {
    display: inline-flex;
  }

  .nav__links {
    position: absolute;
    left: 16px;
    right: 16px;
    top: calc(var(--header-h) - 4px);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px;
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease),
      visibility 0.22s var(--ease);
  }

  .nav__links.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav__link {
    display: block;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
  }

  .section {
    padding: 40px 26px;
    border-radius: var(--radius-lg);
  }

  .brand__name {
    display: none;
  }
}
