/* ==============================
   OneBlog Hexo Theme - Main Styles
   ============================== */

html, body {
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
  background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);
  color: #333;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ==============================
   Navigation
   ============================== */
.blog-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.logo-img {
  height: 28px;
  border-radius: 4px;
}

.logo-text {
  color: #1a1a2e;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.right-area {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-expand {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  opacity: 0;
  overflow: visible;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: right center;
  z-index: 10;
  pointer-events: none;
}

.search-wrapper.is-open .search-expand {
  width: 180px;
  opacity: 1;
  pointer-events: auto;
}

.search-wrapper.is-closing .search-expand {
  width: 0;
  opacity: 0;
}

.search-expand input {
  width: 100%;
  padding: 0.4rem 0.8rem;
  background: #f5f5f5;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #333;
  outline: none;
}

.search-expand input::placeholder {
  color: #aaa;
}

.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 11;
}

.search-btn svg {
  width: 16px;
  height: 16px;
  color: #888;
  transition: color 0.2s ease;
}

.search-btn:hover {
  background: #f5f5f5;
}

.search-btn:hover svg {
  color: #333;
}

/* Search overlay backdrop */
.search-overlay {
  position: fixed;
  top: 54px;
  left: 0;
  width: 100%;
  height: calc(100vh - 54px);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 5;
}

.search-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Search results dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 400px;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.25s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.search-results.has-results {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-result-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f3f5;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.result-item-active {
  background: #f8f9fa;
}

.result-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 0.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-meta {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 0.25rem;
}

.result-category {
  color: #0984e3;
}

.result-excerpt {
  font-size: 0.8rem;
  color: #666;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-highlight {
  color: #0984e3;
  font-weight: 700;
}

.search-result-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
}

.search-result-more {
  padding: 0.6rem 1rem;
  text-align: center;
  color: #999;
  font-size: 0.8rem;
  border-top: 1px solid #f1f3f5;
}

/* Responsive search */
@media (max-width: 768px) {
  .search-results {
    width: calc(100vw - 3rem);
    right: -2.5rem;
    max-height: 350px;
  }
  .search-wrapper.is-open .search-expand {
    width: 140px;
  }
  .search-expand input {
    font-size: 0.8rem;
  }
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 0.35rem 0.7rem;
  text-decoration: none;
  color: #666;
  font-weight: 400;
  font-size: 0.88rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: #333;
  background: #f5f5f5;
  font-weight: 500;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.menu-toggle:hover {
  background: #f5f5f5;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: #64748b;
  border-radius: 1px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle.is-active span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle.is-active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.menu-toggle.is-active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ==============================
   Nav Dropdown Menu
   ============================== */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: flex !important;
  align-items: center;
  gap: 2px;
}

.dropdown-arrow {
  transition: transform 0.2s ease;
}

.nav-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 140px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  padding: 0.4rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              visibility 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(4px);
}

.nav-dropdown-item {
  display: block !important;
  padding: 0.45rem 0.8rem !important;
  font-size: 0.85rem !important;
  color: #555 !important;
  border-radius: 6px !important;
  white-space: nowrap;
  transition: all 0.15s ease !important;
}

.nav-dropdown-item:hover {
  color: #1a1a2e !important;
  background: #f5f5f5 !important;
}

@media (max-width: 768px) {
  .nav-dropdown-menu {
    position: static;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0 0 0 1rem;
    background: transparent;
    opacity: 1;
    visibility: visible;
    min-width: auto;
  }
  .nav-dropdown:hover .nav-dropdown-menu {
    transform: none;
  }
  .nav-dropdown-item {
    font-size: 0.8rem !important;
  }
  .dropdown-arrow {
    display: none;
  }
}

/* ==============================
   Footer
   ============================== */
.blog-footer {
  background: #fff;
  padding: 0.8rem 1.5rem;
  margin-top: 0.5rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  font-weight: 600;
  color: #1a1a2e;
  margin: 0;
}

.footer-desc {
  font-size: 0.85rem;
  color: #999;
  margin: 0.25rem 0 0;
}

.footer-copyright {
  font-size: 0.85rem;
  color: #999;
  margin: 0;
}

.footer-section:last-child {
  text-align: right;
}

.footer-powered {
  font-size: 0.8rem;
  color: #bbb;
  margin: 0.15rem 0 0;
}

.footer-powered a {
  color: #8ec5fc;
  text-decoration: none;
}

.footer-powered a:hover {
  text-decoration: underline;
}

/* ==============================
   Sidebar
   ============================== */
.sidebar,
.right-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
  align-self: start;
  position: sticky;
  top: 54px;
  min-height: calc(100vh - 54px - 2rem);
  overflow-y: auto;
}

.sidebar:hover,
.right-sidebar:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.sidebar-section {
  margin-bottom: 1rem;
}

.sidebar-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
}

.profile {
  text-align: center;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin-bottom: 0.75rem;
}

.profile-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
  margin: 0.5rem 0 0.25rem;
}

.profile-desc {
  font-size: 0.8rem;
  color: #999;
  margin: 0;
}

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

.category-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
}

.category-list li:hover {
  color: #333;
}

.category-name.active {
  color: #1a1a2e;
  font-weight: 600;
}

.category-count {
  color: #999;
}

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

.recent-list li {
  padding: 0.4rem 0;
  font-size: 0.85rem;
}

.recent-list a {
  color: #666;
  text-decoration: none;
}

.recent-list a:hover {
  color: #333;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud .tag {
  color: #666;
  cursor: pointer;
}

.tag-cloud .tag:hover {
  color: #1a1a2e;
}

.tag-cloud-view-all {
  width: 100%;
  margin-top: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  text-align: right;
}

.tag-cloud-view-all a {
  font-size: 0.8rem;
  color: #333;
  text-decoration: none;
  transition: color 0.15s ease;
}

.tag-cloud-view-all a:hover {
  color: #000;
}

/* ==============================
   Tags Page (Full Tag Cloud)
   ============================== */
.tags-page-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: calc(100vh - 54px - 4rem);
}

.tags-page-content {
  background: #fff;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.tags-page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a2e;
  margin: 0 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.tags-page-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0;
}

.tags-page-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #555;
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  line-height: 1.4;
}

.tags-page-tag:hover {
  color: #1a1a2e;
  background: #f5f5f5;
}

.tags-page-count {
  font-size: 0.7em;
  color: #999;
  font-weight: 400;
}

.tags-page-empty {
  text-align: center;
  color: #999;
  padding: 3rem 0;
}

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

.friend-links li {
  padding: 0.25rem 0;
}

.friend-links a {
  color: #666;
  text-decoration: none;
}

.friend-links a:hover {
  color: #1a1a2e;
}

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

.recent-comments li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.recent-comments li:last-child {
  border-bottom: none;
}

.comment-author {
  font-weight: 500;
  color: #1a1a2e;
  font-size: 0.85rem;
}

.comment-content {
  color: #666;
  font-size: 0.8rem;
  margin: 0.25rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-time {
  color: #999;
  font-size: 0.75rem;
}

/* ==============================
   Article List / Index
   ============================== */
.home-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 200px;
  gap: 1.2rem;
  min-height: calc(100vh - 54px - 4rem);
}

.main-content {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%; /* fill grid cell height */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

.article-list {
  flex: 1;
}

.main-content:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.article-card {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.article-card:last-child {
  border-bottom: none;
}

.article-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 0.5rem;
}

.article-category {
  color: #666;
}

.article-title {
  font-size: 1.25rem;
  font-weight: 500;
  color: #1a1a2e;
  margin: 0.5rem 0;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.article-title:hover {
  color: #666;
}

.article-excerpt {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.7;
  margin: 0.5rem 0;
  overflow-wrap: anywhere;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tag {
  font-size: 0.75rem;
  color: #999;
  background: #f5f5f5;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
}


.no-posts {
  text-align: center;
  color: #999;
  padding: 3rem 0;
}

/* ==============================
   Pagination
   ============================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1.5rem;
  flex-wrap: wrap;
}

.page-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #666;
  transition: all 0.25s ease;
  text-decoration: none;
}

.page-btn:hover:not(:disabled) {
  border-color: #1a1a2e;
  color: #1a1a2e;
  background: #fafafa;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-arrow {
  font-size: 1rem;
  line-height: 1;
}

.page-numbers {
  display: flex;
  gap: 0.25rem;
}

.page-number {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  color: #666;
  transition: all 0.25s ease;
  text-decoration: none;
}

.page-number:hover:not(.ellipsis):not(.active) {
  border-color: #1a1a2e;
  color: #1a1a2e;
}

.page-number.active {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #fff;
  font-weight: 500;
}

.page-number.ellipsis {
  border: none;
  cursor: default;
  color: #999;
}

/* ==============================
   Article Page
   ============================== */
.article-header {
  margin-bottom: 2rem;
}

.article-header .article-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 1rem 0 0.5rem;
}

.article-header .article-tags {
  margin-top: 1rem;
}

.article-body {
  font-size: 1rem;
  line-height: 1.8;
  color: #2d3436;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  color: #1a1a2e;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.article-body h2 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
}

.article-body h3 {
  font-size: 1.25rem;
}

.article-body p {
  margin: 1rem 0;
}

.article-body a {
  color: #0984e3;
  text-decoration: underline;
}

.article-body a:hover {
  color: #6c5ce7;
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1.5rem;
  border-left: 4px solid #8ec5fc;
  background: #f8f9fa;
  color: #636e72;
  border-radius: 0 8px 8px 0;
}

.article-body blockquote p {
  margin: 0.5rem 0;
}



/* ==============================
   Code Blocks (Light Theme)
   ============================== */

.article-body pre {
  position: relative;
  background: #f6f8fa;
  padding: calc(1rem + 32px) 1rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #d0d7de;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* macOS-style title bar on standalone pre */
.article-body pre::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: #e8eaed;
  border-bottom: 1px solid #d0d7de;
  border-radius: 8px 8px 0 0;
  background-image:
    radial-gradient(circle at 16px center, #ff5f57 5px, transparent 5px),
    radial-gradient(circle at 36px center, #ffbd2e 5px, transparent 5px),
    radial-gradient(circle at 56px center, #28c840 5px, transparent 5px);
  background-repeat: no-repeat;
}

.article-body pre::-webkit-scrollbar {
  height: 6px;
}

/* Remove macOS title bar from pre elements inside figure.highlight
   (figure.highlight already has its own title bar via ::before) */
.article-body figure.highlight pre::before {
  display: none;
}

/* Reset padding for pre elements inside figure.highlight
   (their parent figure already has the title bar, so no extra top padding needed) */
.article-body figure.highlight pre {
  padding: 1rem 0.6rem;
}
.article-body figure.highlight .code pre {
  padding: 1rem 1rem;
}
.article-body pre::-webkit-scrollbar-track {
  background: transparent;
}
.article-body pre::-webkit-scrollbar-thumb {
  background: #c1c7cd;
  border-radius: 3px;
}

.article-body pre code {
  background: none;
  color: #1f2328;
  padding: 0;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', Consolas, Monaco, monospace;
  white-space: pre;
  word-break: normal;
  word-wrap: normal;
}

/* Figure wrapper (hljs: false mode) */
.article-body figure.highlight {
  position: relative;
  max-width: 100%;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
}

/* macOS-style title bar */
.article-body figure.highlight::before {
  content: '';
  display: block;
  height: 32px;
  background: #e8eaed;
  border-bottom: 1px solid #d0d7de;
  position: sticky;
  left: 0;
  background-image:
    radial-gradient(circle at 16px center, #ff5f57 5px, transparent 5px),
    radial-gradient(circle at 36px center, #ffbd2e 5px, transparent 5px),
    radial-gradient(circle at 56px center, #28c840 5px, transparent 5px);
  background-repeat: no-repeat;
}

.article-body figure.highlight::-webkit-scrollbar {
  height: 6px;
}
.article-body figure.highlight::-webkit-scrollbar-track {
  background: transparent;
}
.article-body figure.highlight::-webkit-scrollbar-thumb {
  background: #c1c7cd;
  border-radius: 3px;
}

.article-body figure.highlight table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  border: none;
}

.article-body figure.highlight td {
  border: none;
  padding: 0;
  vertical-align: top;
}

/* Gutter (line numbers) */
.article-body figure.highlight .gutter {
  width: 3.5em;
  min-width: 3.5em;
  background: #f0f2f5;
  border-right: 1px solid #d0d7de;
  user-select: none;
  -webkit-user-select: none;
}

.article-body figure.highlight .gutter pre {
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 1rem 0.6rem;
  text-align: right;
  color: #6e7781;
  font-size: 0.75rem;
  line-height: 1.6;
  overflow: visible;
}

.article-body figure.highlight .gutter pre span.line {
  display: block;
}

/* Code area */
.article-body figure.highlight .code {
  overflow: visible;
  width: 100%;
}

.article-body figure.highlight .code pre {
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 1rem 1rem;
  overflow: visible;
  min-width: max-content;
}

/* Inline code */
.article-body code {
  background: #f3e8ff;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
  color: #8250df;
  font-family: 'JetBrains Mono', 'Fira Code', 'Source Code Pro', Consolas, Monaco, monospace;
}

/* ==============================
   Code Syntax Highlighting (GitHub Light)
   Works for both hljs: false (Hexo highlight) and hljs: true modes
   ============================== */

/* Comments */
.article-body .comment,
.article-body .hljs-comment {
  color: #6e7781;
  font-style: italic;
}

/* Keywords */
.article-body .keyword,
.article-body .hljs-keyword {
  color: #cf222e;
}

/* Strings */
.article-body .string,
.article-body .hljs-string {
  color: #0550ae;
}

/* Numbers */
.article-body .number,
.article-body .hljs-number,
.article-body .literal,
.article-body .hljs-literal {
  color: #0550ae;
}

/* Built-ins / Constants */
.article-body .built_in,
.article-body .hljs-built_in,
.article-body .hljs-attr {
  color: #8250df;
}

/* Types */
.article-body .type,
.article-body .hljs-type {
  color: #0550ae;
}

/* Function names */
.article-body .title.function__,
.article-body .hljs-title.function__,
.article-body .hljs-title,
.article-body .hljs-title.class__ {
  color: #8250df;
}

/* Params / variables */
.article-body .params,
.article-body .hljs-params {
  color: #1f2328;
}

/* Tags (HTML/XML) */
.article-body .tag,
.article-body .hljs-tag {
  color: #116329;
}

.article-body .hljs-name,
.article-body .hljs-tag .hljs-name {
  color: #116329;
}

/* Attribute names */
.article-body .hljs-attribute,
.article-body .attribute {
  color: #0550ae;
}

/* Selectors (CSS) */
.article-body .selector-class,
.article-body .hljs-selector-class,
.article-body .selector-id,
.article-body .hljs-selector-id,
.article-body .selector-tag,
.article-body .hljs-selector-tag {
  color: #116329;
}

/* Pseudo / At-rules */
.article-body .hljs-selector-pseudo,
.article-body .hljs-at_rule {
  color: #8250df;
}

/* Punctuation / Operators */
.article-body .hljs-punctuation,
.article-body .hljs-operator {
  color: #0550ae;
}

/* Meta / Preprocessor */
.article-body .hljs-meta {
  color: #8250df;
}

/* Regexp */
.article-body .hljs-regexp {
  color: #0550ae;
}

/* Deletion / Insertion (diff) */
.article-body .hljs-deletion {
  color: #cf222e;
  background: rgba(207, 34, 46, 0.08);
}
.article-body .hljs-addition {
  color: #116329;
  background: rgba(17, 99, 41, 0.08);
}

/* Links */
.article-body .hljs-link {
  text-decoration: underline;
}

/* Markup emphasis */
.article-body .hljs-strong {
  font-weight: bold;
}
.article-body .hljs-emphasis {
  font-style: italic;
}

/* Markdown headings */
.article-body .hljs-section,
.article-body .section {
  color: #0550ae;
  font-weight: bold;
}

/* Highlighted line */
.article-body figure.highlight .marked {
  background: rgba(209, 213, 218, 0.3);
}

/* Copy button placeholder */
.article-body figure.highlight .copy-btn {
  display: none;
}

/* ==============================
   Floating Table of Contents (TOC)
   ============================== */
.toc-floating {
  position: fixed;
  right: 1.5rem;
  bottom: 5.5rem;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 1rem;
  width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  z-index: 100;
  transform-origin: bottom right;
  display: none;
}
.toc-floating:active {
  cursor: grabbing;
}

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee;
  cursor: grab;
  user-select: none;
}
.toc-header:active {
  cursor: grabbing;
}

.toc-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.toc-close:hover {
  color: #333;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toc-link {
  font-size: 0.8rem;
  color: #666;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1.4;
  display: block;
}
.toc-link:hover {
  background: #f5f5f5;
  color: #333;
}

.toc-h2 {
  font-weight: 500;
  padding-left: 0.5rem;
}
.toc-h3 {
  font-weight: 400;
  color: #888;
  font-size: 0.75rem;
  padding-left: 1rem;
}

/* 收起时的悬浮图标 */
.toc-collapsed {
  position: fixed;
  right: 2rem;
  bottom: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
}
.toc-collapsed:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

/* giscus 评论区间距 */
.giscus-wrapper {
  margin-top: 1rem;
  min-height: 200px;
}

/* TOC 动画 */
.toc-anim-in {
  animation: tocSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.toc-anim-out {
  animation: tocSlideOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes tocSlideIn {
  from {
    opacity: 0;
    transform: scale(0.7) translateX(40px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateX(0);
  }
}

@keyframes tocSlideOut {
  from {
    opacity: 1;
    transform: scale(1) translateX(0);
  }
  to {
    opacity: 0;
    transform: scale(0.7) translateX(30px);
  }
}

/* 回到顶部按钮调整位置（与 TOC 错开） */
.article-page-layout .back-to-top {
  bottom: 6rem;
}

/* TOC 响应式 */
@media (max-width: 992px) {
  .toc-floating {
    right: 1.5rem;
    bottom: 5.5rem;
    left: auto !important;
    top: auto !important;
    width: 260px;
    max-width: calc(100% - 2rem);
    max-height: 50vh;
  }
  .toc-collapsed {
    right: 1.5rem;
    bottom: 1.5rem;
  }
  .article-page-layout .back-to-top {
    right: 1.5rem;
    bottom: 5.5rem;
    width: 44px;
    height: 44px;
  }
}
@media (max-width: 480px) {
  .toc-floating {
    width: calc(100% - 2rem);
    right: 1rem;
  }
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.article-body th,
.article-body td {
  padding: 0.75rem 1rem;
  border: 1px solid #f1f3f5;
  text-align: left;
}

.article-body th {
  background: #f8f9fa;
  font-weight: 600;
}

.article-body img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

.article-body li {
  margin: 0.5rem 0;
}

.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #f1f3f5;
}

/* Article declaration */
.article-declaration {
  position: relative;
  margin: 2rem 0 0;
  padding: 0.75rem 1rem 0.75rem calc(1rem + 3px);
  background: #f8f9fa;
  border-radius: 0 6px 6px 0;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.5;
  overflow: hidden;
}
.article-declaration::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #8ec5fc 0%, #e0c3fc 100%);
}
.declaration-icon {
  flex-shrink: 0;
  font-size: 1rem;
}
.declaration-text {
  flex: 1;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  transition: all 0.25s ease;
  text-decoration: none;
}

.action-btn:hover {
  border-color: #1a1a2e;
  color: #1a1a2e;
}

/* ==============================
   Back to Top
   ============================== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #555;
  border: 1px solid rgba(255, 255, 255, 0.45);
  cursor: pointer;
  font-size: 1.2rem;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  z-index: 99;
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.4);
}

.back-to-top.visible {
  display: flex;
}

/* ==============================
   Comment Section
   ============================== */
.comment-section {
  margin-top: 2rem;
  padding: 1.5rem 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comment-form {
  margin-bottom: 2rem;
  background: #f8fafc;
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
}

.comment-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
}

.comment-textarea:focus {
  border-color: #0984e3;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.submit-btn {
  padding: 0.5rem 1rem;
  background: #2d3436;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s;
}

.submit-btn:hover {
  background: #000;
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.comment-list {
  margin-top: 1rem;
}

.comment-item {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #f1f3f5;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0c3fc, #8ec5fc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.comment-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.comment-user {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1a1a2e;
}

.comment-date {
  font-size: 0.8rem;
  color: #999;
}

.comment-text {
  font-size: 0.9rem;
  color: #2d3436;
  line-height: 1.6;
}

.no-comments {
  text-align: center;
  color: #999;
  padding: 2rem 0;
  font-size: 0.9rem;
}

/* ==============================
   Page Styles
   ============================== */
.page-content .page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f3f5;
}

.page-body {
  font-size: 1rem;
  line-height: 1.8;
  color: #2d3436;
}

/* ==============================
   Responsive
   ============================== */
@media (max-width: 1200px) {
  .home-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .right-sidebar {
    display: none;
  }
  .article-page-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
}

@media (max-width: 992px) {
  .home-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 1rem;
  }
  .sidebar,
  .right-sidebar {
    display: none !important;
  }
  .main-content {
    padding: 1rem;
  }
  .article-page-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .tags-page-layout {
    padding: 1rem;
  }
  .tags-page-content {
    padding: 1.5rem;
  }

  /* Hamburger visible */
  .menu-toggle {
    display: flex;
  }
  .nav-links {
    position: fixed;
    top: 54px;
    right: 0;
    width: 100%;
    height: calc(100vh - 54px);
    flex-direction: column;
    background-color: white !important;
    padding: 2rem 1.5rem;
    gap: 0.5rem;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s;
    z-index: 99;
    margin: 0;
    display: flex;
  }
  .nav-links.is-open {
    transform: translateX(0);
    visibility: visible;
  }
  .nav-links a {
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 8px;
    text-align: center;
  }
  .right-area {
    gap: 0.5rem;
  }
}

@media (max-width: 768px) {
  .search-expand input {
    width: 140px;
    font-size: 0.8rem;
  }
  /* Smaller code font on mobile */
  .article-body pre code,
  .article-body figure.highlight .code pre,
  .article-body figure.highlight .gutter pre {
    font-size: 0.7rem;
  }
  .article-body figure.highlight .gutter pre {
    padding: 0.75rem 0.5rem;
  }
  .article-body figure.highlight .code pre {
    padding: 0.75rem 0.75rem;
  }
  .article-body pre {
    padding: calc(0.75rem + 32px) 0.75rem 0.75rem;
  }
  .article-body figure.highlight .gutter pre,
  .article-body figure.highlight .code pre {
    padding: 0.75rem 0.5rem;
  }
}

@media (max-width: 576px) {
  .pagination {
    gap: 0.75rem;
  }
  .page-numbers {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .page-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  .article-header .article-title {
    font-size: 1.5rem;
  }
}
