:root {
  --navy: #011462;
  --brown: #5d4230;
  --brown-active: #664630;
  --blue-text: #22347e;
  --page-max: 750px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #f5f3ef;
  font-family: "PingFang SC", "Source Han Sans SC", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;
  color: var(--brown);
}

img {
  max-width: 100%;
  display: block;
  border: 0;
}

button {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

#app {
  max-width: var(--page-max);
  margin: 0 auto;
  min-height: 100vh;
  background: #fff;
  position: relative;
  padding-bottom: calc(65px + env(safe-area-inset-bottom, 0px));
}

.page {
  display: none;
  min-height: 100%;
}

.page.active {
  display: block;
  animation: page-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page.active.enter-forward {
  animation-name: page-enter-forward;
}

.page.active.enter-back {
  animation-name: page-enter-back;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-enter-forward {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes page-enter-back {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* —— 首页名片 —— */
/* 注意：不可在未激活时写 display:flex，否则会盖掉 .page 的隐藏 */
.home {
  position: relative;
  flex-direction: column;
  align-items: center;
  padding-top: min(78.8vw, 591px);
  min-height: min(130.67vw, 980px);
}

.home.active {
  display: flex;
  animation: page-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home.active.enter-forward {
  animation-name: page-enter-forward;
}

.home.active.enter-back {
  animation-name: page-enter-back;
}

.home.active .home-userinfo,
.home.active .home-actions {
  animation: home-rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home.active .home-actions {
  animation-delay: 0.08s;
}

@keyframes home-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 0;
}

.home-userinfo,
.home-actions {
  position: relative;
  z-index: 1;
}

/* 与小程序一致：名片信息与按钮各自相对页面居中，避免被更宽的卡片容器左对齐 */
#home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.home-userinfo {
  display: flex;
  width: min(91.47vw, 686px);
  min-height: min(42.67vw, 320px);
}

.home-avatar {
  margin-top: min(9.73vw, 73px);
  margin-left: min(6.4vw, 48px);
  width: min(25.6vw, 192px);
  height: min(25.6vw, 192px);
  border-radius: 4px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.35);
}

.home-right {
  width: min(53.33vw, 400px);
  margin-left: min(6.27vw, 47px);
  margin-top: min(4vw, 30px);
}

.home-name {
  font-size: clamp(22px, 7.87vw, 59px);
  font-weight: 800;
  color: var(--brown);
  line-height: 1.2;
}

.home-job {
  font-size: clamp(12px, 2.93vw, 22px);
  font-weight: 400;
  color: hsl(24, 32%, 28%);
  margin-left: 8px;
}

.home-contact {
  display: flex;
  align-items: center;
  min-height: min(13.33vw, 100px);
}

.home-contact-icon {
  width: min(5.07vw, 38px);
  flex-shrink: 0;
}

.home-contact-body {
  display: flex;
  flex-direction: column;
  margin-left: min(2.53vw, 19px);
}

.home-contact-label {
  font-size: clamp(12px, 3.33vw, 25px);
  color: var(--brown);
}

.home-contact-value {
  font-weight: 700;
  font-size: clamp(12px, 3.33vw, 25px);
  color: var(--blue-text);
  line-height: 1.35;
}

.home-divider {
  width: min(46.8vw, 351px);
  height: 1px;
  background: #254294;
}

.home-actions {
  width: min(80vw, 600px);
  margin-top: min(5.33vw, 40px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: min(1.6vw, 12px);
}

.home-action,
.home-actions button {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
  transform-origin: center;
}

.home-action:active,
.home-actions button:active {
  transform: scale(0.96);
  opacity: 0.88;
}

.home-actions img {
  width: min(39.33vw, 295px);
  height: auto;
}

/* —— 介绍 / 案例长图 —— */
.stack {
  font-size: 0;
  line-height: 0;
}

.stack img {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: bottom;
}

/* 长图切片偶发 1px 接缝 */
.stack img + img {
  margin-top: -1px;
}

.case-page {
  background: var(--navy);
  padding-bottom: 8px;
}

/* 与原小程序 750 稿一致：左右 28rpx、卡片 338rpx、间距约 18rpx */
.ops-section {
  background: var(--navy);
  padding: 1.33% 3.73% 5.33%;
  min-height: 60px;
  margin-top: -1px; /* 与上方 section_title 长图贴合，避免接缝白线 */
}

.case-loading,
.case-empty {
  padding: 30px 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.4;
}

.case-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 96px;
}

.case-loading[hidden] {
  display: none;
}

.loader {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(243, 226, 184, 0.22);
  border-top-color: #f3e2b8;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.city-block {
  margin-bottom: 4.8%;
  animation: reveal-up 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.city-block:nth-child(1) { animation-delay: 0.02s; }
.city-block:nth-child(2) { animation-delay: 0.08s; }
.city-block:nth-child(3) { animation-delay: 0.14s; }
.city-block:nth-child(4) { animation-delay: 0.2s; }
.city-block:nth-child(5) { animation-delay: 0.26s; }
.city-block:nth-child(n + 6) { animation-delay: 0.3s; }

.city-head {
  position: relative;
  height: 16vw;
  max-height: 120px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.33% 0 3.2%;
  overflow: hidden;
}

.city-en {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  font-size: clamp(28px, 9.6vw, 72px);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(160, 180, 220, 0.18);
  white-space: nowrap;
  line-height: 1;
}

.city-zh {
  position: relative;
  z-index: 1;
  font-size: clamp(22px, 7.47vw, 56px);
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #f3e2b8;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  line-height: 1;
}

.project-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: flex-start;
  align-items: flex-start;
  column-gap: 2%;
  row-gap: 2.88%;
}

.project-card {
  /* 内容区两列：与原稿约 343 / 694 */
  width: calc((100% - 2%) / 2);
  margin: 0;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  flex: 0 0 calc((100% - 2%) / 2);
  animation: reveal-up 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.project-grid .project-card:nth-child(1) { animation-delay: 0.04s; }
.project-grid .project-card:nth-child(2) { animation-delay: 0.1s; }
.project-grid .project-card:nth-child(3) { animation-delay: 0.16s; }
.project-grid .project-card:nth-child(4) { animation-delay: 0.22s; }
.project-grid .project-card:nth-child(5) { animation-delay: 0.28s; }
.project-grid .project-card:nth-child(6) { animation-delay: 0.34s; }
.project-grid .project-card:nth-child(n + 7) { animation-delay: 0.38s; }

.project-card.is-full {
  width: 100%;
  flex: 0 0 100%;
}

.project-card img {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
}

/* —— 底部导航 —— */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--page-max);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: calc(65px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--navy);
  z-index: 100;
}

.tabbar-item {
  display: flex;
  width: 33.33%;
  padding: 10px 8px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 400;
  color: #fff;
  line-height: 1.2;
  transition: color 0.18s ease, transform 0.15s ease, opacity 0.15s ease;
  transform-origin: center bottom;
}

.tabbar-item img {
  width: 27px;
  height: 28px;
  object-fit: contain;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.tabbar-item.active {
  color: var(--brown-active);
}

.tabbar-item.active img {
  transform: scale(1.08);
}

.tabbar-item:active {
  transform: scale(0.94);
  opacity: 0.85;
}

.tabbar-item.pressed {
  transform: scale(0.94);
  opacity: 0.85;
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  max-width: 80%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .loader {
    animation: none;
    border-top-color: #f3e2b8;
    opacity: 0.85;
  }
}
