:root {
  --content-width: 740px;
  --nav-height: 80px;
  --spacing-section: 120px;

  --bg-color: #ffffff;
  --text-color: #37352f;
  --text-color-light: #787774;
  --heading-color: #111111;
  --link-color: #2e7bcf;
  --link-color-hover: #1c5ba6;
  --border-color: #eaeaea;
  --code-bg: #f7f6f3;
  --highlight-color: rgba(0, 0, 0, 0.05);
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-mono: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
  --font-serif: "Charter", "Bitstream Charter", "Sitka Text", Cambria, serif; 
  
  --line-height: 1.75;
  --font-size-base: 18px;
}

[data-theme="dark"] {
  --bg-color: #191919;
  --text-color: #e0e0e0;
  --text-color-light: #9b9b9b;
  --heading-color: #ffffff;
  --link-color: #58a6ff;
  --link-color-hover: #79c0ff;
  --border-color: #2f2f2f;
  --code-bg: #262626;
  --highlight-color: rgba(255, 255, 255, 0.05);
}

*, *:before, *:after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), 
              color 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease-out;
}

a:hover {
  color: var(--link-color-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--heading-color);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2.5em;
  margin-bottom: 0.8em;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.2em; font-weight: 700; margin-top: 1.2em; }
h2 { font-size: 1.7em; border-bottom: 1px solid var(--border-color); padding-bottom: 0.3em; }
h3 { font-size: 1.4em; }
h4 { font-size: 1.15em; }

p {
  margin-bottom: 1.8em;
  margin-top: 0;
}

nav.navigation {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 24px;
  font-size: 1rem;
}

@media (max-width: 600px) {
    nav.navigation {
        justify-content: center;
        flex-wrap: wrap;
        gap: 15px;
    }
}

nav.navigation a {
  color: var(--text-color-light);
  font-weight: 500;
  padding: 5px 0;
}

nav.navigation a:hover {
  color: var(--link-color);
  text-decoration: none;
}

.main {
  width: 100%;
  padding-bottom: var(--spacing-section);
}

#list-page, 
#archive, 
#single, 
#section, 
#page-404, 
#tags {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

.profile {
  text-align: center;
  margin: 60px auto 80px;
  padding: 0 20px;
}

.profile .avatar {
  width: 100px;
  height: 100px;
  margin-bottom: 16px;
  padding: 0;
  background-color: transparent; 
  color: var(--heading-color);
  border-radius: 0;
  box-shadow: none;
  transition: transform 0.3s ease;
}

.profile .avatar:hover {
  transform: translateY(-2px);
}

.profile h1 {
  font-size: 2.4em;
  margin: 0 0 12px 0;
  color: var(--heading-color);
}

.profile h2 {
  font-size: 1.3em;
  font-weight: 400;
  color: var(--text-color-light);
  margin: 0;
  border: none;
  line-height: 1.5;
}

#list-page h2, #archive .key {
  font-size: 1.6rem;
  margin-top: 80px;
  margin-bottom: 24px;
  color: var(--heading-color);
  border-bottom: none;
}

#list-page h3 {
  font-size: 1rem;
  color: var(--text-color-light);
  margin-top: 40px;
  margin-bottom: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.item, .group .value {
  display: flex;
  align-items: baseline;
  margin-bottom: 8px;
  padding: 6px 0;
  transition: transform 0.2s ease;
}

.item .date, .group .value .date {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-color-light);
  min-width: 100px;
  flex-shrink: 0;
  margin-right: 12px;
}

.item .title, .group .value .title {
  font-size: 1rem;
  margin: 0;
  line-height: 1.5;
  font-weight: 500;
}

.item .title a, .group .value .title a {
  color: var(--text-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-bottom-color 0.2s ease;
}

.item .title a:hover, .group .value .title a:hover {
  color: var(--link-color);
  border-bottom-color: var(--link-color);
  text-decoration: none;
}

.tags {
  display: inline;
  margin-left: 12px;
}

.tags a {
  display: inline-block;
  font-size: 0.75em;
  padding: 3px 10px;
  border-radius: 20px;
  background-color: var(--code-bg);
  color: var(--text-color-light);
  margin-right: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tags a:hover {
  background-color: var(--border-color);
  color: var(--text-color);
  transform: translateY(-1px);
}

#single {
  max-width: 1200px;
  margin: 60px auto 100px;
  padding: 0 40px;
}

.post-header {
  max-width: 740px;
  margin: 0 auto 60px;
  text-align: center;
}

.post-layout {
  display: block;
}

.post-layout .post-content {
  margin: 0 auto;
}

.post-layout.with-sidebar {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 60px;
  align-items: start;
}

.post-layout.with-sidebar .post-content {
  margin: 0;
}

.post-sidebar {
  position: sticky;
  top: 100px;
  font-size: 0.9rem;
  padding-right: 20px;
  border-right: 1px solid var(--border-color);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc-container h3 {
  font-size: 0.85em;
  text-transform: uppercase;
  color: var(--text-color-light);
  margin-top: 0;
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

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

#TableOfContents ul li {
  margin-bottom: 10px;
  line-height: 1.4;
}

#TableOfContents ul ul {
  padding-left: 15px;
  margin-top: 8px;
}

#TableOfContents a {
  color: var(--text-color-light);
  text-decoration: none;
  transition: color 0.2s;
  display: block;
}

#TableOfContents a:hover {
  color: var(--link-color);
}

@media (max-width: 1000px) {
  #single {
    padding: 0 20px;
  }
  
  .post-layout.with-sidebar {
    display: block;
  }

  .post-sidebar {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
    margin-bottom: 40px;
    padding-right: 0;
    max-height: none;
  }
  
  .post-header {
    margin-bottom: 40px;
  }
}

#single, #section {
  margin-top: 80px;
  margin-bottom: 120px;
}

#single .title {
  font-size: 3rem;
  line-height: 1.15;
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: -0.03em;
}

#single .tip {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-color-light);
  margin-bottom: 80px;
}

#single .tip .split {
  margin: 0 10px;
  opacity: 0.4;
}

.content {
  font-size: 1.1rem;
}

blockquote {
  border-left: 4px solid var(--link-color);
  margin: 2.5em 0;
  padding-left: 1.5em;
  color: var(--text-color-light);
  font-style: italic;
  font-size: 1.1em;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 3px 6px;
  border-radius: 4px;
  background-color: var(--code-bg);
  color: var(--text-color);
}

pre {
  background-color: var(--code-bg);
  padding: 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2.5em 0;
  font-size: 0.9em;
  line-height: 1.5;
}

pre code {
  background-color: transparent;
  padding: 0;
  color: inherit;
}

.markdown-image, .content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 3em auto;
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 3em 0;
  font-size: 1em;
}

th, td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

th {
  font-weight: 600;
  color: var(--heading-color);
}

#footer {
  margin: 120px 0 80px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-color-light);
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s, transform 0.2s;
  opacity: 0.8;
}

.theme-toggle:hover {
  background: var(--code-bg);
  transform: rotate(15deg);
  opacity: 1;
}

#page-404 {
    margin: 120px auto;
}

#page-404 .text {
    text-align: center;
}

#page-404 .read-more {
    text-align: center;
}

#page-404 .item {
    gap: 12px;
}

.toc {
  background: var(--code-bg);
  padding: 24px;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 60px;
  border: 1px solid var(--border-color);
}

.toc summary {
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
}

.toc ul {
    margin-bottom: 0;
    padding-left: 20px;
}

#tags {
  margin: 80px auto;
  text-align: center;
}

#tags .tag {
  display: inline-block;
  margin: 8px;
}

#tags .tag a {
  display: inline-block;
  padding: 10px 18px;
  background-color: var(--code-bg);
  color: var(--text-color);
  border-radius: 8px;
  font-size: 1em;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#tags .tag a:hover {
  background-color: var(--border-color);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

html {
  scroll-behavior: smooth;
}

.post-content h1, 
.post-content h2, 
.post-content h3, 
.post-content h4 {
  scroll-margin-top: 120px; 
}

#TableOfContents a.active {
  color: var(--link-color);
  font-weight: 500;
  border-left: 2px solid var(--link-color);
  padding-left: 10px;
  margin-left: -12px;
  background-color: var(--highlight-color);
  border-radius: 0 4px 4px 0;
}

#TableOfContents a {
  padding: 4px 0;
  display: block;
  border-left: 2px solid transparent;
  padding-left: 10px;
  margin-left: -12px;
}
