:root {
  /* Light mode variables (default) */
  --BackgroundColor: #ffffff;
  --2ndBackgroundColor: #ececec;
  --FontColor: #505050;
  --AtagColor: #4b4b4b;
  --HeaderBgColor: #ddddddcc;
  --TheamColor: #7a8c99;
  --BorderColor: #c5c5c5;
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
  :root {
    --BorderColor: #555555;
    --TheamColor: #aec9db;
    --BackgroundColor: #1e1e1e;
    --2ndBackgroundColor: #252525;
    --FontColor: #aaaaaa;
    --AtagColor: #aaaaaa;
    --HeaderBgColor: #b5b5b5;
  }


}

body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  color: var(--FontColor);
  background: var(--BackgroundColor);
}

/* TOC scrollbar */
/* html {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--2ndBackgroundColor) transparent;
  border-radius: var(--BrRadius);
} */

html {
  scrollbar-color: var(--BorderColor) transparent;
  scrollbar-width: 4px;
}

/* Customize the scrollbar */
/* pre::-webkit-scrollbar {
  width: thin;
}

pre::-webkit-scrollbar-thumb {
  background-color: var(--BorderColor);
  border-radius: 6px; 
}

pre::-webkit-scrollbar-track {
  background-color: transparent; 
} */



/* header style  */
.site-header {
  padding: 0.5em 0;
  margin: 2em auto;
  max-width: 920px;
  padding: 0 1em;
  text-wrap-style: balance;
  border-bottom: 2px solid var(--BorderColor);
  margin-bottom: 4em;
}

.site-header ul {
  display: flex;
  gap: 0.2em;
  padding: 0;
  margin: 0;
}

.site-header li {
  list-style: none;
}

.site-header a {
  padding: 2px 14px;
  margin: 2px;
  font-weight: bold;
  border-radius: 25px;
  margin-bottom: 6px;
  display: inline-block;
  color: var(--FontColor);
}

.site-header a.active {
  filter: brightness(1);
  text-decoration: none;
  color: #444;
  background: var(--HeaderBgColor);
}




/* table of content when active  */
.toc a.active,
#TableOfContents a.active {
  color: var(--TheamColor);
  text-decoration: underline;
}



.content {
  max-width: 900px;
  margin: 2em auto;
  padding: 0 1em;
}

.site-footer {
  margin-top: 6em;
  padding: 1em 0;
  text-align: center;
  font-size: 0.9em;
}

/* Markdown content styles */
h1,
h2,
h3,
h4 {
  margin-top: 1.4em;
}

pre {
  padding: 1em;
  overflow-x: auto;
  border-radius: var(--BrRadius);
}

code {
  background: var(--2ndBackgroundColor);
  color: var(--FontColor);
  padding: 0.1em 0.6em;
  margin: 1px;
  display: inline-block;
  border-radius: var(--BrRadius);
}

pre,
pre.chroma {
  background-color: var(--2ndBackgroundColor) !important;
  border-radius: var(--BrRadius);
}


a {
  color: var(--AtagColor);
  filter: brightness(0.8);
  text-decoration: none;
}

a:hover {
  filter: brightness(1);
  text-decoration: underline;
}

img {
  width: 100%;
  border-radius: var(--BrRadius);
}

input {
  background-color: var(--2ndBackgroundColor);
  color: var(--FontColor);
  border: 1px solid var(--BorderColor);
  border-radius: var(--BrRadius);
}

blockquote {
  border-left: 4px solid var(--BorderColor);
  padding: 2px 10px 2px 20px;
  background-color: var(--2ndBackgroundColor);
  border-radius: 0 var(--BrRadius) var(--BrRadius) 0;
  font-style: italic;
}

hr {
  margin-bottom: 2vh;
  margin-top: 2vh;
}

/* table styling  */
table {
  border-collapse: collapse;
}

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

table th {
  background: var(--2ndBackgroundColor);
}

iframe {
  max-width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  border: none;
  border-radius: var(--BrRadius);
}



.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5em auto;
  border-radius: var(--BrRadius);
}


/* card styling */
/* .card-container {
  display: flex;
  flex-wrap: wrap;
  gap: 3em;
  justify-content: space-between;
} */

.blog-card {
  display: grid;
  border-bottom: 2px solid var(--BorderColor);
  overflow: hidden;
  min-width: 200px;
  margin-bottom: 3em;
  background-color: var(--2ndBackgroundColor);
  border-radius: var(--BrRadius);
  padding: 12px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.blog-card img {
  width: 100%;
  /* height: 180px; */
  object-fit: cover;
}

.blog-card h2 {
  margin: 0;
}

.blog-card h2 a {
  display: block;
}

.blog-card .meta {
  font-size: 0.9em;
  margin-bottom: 0.5em;
}

.tags {
  margin: 0;
  cursor: default;
}

/* blog card tags  */
.blog-card .tags a {
  display: inline-block;
  color: var(--TheamColor);
  margin: 0.3em 0.3em 0 0;
  padding: 0.3em 0.6em 0.3em 0;
  border-radius: var(--BrRadius);
  font-size: 0.8em;
}

.blog-card .tags a:hover {
  text-decoration: underline;
  color: var(--FontColor);
}

.post-meta {
  filter: contrast(0.2);
  font-size: 0.8em;
  margin-bottom: 0.5em;
  display: inline-flex;
  gap: 20px;
}

/* blog tags  */
.post-tags {
  margin-bottom: 1.5em;
  cursor: default;
}

.post-tags a {
  font-size: 0.8em;
  margin-right: 0.3em;
  padding: 0.4em 0.4em 0.4em 0em;
  color: var(--AtagColor);
  text-decoration: none;
}

.post-tags a:hover {
  color: var(--TheamColor);
  text-decoration: underline;
}

.post-container {
  display: flex;
  gap: 2em;
}

.post-content {
  flex: 1;
  min-width: 300px;
}


/* Layout with sticky TOC */
.toc {
  flex: 2;
  position: sticky;
  top: 1em;
  align-self: flex-start;
  max-height: 95vh;
  min-width: 150px;
  max-width: 256px;
  overflow-y: auto;
  font-size: 0.9em;
  background: none;
  border-radius: var(--BrRadius);
}

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

/* TOC hierarchical numbering */
.toc h3 {
  padding: 4px 8px;
  margin: 0;
}

#TableOfContents {
  padding: 10px;
}

#TableOfContents ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

#TableOfContents li {
  counter-increment: toc-level1;
  position: relative;
}

#TableOfContents li::before {
  content: counters(toc-level1, ".") ". ";
  font-weight: 600;
}

#TableOfContents li ul {
  counter-reset: toc-level1;
  margin-left: 1.2em;
}

/* tags/search tag style  */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  margin-bottom: 2em;
}

.tag-list a {
  padding: 0.2em 0.6em 0.2em 0.0em;
  font-size: 0.8em;
}

.tag-list a:hover {
  /* background: var(--BorderColor); */
  text-decoration: underline;
}

/* CSS rules for screens smaller than 768px */
@media (max-width: 768px) {
  .post-container {
    flex-direction: column-reverse;
  }

  .toc {
    position: inherit;
    max-width: fit-content;
  }
}

/* copy button for code block  */
.post .meta {
  font-size: 0.9em;
  margin-bottom: 1.5em;
  color: #666;
}


.code-block-wrapper {
  position: relative;
  overflow: hidden;
  margin: 1.5em 0;
  border-radius: var(--BrRadius);
}

.code-block-wrapper pre {
  margin: 0;
  padding: 1em;
  overflow-x: auto;
  color: var(--FontColor);
}

.copy-btn {
  position: absolute;
  top: 0.4em;
  right: 0.4em;
  padding: 0.3em 0.6em;
  border: none;
  cursor: pointer;
  color: var(--AtagColor);
  background: var(--BackgroundColor);
  border-radius: var(--BrRadius);
}





/* home page style  */
.info-row {
  display: flex;
  gap: 1.5em;
  margin-bottom: 4em;
  align-items: flex-start;
  justify-content: flex-end;
}

.info-row h2 {
  width: 20%;
  text-align: right;
  margin: 0;
}

.info-row img {
  width: 250px;
  height: 350px;
  object-fit: cover;
}

.info-content {
  border-left: 1px solid var(--BorderColor);
  padding-left: 1em;
  width: 72%;
}



@media (max-width: 768px) {
  .info-row {
    flex-direction: column;
    gap: 0;
  }

  .info-row h2 {
    width: 100%;
    text-align: left;
    margin-bottom: 0;
  }

  .info-content {
    border-left: none;
    width: 100%;
    padding-left: 0;
  }
}


/* pagination style  */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6em;
  margin-top: 2em;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 0.2em 0.8em;
}

.pagination a:hover,
.pagination .active {
  background: var(--HoverOrangeColor);
  text-decoration: underline;
  opacity: 0.5;
}

.pagination .disabled {
  opacity: 0.5;
  cursor: default;
}

.page-info {
  text-align: center;
  margin: 1em 0;
  opacity: 0.8;
  font-size: 0.9em;
}