/* ==========================================================================
   halo-v5ai-theme · 内页样式（pages.css）
   依赖 theme.css 的令牌与外壳类，本文件不重复定义任何颜色 / 字体 / 圆角令牌。
   ------------------------------------------------------------------------
   方向 1「精密界面」的内页延展：
   · 外壳类（.wrap .page-head .posts .post .foot …）全部来自 theme.css，此处只补内页
   · 阅读列 736px，正文 17px / 行高 1.8；字阶 14 / 16 / 17 / 18 / 20 / 24 / 28 / 32
   · 层级靠间距与 1px 规则线，不靠字重、不靠底色块
   · 等宽字只出现在技术元信息：日期、字数、计数、年份、月份、错误码
   · 深色模式：html[data-theme="dark"] 已由 theme.css 覆盖同名令牌，本文件不必再写
   ========================================================================== */

/* 内容不足一屏时，页脚仍然落在视口底部附近（404 / 空列表） */
#main { min-height: 62vh; }

/* ============================ 阅读列 ============================ */
.col {
  width: 100%;
  max-width: 736px;
  margin: 0 auto;
  padding: 0 24px;
}

/* 内页标题区：追加的 kicker（小字元信息）与计数 */
.page-head .kicker {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.page-head .kicker a { text-decoration: none; }
.page-head .kicker a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.page-head .page-desc { font-size: 16px; line-height: 1.8; }

/* ============================ 文章页 ============================ */
.article { padding: 44px 0 0; }

.article-head .col { padding-bottom: 30px; }

.article-kicker {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.article-kicker a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.article-kicker a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.article-kicker span + span::before { content: "/"; padding: 0 8px; color: var(--line-strong); }

.article-head h1 {
  margin: 14px 0 0;
  font-size: 32px;
  line-height: 1.36;
  font-weight: 600;
  letter-spacing: -0.018em;
  overflow-wrap: break-word;
}

.article-meta {
  margin: 20px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.article-meta > span { display: inline-flex; align-items: baseline; gap: 6px; }
.article-meta > span + span::before {
  content: "·";
  padding: 0 10px;
  color: var(--ink-3);
}
.article-meta time { font-variant-numeric: tabular-nums; }

/* 正文区：一条规则线把「标题元信息」与「阅读区」分开 */
.article-body {
  margin-top: 4px;
  padding: 30px 0 0;
  border-top: 1px solid var(--line);
}
.article-body .col { padding-top: 0; }

.article-foot { margin-top: 48px; }
.article-foot .col {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

/* 分类 / 标签 */
.tax { display: grid; gap: 12px; }
.tax-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: start;
}
.tax-row__label {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 44px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.tax-row__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tax-row__list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.tax-row__list a:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

/* 上一篇 / 下一篇 */
.post-nav {
  margin-top: 34px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.post-nav__item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 44px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.12s ease;
}
.post-nav__item:hover { border-color: var(--line-strong); }
.post-nav__label {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.post-nav__title {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.post-nav__item--next { text-align: right; align-items: flex-end; }
/* 只有一篇时占满整行，避免半列空着 */
.post-nav__item--only { grid-column: 1 / -1; text-align: left; align-items: flex-start; }

/* 评论扩展点 */
.comments {
  margin-top: 52px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.comments h2 {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.012em;
}

/* ============================ 正文排版 .prose ============================
   唯一的富文本出口：<div class="prose" th:utext="文章正文">
   ========================================================================= */
.prose {
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
  overflow-wrap: break-word;
  word-break: normal;
}
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }

.prose p { margin: 0 0 1.25em; }
.prose p:empty { display: none; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  margin: 1.9em 0 0.65em;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.014em;
  color: var(--ink);
  scroll-margin-top: 84px;
}
.prose h1 { font-size: 28px; letter-spacing: -0.02em; }
.prose h2 { font-size: 24px; }
.prose h3 { font-size: 20px; }
.prose h4 { font-size: 18px; }
.prose h5 { font-size: 17px; }
.prose h6 {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--ink-2);
}

.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.12s ease, color 0.12s ease;
}
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.prose strong, .prose b { font-weight: 600; }
.prose em, .prose i { font-style: italic; }
.prose del, .prose s { color: var(--ink-3); }
.prose mark {
  /* 只用令牌：高亮是中性底，不引入任何颜色字面量 */
  background: var(--line);
  color: var(--ink);
  padding: 0 0.15em;
  border-radius: 2px;
}
.prose small { font-size: 0.85em; color: var(--ink-2); }
.prose sub, .prose sup { font-size: 0.75em; line-height: 0; }

.prose ul, .prose ol { margin: 0 0 1.25em; padding-left: 1.5em; }
.prose li { margin: 0.35em 0; }
.prose li > ul, .prose li > ol { margin: 0.35em 0 0.2em; }
.prose ul ul, .prose ol ol, .prose ul ol, .prose ol ul { margin-bottom: 0.2em; }
.prose li::marker { color: var(--ink-3); }
.prose ul { list-style: disc; }
.prose ul ul { list-style: circle; }
.prose ol { list-style: decimal; }
.prose li > p:last-child { margin-bottom: 0; }

.prose blockquote {
  margin: 1.7em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--line-strong);
  color: var(--ink-2);
}
.prose blockquote > :last-child { margin-bottom: 0; }
.prose blockquote p { margin-bottom: 0.9em; }

.prose code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.36em;
  overflow-wrap: anywhere;
}
.prose pre {
  margin: 1.7em 0;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  tab-size: 2;
}
.prose pre code {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-size: inherit;
  white-space: pre;
  overflow-wrap: normal;
}

.prose kbd {
  font-family: var(--mono);
  font-size: 0.82em;
  padding: 0.12em 0.4em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
}

/* 表格：桌面铺满阅读列，窄屏整表横向滚动，绝不撑破页面 */
.prose table {
  width: 100%;
  max-width: 100%;
  margin: 1.7em 0;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: break-word;
}
/* 阅读列在 <760px 才变窄，所以滚动只在这一档开启：
   display:block + nowrap 让表按内容取宽，超出部分由表格自己横向滚动 */
@media (max-width: 760px) {
  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .prose table caption { white-space: normal; }
}
.prose caption {
  caption-side: top;
  text-align: left;
  padding-bottom: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
}
.prose th, .prose td {
  padding: 9px 13px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  min-width: 84px;
}
.prose thead th {
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
}
.prose tbody th { font-weight: 600; }

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.8em auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.prose figure { margin: 1.8em 0; }
.prose figure img { margin: 0 auto; }
.prose figcaption {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-3);
  text-align: center;
}
.prose p > img:only-child { margin: 1.8em auto; }
/* 与 theme.css 对 .frame img 的深色处理保持一致 */
html[data-theme="dark"] .prose img { filter: brightness(0.92) contrast(1.02); }

.prose hr {
  margin: 2.6em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose iframe, .prose video, .prose embed {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.prose video { height: auto; }

.prose details {
  margin: 1.4em 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.prose summary { cursor: pointer; font-weight: 500; }
.prose details > :last-child { margin-bottom: 0; }

.prose dl, .prose dd { margin: 0 0 1em; }
.prose dt { font-weight: 600; }
.prose dd { padding-left: 1.2em; }
.prose abbr[title] { text-decoration: underline dotted; cursor: help; }

/* 脚注（Halo 编辑器 footnote 输出） */
.prose sup[data-footnote-ref] { font-family: var(--mono); font-size: 0.72em; }
.prose .footnotes {
  margin-top: 3em;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-2);
}
.prose .footnotes ol { padding-left: 1.3em; }

/* ============================ 归档页 ============================ */
.archive { margin-top: 8px; }

.arch-group { margin-top: 36px; }
.arch-group__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.arch-group__head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.arch-group__head .hint {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
}

.arch-month {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 10px;
}
.arch-month__label {
  margin: 0;
  padding-top: 13px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.arch-month .posts { margin-top: 0; }

/* ============================ 标签集合 ============================ */
.tag-list {
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  column-gap: 48px;
  border-top: 1px solid var(--line);
}
.tag-item { border-bottom: 1px solid var(--line); }
.tag-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 6px 0;
  text-decoration: none;
}
.tag-item__name {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.tag-item a:hover .tag-item__name {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-underline-position: under;
}
.tag-item__count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* ============================ 分类集合（复用 partials/category-tree） ============ */
.cat-wrap { margin-top: 26px; }

.cat-tree {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.cat-tree__item { border-bottom: 1px solid var(--line); }
.cat-tree__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 6px 0;
  text-decoration: none;
}
.cat-tree__link:hover .cat-tree__name {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-underline-position: under;
}
.cat-tree__name {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.cat-tree__count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex: none;
}
/* 递归层级：缩进 + 细线 */
.cat-tree .cat-tree {
  margin: 0 0 0 20px;
  border-top: 0;
}
.cat-tree .cat-tree .cat-tree__link { min-height: 46px; }
.cat-tree .cat-tree .cat-tree__name { font-size: 15px; }

/* ============================ 作者页 ============================ */
.author-avatar {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 0 18px;
  border-radius: 50%;
  border: 1px solid var(--line);
  object-fit: cover;
  background: var(--surface);
}

/* ============================ 文章列表行（partials/post-card 的配套样式） ============ */
.post-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.post-row__link {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-height: 44px;
  text-decoration: none;
}
.post-row__date {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  flex: none;
}
.post-row__title { font-size: 17px; color: var(--ink); line-height: 1.55; }
.post-row__link:hover .post-row__title { text-decoration: underline; text-underline-offset: 4px; }
.post-row__arrow { display: none; }
.post-row__excerpt { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.7; }
.post-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.post-row__tags a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  text-decoration: none;
}
.post-row__tags a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ============================ 分页（partials/pagination） ============================ */
.pagination {
  margin: 44px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.pagination__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.pagination__link:hover { border-color: var(--line-strong); color: var(--ink); }
/* 上一条已经是列表自身的收口线，这里不再重复画 */
.posts + .pagination,
.archive + .pagination {
  margin-top: 30px;
  padding-top: 0;
  border-top: 0;
}
.pagination__status {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}

/* ============================ 空态 ============================ */
.empty-state {
  margin: 32px 0 0;
  padding: 34px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}
.empty-state p {
  margin: 0;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-2);
}
.empty-state .more {
  margin-top: 6px;
  justify-content: center;
  color: var(--ink-3);
}

/* ============================ 错误页 ============================ */
/* 规则线放在 .error-shell 上，宽度与 .page-head 一致；正文收在 640 */
.error-shell {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.error-page {
  padding: 0 0 64px;
  max-width: 640px;
}
.error-code {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}
.error-page h1 {
  margin: 14px 0 0;
  font-size: 32px;
  line-height: 1.36;
  font-weight: 600;
  letter-spacing: -0.018em;
}
.error-text {
  margin: 14px 0 0;
  max-width: 440px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-2);
}
.error-type {
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.error-actions {
  margin-top: 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 20px;
}
.error-actions .go { margin-top: 0; }

/* ============================ 响应式 ============================ */
@media (max-width: 760px) {
  .page-head { margin-top: 44px; }
  .page-head h1 { font-size: 26px; line-height: 1.4; }

  .article { padding-top: 32px; }
  .article-head h1 { font-size: 26px; line-height: 1.42; }
  /* 窄屏会换行，分隔符会跑到行首，改用间距分隔 */
  .article-meta { font-size: 12px; gap: 4px 18px; }
  .article-meta > span + span::before { content: none; }
  .article-body { padding-top: 24px; }

  .prose { font-size: 16px; line-height: 1.8; }
  .prose h1 { font-size: 24px; }
  .prose h2 { font-size: 21px; }
  .prose h3 { font-size: 19px; }
  .prose h4 { font-size: 18px; }
  .prose h5, .prose h6 { font-size: 17px; }
  .prose table { font-size: 14px; }
  .prose th, .prose td { padding: 8px 10px; min-width: 76px; }
  .prose pre { padding: 14px; font-size: 14px; }
  .prose blockquote { padding-left: 16px; }

  .tax-row { grid-template-columns: 1fr; gap: 2px; }
  .tax-row__label { line-height: 1.6; padding-top: 4px; }

  .post-nav { grid-template-columns: 1fr; gap: 10px; }
  .post-nav__item--next { text-align: left; align-items: flex-start; }

  .arch-group { margin-top: 30px; }
  .arch-month {
    grid-template-columns: 1fr;
    gap: 2px;
    margin-top: 14px;
  }
  .arch-month__label { padding-top: 0; }

  .tag-list { grid-template-columns: 1fr; column-gap: 0; }
  .cat-tree .cat-tree { margin-left: 14px; }

  .error-shell { margin-top: 44px; padding-top: 22px; }
  .error-page { padding-bottom: 48px; }
  .error-page h1 { font-size: 26px; line-height: 1.42; }
}

@media (max-width: 420px) {
  .col { padding: 0 18px; }
  .article-head h1 { font-size: 24px; }
  .tag-item__name, .cat-tree__name { font-size: 16px; }
}
