/* ============================================================
   CUSTOM FONT — 仓耳华新体
   font-display: swap 先用系统字体渲染，下载完毕后自动切换
   ============================================================ */
@font-face {
  font-family: 'Canger HuaXinTi';
  src: url('assets/fonts/canger-huaxinti.woff2') format('woff2'),
       url('assets/fonts/canger-huaxinti.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00FF, U+2000-206F, U+2E80-2EFF, U+3000-303F, U+3100-312F, U+3200-32FF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FE30-FE4F, U+FF00-FFEF;
}

/* ============================================================
   TOKENS — warm palette
   ============================================================ */
:root {
  --bg:        #f4f1eb;     /* match hero illustration bg */
  --surface:   #faf7f1;
  --surface2:  #ffffff;
  --fg:        #141413;
  --muted:     #5e5d59;
  --muted2:    #87867f;
  --border:    #eae6de;
  --border2:   #e2dfd6;
  --accent:    #c96442;
  --accent2:   #d97757;
  --dark:      var(--fg);       /* dark section bg = same as fg text */
  --dark2:     #30302e;
  --dark-fg:   #faf9f5;
  --dark-muted:#b0aea5;
  --ring:      #d1cfc5;
  --error:     #b53333;
  --focus:     #3898ec;

  --font-display: 'Canger HuaXinTi', 'Noto Serif SC', 'Source Han Serif SC', 'Iowan Old Style', 'Charter', Georgia, serif;
  --font-body:    'Canger HuaXinTi', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', 'Cascadia Code', ui-monospace, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}

body {
  font-family: var(--font-body);
  font-size: clamp(15px, 1.6vw, 17px);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ============================================================
   UTILITY
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   SKIP LINK
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: #faf9f5;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  z-index: 999;
  font-size: 14px;
  font-weight: 500;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 8px;
}

/* ============================================================
   FOCUS
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ============================================================
   NAV
   ============================================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(20,20,19,0.92);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--dark2);
}

@supports not (backdrop-filter: blur(16px)) {
  nav { background: rgba(20,20,19,1); }
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--dark-fg);
}

.nav-links {
  display: flex;
  gap: clamp(16px, 3vw, 32px);
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--dark-muted);
  transition: color 0.18s;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--dark-fg);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--dark-fg);
}

.nav-toggle svg { display: block; }
.nav-toggle .line1,
.nav-toggle .line2,
.nav-toggle .line3 {
  transition: transform 0.25s, opacity 0.25s;
  transform-origin: center;
}
.nav-toggle.open .line1 {
  transform: translateY(5px) rotate(45deg);
}
.nav-toggle.open .line2 {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle.open .line3 {
  transform: translateY(-5px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--dark2);
    border-bottom: 1px solid var(--dark2);
    flex-direction: column;
    padding: 16px 24px;
    gap: 12px;
  }
  .nav-links.open { display: flex; }
}

/* ============================================================
   SECTION COMMONS
   ============================================================ */
.section {
  padding: clamp(64px, 10vw, 120px) clamp(20px, 4vw, 48px);
}

.section-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 500;
  line-height: 1.18;
  color: var(--fg);
  margin-bottom: 16px;
}

.section-desc {
  font-size: clamp(16px, 1.8vw, 18px);
  color: var(--muted);
  max-width: 560px;
  line-height: 1.6;
}

.section-dark {
  background: var(--fg);
  color: var(--dark-fg);
}

.section-dark .section-title { color: var(--dark-fg); }
.section-dark .section-desc   { color: var(--dark-muted); }
.section-dark .section-label  { color: var(--accent2); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: clamp(80px, 12vw, 160px) clamp(20px, 4vw, 48px) clamp(64px, 10vw, 120px);
}

.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(32px, 6vw, 64px);
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  width: fit-content;
}

.hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 7vw, 72px);
  font-weight: 500;
  line-height: 1.08;
  color: var(--fg);
  letter-spacing: -0.01em;
}

.hero-title em {
  font-style: normal;
  color: var(--accent);
}

.hero-sub {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--muted);
  max-width: 520px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.hero-illustration {
  width: clamp(200px, 28vw, 360px);
  flex-shrink: 0;
}

.hero-illustration img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-2xl);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #faf9f5;
  box-shadow: 0px 0px 0px 1px var(--accent);
}

.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0px 0px 0px 1px var(--accent2);
}

.btn-secondary {
  background: var(--border2);
  color: var(--fg);
  box-shadow: 0px 0px 0px 1px var(--ring);
}

.btn-secondary:hover {
  background: var(--ring);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
}

.btn-ghost:hover { color: var(--fg); }

/* ============================================================
   GRID CARDS — Works
   ============================================================ */
.works-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px, 2.5vw, 24px);
  margin-top: clamp(32px, 5vw, 56px);
}

.work-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 3vw, 32px);
  transition: all 0.22s;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.work-card:hover {
  box-shadow: rgba(0,0,0,0.05) 0px 4px 24px;
  border-color: var(--border2);
  transform: translateY(-2px);
}

.work-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.work-card-icon svg {
  width: 20px;
  height: 20px;
}

.work-card-title {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 500;
  line-height: 1.25;
}

.work-card-desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.work-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--border);
  color: var(--muted);
  font-weight: 500;
}

.work-card-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.18s;
}

.work-card-link:hover { gap: 8px; }

/* ============================================================
   CONTENT SECTION — link cards
   ============================================================ */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(16px, 2.5vw, 24px);
  margin-top: clamp(32px, 5vw, 56px);
}

.content-card {
  background: var(--dark2);
  border: 1px solid var(--dark2);
  border-radius: var(--radius-xl);
  padding: clamp(24px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.22s;
}

.content-card:hover {
  border-color: var(--accent);
  box-shadow: rgba(0,0,0,0.2) 0px 4px 24px;
}

.content-card-platform {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent2);
}

.content-card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--dark-fg);
  line-height: 1.25;
}

.content-card-desc {
  font-size: 14px;
  color: var(--dark-muted);
  line-height: 1.5;
  flex: 1;
}

.content-card-arrow {
  color: var(--accent2);
  font-size: 14px;
  font-weight: 500;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 6vw, 64px);
  align-items: start;
  margin-top: clamp(24px, 4vw, 40px);
}

.about-text {
  font-size: clamp(16px, 1.8vw, 18px);
  line-height: 1.7;
  color: var(--muted);
}

.about-text p + p { margin-top: 1em; }

.about-meta {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.meta-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted2);
  min-width: 72px;
  padding-top: 2px;
}

.meta-value {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2.5vw, 24px);
  margin-top: clamp(32px, 5vw, 56px);
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.22s;
}

a.contact-card { cursor: pointer; }

a.contact-card:hover {
  box-shadow: rgba(0,0,0,0.05) 0px 4px 24px;
  border-color: var(--border2);
}

.contact-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.contact-card-icon svg {
  width: 20px;
  height: 20px;
}

.contact-card-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted2);
}

.contact-card-value {
  font-size: 16px;
  font-weight: 500;
  color: var(--fg);
}

.contact-card-hint {
  font-size: 13px;
  color: var(--muted2);
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: var(--fg);
  border-top: 1px solid var(--dark2);
  padding: clamp(32px, 5vw, 56px) clamp(20px, 4vw, 48px);
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-left {
  font-size: 14px;
  color: var(--dark-muted);
}

.footer-right {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--dark-muted);
}

.footer-right a:hover { color: var(--dark-fg); }

/* ============================================================
   RESPONSIVE — tablet
   ============================================================ */
@media (max-width: 860px) {
  .works-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-illustration { width: clamp(160px, 40vw, 280px); justify-self: center; }
}

/* ============================================================
   RESPONSIVE — mobile
   ============================================================ */
@media (max-width: 540px) {
  .content-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }

  .footer-inner { flex-direction: column; text-align: center; }
  .footer-right { justify-content: center; }
}

/* ============================================================
   ANIMATION: fade-in on scroll
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ring); }

html {
  scrollbar-width: thin;
  scrollbar-color: var(--border2) var(--bg);
}

/* ============================================================
   SELECTION
   ============================================================ */
::selection {
  background: var(--accent);
  color: #faf9f5;
}
