/* ============================================================
   components.css — 按钮 / 导航 / 卡片 / 页脚 等公共组件
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: var(--c-primary);
  --btn-color: var(--c-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-color);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out),
    background 0.35s var(--ease-out), color 0.35s var(--ease-out),
    border-color 0.35s var(--ease-out);
  will-change: transform;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-lg {
  padding: 15px 30px;
  font-size: 15px;
}

.btn-primary {
  background: var(--c-primary);
  color: var(--c-white);
  box-shadow: 0 6px 20px rgba(11, 61, 74, 0.2);
}
.btn-primary:hover {
  background: var(--c-primary-2);
  box-shadow: 0 12px 30px rgba(11, 61, 74, 0.32);
}

.btn-outline {
  background: transparent;
  color: var(--c-ink);
  border-color: var(--c-line);
}
.btn-outline:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--c-primary);
  padding-left: 4px;
  padding-right: 4px;
  border-radius: 0;
}
.btn-ghost:hover {
  transform: translateY(0);
  color: var(--c-mint);
}

.btn-amber {
  background: var(--c-amber);
  color: var(--c-ink);
  box-shadow: 0 6px 20px rgba(232, 163, 61, 0.3);
}
.btn-amber:hover {
  background: var(--c-amber-dark);
  box-shadow: 0 12px 30px rgba(232, 163, 61, 0.45);
}

.btn-ghost-light {
  background: transparent;
  color: var(--c-white);
  border-color: rgba(255, 255, 255, 0.4);
}
.btn-ghost-light:hover {
  border-color: var(--c-amber);
  color: var(--c-amber);
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding-block: 18px;
  background: #114d5c;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: background 0.4s var(--ease-out), border-color 0.4s var(--ease-out),
    padding 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.site-header.scrolled {
  background: rgba(17, 17, 17, 0.85);
  border-bottom-color: var(--c-line);
  padding-block: 12px;
  box-shadow: 0 6px 24px rgba(11, 61, 74, 0.06);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* 品牌 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
  transition: color 0.3s var(--ease-out);
}

.brand-logo {
  height: 80px;
  width: auto;
  display: block;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}
.brand-en {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--c-mint);
  text-transform: uppercase;
}

/* 导航菜单 */
.nav-menu {
  display: flex;
  gap: 8px;
}
.nav-menu a {
  position: relative;
  padding: 8px 14px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-pill);
  transition: color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}
.nav-menu a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1px;
  background: #ffffff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}
.nav-menu a:hover {
  color: #ffffff;
}
.nav-menu a:hover::after,
.nav-menu a.active::after {
  transform: scaleX(1);
}
.nav-menu a.active {
  color: #ffffff;
}

/* 导航 CTA */
.nav-cta {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 移动端汉堡 */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius);
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--c-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
}

/* ---------- 页脚 ---------- */
.site-footer {
  background: #114d5c;
  color: rgba(255, 255, 255, 0.78);
  padding-top: 80px;
  position: relative;
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(63, 184, 175, 0.4),
    transparent
  );
}

.footer-top {
  display: grid;
  grid-template-columns: 170px auto 1.6fr;
  gap: 48px;
  padding-bottom: 56px;
  border-bottom: 1px solid var(--c-line-dark);
  align-items: start;
}

.footer-brand .brand-light {
  color: var(--c-white);
}
.footer-brand .brand-light .brand-name {
  color: var(--c-white);
}
.footer-brand .brand-light .brand-en {
  color: var(--c-mint);
}

.footer-tagline {
  margin-top: 18px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.8;
}

/* 页脚双二维码堆叠 */
.footer-qr-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: center;
}
.qr-stack-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
}
.qr-stack-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(63, 184, 175, 0.5);
  transform: translateY(-2px);
}
.qr-stack-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--c-white);
  padding: 3px;
  flex-shrink: 0;
}
.qr-stack-item span {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  transition: color 0.3s var(--ease-out);
}
.qr-stack-item:hover span {
  color: var(--c-mint);
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.footer-col-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-mint);
  margin-bottom: 18px;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-col ul a,
.footer-col ul li {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.3s var(--ease-out);
}
.footer-col ul a:hover {
  color: var(--c-amber);
}

.footer-qr .qr-mock {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.qr-mock img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--c-white);
  padding: 4px;
}
.qr-mock span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 32px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}
.footer-legal {
  display: flex;
  gap: 24px;
}
.footer-legal a:hover {
  color: var(--c-amber);
}

/* ---------- 响应式:导航与页脚 ---------- */
@media (max-width: 1024px) {
  .footer-cols {
    grid-template-columns: repeat(2, 1fr);
    gap: 36px;
  }
  .footer-top {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .footer-qr-stack {
    flex-direction: row;
    gap: 12px;
  }
  .qr-stack-item {
    flex: 1;
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  /* 禁用 backdrop-filter 以避免 containing block 问题 */
  /* 当父元素有 backdrop-filter 时，position: fixed 的子元素会被限制在父元素内 */
  .site-header {
    overflow: visible;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    /* background: rgba(247, 244, 238, 0.95); */
    background: rgba(247, 244, 238, 0.95);
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 80vw;
    max-width: 320px;
    min-width: 260px;
    background: var(--c-bg);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 72px 0 0;
    /* 适配 iOS 底部安全区 */
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    box-shadow: -8px 0 32px rgba(11, 61, 74, 0.2);
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out);
    border-left: 1px solid var(--c-line);
    overflow-y: auto;
    z-index: 200;
  }
  .nav-menu.is-open {
    transform: translateX(0);
  }
  .nav-menu a {
    padding: 16px 24px;
    border-bottom: 1px solid var(--c-line);
    border-radius: 0;
    font-size: 16px;
    min-height: 52px;
    display: flex;
    align-items: center;
    color: var(--c-ink);
    font-weight: 500;
  }
  .nav-menu a::after {
    display: none;
  }
  .nav-menu a.active {
    color: var(--c-white);
    background: var(--c-primary);
  }
  .nav-menu a:hover {
    background: var(--c-bg-alt);
  }
  .nav-menu a.active:hover {
    background: var(--c-primary-2);
  }

  /* 菜单底部添加分隔线和额外信息 */
  .nav-menu::after {
    content: '';
    display: block;
    height: 1px;
    background: var(--c-line);
    margin: auto 24px 16px;
  }

  .nav-toggle {
    display: flex;
    position: relative;
    z-index: 210;
  }
  .nav-cta .btn {
    display: none;
  }

  /* 遮罩层(完全透明,仅用于点击关闭菜单) */
  .nav-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    transition: visibility 0.35s var(--ease-out);
    z-index: 150;
  }
  .nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
  .footer-legal {
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }
  /* 页脚在移动端缩小内边距 */
  .site-footer {
    padding-top: 56px;
  }
  .footer-top {
    padding-bottom: 40px;
  }
}

@media (max-width: 560px) {
  .footer-cols {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .footer-qr-stack {
    flex-direction: column;
    gap: 10px;
  }
  .qr-stack-item img {
    width: 48px;
    height: 48px;
  }
}
