/* ============================================================
   Timetombs blog — 简洁配色 & 统一间距
   设计令牌: :root 中的 CSS 变量
   ============================================================ */

:root {
  /* 颜色 */
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-muted: #eef1f4;
  --ink: #1f2328;
  --ink-soft: #4b5563;
  --ink-secondary: #6e7781;
  --ink-faint: #9aa4b2;
  --line: #e4e8ee;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-soft: rgba(9, 105, 218, 0.1);
  --code-ink: #c7254e;
  --mark-bg: #fff8c5;
  /* 阴影 & 圆角 */
  --shadow-img: 0 1px 2px rgba(31, 35, 40, 0.06), 0 6px 20px rgba(31, 35, 40, 0.09);
  --shadow-float: 0 12px 32px rgba(31, 35, 40, 0.14);
  --radius: 8px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  height: 100%;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  word-break: break-word;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent-soft);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  position: relative;
  margin: 0;
  padding: 0;
  font-weight: 600;
  line-height: 1.4;
}

a {
  position: relative;
  text-decoration: none;
  color: var(--accent);
  transition: color 0.15s ease;
}

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

a img {
  border-width: 0;
}

a .fa {
  margin-right: 4px;
}

table {
  position: relative;
  border-collapse: collapse;
  border: 1px solid var(--line);
  max-width: 100%;
}

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

th {
  background-color: var(--bg-soft);
  font-weight: 600;
}

summary {
  position: relative;
  display: block;
  margin-top: 0.5em;
  cursor: pointer;
}

code {
  background-color: var(--bg-soft);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--code-ink);
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;
  font-size: 0.9em;
}

mark {
  background-color: var(--mark-bg);
  padding: 1px 4px;
  border-radius: 3px;
}

time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

fieldset{
  padding: 24px;
}

/* ============================================================
   布局
   ============================================================ */

.main {
  margin: 48px 64px 64px;
  /* 自适应: 两侧留白随视口宽度在 24px ~ 96px 之间缩放 */
  margin: 48px clamp(24px, 5vw, 96px) 64px;
  box-sizing: border-box;
}

.header {
  position: relative;
  box-sizing: border-box;
}

.header-hgroup {
  text-align: right;
}

.header-hgroup-subtitle {
  color: var(--ink-secondary);
  font-size: 12px;
  margin: 6px 0 0;
}

.header-nav {
  text-align: right;
  font-size: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.header-nav-item {
  display: inline-block;
  font-size: 15px;
  margin-left: 24px;
  text-align: center;
}

.header-nav-item a {
  color: var(--ink-soft);
}

.header-nav-item a:hover {
  color: var(--accent);
}

.header-nav-item img {
  display: inline-block;
  height: 15px;
  vertical-align: middle;
  margin-right: 6px;
}

.header-stats {
  position: relative;
}

.stats {
  position: relative;
  padding-top: 8px;
  color: var(--ink-secondary);
  font-size: 12px;
}

.stats-date {
  display: inline-block;
}

.search {
  position: absolute;
  box-sizing: border-box;
  top: 0;
  right: 0;
  font-size: 0;
}

.search-input {
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 14px;
  padding: 8px 12px;
  width: 16em;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-input::-webkit-input-placeholder {
  color: var(--ink-faint);
}

.search-input::placeholder {
  color: var(--ink-faint);
}

.content {
  position: relative;
  display: block;
  margin-top: 40px;
  box-sizing: border-box;
}

.footer {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  text-align: center;
  color: var(--ink-secondary);
  font-size: 13px;
}

.footer section {
  margin-top: 8px;
}

/* ============================================================
   文章列表 / 文章页
   ============================================================ */

.articles-item {
  margin: 36px 0;
}

.article {
  position: relative;
}

.topic-title,
.article-title {
  border-bottom: 1px solid var(--line);
  font-size: 24px;
  font-weight: 600;
  padding: 0.45em 0;
}

.article-title-weight {
  margin-left: 8px;
  color: #d64541;
  font-size: 15px;
  position: relative;
  font-weight: normal;
}

.article-copyright {
  position: absolute;
  display: inline-block;
  padding-top: 8px;
  font-size: 12px;
  font-weight: normal;
}

.article-copyright span {
  color: var(--ink-secondary);
}

.article-meta {
  text-align: right;
  margin-top: 8px;
  color: var(--ink-secondary);
  font-size: 12px;
}

.article-meta section {
  margin-top: 4px;
}

.article-topic {
  margin-left: 4px;
}

.article-tag {
  margin-left: 4px;
}

.article-content {
  font-size: 16px;
  line-height: 1.75;
  margin: 1.25em 0;
  color: var(--ink);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
  position: relative;
  margin: 1.75em 0 0.5em;
  font-weight: 600;
}

.article-content .article-h-a {
  margin: 0;
}

.article-content h1 {
  font-size: 24px;
}

.article-content h2 {
  font-size: 22px;
}

.article-content h3 {
  font-size: 19px;
}

.article-content h4 {
  font-size: 17px;
}

.article-content h5 {
  font-size: 16px;
}

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

.article-content .header-locator {
  position: fixed;
  display: inline-block;
  width: 0;
  height: 0;
  font-size: 0;
}

.article-content p {
  margin: 1em 0 0;
}

.article-content a {
  margin-left: 4px;
  margin-right: 4px;
  word-break: break-all;
}

.article-content a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content blockquote {
  position: relative;
  font-size: 15px;
  margin: 1em 0 0;
  border-left: 4px solid var(--accent);
  background-color: var(--bg-soft);
  color: var(--ink-soft);
  line-height: 1.7;
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  word-break: break-all;
}

.article-content blockquote p {
  margin: 0;
}

.article-content img {
  display: block;
  max-width: 100%;
  margin: 12px 0 0;
  padding: 0;
  font-size: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-img);
}

.article-content ul {
  margin-top: 8px;
  margin-bottom: 0;
}

.article-content ol {
  margin-top: 8px;
  margin-bottom: 0;
}

.article-content ol li {
  padding-left: 8px;
  word-break: break-all;
}

.article-content table {
  margin-top: 1em;
  font-size: 14px;
  word-break: break-all;
}

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

.article-content .footnotes {
  position: relative;
  line-height: 1.6;
}

.article-content .footnotes p {
  margin-top: 8px;
}

.article-content .footnotes a {
  margin-left: 0;
}

.article-content .footnote-backref {
  margin: 0;
  padding-left: 6px;
  padding-right: 6px;
}

.article-content .footnote-ref {
  font-size: 14px;
  margin: 0;
  padding-left: 6px;
  padding-right: 6px;
}

/* ============================================================
   代码块
   ============================================================ */

.highlight {
  margin-top: 16px;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 100%;
}

.highlight pre {
  margin: 0;
  padding: 12px 16px;
  background-color: var(--bg-soft) !important;
  font-size: 13.5px;
  line-height: 1.6;
  overflow-x: auto;
}

.highlight code {
  color: unset;
  background-color: unset;
  padding-left: unset;
  padding-right: unset;
}

.highlight-file .highlight {
  margin-top: 0;
  border: none;
  border-radius: 0;
}

.highlight-file-switch {
  color: var(--accent);
  cursor: pointer;
}

.highlight-file-switch::before {
  margin-right: 6px;
}

.highlight-file,
.highlight-files {
  margin-top: 16px;
}

.highlight-file-header,
.highlight-files-header {
  padding: 8px 12px;
  background-color: var(--bg-muted);
  color: var(--ink-soft);
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.highlight-file:not(.highlight-file_opened) .highlight-file-header {
  border-radius: var(--radius);
}

.highlight-file-content {
  display: none;
}

.highlight-file-content pre {
  margin: 0 !important;
  padding: 12px 16px;
  background-color: var(--bg-soft);
}

.highlight-file-content code {
  padding: 0 !important;
}

.highlight-file_opened .highlight-file-content {
  display: block;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.highlight-files .highlight-file {
  margin-top: 0;
}

.highlight-files .highlight-file-header {
  background-color: #fff;
  border: none;
  border-radius: 0;
}

.highlight-files .highlight-files-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.highlight-file_opened .highlight-file-switch::before {
  content: '\f068';
}

.highlight-files .highlight-file_opened .highlight-file-header {
  background-color: var(--bg-muted);
}

.code-snippet {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-snippet .title {
  background-color: var(--bg-muted);
  color: var(--ink-soft);
  font-size: 13px;
  padding: 8px 12px;
}

.code-snippet .highlight {
  margin-top: 0;
  border: none;
  border-radius: 0;
}

/* ============================================================
   文章翻页 / 评论
   ============================================================ */

.article-page {
  margin-top: 48px;
  border-top: 1px solid var(--line);
}

.article-page-prev,
.article-page-next {
  margin-top: 12px;
}

.article-comment {
  margin-top: 48px;
}

.article-comment .utterances {
  max-width: unset;
}

/* ============================================================
   专题 / 标签 / 归档
   ============================================================ */

.topic {
  margin-top: 40px;
}

.topic-content {
  font-size: 15px;
  margin-top: 12px;
  border-left: 4px solid var(--line);
  color: var(--ink-soft);
  line-height: 1.7;
  padding: 0 12px;
  word-break: break-all;
}

.topic-content p {
  margin: 0;
}

.topic-title {
  font-size: 24px;
}

.topic-articles-count {
  font-weight: normal;
  font-size: 16px;
  color: var(--ink-secondary);
}

.topic-article {
  list-style: decimal-leading-zero;
}

.topic-article-time {
  margin-left: 0.5em;
}

.tags {
  margin-top: 40px;
}

.tags-title h1 {
  font-size: 24px;
}

.tags-title .tags-count {
  font-weight: normal;
  font-size: 16px;
  color: var(--ink-secondary);
}

.tags .tag {
  display: inline-block;
  line-height: 2;
}

.tags .tag .tag-link {
  margin-left: 8px;
}

.tags .tag .tag-count {
  font-size: 12px;
  color: var(--ink-secondary);
}

.tag-title {
  font-size: 24px;
}

.tag-title-count {
  font-weight: normal;
  font-size: 16px;
  color: var(--ink-secondary);
}

.tag-articles {
  margin-top: 24px;
}

.tag-article {
  list-style: decimal-leading-zero;
}

.tag-article-time {
  margin-left: 0.5em;
}

.archives-title {
  font-size: 24px;
}

.archives-count {
  font-weight: normal;
  font-size: 16px;
  color: var(--ink-secondary);
}

.archive-group {
  margin-top: 32px;
}

.archive-group-title {
  font-size: 20px;
}

.archive-group-count {
  font-size: 16px;
  color: var(--ink-soft);
}

.archive-group-items {
  margin-top: 12px;
}

.archive-group-item {
  list-style: decimal-leading-zero;
}

.archive-group-item-time {
  margin-left: 0.5em;
}

/* ============================================================
   目录 / 工具栏 / 阅读进度
   ============================================================ */

.toc {
  position: fixed;
  display: inline-block;
  visibility: hidden;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 9999;
  overflow-y: auto;
  overflow-x: auto;
  box-shadow: var(--shadow-float);
  border-radius: 0 12px 12px 0;
  font-size: 14px;
  max-width: 360px;
  padding-top: 16px;
  background-color: #fff;
  box-sizing: border-box;
}

.toc .toc-page-title {
  display: block;
  white-space: nowrap;
  padding: 6px 16px;
}

.toc section.selected {
  background-color: var(--bg-soft);
}

.toc section.selected .toc-page-title {
  background-color: var(--bg-muted);
  color: var(--ink);
  padding-right: 34px;
}

.toc section.selected .toc-page-title::after {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: FontAwesome;
  font-size: 12px;
  color: var(--ink-secondary);
  content: '\f107';
}

.toc section.selected.collapsed #TableOfContents {
  display: none;
}

.toc section.selected.collapsed .toc-page-title::after {
  content: '\f105';
}

.toc nav ul {
  list-style: none;
  margin: 0;
  padding-left: 16px;
}

.toc nav a {
  display: block;
  white-space: nowrap;
  padding: 6px 10px;
  margin-right: 8px;
  border-radius: 6px;
  color: var(--ink-soft);
}

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

.toc nav a.selected {
  color: var(--accent);
  font-weight: 500;
}

.toolbar {
  position: fixed;
  display: inline-block;
  right: 24px;
  bottom: 24px;
  z-index: 8888;
  font-size: 20px;
  box-sizing: border-box;
  background-color: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow-float);
}

.toolbar a {
  display: block;
  margin: 8px 12px;
  color: var(--ink-soft);
}

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

.toc.opened {
  visibility: visible;
}

.horizontal-progress {
  position: fixed;
  display: inline-block;
  top: 0;
  height: 2px;
  width: 0;
  z-index: 9999;
  background-color: var(--accent);
}
