/* ==========================================================================
   layout.css — 页头 / 导航 / 页脚 / 栅格 / 三端断点
   ========================================================================== */

/* --------------------------------------------------------------------------
   页头
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background 0.3s var(--ease), box-shadow 0.3s var(--ease),
    backdrop-filter 0.3s var(--ease);
}

.site-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background: transparent;
  transition: background 0.3s var(--ease);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* 首页顶部：透明压在深色 Hero 上 */
.site-header.on-dark {
  background: transparent;
}

.site-header.on-dark .brand-name,
.site-header.on-dark .nav-link,
.site-header.on-dark .header-icon {
  color: rgba(255, 255, 255, 0.88);
}

.site-header.on-dark .nav-link:hover,
.site-header.on-dark .nav-link[aria-current="page"] {
  color: #fff;
}

.site-header.on-dark .brand-mark {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* 滚动后 / 内页：毛玻璃白底 */
.site-header.is-solid {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  box-shadow: 0 1px 0 rgba(10, 16, 32, 0.06);
}

.site-header.is-solid.on-dark,
.site-header.is-solid {
  --header-fg: var(--ink-800);
}

.site-header.is-solid .brand-name,
.site-header.is-solid .nav-link,
.site-header.is-solid .header-icon {
  color: var(--ink-700);
}

.site-header.is-solid .nav-link:hover,
.site-header.is-solid .nav-link[aria-current="page"] {
  color: var(--brand-600);
}

/* 品牌 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  box-shadow: var(--sh-brand);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 800;
  font-size: 1.03rem;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  transition: color 0.3s var(--ease);
  white-space: nowrap;
}

.brand-tag {
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-2);
  font-weight: 600;
}

/* 主导航 */
.nav {
  display: none;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: var(--r-xs);
  font-size: 0.945rem;
  font-weight: 600;
  color: var(--ink-700);
  white-space: nowrap;
  transition: color 0.22s var(--ease), background 0.22s var(--ease);
}

.nav-link:hover {
  background: rgba(37, 99, 235, 0.07);
}

.site-header.on-dark:not(.is-solid) .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-item {
  position: relative;
}

.nav-link .caret {
  width: 10px;
  height: 10px;
  transition: transform 0.25s var(--ease);
}

.nav-item:hover .caret {
  transform: rotate(180deg);
}

/* 下拉 */
.dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 250px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  list-style: none;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease),
    visibility 0.22s;
}

.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown a {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-xs);
  color: var(--ink-700);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.dropdown a:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}

.dropdown a > span {
  display: block;
  min-width: 0;
}

.dropdown a strong {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.4;
}

.dropdown a em {
  display: block;
  font-style: normal;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
}

.dropdown svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--brand-600);
}

/* 头部右侧动作区 */
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-700);
  transition: background 0.22s var(--ease), color 0.22s var(--ease);
}

.header-icon:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-600);
}

.header-icon svg {
  width: 19px;
  height: 19px;
}

.header-cta {
  display: none;
}

/* 汉堡按钮 */
.nav-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-800);
}

.nav-toggle:hover {
  background: rgba(37, 99, 235, 0.08);
}

.site-header.on-dark:not(.is-solid) .nav-toggle {
  color: #fff;
}

.nav-toggle-bars {
  position: relative;
  width: 19px;
  height: 13px;
}

.nav-toggle-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.28s var(--ease), opacity 0.2s var(--ease),
    width 0.28s var(--ease);
}

.nav-toggle-bars span:nth-child(1) {
  top: 0;
}
.nav-toggle-bars span:nth-child(2) {
  top: 5.5px;
  width: 74%;
}
.nav-toggle-bars span:nth-child(3) {
  top: 11px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
  width: 100%;
}

/* --------------------------------------------------------------------------
   移动端抽屉
   -------------------------------------------------------------------------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(7, 12, 24, 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.drawer-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  width: min(88vw, 380px);
  background: #fff;
  box-shadow: -20px 0 60px -20px rgba(7, 12, 24, 0.35);
  display: flex;
  flex-direction: column;
  transform: translateX(101%);
  transition: transform 0.38s var(--ease-out);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer.is-open {
  transform: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.drawer-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--ink-700);
  background: var(--bg-soft);
}

.drawer-close svg {
  width: 18px;
  height: 18px;
}

.drawer-body {
  padding: 12px 12px 24px;
  flex: 1;
}

.drawer-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawer-nav > li {
  border-bottom: 1px solid var(--line-soft);
}

.drawer-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--ink-800);
  border-radius: var(--r-xs);
}

.drawer-nav a:hover,
.drawer-nav a[aria-current="page"] {
  color: var(--brand-600);
}

.drawer-sub {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 12px;
  display: grid;
  gap: 2px;
}

.drawer-sub a {
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--muted);
  padding: 9px 12px;
}

.drawer-foot {
  padding: 18px 20px 26px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  background: var(--bg-soft);
}

.drawer-contact {
  font-size: 0.88rem;
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.drawer-contact strong {
  color: var(--ink-800);
  font-size: 1.06rem;
  letter-spacing: 0.01em;
}

/* --------------------------------------------------------------------------
   页面主区
   -------------------------------------------------------------------------- */
.page-main {
  padding-top: var(--header-h);
}

/* 内页横幅 */
.page-hero {
  position: relative;
  background: var(--grad-dark);
  color: var(--on-dark-dim);
  padding-block: clamp(52px, 8vw, 96px) clamp(46px, 7vw, 84px);
  overflow: hidden;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto auto;
  width: 62vw;
  height: 62vw;
  max-width: 760px;
  max-height: 760px;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(37, 99, 235, 0.5) 0%,
    rgba(6, 182, 212, 0.16) 45%,
    transparent 68%
  );
  pointer-events: none;
}

.page-hero .container {
  position: relative;
}

.page-hero h1 {
  color: #fff;
  margin-bottom: 14px;
  max-width: 18em;
}

.page-hero p {
  max-width: 62ch;
  margin: 0;
  font-size: var(--fs-lead);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--muted-2);
  margin-bottom: 18px;
  list-style: none;
  padding: 0;
}

.breadcrumb a {
  color: var(--on-dark-dim);
}

.breadcrumb a:hover {
  color: #fff;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: 8px;
  opacity: 0.5;
}

/* 网格背景装饰 */
.grid-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(
      to right,
      rgba(255, 255, 255, 0.055) 1px,
      transparent 1px
    ),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(
    ellipse 80% 70% at 50% 0%,
    #000 20%,
    transparent 78%
  );
}

/* --------------------------------------------------------------------------
   栅格
   -------------------------------------------------------------------------- */
.grid {
  display: grid;
  gap: clamp(16px, 2.4vw, 26px);
}

.grid-2,
.grid-3,
.grid-4 {
  grid-template-columns: 1fr;
}

.split {
  display: grid;
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  grid-template-columns: 1fr;
}

/* 平板 ≥ 640px */
@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 桌面 ≥ 1024px */
@media (min-width: 1024px) {
  :root {
    --header-h: 76px;
  }

  .nav {
    display: block;
  }

  .nav-toggle {
    display: none;
  }

  .header-cta {
    display: inline-flex;
  }

  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split-wide-left {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

@media (min-width: 1440px) {
  :root {
    --container: 1280px;
  }
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--ink-900);
  color: var(--muted-2);
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: auto auto -50% -10%;
  width: 52vw;
  height: 52vw;
  max-width: 620px;
  max-height: 620px;
  background: radial-gradient(
    circle,
    rgba(37, 99, 235, 0.22) 0%,
    transparent 65%
  );
  pointer-events: none;
}

.footer-top {
  position: relative;
  padding-block: clamp(44px, 6vw, 72px) clamp(30px, 4vw, 46px);
  display: grid;
  gap: 34px;
  grid-template-columns: 1fr;
}

.footer-brand .brand-name {
  color: #fff;
}

.footer-brand p {
  margin: 16px 0 20px;
  max-width: 40ch;
  line-height: 1.85;
}

.footer-cols {
  display: grid;
  gap: 30px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.footer-col h4 {
  color: #fff;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0.92;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.footer-col a {
  color: var(--muted-2);
}

.footer-col a:hover {
  color: #fff;
}

.footer-contact li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  line-height: 1.7;
}

.footer-contact svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 5px;
  color: var(--brand-500);
}

.footer-bottom {
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  padding-block: 20px 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.83rem;
}

.footer-bottom p {
  margin: 0;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (min-width: 768px) {
  .footer-cols {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .footer-top {
    grid-template-columns: 1fr 1.35fr;
    gap: 46px;
  }
}

@media (min-width: 1024px) {
  .footer-top {
    grid-template-columns: 0.9fr 1.6fr;
  }
  .footer-cols {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   返回顶部 / 搜索浮层
   -------------------------------------------------------------------------- */
.to-top {
  position: fixed;
  right: clamp(14px, 2.4vw, 28px);
  bottom: clamp(14px, 2.4vw, 28px);
  z-index: 90;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-600);
  color: #fff;
  box-shadow: var(--sh-brand);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.9);
  transition: all 0.3s var(--ease);
}

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

.to-top:hover {
  background: var(--brand-700);
  color: #fff;
}

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

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: start center;
  padding: clamp(70px, 12vh, 140px) var(--gutter) 40px;
  background: rgba(7, 12, 24, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.search-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.search-panel {
  width: min(660px, 100%);
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  transform: translateY(-14px) scale(0.985);
  transition: transform 0.28s var(--ease-out);
}

.search-modal.is-open .search-panel {
  transform: none;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.search-row svg {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.search-row input {
  flex: 1;
  border: 0;
  outline: none;
  font-size: 1.05rem;
  min-width: 0;
  background: transparent;
}

.search-hint {
  padding: 14px 20px;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.search-results {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  border-top: 1px solid var(--line);
}

.search-results:empty {
  display: none;
}

.search-result {
  display: block;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-800);
}

.search-result:hover {
  background: var(--brand-50);
}

.search-result strong {
  display: block;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.5;
}

.search-result span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}
