/* MarkAI 使用说明 · 明风说-1（对齐 docs-ming-home-v1）· 电脑/手机自适应 */

:root {
  --bg: #eef3e8;
  --bg-deep: #e4ebe0;
  --paper: #fbf8f1;
  --ink: #1a1a18;
  --muted: #5c5c54;
  --line: #ddd4c4;
  --accent: #4a6b52;
  --accent-soft: #e4efe6;
  --jade: #6b8f71;
  --gold: #c4a35a;
  --radius: 14px;
  --max-text: 44rem;
  --sidebar-w: 15rem;
  --topbar-h: 3.4rem;
  --font: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* 说-1 庭院山水底（来自 docs-ming-home-v1 气质） */
.site-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    url("../assets/bg-ming.jpg") center / cover no-repeat,
    linear-gradient(180deg, #f3f6ef 0%, var(--bg) 50%, var(--bg-deep) 100%);
}

.site-bg-veil {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(243, 246, 239, 0.35) 0%,
    rgba(238, 243, 232, 0.2) 40%,
    rgba(228, 235, 224, 0.45) 100%
  );
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration: none;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* —— 顶栏 —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  background: rgba(251, 248, 241, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand-logo {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  min-width: 2.75rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

/* —— 布局 —— */
.layout {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: min(86vw, var(--sidebar-w));
  background: rgba(251, 248, 241, 0.88);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(6px);
  padding: 1.1rem 0.75rem 2rem;
  overflow-y: auto;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  z-index: 35;
}

body.nav-open .sidebar {
  transform: translateX(0);
}

.backdrop {
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 30;
}

.sidebar-label {
  margin: 0 0.65rem 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-display);
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9375rem;
  min-height: 2.5rem;
}

.sidebar a:hover {
  background: rgba(74, 107, 82, 0.08);
}

.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.main {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 1rem;
}

.article {
  max-width: calc(var(--max-text) + 2.5rem);
  margin: 0 auto;
  background: rgba(251, 248, 241, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.15rem 2rem;
  box-shadow: 0 8px 28px rgba(60, 70, 50, 0.06);
  backdrop-filter: blur(4px);
}

.article-head h1 {
  margin: 0 0 0.85rem;
  font-size: 1.65rem;
  line-height: 1.3;
  font-family: var(--font-display);
}

/* —— 本页目录 —— */
.toc {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  background: rgba(238, 243, 232, 0.65);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.toc-title {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.1rem;
}

.toc li {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.toc-l3 {
  margin-left: 0.75rem;
}

/* —— 正文 —— */
.content > *:first-child {
  margin-top: 0;
}

.content h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.28rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
}

.content h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.08rem;
}

.content h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1rem;
}

.content p,
.content ul,
.content ol {
  margin: 0.65rem 0;
}

.content li {
  margin: 0.25rem 0;
}

.content blockquote {
  margin: 1rem 0;
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--jade);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 0 8px 8px 0;
}

.content blockquote p {
  margin: 0.35rem 0;
}

.content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 1.75rem 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 1rem 0;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.content th,
.content td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.content th {
  background: rgba(238, 243, 232, 0.8);
  font-weight: 600;
}

.content pre {
  overflow-x: auto;
  padding: 0.85rem 1rem;
  background: #1e1e1e;
  color: #f2f2f2;
  border-radius: 8px;
  font-size: 0.85rem;
}

.content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* —— 截图 —— */
.shot {
  margin: 1.1rem 0;
  padding: 0;
  text-align: center;
}

.shot img {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: zoom-in;
}

.shot.img-sm img {
  max-width: min(100%, 220px);
}

.shot.img-md img {
  max-width: min(100%, 320px);
}

.shot.img-lg img {
  max-width: min(100%, 420px);
}

.shot-link {
  display: inline-block;
  text-decoration: none;
}

/* —— 首页 —— */
.home-hero {
  margin-bottom: 1.75rem;
}

.home-kicker {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.15rem 0.7rem;
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(74, 107, 82, 0.25);
  border-radius: 999px;
}

.home-hero h1 {
  margin: 0 0 0.55rem;
  font-size: 1.85rem;
  line-height: 1.25;
  font-weight: 700;
  font-family: var(--font-display);
}

.home-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  max-width: 36rem;
}

.home-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-card {
  border-top: 1px solid var(--line);
}

.home-card:last-child {
  border-bottom: 1px solid var(--line);
}

.home-card a {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 0.15rem;
  text-decoration: none;
  color: inherit;
  min-height: 3.25rem;
}

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

.home-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  min-width: 1.75rem;
  line-height: 1.5;
  padding-top: 0.05rem;
}

.home-card-title {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
  transition: color 0.15s ease;
}

.home-card-desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.home-note {
  margin-top: 1.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* —— 翻页 —— */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.9375rem;
}

.pager a {
  text-decoration: none;
  max-width: 48%;
  padding: 0.35rem 0;
  min-height: 2.5rem;
}

.pager-next {
  text-align: right;
  margin-left: auto;
}

.site-footer {
  max-width: calc(var(--max-text) + 2.5rem);
  margin: 1.25rem auto 0;
  padding: 0 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

/* —— 灯箱 —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(10, 10, 10, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(100%, 720px);
  max-height: 92vh;
  border-radius: 6px;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.75rem;
  height: 2.75rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

/* —— 桌面 —— */
@media (min-width: 900px) {
  .nav-toggle {
    display: none;
  }

  .sidebar {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    transform: none;
    flex-shrink: 0;
    width: var(--sidebar-w);
    margin: 1rem 0 1rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(251, 248, 241, 0.92);
    box-shadow: 0 6px 20px rgba(60, 70, 50, 0.05);
  }

  .backdrop {
    display: none !important;
  }

  .main {
    padding: 1.5rem 2rem 3.5rem;
  }

  .article {
    padding: 1.85rem 2.1rem 2.5rem;
  }

  .article-head h1,
  .home-hero h1 {
    font-size: 2rem;
  }

  .home-card a {
    padding: 1.05rem 0.25rem;
  }
}
