/* ==========================================================================
   main.css —— 版式与组件
   --------------------------------------------------------------------------
   视觉基准来自原站（Maupassant 主题）：白底、#444 正文、衬线标题、
   朱红强调色、细灰分隔线。所有数值都走 CSS 变量，
   想改风格请编辑 theme.config.mjs（生成 theme-vars.css），而不是改这个文件。
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. 默认变量（theme-vars.css / themes.css 会覆盖）
   -------------------------------------------------------------------------- */
:root {
  /* 颜色 */
  --bg: #ffffff;
  --bg-soft: #f8f8f8;
  --bg-code: #f8f8f8;
  --text: #444444;
  --text-strong: #555555;
  --text-soft: #999999;
  --text-faint: #bbbbbb;
  --link: #6e7173;
  --link-hover: #444444;
  --accent: #c83c23;
  --accent-hover: #d26911;
  --border: #dddddd;
  --border-strong: #cccccc;
  --selection-bg: #f6f6f3;
  --selection-text: #555555;

  /* 字体 */
  --font-sans: "Helvetica Neue", Arial, "Hiragino Sans GB", "STHeiti", "Microsoft YaHei",
    "WenQuanYi Micro Hei", SimSun, sans-serif;
  --font-serif: "ff-tisa-web-pro", Cambria, "Times New Roman", Georgia, Times, "Songti SC", SimSun,
    serif;
  --font-mono: Menlo, Monaco, Consolas, "Lucida Console", "Courier New", monospace;

  /* 字号 / 排版 */
  --font-size-base: 14px;
  --font-size-content: 15px;
  --line-height-content: 1.75;
  --letter-spacing: 0.4px;
  --font-size-logo: 50px;
  --font-size-title: 25px;
  --font-size-widget: 16px;
  --post-align: left;

  /* 版式 */
  --container-width: 1150px;
  --container-padding: 60px;
  --main-width: 800px;
  --sidebar-width: 245px;
  --sidebar-gap: 35px;
  --radius: 2px;
  --post-max-width: 760px;
  --sidebar-border: 1px solid var(--border);

  /* 其它 */
  --cover-height: 220px;
  --img-teaser-height: 140px;
}

/* --------------------------------------------------------------------------
   1. 基础重置
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
  border: 0;
}

a,
button.submit {
  color: var(--link);
  text-decoration: none;
  transition: all 0.1s ease-in;
}

a:hover,
a:active {
  color: var(--link-hover);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-sans);
  font-weight: bold;
}

hr {
  margin: 2em auto;
  width: 100px;
  border: 0;
  border-top: 2px solid var(--border);
}

::selection {
  background: var(--selection-bg);
  color: var(--selection-text);
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

.clearfix::before,
.clearfix::after,
.col-group::before,
.col-group::after {
  content: " ";
  display: table;
}

.clearfix::after,
.col-group::after {
  clear: both;
}

/* --------------------------------------------------------------------------
   2. 布局骨架
   -------------------------------------------------------------------------- */
.container {
  width: var(--container-width);
  padding: 0 var(--container-padding);
  margin: 0 auto;
  box-sizing: content-box;
}

.col-group {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#main {
  flex: 0 0 var(--main-width);
  max-width: var(--main-width);
  min-width: 0;
  padding-top: 20px;
}

.col-8 {
  width: var(--main-width);
}

#secondary {
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  padding-left: var(--sidebar-gap);
  margin-left: var(--sidebar-gap);
  padding-top: 25px;
  border-left: var(--sidebar-border);
  box-sizing: content-box;
  word-wrap: break-word;
}

/* 侧栏放左边 */
[data-sidebar="left"] .col-group {
  flex-direction: row-reverse;
}

[data-sidebar="left"] #secondary {
  padding-left: 0;
  padding-right: var(--sidebar-gap);
  margin-left: 0;
  margin-right: var(--sidebar-gap);
  border-left: 0;
  border-right: var(--sidebar-border);
}

/* 不显示侧栏 */
[data-sidebar="none"] #secondary {
  display: none;
}

[data-sidebar="none"] #main {
  flex: 1 1 auto;
  max-width: none;
}

/* --------------------------------------------------------------------------
   3. 页头 #header
   -------------------------------------------------------------------------- */
#header {
  padding: 32px 0 0;
  text-align: left;
}

#header .col-group {
  border-bottom: 1px solid var(--border);
  align-items: flex-end;
}

#logo {
  display: inline-block;
  font-family: var(--font-serif);
  font-weight: bold;
  font-size: var(--font-size-logo);
  line-height: 2;
  color: var(--text-strong);
}

#logo:hover {
  color: var(--text-soft);
}

.description {
  margin: -18px 0 0;
  color: var(--text-soft);
}

#nav-menu {
  margin: 10px 0 -1px;
  padding: 0;
  margin-left: auto;
}

#nav-menu ul.menu {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
}

#nav-menu li {
  display: inline-block;
  margin-right: -1px;
}

#nav-menu a {
  display: block;
  padding: 0 20px;
  height: 32px;
  line-height: 32px;
  color: var(--text);
}

#nav-menu .current-menu-item a,
#nav-menu .current-post-parent a {
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--bg);
  color: var(--text-strong);
}

/* --------------------------------------------------------------------------
   4. 文章列表
   -------------------------------------------------------------------------- */
.post {
  padding: 25px 0 20px;
}

.post-title {
  margin: 0;
  color: var(--text-strong);
  text-align: left;
  font-family: var(--font-serif);
  font-weight: bold;
  font-size: var(--font-size-title);
  line-height: 1.2;
}

.post-title a {
  color: var(--text-strong);
}

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

.post-meta {
  padding: 0;
  margin: 9px 0;
  color: var(--text-soft);
  text-align: left;
  list-style: none;
  font-size: 13px;
}

.post-meta li {
  display: inline-block;
}

.post-meta li + li::before {
  content: "·";
  margin: 0 7px;
  color: var(--text-faint);
}

.post-meta a {
  color: var(--text-soft);
}

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

.content-detail {
  color: var(--text);
}

.content-detail p {
  font-size: var(--font-size-content);
  line-height: var(--line-height-content);
  margin: 0 0 1.234em;
  letter-spacing: var(--letter-spacing);
}

.content-detail img {
  max-width: 100%;
  height: auto;
}

.post-cover {
  display: block;
  margin: 0 0 1em;
  overflow: hidden;
}

.post-cover img {
  display: block;
  width: 100%;
  height: var(--cover-height);
  object-fit: cover;
  border-radius: var(--radius);
}

.more {
  padding: 10px 0 0;
}

.more a {
  border: none;
  color: var(--accent);
}

.excerpt {
  color: var(--text);
}

/* 列表样式：卡片 */
[data-list-style="card"] .post {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
}

[data-list-style="card"] .post-cover img {
  height: 300px;
}

[data-list-style="card"] .post-title {
  font-size: calc(var(--font-size-title) - 2px);
}

/* 列表样式：整篇 */
[data-list-style="full"] .post + .post {
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   5. 正文排版
   -------------------------------------------------------------------------- */
.post-single .post-title,
.post-page .post-title {
  font-size: calc(var(--font-size-title) + 3px);
}

.post-single .content-detail,
.post-page .content-detail {
  max-width: var(--post-max-width);
  text-align: var(--post-align);
  padding-top: 25px;
}

.post-content h2 {
  font-size: 1.28571em;
  margin: 2em 0 0.8em;
}

.post-content h3 {
  font-size: 1.14em;
  margin: 1.8em 0 0.7em;
}

.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 1.6em 0 0.6em;
}

.post-content a,
.comment-content a {
  border-bottom: 1px solid var(--border);
  color: var(--accent);
}

.post-content a:hover {
  border-bottom-color: transparent;
}

.post-content ul,
.post-content ol {
  padding-left: 1.6em;
  margin: 0 0 1.234em;
  font-size: var(--font-size-content);
  line-height: var(--line-height-content);
}

.post-content li {
  margin: 0.35em 0;
}

.post-content li > ul,
.post-content li > ol {
  margin-bottom: 0;
}

blockquote {
  margin: 2em 1.5em;
  padding-left: 1.5em;
  border-left: 4px solid var(--border);
  color: var(--text-soft);
}

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

code {
  padding: 2px 4px;
  background: var(--bg-code);
  font-family: var(--font-mono);
  font-size: 0.92857em;
  border-radius: var(--radius);
}

pre {
  padding: 8px;
  overflow: auto;
  max-height: 400px;
  margin: 0;
}

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

.code-block {
  position: relative;
  margin: 0 0 1.4em;
  background: var(--bg-code);
  border-radius: var(--radius);
}

.code-block[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 6px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  pointer-events: none;
}

.post-content img {
  padding: 1em 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.4em;
  font-size: 0.95em;
}

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

.post-content th {
  background: var(--bg-soft);
  color: var(--text-strong);
}

.post-content hr {
  clear: both;
}

/* 文章内目录 */
.post-toc {
  margin: 24px 0 8px;
  padding: 14px 18px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  font-size: 13px;
}

.toc-title {
  margin: 0 0 6px;
  font-weight: bold;
  color: var(--text-strong);
}

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

.post-toc li {
  line-height: 1.9;
}

.post-toc .toc-level-3 {
  padding-left: 1em;
}

.post-toc .toc-level-4 {
  padding-left: 2em;
}

/* 上一篇 / 下一篇 */
.post-nav {
  margin: 15px 0 20px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 13px;
}

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

.post-nav-next {
  text-align: right;
}

/* 相关文章 */
#related_posts {
  padding: 2em 0 30px;
}

#related_posts .widget-title {
  font-size: 18px;
}

.related_articles {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.related_articles h4 {
  margin: 0;
  color: var(--text-soft);
  font-weight: normal;
  font-size: 14px;
}

.related_articles h4:hover,
.related_articles h4 a:hover {
  color: var(--accent);
}

.related_articles img {
  width: auto;
  height: var(--img-teaser-height);
}

/* --------------------------------------------------------------------------
   6. 侧栏 .widget
   -------------------------------------------------------------------------- */
.widget {
  margin-bottom: 30px;
}

.widget-title,
h3#response {
  color: var(--link);
  line-height: 2.7;
  margin: 0;
  font-size: var(--font-size-widget);
  font-weight: normal;
  border-bottom: 1px solid var(--border);
}

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

.widget ul li {
  margin: 5px 0;
  line-height: 1.5;
}

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

.widget .count {
  color: var(--text-faint);
  font-size: 0.9em;
}

/* 搜索框 */
#search,
.site-search-form {
  position: relative;
  margin-top: 15px;
}

.site-search-form input[type="search"] {
  width: 100%;
  padding: 15px 40px 15px 15px;
  line-height: 1;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

.site-search-form input[type="search"]:focus {
  border-color: var(--border-strong);
}

.site-search-form button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  padding: 0;
  width: 26px;
  height: 26px;
  background: transparent;
  color: var(--text-soft);
  font-size: 16px;
  cursor: pointer;
}

.site-search-form button:hover {
  color: var(--accent);
}

/* 友链 */
.friend-links {
  line-height: 1.9;
  margin: 0;
}

.friend-links .sep {
  color: var(--text-faint);
}

/* 标签云 */
.tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  line-height: 1.9;
}

.tagcloud a {
  color: var(--link);
  font-size: 13px;
}

.tagcloud a .count {
  color: var(--text-faint);
}

.tagcloud-large {
  gap: 10px;
  margin-top: 20px;
}

.tagcloud-large a {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.tagcloud-large a:hover {
  background: var(--bg-soft);
  border-bottom-color: var(--accent-hover);
}

.tagcloud a.is-active {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   7. 分页 .page-navigator
   -------------------------------------------------------------------------- */
.page-navigator {
  border-top: 1px solid var(--border);
  list-style: none;
  padding: 25px 0 0;
  margin: 0;
  font-size: 16px;
}

.page-navigator li {
  display: inline-block;
  margin: 0 5px 5px 0;
}

.page-navigator a,
.page-navigator span {
  display: inline-block;
  padding: 5px 9px;
  height: 25px;
  line-height: 25px;
  border: 1px solid var(--border);
  color: var(--link);
}

.page-navigator a:hover {
  background: var(--bg-soft);
  border-bottom-color: var(--accent-hover);
}

.page-navigator .current span {
  background: var(--bg-soft);
  border-bottom-color: var(--accent-hover);
  color: var(--text-strong);
}

.page-navigator .dots span {
  border: none;
  color: var(--text-faint);
}

/* --------------------------------------------------------------------------
   8. 归档 / 标签 / 搜索 / 404
   -------------------------------------------------------------------------- */
.archive-sub {
  color: var(--text-soft);
  font-size: 13px;
  margin: 8px 0 20px;
}

.archive-year {
  margin-bottom: 34px;
}

.archive-title {
  padding-top: 20px;
  color: var(--text-soft);
  font-size: 1em;
  margin: 0 0 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.archive-title .count {
  color: var(--text-faint);
  font-weight: normal;
  font-size: 0.9em;
}

.archive-month {
  margin: 18px 0 0 0;
}

.month-title {
  width: 60px;
  margin: 0;
  padding: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: normal;
}

.archive-list {
  list-style: none;
  margin: -1.6em 0 0 90px;
  padding: 0 0 0 1.5em;
  border-left: 1px solid var(--border);
}

.archive-list li {
  line-height: 1.9;
}

.archive-date {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  margin-right: 10px;
}

.search-page-form {
  display: flex;
  gap: 10px;
  margin: 20px 0 10px;
}

.search-page-form input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

.search-page-form button {
  padding: 0 18px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
}

.search-page-form button:hover {
  border-bottom-color: var(--accent-hover);
}

.search-status {
  color: var(--text-soft);
  font-size: 13px;
}

.search-result {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.search-result h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-family: var(--font-serif);
}

.search-result h3 a {
  color: var(--text-strong);
}

.search-result h3 a:hover {
  color: var(--accent);
}

.search-result .snippet {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.search-result mark {
  background: var(--selection-bg);
  color: var(--accent);
}

.empty-state {
  padding: 60px 0;
  color: var(--text-soft);
  text-align: center;
}

.empty-state .hint {
  font-size: 13px;
}

.empty-state code {
  padding: 2px 6px;
}

.error-page {
  margin: 100px 0;
  text-align: center;
}

.error-page .post-title {
  font-size: 60px;
  margin-bottom: 10px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   9. 页脚
   -------------------------------------------------------------------------- */
#footer {
  padding: 0.1em 0 3.6em;
  line-height: 1.5;
  color: var(--text-soft);
  font-size: 13px;
}

#footer .container {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.footer-inner {
  margin: 0;
}

/* --------------------------------------------------------------------------
   10. 浮动控件：配色切换 / 返回顶部
   -------------------------------------------------------------------------- */
.theme-switcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  font-size: 13px;
}

.theme-switcher-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.theme-switcher-toggle:hover {
  border-color: var(--accent-hover);
  color: var(--accent);
}

.theme-switcher-panel {
  position: absolute;
  right: 0;
  bottom: 50px;
  min-width: 118px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.theme-switcher-panel[hidden] {
  display: none;
}

.ts-title {
  margin: 2px 0 6px;
  padding: 0 6px;
  color: var(--text-faint);
  font-size: 11px;
}

.theme-switcher-panel button {
  display: block;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.theme-switcher-panel button:hover {
  background: var(--bg-soft);
}

.theme-switcher-panel button.is-active {
  color: var(--accent);
  font-weight: bold;
}

.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 72px;
  z-index: 50;
  width: 40px;
  height: 40px;
  line-height: 38px;
  text-align: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-soft);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.back-to-top:hover {
  color: var(--accent);
  border-color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   11. 响应式（断点与原站一致）
   -------------------------------------------------------------------------- */
@media screen and (max-width: 1290px) {
  .container {
    width: auto;
    max-width: 1290px;
  }

  #main {
    flex: 1 1 auto;
    max-width: none;
    margin-right: 20px;
  }
}

@media screen and (max-width: 1057px) {
  :root {
    --sidebar-width: 200px;
    --sidebar-gap: 26px;
  }
}

@media screen and (max-width: 860px) {
  #header {
    text-align: center;
  }

  #header .col-group {
    display: block;
  }

  #nav-menu {
    float: none;
    margin: 10px 0 -1px;
  }

  #nav-menu ul.menu {
    text-align: center;
  }

  .col-group {
    display: block;
  }

  #main {
    width: 100%;
    max-width: none;
    margin-right: 0;
  }

  #secondary {
    display: none;
  }

  #logo {
    font-size: 40px;
  }
}

@media screen and (max-width: 680px) {
  .container {
    padding: 0 20px;
  }

  .post-title {
    font-size: 22px;
  }

  .post-single .post-title,
  .post-page .post-title {
    font-size: 24px;
  }

  .page-navigator {
    padding: 15px 0 0;
  }

  .page-navigator a,
  .page-navigator span {
    padding: 4px 6px;
  }

  #footer {
    padding-top: 10px;
  }

  .post {
    padding: 12px 0;
  }

  .post-content img {
    padding: 0.2em 0;
  }

  #nav-menu a {
    padding: 0 15px;
    height: 27px;
    line-height: 27px;
    font-size: 13px;
  }

  .archive-list {
    margin-left: 70px;
    padding-left: 20px;
  }

  .theme-switcher,
  .back-to-top {
    right: 14px;
    bottom: 14px;
  }

  .back-to-top {
    bottom: 64px;
  }
}

@media print {
  #header,
  #secondary,
  #footer,
  .theme-switcher,
  .back-to-top,
  .page-navigator,
  .post-nav {
    display: none !important;
  }
}
