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

/* ---- Light Theme (Parchment) ---- */
[data-theme="light"] {
  --color-bg: #f5f4ed;
  --color-surface: #faf9f5;
  --color-surface-hover: #f0eee6;
  --color-text: #141413;
  --color-text-secondary: #5e5d59;
  --color-muted: #87867f;
  --color-border: #f0eee6;
  --color-border-strong: #e8e6dc;
  --color-accent: #c96442;
  --color-accent-hover: #d97757;
  --color-accent-soft: rgba(201, 100, 66, 0.08);
  --color-ring: #d1cfc5;
  --shadow-whisper: rgba(0, 0, 0, 0.05) 0px 4px 24px;
}

/* ---- Dark Theme (Near Black) ---- */
[data-theme="dark"] {
  --color-bg: #141413;
  --color-surface: #30302e;
  --color-surface-hover: #3d3d3a;
  --color-text: #faf9f5;
  --color-text-secondary: #b0aea5;
  --color-muted: #87867f;
  --color-border: #30302e;
  --color-border-strong: #4d4c48;
  --color-accent: #d97757;
  --color-accent-hover: #c96442;
  --color-accent-soft: rgba(217, 119, 87, 0.12);
  --color-ring: #4d4c48;
  --shadow-whisper: rgba(0, 0, 0, 0.2) 0px 4px 24px;
}

:root {
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max-width: 860px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ---- Header ---- */

header {
  padding: 24px 24px;
}

nav {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--color-text);
  min-width: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: var(--shadow-whisper);
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 8px 4px;
}

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

.nav-link-active {
  color: var(--color-text);
}

.theme-toggle,
.lang-toggle {
  background: var(--color-surface);
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--color-surface) 0px 0px 0px 0px, var(--color-ring) 0px 0px 0px 1px;
}

.theme-toggle { width: 36px; }

.lang-toggle {
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
}

.theme-toggle:hover,
.lang-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
}

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

/* ---- Language Toggle ---- */
[data-lang="zh"] .lang-zh { display: inline; }
[data-lang="zh"] .lang-en { display: none; }
[data-lang="en"] .lang-zh { display: none; }
[data-lang="en"] .lang-en { display: inline; }

/* ---- Main ---- */

main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ---- Hero ---- */

.hero {
  text-align: center;
  padding: 80px 0 60px;
}

.hero-logo {
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: 36px;
  box-shadow: var(--shadow-whisper);
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: 3.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.10;
  margin-bottom: 12px;
  color: var(--color-text);
}

.hero .subtitle {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  font-weight: 400;
  line-height: 1.7;
  margin-bottom: 24px;
}

.slogan-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slogan-line {
  display: block;
}

.slogan-highlight {
  color: var(--color-accent);
  font-weight: 500;
  margin-top: 8px;
}

.hero-links {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn {
  display: inline-block;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  line-height: 1.25;
}

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

.btn-brand:hover {
  background: var(--color-accent-hover);
}

.btn-surface {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: none;
  box-shadow: var(--color-surface) 0px 0px 0px 0px, var(--color-ring) 0px 0px 0px 1px;
}

.btn-surface:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* ---- Sections ---- */

.section {
  padding: 60px 0;
}

.section + .section {
  border-top: 1px solid var(--color-border);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text);
  margin-bottom: 24px;
  text-align: left;
}

/* ---- Featured Card ---- */

.featured-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  gap: 20px;
  align-items: center;
  box-shadow: var(--shadow-whisper);
  min-width: 0;
}

.featured-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.project-logo {
  object-fit: cover;
  overflow: hidden;
}

.featured-body {
  flex: 1;
  min-width: 0;
}

.featured-body h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 4px;
}

.featured-body h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.featured-body h3 a:hover {
  color: var(--color-accent);
}

.featured-body p {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ---- Project Grid ---- */

.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.project-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  padding: 20px 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  min-width: 0;
}

.project-card:hover {
  background: var(--color-surface-hover);
  box-shadow: var(--color-surface) 0px 0px 0px 0px, var(--color-ring) 0px 0px 0px 1px;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-body h3 {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 24px;
  white-space: nowrap;
}

.tag-accent {
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.tag-success {
  color: #5a8a5e;
  background: rgba(90, 138, 94, 0.1);
}

.tag-muted {
  color: var(--color-muted);
  background: transparent;
  box-shadow: inset 0px 0px 0px 1px var(--color-ring);
  border: none;
}

.project-card p {
  font-size: 0.8125rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ---- About Page ---- */

.about-main {
  padding-top: 20px;
}

.about-hero {
  padding: 24px 0 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.about-avatar {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: var(--shadow-whisper);
}

.about-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.about-name {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.2;
}

.about-links-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 28px;
}

.about-link-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 18px 14px;
  border-radius: 20px;
  text-decoration: none;
  color: #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  min-height: 144px;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(25, 25, 25, 0.1);
  width: clamp(180px, 22vw, 240px);
  flex: 0 0 auto;
}

.about-link-card::after {
  content: "";
  position: absolute;
  inset: auto -15% -42% auto;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(8px);
  pointer-events: none;
}

.about-link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(25, 25, 25, 0.14);
}

.about-link-github {
  background: linear-gradient(160deg, #2f313d 0%, #17181f 100%);
}

.about-link-email {
  background: linear-gradient(160deg, #25457d 0%, #10255a 100%);
  width: clamp(220px, 28vw, 320px);
}

.about-link-xiaohongshu {
  background: linear-gradient(160deg, #ff4b6e 0%, #ff2347 100%);
}

.about-link-blog {
  background: linear-gradient(135deg, #5a8a5e, #3d6b40);
}

.about-link-card svg {
  position: relative;
  z-index: 1;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22));
}

.about-link-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.about-link-label {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.about-link-sub {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.82;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.about-bio {
  max-width: 600px;
  margin-bottom: 28px;
  text-align: center;
}

.about-intro-line {
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  color: var(--color-text-secondary);
  line-height: 1.8;
}

.about-intro-line + .about-intro-line {
  margin-top: 6px;
}

.about-lead {
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  color: var(--color-text-secondary);
  line-height: 1.8;
}

.about-section {
  margin-top: 22px;
  width: 100%;
  max-width: 640px;
}

.about-section + .about-section {
  padding-top: 28px;
  border-top: 1px solid var(--color-border);
}

.about-section-intro {
  margin-top: 0;
}

.about-section-intro .about-bio {
  margin-bottom: 0;
}

.about-section h4 {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  text-align: center;
}

.about-card-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: 12px;
  justify-content: center;
}

.about-section-social .about-card-grid {
  grid-template-columns: repeat(3, 176px);
  gap: 16px;
}

.about-card-grid-compact {
  grid-template-columns: 320px;
  justify-content: center;
}

.about-card-item {
  min-width: 0;
  width: 100%;
}

.about-card-link {
  min-height: 92px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
  appearance: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.about-section-social .about-card-link {
  min-height: 132px;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.about-card-link:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text);
  transform: translateY(-1px);
}

.about-card-link.is-disabled {
  color: var(--color-muted);
  cursor: default;
}

.about-card-badge {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.about-card-badge-github {
  background: linear-gradient(135deg, #2f313d, #17181f);
}

.about-card-badge-wechat {
  background: linear-gradient(135deg, #4faa5a, #2f8d43);
}

.about-card-badge-xiaohongshu {
  background: linear-gradient(135deg, #ff5f7c, #ff3358);
}

.about-card-badge-email {
  background: linear-gradient(135deg, #6f7b8f, #4f5968);
}

.about-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-text);
}

.about-section-social .about-card-title {
  font-size: 0.9rem;
}

.about-card-sub {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--color-muted);
  overflow-wrap: anywhere;
}

.about-section-social .about-card-sub {
  display: none;
}

.about-support-copy {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
  text-align: center;
  font-weight: 400;
}

.about-support-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
  box-shadow: inset 0 0 0 1px rgba(201, 100, 66, 0.18);
}

.about-support-link:hover {
  color: var(--color-accent-hover);
  background: rgba(201, 100, 66, 0.12);
}

.about-contact-list {
  list-style: none;
  display: flex;
  justify-content: center;
}

.about-contact-item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-secondary);
}

.about-contact-label {
  color: var(--color-muted);
}

.about-contact-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  font-family: var(--font-sans);
  letter-spacing: 0;
  display: inline-block;
}

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

.about-support-block {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-support-title {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  text-align: center;
}

.about-qrcode {
  width: min(100%, 260px);
  border-radius: 18px;
  border: 1px solid var(--color-border);
  background: #fff;
  box-shadow: var(--shadow-whisper);
}

.modal-open {
  overflow: hidden;
}

.about-modal[hidden] {
  display: none;
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.about-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 19, 0.45);
  backdrop-filter: blur(4px);
}

.about-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(92vw, 520px);
  margin: 8vh auto 0;
  padding: 20px;
  border-radius: 22px;
  background: var(--color-surface);
  box-shadow: rgba(0, 0, 0, 0.18) 0px 20px 60px;
}

.about-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
}

.about-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  margin-bottom: 14px;
}

.about-modal-image {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
}

/* ---- Footer ---- */

footer {
  padding: 60px 24px 32px;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

footer p {
  font-size: 0.75rem;
  color: var(--color-muted);
  letter-spacing: 0.12px;
}

/* ---- Responsive ---- */

@media (min-width: 768px) {
  .project-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero h1 {
    font-size: 4rem;
  }
}

@media (max-width: 767px) and (min-width: 480px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .featured-card {
    padding: 20px 22px;
  }
}

@media (max-width: 767px) {
  main {
    padding: 0 20px;
  }

  .section {
    padding: 44px 0;
  }

  .hero {
    padding: 56px 0 44px;
  }

  .hero .subtitle {
    font-size: 1.0625rem;
    line-height: 1.65;
  }

  .featured-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-card {
    padding: 18px 18px;
  }

  .about-main {
    padding-top: 8px;
  }

  .about-hero {
    padding: 12px 0 48px;
  }

  .about-links-grid {
    gap: 12px;
  }

  .about-section-social .about-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 479px) {
  .project-grid {
    grid-template-columns: 1fr;
  }

  header {
    padding: 20px 16px;
  }

  nav {
    gap: 12px;
    align-items: flex-start;
  }

  .brand {
    gap: 10px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .brand-name {
    font-size: 1rem;
  }

  .nav-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .nav-link,
  .lang-toggle,
  .theme-toggle {
    min-height: 40px;
  }

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

  .hero-logo {
    width: 120px;
    height: 120px;
    border-radius: 28px;
    margin-bottom: 16px;
  }

  .hero-links {
    width: 100%;
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .project-card {
    flex-direction: column;
    gap: 12px;
  }

  .about-link-card {
    width: min(100%, 240px);
    min-height: 128px;
    padding: 16px 16px 14px;
  }

  .about-link-email {
    width: min(100%, 280px);
  }

  .about-section-social .about-card-grid {
    gap: 10px;
  }

  .about-section-social .about-card-link {
    min-height: 104px;
    padding: 12px 10px;
  }

  .about-section-social .about-card-badge {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 0.85rem;
  }

  .about-section-social .about-card-title {
    font-size: 0.82rem;
  }

  .about-contact-item {
    font-size: 0.95rem;
  }

  .about-qrcode {
    border-radius: 16px;
  }
}
