/* Theme variables */
:root {
  --bg-color: #ffffff;
  --text-color: #444444;
  --text-secondary: #7080a0;
  --border-color: lightgray;
  --code-bg: lightgray;
  --link-color: #2060d0;
  --link-hover: #5090ff;
  --blockquote-border: #b4c6c7;
}

[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --text-secondary: #a0b0c0;
  --border-color: #444444;
  --code-bg: #2d2d2d;
  --link-color: #6fa8dc;
  --link-hover: #8fc1ff;
  --blockquote-border: #4a5a5b;
}

.site-header, .breadcrumb, .site-footer, .main {
  max-width: 800px;
}

.author-social {
  width: 100%;
}

.about {
  text-align: left;
}

.article img {
  max-width: 100%;
  box-sizing: border-box;
  border: solid 0px lightgray;
  padding: 4px;
  display: flex;
}

.list .article {
  padding-bottom: 0px;
  border-bottom: none;
}

.list ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}
.list .article-item {
  padding: 0 0 5px 0;
  margin: 0 0 5px 0;
  display: -webkit-flex;
  display: flex;
}
.list .article-item > a {
  -webkit-flex-grow: 0;
  flex-grow: 0;
}
.list .article-item > a:visited {
  color: #a8a8a8;
}
.list .article-item time {
  -webkit-flex-grow: 1;
  flex-grow: 1;
  text-align: right;
}

.terms > ul > li {
  padding: 0 0 5px 0;
  margin: 0 0 5px 0;
  border-bottom: none;
}

.highlight {
  margin: 3px 0 0 0;
}
.highlight pre, .highlight code {
  display: block;
  margin: 0px;
}
.highlight code {
  padding: 5px 0 5px 5px;
}

.about ul:not(.author-social) {

}

/* Theme toggle button */
#theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2em;
  color: var(--text-color);
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.3s ease;
}

#theme-toggle:hover {
  color: var(--link-hover);
}

/* Apply theme colors */
body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: var(--link-color);
}

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

hr {
  border-top-color: var(--border-color);
}

pre, code {
  background-color: var(--code-bg);
}

blockquote {
  border-left-color: var(--blockquote-border);
  color: var(--text-secondary);
}

.toc {
  border-color: var(--border-color);
}

.article img {
  border-color: var(--border-color);
}

.article > table {
  border-color: var(--border-color);
}

.article > table th, .article > table td {
  border-color: var(--border-color);
}

/* Content wrapper with TOC on the right */
.content-wrapper {
  position: relative;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.content-wrapper .main {
  max-width: 800px;
}

/* Sticky table of contents */
.toc {
  position: fixed;
  top: 160px;
  right: calc((100vw - 800px) / 2 - 280px);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  background-color: var(--bg-color);
  width: 250px;
}

.toc a {
  transition: color 0.2s ease;
}

.toc a.active {
  color: var(--link-hover);
  font-weight: bold;
}

/* Hide TOC on smaller screens */
@media (max-width: 1400px) {
  .toc {
    display: none;
  }
}

/* Smooth scrollbar for TOC in dark mode */
.toc::-webkit-scrollbar {
  width: 6px;
}

.toc::-webkit-scrollbar-track {
  background: var(--bg-color);
}

.toc::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.toc::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Article metadata styling */
.article-meta-wordcount,
.article-meta-readtime {
  color: var(--text-secondary);
  font-size: 0.95em;
}

.article-meta-wordcount i,
.article-meta-readtime i {
  opacity: 0.7;
  margin-right: 2px;
}
