:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --bg-soft: #ededec;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --ink: #090a0c;
  --ink-soft: #3d4149;
  --muted: #767a84;
  --line: rgba(9, 10, 12, 0.1);
  --line-strong: rgba(9, 10, 12, 0.18);
  --accent: #332b7a;
  --accent-blue: #152238;
  --shadow: 0 24px 80px rgba(12, 15, 22, 0.1);
  --radius: 12px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(9, 10, 12, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(9, 10, 12, 0.02) 1px, transparent 1px);
  background-size: 78px 78px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.36), transparent 58%);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background 220ms ease, border-color 220ms ease, backdrop-filter 220ms ease;
}
.site-header.is-scrolled,
.nav-open .site-header {
  background: rgba(246, 246, 243, 0.82);
  border-color: var(--line);
  backdrop-filter: blur(18px);
}
.nav-shell {
  width: min(var(--max), calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 12px;
}
.nav { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); color: var(--ink-soft); font-size: 14px; }
.nav a { transition: color 180ms ease; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav-toggle { display: none; }

.page { width: min(var(--max), calc(100% - 40px)); margin: 0 auto; padding-top: 72px; }
.hero, .page-hero { padding: clamp(118px, 18vh, 190px) 0 70px; }
.apple-hero {
  min-height: 96vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  align-items: end;
  gap: clamp(42px, 8vw, 120px);
}
.hero-copy { align-self: end; }
.eyebrow { margin: 0 0 18px; color: var(--accent); font-size: 12px; font-weight: 750; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 900px;
  margin-bottom: 26px;
  font-size: clamp(58px, 11vw, 168px);
  line-height: 0.86;
  letter-spacing: -0.055em;
  font-weight: 760;
}
h1 span {
  color: var(--muted);
}
.zh,
.zh-heading,
.zh-title {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.zh {
  margin-top: -4px;
  color: var(--ink-soft);
}
.zh-heading {
  margin-top: -8px;
  color: var(--ink-soft);
  font-size: clamp(30px, 4.5vw, 64px);
  letter-spacing: -0.025em;
}
.zh-title {
  margin-top: -10px;
  color: var(--ink-soft);
  font-size: clamp(34px, 6.2vw, 86px);
  letter-spacing: -0.025em;
}
h2 { margin-bottom: 24px; max-width: 840px; font-size: clamp(38px, 6vw, 88px); line-height: 0.98; letter-spacing: -0.04em; font-weight: 740; }
h3 { margin-bottom: 12px; font-size: 24px; line-height: 1.12; letter-spacing: -0.025em; }
.hero-subtitle { max-width: 780px; margin-bottom: 18px; color: var(--ink-soft); font-size: clamp(20px, 3vw, 34px); line-height: 1.18; letter-spacing: -0.028em; }
.lede, .body-copy { max-width: 760px; color: var(--muted); font-size: clamp(17px, 1.7vw, 21px); line-height: 1.74; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}
.button:hover { transform: translateY(-2px); border-color: rgba(51, 43, 122, 0.35); }
.button.primary { background: var(--ink); color: white; border-color: var(--ink); }
.button.subtle { background: rgba(255, 255, 255, 0.54); }

.hero-photo, .about-portrait, .gallery-card, .photo-tile {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.hero-photo { aspect-ratio: 4 / 5; }
.hero-photo img, .about-portrait img, .gallery-card img, .photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.section { padding: clamp(78px, 11vw, 140px) 0; border-top: 1px solid var(--line); }
.section-grid { display: grid; grid-template-columns: minmax(160px, 0.32fr) minmax(0, 1fr); gap: clamp(30px, 7vw, 96px); }
.section-label { color: var(--accent); font-size: 13px; font-weight: 750; text-transform: uppercase; }
.quiet-section { padding-top: clamp(60px, 9vw, 110px); }

.cards { display: grid; gap: 16px; }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  min-height: 260px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.85) inset;
  transition: transform 210ms ease, border-color 210ms ease, box-shadow 210ms ease;
}
.card:hover { transform: translateY(-4px); border-color: rgba(51, 43, 122, 0.28); box-shadow: var(--shadow); }
.card p { color: var(--muted); line-height: 1.66; }
.card-kicker { display: block; margin-bottom: 16px; color: var(--accent); font-size: 12px; font-weight: 750; text-transform: uppercase; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tag-row span { color: var(--accent-blue); font-size: 12px; font-weight: 700; }

.photo-strip { display: grid; grid-template-columns: 1.35fr 0.85fr 0.85fr; gap: 16px; }
.photo-tile { min-height: 280px; }
.photo-tile:first-child { min-height: 420px; }
.gallery-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.gallery-card { grid-column: span 3; background: var(--surface-strong); }
.gallery-card.featured { grid-column: span 3; }
.gallery-card img { aspect-ratio: 4 / 3; }
.gallery-card.featured img { aspect-ratio: 16 / 11; }
.gallery-card figcaption { display: flex; justify-content: space-between; gap: 16px; padding: 18px; color: var(--muted); }
.gallery-card figcaption strong { color: var(--ink); }

.about-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 430px); gap: clamp(36px, 8vw, 110px); align-items: end; }
.about-portrait { aspect-ratio: 4 / 5; }
.skill-cloud { display: flex; flex-wrap: wrap; gap: 12px; }
.skill-cloud span {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-soft);
  font-weight: 650;
}
.split-list { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); }
.split-list div { display: grid; grid-template-columns: 170px 1fr; gap: 24px; padding: 26px; background: rgba(255, 255, 255, 0.62); }
.split-list p { margin: 0; color: var(--muted); line-height: 1.64; }

.contact-layout { display: grid; grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1fr); gap: clamp(34px, 7vw, 100px); align-items: start; }
.contact-links { display: grid; gap: 1px; border-top: 1px solid var(--line); }
.contact-links a { display: grid; gap: 8px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.contact-links span { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.contact-links strong { font-size: clamp(22px, 3vw, 34px); letter-spacing: -0.03em; }
.contact-form { display: grid; gap: 16px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.contact-form.compact { padding: 0; border: 0; box-shadow: none; background: transparent; }
label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 14px; font-weight: 650; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 14px 15px;
  font: inherit;
}
textarea { min-height: 150px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid rgba(51, 43, 122, 0.18); border-color: rgba(51, 43, 122, 0.35); }
.form-messages p { margin: 0 0 10px; padding: 12px; border-radius: 8px; background: rgba(51, 43, 122, 0.08); color: var(--accent); }
.form-messages .error { background: rgba(150, 40, 40, 0.08); color: #8a2424; }

.admin-page { padding-bottom: 90px; }
.admin-card { max-width: 520px; margin: 130px auto; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.compact-hero { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.admin-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.admin-table { width: 100%; min-width: 1080px; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; color: var(--ink-soft); }
.admin-table th { color: var(--ink); background: rgba(255, 255, 255, 0.55); }
.admin-table tr.unread td:first-child { color: var(--accent); font-weight: 800; }
.table-actions { display: flex; gap: 8px; }
.table-actions button { border: 1px solid var(--line); border-radius: 999px; padding: 8px 10px; background: white; cursor: pointer; }

.site-footer {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.not-found { min-height: 78vh; display: grid; place-items: center; text-align: center; }
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 680ms ease, transform 680ms ease; }
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #08090c;
    --bg-soft: #111218;
    --surface: rgba(18, 19, 24, 0.72);
    --surface-strong: rgba(22, 23, 29, 0.9);
    --ink: #f7f7f4;
    --ink-soft: #c8cad1;
    --muted: #90939d;
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.18);
    --accent: #8a84ff;
    --accent-blue: #a7bbff;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  }
  body { background: radial-gradient(circle at 78% 10%, rgba(51, 43, 122, 0.18), transparent 34%), var(--bg); }
  .site-header.is-scrolled, .nav-open .site-header { background: rgba(8, 9, 12, 0.8); }
  .button.primary { background: var(--ink); color: var(--bg); }
  .button.subtle, .skill-cloud span, input, textarea, .split-list div, .admin-table th { background: rgba(255, 255, 255, 0.055); }
  .table-actions button { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
}

@media (max-width: 900px) {
  .nav-shell, .page, .site-footer { width: min(100% - 28px, var(--max)); }
  .nav-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.42);
  }
  .nav-toggle span { width: 16px; height: 1px; background: var(--ink); grid-area: 1 / 1; transition: transform 180ms ease; }
  .nav-toggle span:last-child { transform: translateY(5px); }
  .nav-open .nav-toggle span:first-child { transform: rotate(45deg); }
  .nav-open .nav-toggle span:last-child { transform: rotate(-45deg); }
  .nav {
    position: fixed;
    top: 72px;
    left: 14px;
    right: 14px;
    display: none;
    grid-template-columns: 1fr;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
  }
  .nav-open .nav { display: grid; }
  .apple-hero, .about-hero, .section-grid, .contact-layout { grid-template-columns: 1fr; }
  .hero, .page-hero { padding-top: 108px; }
  .hero-photo, .about-portrait { max-width: 520px; }
  .cards.three, .project-grid { grid-template-columns: 1fr; }
  .photo-strip, .gallery-grid { grid-template-columns: 1fr; }
  .gallery-card, .gallery-card.featured { grid-column: auto; }
  .split-list div { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  h1 { font-size: clamp(48px, 18vw, 82px); }
  h2 { font-size: clamp(34px, 11vw, 58px); }
  .actions, .button { width: 100%; }
  .hero-subtitle { font-size: 20px; }
  .contact-form, .admin-card { padding: 20px; }
  .site-footer { flex-direction: column; }
}
