/* ==========================================================================
   MetroShiro · metro theme
   "cold paper" — 冷调纸面，墨色正文，只用发丝线分隔。
   没有卡片、圆角、阴影、渐变和毛玻璃：结构靠留白和 1px 线表达。
   ========================================================================== */

:root {
  color-scheme: light;

  /* surface */
  --bg: #f5f7f8;
  --ink: #171d21;
  --ink-2: #3c474d;
  --muted: #5f6b72;
  --faint: #8a959b; /* 只用于装饰性元素，不承载正文信息 */

  /* hairlines */
  --line: #e2e7e9;
  --line-strong: #c8d1d5;

  /* 全站唯一的彩色：钢蓝 */
  --accent: #4a6b7d;

  --code-bg: #edf1f3;
  --mark: #d9e6ed;

  --radius: 2px;
  --bar-h: 60px;
  --measure: 1080px;
}

/* 深色模式：同一套结构，冷调深色纸 */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0e1214;
    --ink: #e3e9eb;
    --ink-2: #b3bec3;
    --muted: #7d8a90;
    --faint: #5a666b;
    --line: #1f272b;
    --line-strong: #2e383d;
    --accent: #8fb2c4;
    --code-bg: #131a1d;
    --mark: #22323a;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei",
    sans-serif;
  font-size: 15.5px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--mark);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* 背景图默认关闭；在 _config.yml 里填路径会以很低的浓度显示 */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  opacity: .12;
  pointer-events: none;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.bar {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* 唯一的装饰：一个 7px 的方形记号 */
.brand::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  flex: none;
}

.nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
  font-size: 13.5px;
  letter-spacing: .02em;
}

.nav a {
  color: var(--muted);
  padding: 19px 0;
  position: relative;
  transition: color .2s ease;
}

.nav a:hover { color: var(--ink); }

.nav a.on { color: var(--ink); }

.nav a.on::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
}

.clock {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

/* ---------- layout ---------- */

.wrap {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
}

.home {
  flex: 1;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  padding: 48px 0 72px;
}

/* 没文章时把主体在视口里居中，避免上面堆一块、下面空一片 */
.home:has(.empty) {
  align-content: center;
  padding-bottom: 48px;
}

/* 主题里 .card 还挂在模板上，这里把它彻底摊平 */
.card {
  background: none;
  border: 0;
  border-radius: 0;
}

/* ---------- profile ---------- */

.profile {
  position: sticky;
  top: calc(var(--bar-h) + 28px);
  padding: 0;
  text-align: left;
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin-bottom: 14px;
  filter: grayscale(1) contrast(.95);
}

.name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .03em;
}

.lvl {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: .08em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 0 26px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
  letter-spacing: .02em;
}

.stats b {
  display: block;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 1px;
  font-variant-numeric: tabular-nums;
}

/* 归档 / 标签 / 分类：单列窄栏 */
.page-shell {
  flex: 1;
  align-self: center;
  width: 100%;
  max-width: 720px;
  padding: 60px 0 88px;
}

.page-head {
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.4;
  margin: 0 0 4px;
}

.page-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

/* ---------- feed ---------- */

.feed {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.section-title {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--faint);
  padding: 0 0 12px;
}

.empty {
  padding: 72px 24px 64px;
  text-align: center;
}

.empty-mark {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 32px;
  line-height: 1;
  color: var(--faint);
  margin-bottom: 18px;
  font-variant-numeric: tabular-nums;
}

.empty h2,
.empty h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: .02em;
}

.empty p {
  margin: 0 auto;
  max-width: 30em;
  font-size: 13.5px;
  color: var(--muted);
}

.post {
  padding: 26px 0 24px;
  border-top: 1px solid var(--line);
}

.post h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: .01em;
  line-height: 1.5;
}

.post h2 a { transition: color .2s ease; }

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

.excerpt {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-2);
  max-width: 60ch;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 14px;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
}

.more {
  margin-left: auto;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}

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

/* ---------- article ---------- */

.post-detail { padding: 0; }

.post-detail h1 {
  font-size: 27px;
  line-height: 1.35;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -.005em;
}

.post-detail .meta {
  margin-top: 0;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.content {
  margin-top: 26px;
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--ink-2);
}

.content h2 {
  font-size: 19px;
  margin: 38px 0 12px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: .01em;
}

.content h3 {
  font-size: 16px;
  margin: 30px 0 10px;
  color: var(--ink);
  font-weight: 600;
}

.content p { margin: 0 0 18px; }

.content a {
  color: var(--accent);
  border-bottom: 1px solid var(--line-strong);
  transition: border-color .2s ease;
}

.content a:hover { border-bottom-color: var(--accent); }

.content ul,
.content ol { padding-left: 22px; margin: 0 0 18px; }

.content li { margin-bottom: 6px; }

.content li::marker { color: var(--faint); }

.content blockquote {
  margin: 24px 0;
  padding: 2px 0 2px 18px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
}

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

.content img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.content code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: var(--radius);
  color: var(--ink);
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.75;
}

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

/* Hexo 自带的 figure.highlight：行号栏和代码合成一张卡 */
.content .highlight {
  margin: 24px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--code-bg);
  overflow: hidden;
}

.content .highlight table {
  width: auto;
  margin: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.8;
}

.content .highlight tr,
.content .highlight td { border: 0; padding: 0; }

.content .highlight pre {
  margin: 0;
  padding: 14px 0;
  background: none;
  border: 0;
  border-radius: 0;
  font-size: inherit;
  line-height: inherit;
}

.content .highlight .gutter {
  border-right: 1px solid var(--line);
  user-select: none;
}

.content .highlight .gutter pre {
  padding: 14px 14px 14px 16px;
  color: var(--faint);
}

.content .highlight .code pre { padding: 14px 18px; }

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

.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 20px;
}

.content thead th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line-strong);
}

.content th,
.content td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

.tags {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .02em;
}

.back {
  align-self: flex-start;
  font-size: 12.5px;
  color: var(--muted);
  padding: 22px 0 0;
  letter-spacing: .02em;
  transition: color .2s ease;
}

.back:hover { color: var(--ink); }

/* ---------- pager ---------- */

.pager {
  display: flex;
  justify-content: center;
  gap: 22px;
  padding: 26px 0 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.pager a,
.pager span {
  color: var(--muted);
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}

.pager a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }

.pager .current {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- footer ---------- */

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: var(--bg);
}

.foot {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 28px 24px 34px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
  letter-spacing: .02em;
}

.foot small {
  font-size: 11px;
  color: var(--muted);
}

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

.foot .mid strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 2px;
}

.foot .right { text-align: right; }

.foot .right span { display: block; }

.foot .right b {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- tag cloud ---------- */

.cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  padding: 4px 0 0;
}

.cloud-item {
  color: var(--ink-2);
  font-size: 14px;
  transition: color .2s ease;
}

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

.cloud-item span {
  color: var(--muted);
  font-size: 11px;
  margin-left: 5px;
  font-variant-numeric: tabular-nums;
}

/* ---------- motion ---------- */

a { transition: color .2s ease; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .bar { gap: 18px; padding: 0 20px; }
  .nav { gap: 18px; font-size: 13px; }
  .clock { display: none; }
  .wrap { padding: 0 20px; }

  .home {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
    padding: 32px 0 56px;
  }

  .profile {
    position: static;
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0 16px;
    align-items: center;
    text-align: left;
  }

  .avatar {
    width: 56px;
    height: 56px;
    margin: 0;
    grid-row: span 2;
  }

  .name { align-self: end; }
  .lvl { align-self: start; }

  .stats {
    grid-column: 1 / -1;
    margin-top: 16px;
    padding-top: 12px;
    gap: 0 28px;
  }

  .page-shell { padding: 44px 0 64px; }
  .post { padding: 22px 0 20px; }
  .post-detail h1 { font-size: 22px; }
  .empty { padding: 56px 16px 48px; }

  .foot {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 14px;
  }
  .foot .right { text-align: center; }
  .foot .right span { display: inline-block; margin: 0 10px; }
}

@media (max-width: 560px) {
  .bar {
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 16px 0;
    gap: 0;
  }

  .brand { font-size: 15px; }

  .nav {
    width: 100%;
    margin: 2px 0 0;
    gap: 22px;
    font-size: 13px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar { display: none; }

  .nav a { padding: 7px 0 10px; white-space: nowrap; }

  .wrap { padding: 0 16px; }

  .content { font-size: 15px; }
}
