@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --fg: #1a1a1a;
  --fg-2: #555;
  --fg-3: #999;
  --bg: #fff;
  --bg-2: #f7f7f8;
  --bg-3: #f0f0f2;
  --border: #e5e5e5;
  --accent: #e8590c;
  --accent-hover: #d9480f;
  --r: 6px;
  --font: 'Source Serif 4', 'Noto Serif SC', Georgia, 'Songti SC', serif;
  --sans: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

[data-md-color-scheme="default"] {
  --md-default-bg-color: var(--bg);
  --md-default-fg-color: var(--fg);
  --md-default-fg-color--light: var(--fg-2);
  --md-default-fg-color--lighter: var(--fg-3);
  --md-primary-fg-color: var(--bg);
  --md-primary-bg-color: var(--fg);
  --md-accent-fg-color: var(--accent);
  --md-typeset-a-color: var(--accent);
  --md-code-bg-color: var(--bg-2);
  --md-code-fg-color: var(--fg);
  --md-footer-bg-color: var(--bg);
  --md-footer-fg-color: var(--fg-3);
}


body { font-family: var(--font); -webkit-font-smoothing: antialiased; color: var(--fg); }
.md-tabs { display: none; }

/* ── Header ── */
.md-header {
  background: var(--bg) !important;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}
.md-header__inner { padding: 0.4rem 0; }
.md-header__title { font-weight: 600; color: var(--fg); font-family: var(--sans); font-size: 0.9rem; }
.md-header[data-md-state="shadow"] { box-shadow: none; }

.md-search__form {
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-2); transition: border-color 150ms ease;
}
.md-search__form:hover, .md-search__form:focus-within { border-color: var(--fg-2); }

/* ── Typography ── */
.md-typeset {
  font-family: var(--font); font-size: 0.95rem;
  line-height: 1.8; color: var(--fg);
}
.md-typeset h1, .md-typeset h2, .md-typeset h3, .md-typeset h4 {
  font-family: var(--font); color: var(--fg);
}
.md-typeset h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.4rem; }
.md-typeset h2 {
  font-size: 1.3rem; font-weight: 700; margin-top: 2.5rem;
  padding-bottom: 0.6rem; border-bottom: 1px solid var(--border);
}
.md-typeset h3 { font-size: 1.05rem; font-weight: 700; }
.md-typeset a { color: var(--accent); text-decoration: none; }
.md-typeset a:hover { color: var(--accent-hover); text-decoration: underline; }


/* ── Nav (left sidebar) ── */
.md-nav { font-family: var(--sans); }
.md-nav__link { border-radius: 4px; font-size: 0.84rem; color: var(--fg-2); }
.md-nav__link:hover { color: var(--fg); }
.md-nav__item--active > .md-nav__link { color: var(--accent); font-weight: 600; }
.md-sidebar { padding-top: 0.8rem; }

/* ── TOC (right sidebar) ── */
.md-nav--secondary .md-nav__title { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; color: var(--fg-2); }
.md-nav--secondary .md-nav__link { font-size: 0.8rem; color: var(--fg-3); }
.md-nav--secondary .md-nav__link:hover { color: var(--accent); }
.md-nav--secondary .md-nav__item--active > .md-nav__link { color: var(--accent); }

/* ── Hero (homepage) ── */
.home-hero {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 2.5rem 2rem 2rem;
  margin-bottom: 2rem; text-align: center;
}
.home-hero h1 {
  color: var(--fg) !important; font-size: 2rem; font-weight: 700;
  margin: 0 0 0.5rem; border: none; padding: 0;
}
.home-hero p { color: var(--fg-2); font-size: 0.95rem; margin: 0; }

/* ── Cards ── */
.card-grid > ul, .card-row > ul {
  display: grid; grid-template-columns: 1fr; gap: 10px;
  list-style: none; margin: 0.5rem 0 0; padding: 0;
}
.card-grid > ul > li, .card-row > ul > li {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 1rem 1.2rem; background: var(--bg);
  transition: border-color 200ms ease; margin: 0;
}
.card-grid > ul > li:hover, .card-row > ul > li:hover { border-color: var(--accent); }


/* ── Code ── */
.md-typeset code {
  font-family: var(--mono); background: var(--bg-2);
  border-radius: 3px; font-size: 0.84em; color: var(--fg);
}
.md-typeset pre {
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-2);
}
.md-typeset pre code { background: transparent; }

/* ── Admonitions ── */
.md-typeset .admonition, .md-typeset details {
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: none; overflow: hidden;
}
.md-typeset .admonition-title, .md-typeset summary {
  border-bottom: 1px solid var(--border);
  background: var(--bg-2) !important; font-weight: 600;
}

/* ── Tables ── */
.md-typeset table:not([class]) {
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; font-size: 0.9rem;
}
.md-typeset table:not([class]) th {
  background: var(--bg-2); font-weight: 600; color: var(--fg-2);
}
.md-typeset table:not([class]) td { color: var(--fg-2); }

/* ── Footer ── */
.md-footer { border-top: 1px solid var(--border); background: var(--bg); }
.md-footer-meta { background: var(--bg); }

/* ── Layout ── */
.md-main__inner { margin-top: 0; }
.md-grid { max-width: 1600px; }

@media (min-width: 720px) {
  .card-grid > ul { grid-template-columns: repeat(2, 1fr); }
  .card-row > ul { grid-template-columns: repeat(3, 1fr); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

::selection { background: rgba(232, 89, 12, 0.15); }

/* ── Animations ── */

/* 页面内容淡入上滑 */
.md-content {
  animation: fadeSlideUp 0.4s ease both;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero 区域缩放淡入 */
.home-hero {
  animation: heroIn 0.5s ease both;
}
@keyframes heroIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* 卡片依次入场 */
.card-grid > ul > li,
.card-row > ul > li {
  opacity: 0;
  animation: cardIn 0.35s ease both;
}
.card-grid > ul > li:nth-child(1), .card-row > ul > li:nth-child(1) { animation-delay: 0.1s; }
.card-grid > ul > li:nth-child(2), .card-row > ul > li:nth-child(2) { animation-delay: 0.18s; }
.card-grid > ul > li:nth-child(3), .card-row > ul > li:nth-child(3) { animation-delay: 0.26s; }
.card-grid > ul > li:nth-child(4), .card-row > ul > li:nth-child(4) { animation-delay: 0.34s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 卡片 hover 微上浮 */
.card-grid > ul > li:hover,
.card-row > ul > li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.card-grid > ul > li,
.card-row > ul > li {
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

/* 链接下划线动画 */
.md-typeset a {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.25s ease, color 0.2s ease;
}
.md-typeset a:hover {
  background-size: 100% 1px;
  text-decoration: none;
}

/* 侧栏链接 hover 过渡 */
.md-nav__link {
  transition: color 0.15s ease, background 0.15s ease;
}

/* h2 分割线淡入 */
.md-typeset h2 {
  animation: h2In 0.4s ease both;
}
@keyframes h2In {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* 代码块 hover 边框变化 */
.md-typeset pre {
  transition: border-color 0.2s ease;
}
.md-typeset pre:hover {
  border-color: var(--fg-3);
}
