/* ============================================
   张飞扬个人网站 - 全局样式
   简约干净 · 黑白为主 · 排版优先
   ============================================ */

/* ---------- 1. Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

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

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* ---------- 2. CSS Variables (Theming) ---------- */
:root {
  /* Light mode (default) */
  --bg: #ffffff;
  --bg-secondary: #f7f7f8;
  --bg-card: #fafafa;
  --bg-hover: #f0f0f0;
  --text: #1a1a1a;
  --text-secondary: #5c5c5c;
  --text-tertiary: #999999;
  --border: #e8e8e8;
  --border-light: #f0f0f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-bg: rgba(37, 99, 235, 0.06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --max-width: 760px;
  --max-width-wide: 1080px;
  --header-height: 60px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #161616;
  --bg-secondary: #1e1e1e;
  --bg-card: #212121;
  --bg-hover: #2a2a2a;
  --text: #e5e5e5;
  --text-secondary: #a8a8a8;
  --text-tertiary: #707070;
  --border: #2e2e2e;
  --border-light: #262626;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-bg: rgba(96, 165, 250, 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ---------- 3. Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.2rem;
}

h4 {
  font-size: 1rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--text);
  font-weight: 600;
}

code {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.875em;
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--text);
}

/* ---------- 4. Layout ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  width: 100%;
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 64px 0;
}

.section-sm {
  padding: 40px 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: "";
  width: 4px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.text-center {
  text-align: center;
}

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 48px 0;
}

/* ---------- 5. Header / Navigation ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.header-inner {
  max-width: var(--max-width-wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.3s ease, color 0.3s ease;
}

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

.nav-link {
  padding: 8px 14px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent);
  font-weight: 500;
}

/* Theme Toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color 0.2s ease, background 0.2s ease;
  margin-left: 8px;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

/* Mobile menu button */
.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

/* ---------- 6. Hero Section ---------- */
.hero {
  padding: 96px 0 64px;
  text-align: center;
}

.hero-name {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-weight: 400;
}

.hero-title .dot {
  color: var(--accent);
  margin: 0 8px;
}

.hero-bio {
  max-width: 560px;
  margin: 0 auto 36px;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text-secondary);
}

/* ---------- 7. Tags / Badges ---------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.tag-group {
  margin-bottom: 20px;
}

.tag-group-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 20px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  cursor: default;
}

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

.tag-accent {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
}

/* ---------- 8. Navigation Cards (Home) ---------- */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 48px;
}

.nav-card {
  display: block;
  padding: 28px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.nav-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.nav-card:hover .nav-card-title {
  color: var(--accent);
}

.nav-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  transition: color 0.2s ease;
}

.nav-card-desc {
  font-size: 0.88rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.nav-card-arrow {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- 9. Cards (Projects, Blog) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-category {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-weight: 500;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-meta svg {
  width: 14px;
  height: 14px;
}

/* ---------- 10. Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 28px;
}

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

.timeline-item {
  position: relative;
  padding-bottom: 32px;
}

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

.timeline-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  z-index: 1;
}

.timeline-date {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 4px;
}

.timeline-role {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.timeline-org {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ---------- 11. Skills ---------- */
.skills-group {
  margin-bottom: 32px;
}

.skills-group-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ---------- 12. Honors / Achievements ---------- */
.honors-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.honor-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
}

.honor-item:hover {
  border-color: var(--accent);
}

.honor-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--accent);
}

.honor-badge svg {
  width: 18px;
  height: 18px;
}

.honor-date {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.honor-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
}

/* ---------- 13. Education ---------- */
.edu-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edu-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.edu-info h4 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.edu-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0;
}

.edu-degree {
  font-size: 0.82rem;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* ---------- 14. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
}

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

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

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- 15. About Page: Bio ---------- */
.bio {
  font-size: 1rem;
  line-height: 2;
  color: var(--text-secondary);
}

.bio p {
  margin-bottom: 1.2rem;
}

.bio strong {
  color: var(--text);
}

/* ---------- 16. Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}

.footer p {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin: 0;
}

.footer-link {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

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

/* ---------- 17. Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.25s ease;
  margin: auto 0;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-tertiary);
  transition: all 0.2s ease;
}

.modal-close:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-category {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-weight: 500;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-time {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.modal-section {
  margin-bottom: 24px;
}

.modal-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

.modal-section p,
.modal-section li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.modal-section ul {
  padding-left: 20px;
  list-style: disc;
}

.modal-section ul li {
  margin-bottom: 6px;
}

.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-tech .tag {
  font-size: 0.78rem;
  padding: 3px 10px;
}

/* ---------- 18. Search ---------- */
.search-bar {
  position: relative;
  margin-bottom: 28px;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

/* Blog filter tabs */
.filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: 20px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.filter-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-tab.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Search no results */
.no-results {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

/* ---------- 19. Contact Page ---------- */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.contact-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.contact-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--accent-bg);
  color: var(--accent);
}

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

.contact-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.contact-value {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

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

/* ---------- 20. Featured Projects (Home) ---------- */
.featured-section {
  padding: 48px 0 64px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ---------- 21. Animations ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* ---------- 22. Page Hero (sub-pages) ---------- */
.page-hero {
  padding: 56px 0 40px;
}

.page-hero h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.page-hero p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 520px;
}

/* ---------- 23. RSS link ---------- */
.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 16px;
}

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

.rss-link svg {
  width: 15px;
  height: 15px;
}

/* ---------- 24. Responsive ---------- */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .container,
  .container-wide {
    padding: 0 20px;
  }

  .header-inner {
    padding: 0 20px;
  }

  .nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    gap: 2px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
  }

  .nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    padding: 64px 0 48px;
  }

  .hero-name {
    font-size: 2rem;
  }

  .nav-cards {
    grid-template-columns: 1fr;
  }

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

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

  .section {
    padding: 48px 0;
  }

  .modal {
    padding: 28px 24px;
    margin: 0;
  }

  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal {
    border-radius: 0;
    min-height: 100vh;
  }

  .edu-item {
    flex-direction: column;
    gap: 8px;
  }

  .contact-item {
    padding: 18px 20px;
  }
}

@media (max-width: 480px) {
  .hero-name {
    font-size: 1.7rem;
  }

  .hero-title {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .tag-group-label {
    font-size: 0.75rem;
  }
}

/* ---------- 25. Utility ---------- */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mt-4 { margin-top: 32px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
