/* ==========================================================================
   余剑锰个人主页 - 深色科技风
   ========================================================================== */

:root,
[data-theme="dark"] {
  --background: #0b1220;
  --background-2: #101827;
  --foreground: #e5e7eb;
  --accent: #22d3ee;
  --accent-2: #3b82f6;
  --muted: #1f2937;
  --muted-foreground: #94a3b8;
  --border: #1f2937;
  --card: #111827;
  --danger: #f87171;
}

[data-theme="light"] {
  --background: #f8fafc;
  --background-2: #eef2f7;
  --foreground: #1f2937;
  --accent: #0284c7;
  --accent-2: #2563eb;
  --muted: #e2e8f0;
  --muted-foreground: #64748b;
  --border: #dbe2ea;
  --card: #ffffff;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
    "Hiragino Sans GB", sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: var(--muted);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.92em;
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}

.wrap {
  width: min(1080px, 100% - 3rem);
  margin: 0 auto;
}

section {
  padding: 3.25rem 0 0.5rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
}

.section-title::before {
  content: "// ";
  color: var(--accent);
}

/* ===== 顶部导航 ===== */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.9rem 0;
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.top .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: min(1080px, 100% - 3rem);
}

.brand {
  color: var(--foreground);
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand::before {
  content: "// ";
  color: var(--accent);
}

.brand:hover {
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.86rem;
}

.nav a {
  color: var(--muted-foreground);
}

.nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

#page-theme {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--foreground);
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

#page-theme:hover {
  border-color: var(--accent);
}

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 5rem 0 2rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2.4rem, 7vw, 4.5rem);
  font-weight: 750;
  line-height: 1.05;
  letter-spacing: -0.04em;
  background: linear-gradient(120deg, var(--foreground) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lead {
  margin: 0 auto 2rem;
  color: var(--muted-foreground);
  font-size: 1.05rem;
  max-width: 52ch;
}

.social {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--foreground);
  background: var(--card);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1220;
  font-weight: 600;
}

.btn-accent:hover {
  filter: brightness(1.1);
  color: #0b1220;
}

.status {
  min-height: 1.4rem;
  margin: 1rem 0 0;
  color: var(--accent);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.status.show {
  opacity: 1;
}

/* ===== 正文 ===== */
.prose p {
  margin: 0 0 1rem;
  max-width: 70ch;
}

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

/* ===== 时间线 ===== */
.timeline {
  display: grid;
  gap: 1.25rem;
}

.timeline-item {
  border-left: 2px solid var(--border);
  padding: 0 0 0.25rem 1.25rem;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.4rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.timeline-item h3 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}

.timeline-item .meta {
  margin: 0 0 0.4rem;
  color: var(--muted-foreground);
  font-size: 0.85rem;
}

.timeline-item p {
  margin: 0;
}

.timeline-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted-foreground);
}

.timeline-list li {
  margin: 0.35rem 0;
}

/* ===== 技能 ===== */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--muted) 45%, var(--background));
  color: var(--foreground);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
}

/* ===== 卡片网格 ===== */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.repo-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 1.15rem 1.2rem;
  transition: transform 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.repo-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 30px -18px rgb(0 0 0 / 0.55);
}

.repo-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  word-break: break-word;
}

.repo-card .desc {
  margin: 0 0 1rem;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  flex-grow: 1;
}

.repo-card .topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.topic {
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.repo-card .foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.repo-card .stats {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.repo-card .links {
  display: flex;
  gap: 0.85rem;
}

.repo-link {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

.state {
  color: var(--muted-foreground);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* ===== 联系方式 ===== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 1.1rem 1.2rem;
}

.contact-label {
  color: var(--muted-foreground);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-card strong {
  overflow-wrap: anywhere;
}

.btn-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* ===== Footer ===== */
.bottom {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

.bottom .wrap {
  padding: 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted-foreground);
}

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .nav {
    display: none;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-top: 3.5rem;
  }

  section {
    padding-top: 2.5rem;
  }

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