/* ===== 品牌与设计系统 ===== */
:root {
  /* Brand */
  --brand-primary: #002fa7;
  --brand-primary-light: #3b6de8;
  --brand-primary-muted: #e8f0fe;
  --kktong-accent: #3b82c0;

  /* Light theme neutrals */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Functional */
  --accent: #002fa7;
  --accent-light: #3b6de8;
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --shadow-soft: 0 4px 20px rgba(0, 47, 167, 0.08);
  --shadow-medium: 0 8px 30px rgba(0, 47, 167, 0.12);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --tracking-tight: -0.03em;
  --tracking-tighter: -0.05em;

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

body.is-loading {
  overflow: hidden;
}

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

em {
  font-style: italic;
  color: var(--brand-primary-light);
}

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

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.accent {
  color: var(--accent);
}

/* ===== Preloader ===== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}

.preloader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.preloader__logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.preloader__bar-wrap {
  width: 200px;
  height: 3px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.preloader__bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.preloader__counter {
  display: flex;
  align-items: baseline;
  gap: 0.15rem;
}

.preloader__pct {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: var(--tracking-tighter);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--accent);
}

.preloader__pct-sign {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  z-index: 100;
  transition: background 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out), backdrop-filter 0.5s var(--ease-out);
  will-change: background, box-shadow, backdrop-filter;
}

.nav.is-scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border-light);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.nav__logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.nav__logo-text {
  font-size: 1.1rem;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav__link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  transition: color 0.3s ease;
}

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

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.3s var(--ease-out);
}

.nav__link:hover::after {
  width: 100%;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  width: 100%;
  height: 250vh;
}

.hero__bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero__mesh {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(at 20% 20%, rgba(59, 109, 232, 0.18) 0px, transparent 50%),
    radial-gradient(at 80% 10%, rgba(0, 47, 167, 0.12) 0px, transparent 50%),
    radial-gradient(at 10% 80%, rgba(232, 240, 254, 0.8) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(59, 109, 232, 0.1) 0px, transparent 50%),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #ffffff 100%);
  animation: meshMove 18s ease-in-out infinite alternate;
}

@keyframes meshMove {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(2%, 2%) scale(1.05);
  }
  100% {
    transform: translate(-2%, 1%) scale(1.02);
  }
}

.hero__shapes {
  position: absolute;
  inset: 0;
}

.hero__shapes span {
  position: absolute;
  border-radius: 50%;
  background: var(--brand-primary);
  opacity: 0.04;
  animation: float 12s ease-in-out infinite;
  will-change: transform;
}

.hero__shapes span:nth-child(1) {
  width: 300px;
  height: 300px;
  top: 10%;
  left: 10%;
  animation-delay: 0s;
}

.hero__shapes span:nth-child(2) {
  width: 180px;
  height: 180px;
  top: 60%;
  right: 15%;
  animation-delay: -3s;
}

.hero__shapes span:nth-child(3) {
  width: 120px;
  height: 120px;
  bottom: 20%;
  left: 30%;
  animation-delay: -6s;
}

.hero__shapes span:nth-child(4) {
  width: 220px;
  height: 220px;
  top: 30%;
  right: 25%;
  animation-delay: -9s;
}

.hero__shapes span:nth-child(5) {
  width: 160px;
  height: 160px;
  top: 18%;
  right: 38%;
  animation-delay: -2s;
  background: var(--brand-primary-light);
  opacity: 0.03;
}

.hero__shapes span:nth-child(6) {
  width: 100px;
  height: 100px;
  top: 72%;
  left: 6%;
  animation-delay: -4s;
  opacity: 0.05;
}

.hero__shapes span:nth-child(7) {
  width: 200px;
  height: 200px;
  top: 42%;
  left: 48%;
  animation-delay: -7s;
  background: var(--brand-primary-light);
  opacity: 0.03;
}

.hero__shapes span:nth-child(8) {
  width: 140px;
  height: 140px;
  bottom: 8%;
  right: 6%;
  animation-delay: -10s;
  opacity: 0.04;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-30px) scale(1.05);
  }
}

.hero__pin {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  padding: 0 2rem;
}

.hero__tag {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.5rem;
  opacity: 0;
}

.hero__heading {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: var(--tracking-tighter);
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.hero__line {
  display: block;
  overflow: hidden;
  opacity: 0;
}

.hero__sub {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
  opacity: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  border-radius: 100px;
  background: var(--accent);
  color: #fff;
  transition: all 0.4s var(--ease-out);
  opacity: 0;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 47, 167, 0.25);
}

.btn:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 47, 167, 0.3);
  gap: 0.85rem;
}

.btn__arrow {
  transition: transform 0.4s var(--ease-out);
}

.btn:hover .btn__arrow {
  transform: translateX(4px);
}

.hero__scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 0;
}

.hero__scroll-indicator span {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: var(--border-medium);
  position: relative;
  overflow: hidden;
}

.hero__scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent);
  animation: scrollLine 2s ease-in-out infinite;
}

@keyframes scrollLine {
  0% { top: -100%; }
  50% { top: 100%; }
  100% { top: 100%; }
}

/* Hero floating hover */
[data-text-fx="float"] .hero__line {
  display: inline-block;
}

[data-text-fx="float"]:hover .hero__line {
  animation: textFloat 2s ease-in-out infinite;
}

[data-text-fx="float"]:hover .hero__line:nth-child(2) {
  animation-delay: 0.3s;
}

@keyframes textFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ===== Video Transition ===== */
.video-transition {
  position: relative;
  z-index: 2;
  height: 300vh;
  background: var(--bg-primary);
}

.video-transition__inner {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-primary);
}

.video-transition__frame {
  position: absolute;
  inset: 0;
  will-change: clip-path, transform;
  clip-path: inset(30% 25% 30% 25% round 20px);
}

.video-transition__bg {
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 30% 30%, rgba(0, 47, 167, 0.15), transparent 40%),
    radial-gradient(circle at 70% 70%, rgba(59, 109, 232, 0.12), transparent 40%),
    linear-gradient(135deg, var(--brand-primary-muted) 0%, #ffffff 100%);
}

.video-transition__overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  pointer-events: none;
  z-index: 1;
}

.video-transition__text {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  pointer-events: none;
}

.vt-word {
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  opacity: 0;
  will-change: transform, opacity;
}

.vt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  flex-shrink: 0;
}

/* ===== Work Showcase (Horizontal Scroll) ===== */
.work {
  position: relative;
  z-index: 3;
  background: var(--bg-primary);
}

.work__showcase {
  position: relative;
  height: 100vh;
}

.work__showcase-inner {
  display: flex;
  width: 100%;
  height: 100vh;
  background: var(--bg-primary);
  position: relative;
  z-index: 10;
}

.work__gallery-wrapper {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.work__gallery {
  display: flex;
  gap: 3rem;
  height: 100%;
  align-items: center;
  padding: 0 4rem;
  will-change: transform;
}

.work__card {
  flex-shrink: 0;
  width: 44vw;
  max-width: 560px;
  height: 68vh;
  max-height: 540px;
  background: var(--bg-secondary);
  border-radius: 28px;
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s var(--ease-out);
  position: relative;
  overflow: hidden;
  outline: none;
}

.work__card:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 47, 167, 0.2);
}

.work__card.is-active {
  border-color: rgba(0, 47, 167, 0.25);
  box-shadow: var(--shadow-medium);
  transform: scale(1.02);
}

.work__card-visual {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-primary-muted), #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.work__card-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at center, var(--project-color, var(--accent)) 0%, transparent 70%);
  opacity: 0.18;
  transition: opacity 0.4s ease;
}

.work__card:hover .work__card-visual::before,
.work__card.is-active .work__card-visual::before {
  opacity: 0.3;
}

.work__card-icon {
  width: 64px;
  height: 64px;
  color: var(--project-color, var(--accent));
  position: relative;
  z-index: 1;
  opacity: 0.75;
  transition: opacity 0.4s ease, transform 0.4s var(--ease-out);
}

.work__card:hover .work__card-icon,
.work__card.is-active .work__card-icon {
  opacity: 1;
  transform: scale(1.1);
}

.work__card-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

.work__card.kktong .work__card-title {
  color: var(--kktong-accent);
}

/* Info Panel */
.work__info-panel {
  width: 360px;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 2rem 2.5rem;
  border-left: 1px solid var(--border-light);
  background: var(--bg-primary);
  position: relative;
  z-index: 3;
}

.work__info-content {
  width: 100%;
}

.work__info-number {
  display: block;
  font-size: 5rem;
  font-weight: 900;
  line-height: 1;
  color: var(--border-light);
  margin-bottom: 1.5rem;
  letter-spacing: var(--tracking-tighter);
  transition: color 0.4s ease;
}

.work__info-number.is-active {
  color: var(--accent);
}

.work__info-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: var(--tracking-tight);
}

.work__info-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.work__info-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.work__info-tags span {
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--brand-primary-muted);
  color: var(--accent);
}

.work__info-progress {
  margin-top: 2rem;
  height: 3px;
  background: var(--border-light);
  border-radius: 2px;
  overflow: hidden;
}

.work__info-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== Services ===== */
.services {
  position: relative;
  z-index: 2;
  padding: 8rem 0;
  background: var(--bg-secondary);
}

.services__header {
  text-align: center;
  margin-bottom: 4rem;
}

.section__heading {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.section__heading-line {
  display: inline-block;
  position: relative;
}

.section__subheading {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.services__item {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s var(--ease-out);
}

.services__item:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 47, 167, 0.2);
  box-shadow: var(--shadow-soft);
}

.services__item-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1.25rem;
  color: var(--accent);
}

.services__item-icon svg {
  width: 100%;
  height: 100%;
}

.services__item-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.services__item-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Text hover effects */
.text-char {
  display: inline-block;
  transition: transform 0.3s var(--ease-out), color 0.3s ease;
  cursor: default;
}

.text-char:hover {
  transform: translateY(-5px) scale(1.05);
  color: var(--accent);
}

[data-text-fx="hover"] .section__heading-line::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s var(--ease-out);
}

[data-text-fx="hover"]:hover .section__heading-line::after {
  width: 100%;
}

/* ===== About ===== */
.about {
  position: relative;
  z-index: 2;
  padding: 8rem 0;
  background: var(--bg-primary);
}

.about__inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  align-items: center;
}

.about__content .section__heading {
  margin-bottom: 1.5rem;
}

.about__text {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.25rem;
  font-size: 1rem;
}

.about__text strong {
  color: var(--text-primary);
  font-weight: 700;
}

.about__image-wrap {
  height: 380px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.about__image {
  width: 100%;
  height: 100%;
  position: relative;
  background: linear-gradient(135deg, var(--brand-primary-muted), #ffffff);
}

.about__image-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(0, 47, 167, 0.1), transparent 50%),
    radial-gradient(circle at 70% 70%, rgba(59, 109, 232, 0.08), transparent 50%);
}

.about__image-shape {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  opacity: 0.15;
}

/* ===== Footer ===== */
.footer {
  padding: 4rem 0 2rem;
  border-top: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.footer__inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.footer__logo-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.footer__logo-text {
  font-size: 1.1rem;
}

.footer__desc {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  max-width: 300px;
}

.footer__copyright {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer__col-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.footer__links {
  list-style: none;
}

.footer__links li {
  margin-bottom: 0.75rem;
}

.footer__links li a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: color 0.3s ease;
}

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

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

  .hero__mesh,
  .hero__shapes span {
    animation: none;
  }

  .work__card,
  .work__card-icon,
  .work__card-visual::before,
  .text-char {
    transition: none;
  }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  .nav {
    padding: 0.875rem 1.25rem;
  }

  .nav__links {
    gap: 1rem;
  }

  .nav__logo-text {
    font-size: 1rem;
  }

  .hero {
    height: auto;
    min-height: 100vh;
  }

  .hero__pin {
    height: auto;
    min-height: 100vh;
    padding: 8rem 0 6rem;
  }

  .hero__content {
    padding: 0 1.25rem;
  }

  .video-transition {
    height: 200vh;
  }

  /* Mobile work showcase fallback */
  .work__showcase {
    height: auto;
    overflow: visible;
  }

  .work__showcase-inner {
    flex-direction: column;
    height: auto;
  }

  .work__gallery-wrapper {
    height: auto;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .work__gallery-wrapper::-webkit-scrollbar {
    display: none;
  }

  .work__gallery {
    padding: 2rem 1.25rem;
    gap: 1rem;
  }

  .work__card {
    width: 80vw;
    height: auto;
    min-height: 320px;
    max-height: none;
    padding: 2rem;
  }

  .work__card-visual {
    width: 100px;
    height: 100px;
  }

  .work__card-icon {
    width: 48px;
    height: 48px;
  }

  .work__info-panel {
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border-light);
    padding: 2rem 1.25rem;
  }

  .work__info-number {
    font-size: 3rem;
  }

  .services {
    padding: 5rem 0;
  }

  .services__grid {
    grid-template-columns: 1fr;
  }

  .about {
    padding: 5rem 0;
  }

  .about__inner {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about__image-wrap {
    height: 280px;
    order: -1;
  }

  .footer__inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}
