/* ============================================================
   Jian Wang · Personal Homepage — Apple-inspired minimal theme
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --card: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --border: rgba(0, 0, 0, 0.08);
  --nav-bg: rgba(255, 255, 255, 0.72);
  --chip: rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-alt: #101012;
    --card: #1c1c1e;
    --text: #f5f5f7;
    --text-muted: #86868b;
    --accent: #2997ff;
    --accent-hover: #409cff;
    --border: rgba(255, 255, 255, 0.12);
    --nav-bg: rgba(22, 22, 23, 0.72);
    --chip: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ============================== Nav ============================== */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1024px;
  margin: 0 auto;
  height: 52px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links { display: flex; gap: 28px; }

.nav-links a {
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.25s ease;
}

.nav-links a:hover { color: var(--text); }

.lang-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.15s ease;
}

.lang-btn:hover { background: var(--chip); }
.lang-btn:active { transform: scale(0.96); }

/* ============================== Hero ============================== */

.hero {
  max-width: 820px;
  margin: 0 auto;
  padding: 168px 24px 96px;
  text-align: center;
}

.avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 5.5px var(--border), var(--shadow);
  margin-bottom: 36px;
}

.eyebrow {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 26px;
}

.hero h1 .hl { display: block; }

.hero-sub {
  font-size: clamp(18px, 2.4vw, 22px);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 40px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================== Buttons ============================== */

.btn {
  display: inline-block;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  padding: 13px 28px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.25s ease, transform 0.15s ease, opacity 0.25s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--chip); }

/* ============================== Sections ============================== */

.section {
  max-width: 1024px;
  margin: 0 auto;
  padding: 110px 24px;
}

.section-alt {
  max-width: none;
  background: var(--bg-alt);
}

.section-alt > * {
  max-width: 1024px;
  margin-left: auto;
  margin-right: auto;
}

.section-contact {
  text-align: center;
  padding-bottom: 130px;
}

.section-head { margin-bottom: 56px; }

.section-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.section h2 {
  font-size: clamp(32px, 4.6vw, 52px);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.12;
  margin-bottom: 14px;
}

.section-sub {
  font-size: 19px;
  color: var(--text-muted);
  max-width: 620px;
}

.section-contact .section-sub { margin: 0 auto; }

/* ============================== Grid & Cards ============================== */

.grid {
  display: grid;
  gap: 20px;
}

.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card);
  border-radius: 22px;
  padding: 34px 30px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-icon {
  font-size: 30px;
  margin-bottom: 16px;
  line-height: 1;
}

.card h3,
.work-card h3 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.card p,
.work-card p {
  font-size: 15.5px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* Work cards */

.work-card {
  background: var(--bg);
  border-radius: 22px;
  padding: 34px 32px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section-alt .work-card { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }

.work-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.work-tag {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.chips span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--chip);
  padding: 5px 12px;
  border-radius: 999px;
}

/* ============================== Timeline ============================== */

.timeline {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1.5px;
  background: var(--border);
}

.tl-item {
  position: relative;
  padding-bottom: 44px;
}

.tl-item:last-child { padding-bottom: 0; }

.tl-item::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 9px;
  width: 11.5px;
  height: 11.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.tl-time {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.tl-body h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.tl-body p {
  font-size: 15.5px;
  color: var(--text-muted);
}

/* ============================== Contact ============================== */

.contact-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.contact-note {
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================== Footer ============================== */

.footer {
  border-top: 1px solid var(--border);
  padding: 30px 24px 40px;
  text-align: center;
}

.footer p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================== Toast ============================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translate(-50%, 16px);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 200;
}

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

/* ============================== Reveal on scroll ============================== */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .card:hover,
  .work-card:hover { transform: none; }
}

/* ============================== Responsive ============================== */

@media (max-width: 880px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .nav-links { display: none; }
  .hero { padding-top: 132px; }
  .section { padding: 80px 20px; }
}

@media (max-width: 560px) {
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(28px, 8.5vw, 40px); line-height: 1.18; }
  .card { padding: 28px 24px; }
}
