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

:root {
  --bg: #f8f8fb;
  --text: #1a1a1c;
  --text-secondary: #6b6b75;
  --text-muted: #9595a0;
  --accent: #5b5fa8;
  --accent-hover: #4a4e94;
  --border: rgba(0, 0, 0, 0.08);
  --surface: #f3f3f6;
  --font: 'JetBrains Mono', 'Noto Sans SC', 'Microsoft YaHei', monospace;
}

[data-theme="dark"] {
  --bg: #0d0d0f;
  --text: #e8e8ed;
  --text-secondary: #9e9ea8;
  --text-muted: #6b6b75;
  --accent: #8b8fd8;
  --accent-hover: #a5a8ee;
  --border: rgba(255, 255, 255, 0.08);
  --surface: #151518;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: color 0.3s;
}

main {
  flex: 1;
}

/* ── Navigation ──────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}
.site-header.scrolled {
  background: rgba(248, 248, 251, 0.92);
  box-shadow: 0 1px 0 var(--border);
}
[data-theme="dark"] .site-header.scrolled {
  background: rgba(13, 13, 15, 0.92);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
}

.logo {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}
.logo:hover { color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.2s;
}
.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  transition: color 0.3s, transform 0.3s;
}
.theme-toggle:hover {
  color: var(--accent);
  transform: rotate(180deg);
}

/* ── Page Header ─────────────────────────────── */
.page-header {
  padding: 160px 0 64px;
}

.page-header.with-photo {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 48px;
}

.profile-photo {
  flex-shrink: 0;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.page-path {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--text);
}

.page-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 72px;
}

/* ── Content Section ─────────────────────────── */
.content-section {
  max-width: 720px;
  padding-bottom: 80px;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 32px;
  letter-spacing: 0.04em;
}

/* ── Definition List (Resume) ────────────────── */
.dl-group {
  margin-bottom: 48px;
}

.dl-group dt {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dl-group dd {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.7;
}

.dl-group dd a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
.dl-group dd a:hover { color: var(--accent-hover); }

/* ── Timeline ───────────────────────────────── */
.tl {
  position: relative;
  padding-left: 24px;
}
.tl::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 8px;
  width: 1px;
  background: var(--border);
}

.tl-item {
  position: relative;
  margin-bottom: 48px;
}
.tl-item:last-child { margin-bottom: 0; }

.tl-dot {
  position: absolute;
  left: -27px; top: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.tl-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tl-title {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}

.tl-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.tl-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
}

.tl-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px;
}
.tl-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tl-links {
  display: flex; flex-wrap: wrap; gap: 16px;
}
.tl-links a {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
.tl-links a:hover { color: var(--accent-hover); }

/* ── Entry List (Apps / OpenSource) ──────────── */
.entry {
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border);
}
.entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.entry-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.entry-head img {
  width: 28px; height: 28px;
  border-radius: 4px;
  flex-shrink: 0;
}
.entry-head h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}
.entry-head span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.entry-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.entry-status {
  font-size: 0.75rem;
  font-weight: 500;
}
.entry-status.live { color: #3d9a6e; }
.entry-status.deprecated { color: #c4554d; }

.entry-actions {
  display: flex; gap: 14px; flex-wrap: wrap;
}
.entry-actions a {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}
.entry-actions a:hover { color: var(--accent-hover); }
.entry-actions a.muted {
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Back Link ───────────────────────────────── */
.back-link {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 16px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

/* ── Footer ──────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-inner a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-inner a:hover { color: var(--accent); }

/* ── Error Pages ─────────────────────────────── */
.error-page {
  min-height: calc(100vh - 200px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
}

.error-code {
  font-size: 8rem;
  font-weight: 200;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 16px;
}

.error-title {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.error-terminal {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 32px;
  padding: 24px 32px;
  border: 1px solid var(--border);
  text-align: left;
  max-width: 480px;
  width: 100%;
}
.error-terminal .e-prompt { color: var(--accent); }
.error-terminal .e-err { color: #c4554d; }
.error-terminal .e-comment { color: var(--text-muted); }

.error-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.error-actions {
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
}

.btn {
  padding: 10px 24px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  transition: border-color 0.2s, color 0.2s;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Scroll Reveal ───────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── View Transitions ────────────────────────── */
::view-transition-old(root) {
  animation: 0.3s ease both vt-fade-out;
}
::view-transition-new(root) {
  animation: 0.3s ease both vt-fade-in;
}
@keyframes vt-fade-out {
  to { opacity: 0; transform: translateY(-12px); }
}
@keyframes vt-fade-in {
  from { opacity: 0; transform: translateY(12px); }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
  :root { font-size: 15px; }
  .container { padding: 0 20px; }

  .main-nav {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 150;
  }
  .main-nav.active {
    opacity: 1;
    pointer-events: auto;
  }
  .main-nav .theme-toggle { margin-top: 8px; }

  .mobile-menu-toggle {
    display: block;
    position: relative;
    z-index: 160;
  }

  .page-header { padding: 120px 0 40px; }
  .page-header.with-photo { flex-direction: column-reverse; gap: 24px; align-items: center; text-align: center; }
  .profile-photo { width: 88px; height: 88px; }
  .content-section { padding-bottom: 60px; }

  .tl { padding-left: 20px; }
  .tl-dot { left: -23px; }

  .footer-inner {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .error-code { font-size: 5rem; }
  .error-terminal { padding: 16px 20px; }
}
