/* ============================================================
   AstroPaper 主题 · theme-astro-paper.css
   设计还原自 AstroPaper v6（satnaing/astro-paper）
   配色：浅色 #fdfdfd / #282728 / 强调 #006cac
         深色 #212737 / #eaedf3 / 强调 #ff6b01
   ============================================================ */

:root {
  --background: #fdfdfd;
  --foreground: #282728;
  --accent-foreground: #ffffff;
  --muted: #e6e6e6;
  --muted-foreground: #6b7280;
  --border: #ece9e9;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
}

html.dark {
  --background: #212737;
  --foreground: #eaedf3;
  --accent-foreground: #ffffff;
  --muted: #343f60;
  --muted-foreground: #afb9ca;
  --border: #ab4b08;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

::selection { background: var(--accent); color: var(--accent-foreground); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- 布局骨架 ---------- */

.t-container {
  width: 100%;
  max-width: 48rem; /* max-w-3xl */
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.t-main { flex: 1 1 auto; padding-top: .25rem; padding-bottom: 2.5rem; }

/* 跳转正文（无障碍） */
.t-skip {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 50;
  padding: .5rem .75rem;
  background: var(--background);
  color: var(--accent);
  transition: top .15s ease;
}
.t-skip:focus { top: 1rem; }

/* ---------- 页头 ---------- */

.t-header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.t-brand {
  width: 100%;
  padding: 1rem 0;
  font-size: 1.25rem;
  line-height: 2rem;
  font-weight: 600;
  white-space: nowrap;
}

.t-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-bottom: 1rem;
  font-weight: 500;
}

.t-nav a {
  transition: color .15s ease;
  text-underline-offset: 8px;
  text-decoration-thickness: 2px;
}
.t-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: wavy;
}

.t-rss svg, #dark-toggle svg { width: 1.25rem; height: 1.25rem; }
.t-rss { display: inline-flex; color: var(--accent); }

/* 深浅切换按钮（官方 theme.js 接管点击） */
#dark-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
#dark-toggle:hover { color: var(--accent); }
#dark-toggle .icon-dark { display: none; }
html.dark #dark-toggle .icon-dark { display: block; }
html.dark #dark-toggle .icon-light { display: none; }

/* ---------- 首页 Hero ---------- */

.t-hero {
  padding-top: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.t-hero-row {
  display: flex;
  align-items: baseline;
  gap: .5rem;
}

.t-hero-title {
  display: inline-block;
  margin: 1rem 0;
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.t-hero-rss {
  display: inline-flex;
  color: var(--accent);
}
.t-hero-rss svg { width: 1.25rem; height: 1.25rem; }
.t-hero-rss:hover { opacity: .75; }

.t-hero-desc { margin: 0; color: var(--foreground); }

/* ---------- 分类栏（cats.html 兜底之外的微调） ---------- */

.t-section { padding-top: 2rem; }

.t-section-title {
  margin: 0 0 .5rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: .025em;
}

/* ---------- 文章列表（AstroPaper Card 风格） ---------- */

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

.t-card { margin: 1.5rem 0; }

.t-card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.t-card-title a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-style: dashed;
  text-underline-offset: 4px;
  transition: text-decoration-color .15s ease;
}
.t-card-title a:hover { text-decoration-color: var(--accent); }

/* 封面：容器固定尺寸，原图比例不影响卡片高度（自检 10） */
.t-card-cover {
  display: block;
  height: 10rem;
  margin-bottom: .75rem;
  border: 1px solid var(--border);
  overflow: hidden;
}
.t-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.t-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: .25rem 0;
  color: var(--muted-foreground);
  font-size: .875rem;
}

.t-card-date {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}
.t-card-date svg { width: 1rem; height: 1rem; flex: none; }

.t-cat {
  padding: .05rem .5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-foreground);
  font-size: .75rem;
  transition: color .15s ease, border-color .15s ease;
}
.t-cat:hover { color: var(--accent); border-color: var(--accent); }

.t-card-summary {
  margin: .25rem 0 0;
  overflow-wrap: anywhere;
}

.t-empty {
  padding: 2rem 0;
  color: var(--muted-foreground);
}

/* ---------- 文章页 ---------- */

.t-back {
  display: inline-block;
  margin: 1.25rem 0 0;
  color: var(--muted-foreground);
  font-size: .875rem;
  transition: color .15s ease;
}
.t-back:hover { color: var(--accent); }

.t-post { padding-top: .5rem; }

.t-post-title {
  margin: .5rem 0;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.t-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: .5rem 0 0;
  color: var(--muted-foreground);
  font-size: .875rem;
}

.t-draft {
  padding: .05rem .5rem;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: .75rem;
}

.t-post-cover {
  height: 14rem;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  overflow: hidden;
}
.t-post-cover img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 正文排版（平台 nb-* 类，兜底在 blog-shared.css） ---------- */

.t-prose { font-size: 1rem; overflow-wrap: anywhere; }

.t-prose a, .t-prose .nb-link {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 4px;
  transition: color .15s ease;
}
.t-prose a:hover, .t-prose .nb-link:hover { color: var(--accent); }

.t-prose .nb-h2, .t-prose .nb-h3, .t-prose .nb-h4 {
  color: var(--foreground);
  font-weight: 700;
  line-height: 1.35;
  margin: 1.75rem 0 .75rem;
}
.t-prose .nb-h2 { font-size: 1.5rem; }
.t-prose .nb-h3 { font-size: 1.25rem; font-style: italic; }
.t-prose .nb-h4 { font-size: 1.125rem; }

.t-prose .nb-p { margin: .75rem 0; }

.t-prose strong { color: var(--foreground); font-weight: 700; }

.t-prose .nb-quote {
  margin: 1rem 0;
  padding: .25rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted-foreground);
  font-style: italic;
}

.t-prose .nb-code {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: .375rem;
  background: var(--muted);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.7;
  overflow-x: auto;
}
.t-prose .nb-code code { background: transparent; padding: 0; }

.t-prose code {
  padding: .1rem .35rem;
  border-radius: .25rem;
  background: var(--muted);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: .875em;
}

.t-prose .nb-list { margin: .75rem 0; padding-left: 1.5rem; }
.t-prose .nb-list li { margin: .25rem 0; }
.t-prose .nb-list li::marker { color: var(--accent); }

.t-prose .nb-image {
  margin: 1.25rem auto;
  border: 1px solid var(--border);
}
.t-prose .nb-image img { margin: 0 auto; }

.t-prose .nb-table-wrap { margin: 1rem 0; overflow-x: auto; }
.t-prose .nb-table { border-collapse: collapse; width: 100%; }
.t-prose .nb-table th, .t-prose .nb-table td {
  border: 1px solid var(--border);
  padding: .5rem;
}
.t-prose .nb-table th { padding-top: .375rem; padding-bottom: .375rem; }

.t-prose hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

.t-prose del { color: var(--muted-foreground); }

/* ---------- 上一篇 / 下一篇 ---------- */

.t-around {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.t-around-item {
  display: flex;
  flex-direction: column;
  max-width: 48%;
  overflow-wrap: anywhere;
}
.t-around-next { margin-left: auto; text-align: right; }

.t-around-item small { color: var(--muted-foreground); font-size: .75rem; }
.t-around-item b { font-weight: 500; transition: color .15s ease; }
.t-around-item:hover b { color: var(--accent); }

/* ---------- 推荐阅读 ---------- */

.t-recommend { margin-top: 2.5rem; }
.t-recommend .t-card { margin: 1rem 0; }

/* ---------- 评论区（simple 主题 partial 输出 nb-comment* 类，需主题自带样式） ---------- */

.t-comments { margin-top: 2.5rem; }

.nb-comments { margin-top: 0; padding-top: 1.25rem; }

.nb-comments-title {
  margin: 0 0 .5rem;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: .025em;
}

.nb-comment {
  display: flex;
  gap: .625rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}

.nb-comment-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.nb-comment-avatar-ph { background: var(--muted); display: inline-block; }

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

.nb-comment-head {
  display: flex;
  gap: .5rem;
  align-items: baseline;
  font-size: .875rem;
}

.nb-comment-time {
  color: var(--muted-foreground);
  font-size: .75rem;
}

.nb-comment-content {
  margin-top: .25rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.nb-comment-del {
  border: none;
  background: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: .75rem;
}
.nb-comment-del:hover { opacity: .8; }

.nb-comment-hint {
  color: var(--muted-foreground);
  font-size: .875rem;
  padding: .5rem 0;
  margin: 0;
}

.nb-comment-form { margin-top: 1rem; }

.nb-comment-form textarea {
  width: 100%;
  padding: .625rem .75rem;
  border: 1px solid var(--border);
  border-radius: .375rem;
  background: var(--background);
  color: var(--foreground);
  font-family: inherit;
  font-size: .875rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color .15s ease;
}
.nb-comment-form textarea::placeholder { color: var(--muted-foreground); }
.nb-comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.nb-comment-btn {
  margin-top: .5rem;
  padding: .4375rem 1.125rem;
  border: none;
  border-radius: .375rem;
  background: var(--accent);
  color: var(--accent-foreground);
  cursor: pointer;
  font-family: inherit;
  font-size: .875rem;
  transition: opacity .15s ease;
}
.nb-comment-btn:hover { opacity: .9; }

.nb-comment-login {
  color: var(--accent);
  font-size: .875rem;
}

/* ---------- 页脚 ---------- */

.t-footer { margin-top: auto; }

.t-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: .25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  font-size: .875rem;
  white-space: nowrap;
}
.t-footer-inner p { margin: 0; }
.t-footer-inner a { transition: color .15s ease; }
.t-footer-inner a:hover { color: var(--accent); }

/* ---------- 分页器微调（兜底样式在 blog-shared.css） ---------- */

nav.pagination, .pagination { margin-top: 2rem; }

/* ---------- 移动端适配（375px 无横向溢出，自检 09） ---------- */

@media (min-width: 640px) {
  .t-header-inner {
    flex-direction: row;
    align-items: center;
  }
  .t-brand { width: auto; padding: 1.5rem 0; font-size: 1.5rem; line-height: 1; }
  .t-nav { padding-bottom: 0; }
  .t-hero-title { font-size: 3rem; }
  .t-footer-inner { flex-direction: row-reverse; }
}

@media (max-width: 480px) {
  .t-card-cover { height: 9rem; }
  .t-post-cover { height: 11rem; }
  .t-hero-title { font-size: 2rem; }
  .t-post-title { font-size: 1.5rem; }
  .t-around { flex-direction: column; }
  .t-around-item { max-width: 100%; }
  .t-around-next { margin-left: 0; text-align: left; }
  .t-nav { gap: .9rem; }
}
