:root {
  --color-fg-default: #24292f;
  --color-fg-muted: #57606a;
  --color-fg-subtle: #6e7781;
  --color-canvas-default: #ffffff;
  --color-canvas-subtle: #f6f8fa;
  --color-border-default: #d0d7de;
  --color-border-muted: #d8dee4;
  --color-accent-fg: #0969da;
  --color-btn-text: #24292f;
  --color-btn-bg: #f6f8fa;
  --color-btn-border: rgba(27,31,35,0.15);
  --color-btn-hover-bg: #f3f4f6;
  --color-btn-hover-border: rgba(27,31,35,0.15);
  --header-height: 64px;
  --container-width: 1280px;
}

body {
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-fg-default);
  background-color: var(--color-canvas-default);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-accent-fg);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px; /* 32px on larger screens usually */
  display: flex;
  flex-direction: row;
  gap: 24px;
  margin-top: 24px;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

/* Header */
.header {
  background-color: #24292f;
  color: #ffffff;
  padding: 16px 0;
}

body.header-fixed .header {
  position: sticky;
  top: 0;
  z-index: 110;
}

body.header-fixed .tab-nav {
  top: var(--header-height);
}

.header-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  font-weight: bold;
  font-size: 20px;
  color: #ffffff;
}

.header-nav a {
  color: #ffffff;
  margin-left: 16px;
  font-weight: 600;
}

/* Tab Nav (Under header, like Overview, Repositories) */
.tab-nav {
  border-bottom: 1px solid var(--color-border-default);
  background-color: var(--color-canvas-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  margin-top: 24px; /* Adjust if needed */
  margin-bottom: 16px;
}

.tab-nav-inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 8px;
}

.tab-item {
  padding: 8px 16px;
  color: var(--color-fg-default);
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-item.active {
  font-weight: 600;
  border-bottom-color: #fd8c73; /* GitHub orange highlight for tabs */
}

.tab-item:hover {
  background-color: var(--color-canvas-subtle);
  text-decoration: none;
}

/* Sidebar */
.sidebar {
  width: 296px;
  flex-shrink: 0;
}

.avatar-img {
  width: 260px; /* Reduced slightly */
  height: 260px;
  border-radius: 50%;
  border: 1px solid var(--color-border-muted);
  margin-bottom: 16px;
}

.profile-name {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.profile-bio {
  font-size: 16px;
  color: var(--color-fg-default);
  margin-top: 16px;
  margin-bottom: 16px;
}

.profile-details {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 14px;
  color: var(--color-fg-default);
}

.profile-details li {
  display: flex;
  align-items: center;
  padding-top: 4px;
}

.profile-details svg {
  margin-right: 8px;
  fill: var(--color-fg-muted);
}

/* Main Content */
.main-content {
  flex-grow: 1;
  min-width: 0;
}

/* Post List (Pinned Repos style) */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
}

.post-card {
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  padding: 16px;
  background-color: var(--color-canvas-default);
  display: flex;
  flex-direction: column;
}

.post-title {
  font-weight: 600;
  color: var(--color-accent-fg);
  margin-bottom: 8px;
  font-size: 16px;
}

.post-meta {
  font-size: 12px;
  color: var(--color-fg-muted);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.post-excerpt {
  font-size: 12px;
  color: var(--color-fg-muted);
  margin-bottom: 16px;
  flex-grow: 1;
}

.language-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #f1e05a; /* Example JS color */
  display: inline-block;
  margin-right: 4px;
}

/* Single Post */
.post-content {
  font-size: 16px;
  line-height: 1.6;
}

.post-content h1, .post-content h2, .post-content h3 {
  border-bottom: 1px solid var(--color-border-muted);
  padding-bottom: .3em;
  margin-top: 24px;
}

.post-content pre {
  background-color: #f6f8fa;
  border-radius: 6px;
  padding: 12px;
  overflow: auto;
}

.post-content code {
  background-color: rgba(175,184,193,0.2);
  padding: 0.2em 0.4em;
  border-radius: 6px;
  font-family: Consolas, ui-monospace, SFMono-Regular, SF Mono, Menlo, Liberation Mono, monospace;
  font-size: 85%;
}

.post-content pre code {
  background-color: transparent;
  padding: 0;
}

/* Post Body Images */
.post-content img {
  max-width: 100%;
  height: auto;
  display: block; /* Avoid inline gap */
  margin: 16px auto; /* Center image */
  border-radius: 6px; /* Optional: adds subtle border radius */
}

/* Footer */
.footer {
  margin-top: 40px;
  padding: 40px 16px;
  border-top: 1px solid var(--color-border-default);
  text-align: center;
  font-size: 12px;
  color: var(--color-fg-muted);
}

/* Highlight.js GitHub Theme (Simplified) */
.highlight {
  background: #f6f8fa;
  color: #24292e;
  padding: 12px;
  border-radius: 6px;
  margin: 16px 0;
  overflow: auto;
  font-family: Consolas, ui-monospace, SFMono-Regular, SF Mono, Menlo, Liberation Mono, monospace;
  font-size: 85%;
  line-height: 1.45;
  position: relative; /* For copy button positioning */
}
.highlight pre {
  margin: 0;
  padding: 0;
}
.highlight:hover .copy-btn {
  opacity: 1;
}

/* Copy Button */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  background-color: transparent;
  border: 1px solid rgba(27, 31, 35, 0.15);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0; /* Hidden by default */
  transition: opacity 0.2s, background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-fg-muted);
}

.copy-btn:hover {
  background-color: #f3f4f6;
  border-color: rgba(27, 31, 35, 0.15);
}

.copy-btn svg {
  fill: currentColor;
}

.copy-btn.copied {
  border-color: #2da44e;
  color: #2da44e;
}

.highlight table { margin: 0; padding: 0; border: 0; width: 100%; }
.highlight td, .highlight th { border: 0; padding: 0; vertical-align: top; }
.highlight .gutter { padding-right: 8px; color: #6e7781; text-align: right; border-right: 1px solid #d0d7de; }
.highlight .code { padding-left: 8px; }

/* GitHub Light Default Colors */
.highlight .keyword, .highlight .selector-tag, .highlight .meta-keyword, .highlight .doctag, .highlight .section { color: #cf222e; } /* Red */
.highlight .function, .highlight .title, .highlight .name { color: #8250df; } /* Purple */
.highlight .attribute { color: #0550ae; } /* Blue */
.highlight .string, .highlight .meta, .highlight .quote, .highlight .regexp { color: #0a3069; } /* Dark Blue */
.highlight .comment { color: #6e7781; } /* Gray */
.highlight .variable, .highlight .template-variable, .highlight .selector-id, .highlight .class .title { color: #953800; } /* Orange/Brown */
.highlight .section, .highlight .name, .highlight .strong { font-weight: bold; }
.highlight .symbol, .highlight .bullet, .highlight .subst, .highlight .meta, .highlight .meta .keyword, .highlight .selector-attr, .highlight .selector-pseudo, .highlight .link { color: #0550ae; } /* Blue */
.highlight .built_in, .highlight .deletion { color: #cf222e; } /* Red */
.highlight .literal, .highlight .number, .highlight .tag, .highlight .attr { color: #0550ae; } /* Blue for numbers/constants */

/* Tag Cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-link, .tag-list-link {
  display: inline-block;
  padding: 0 10px;
  line-height: 24px;
  background-color: #ddf4ff;
  color: #0969da;
  border-radius: 2em;
  text-decoration: none;
  font-size: 12px;
  border: 1px solid rgba(54,163,255,0.4);
}
.tag-link:hover, .tag-list-link:hover {
  background-color: #0969da;
  color: #ffffff;
  text-decoration: none;
}
.tag-count, .tag-list-count {
  display: inline-block;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: #0969da;
  background-color: rgba(255,255,255,0.5);
  border-radius: 20px;
  margin-left: 4px;
  vertical-align: middle;
}
.tag-link:hover .tag-count, .tag-list-link:hover .tag-list-count {
  color: #0969da;
  background-color: #ffffff;
}

/* Archive Page */
.archive-year-header {
  margin-top: 24px;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  color: var(--color-fg-default);
}
.archive-year-header .year-icon {
  margin-right: 8px;
  color: var(--color-fg-muted);
}
.archive-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.archive-item:last-child {
  border-bottom: none;
}
.archive-post-title {
  font-size: 16px;
  font-weight: 600;
}
.archive-post-meta {
  font-size: 12px;
  color: var(--color-fg-muted);
}

/* Post Layout with TOC */
.post-layout-wrapper {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.post-content-container {
  flex: 1;
  min-width: 0; /* Prevent flex overflow */
  border: 1px solid #d0d7de;
  border-radius: 6px;
}
.post-header {
  background-color: #f6f8fa;
  border-bottom: 1px solid #d0d7de;
  padding: 16px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}
.post-body {
  padding: 32px;
}

/* TOC Sidebar */
.post-toc-container {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 80px; /* Header height + gap */
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-left: 8px;
}
.post-toc-header {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--color-fg-default);
}
.toc {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-item {
  list-style: none;
  margin-bottom: 4px;
}
.toc-link {
  display: block;
  font-size: 12px;
  color: var(--color-fg-muted);
  text-decoration: none;
  padding: 4px 0 4px 8px;
  border-left: 2px solid transparent;
  line-height: 1.5;
}
.toc-link:hover {
  color: var(--color-accent-fg);
  text-decoration: none;
}
.toc-link.active {
  color: var(--color-fg-default);
  font-weight: 600;
  border-left-color: #fd8c73; /* GitHub highlight color */
}
.toc-child {
  list-style: none;
  padding-left: 12px;
  margin-top: 4px;
}

/* Pagination */
.pagination {
  margin-top: 24px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.pagination .page-number,
.pagination .extend {
  display: inline-block;
  min-width: 32px;
  height: 32px;
  line-height: 30px; /* Adjust for border */
  padding: 0 6px;
  color: var(--color-fg-default);
  text-align: center;
  text-decoration: none;
  background-color: var(--color-canvas-default);
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  transition: border-color 0.2s, background-color 0.2s;
  font-size: 14px;
  box-sizing: border-box;
}

.pagination .page-number:hover,
.pagination .extend:hover {
  background-color: var(--color-canvas-subtle);
  border-color: var(--color-border-muted);
  text-decoration: none;
}

.pagination .page-number.current {
  color: #ffffff;
  background-color: var(--color-accent-fg);
  border-color: var(--color-accent-fg);
  cursor: default;
}

.pagination .extend.prev,
.pagination .extend.next {
  color: var(--color-accent-fg);
}

.pagination .extend.prev:hover,
.pagination .extend.next:hover {
  color: #ffffff;
  background-color: var(--color-accent-fg);
  border-color: var(--color-accent-fg);
}

/* Category List */
.category-list-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.category-list-item {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-muted);
}
.category-list-item:last-child {
  border-bottom: none;
}
.category-list-link {
  font-weight: 600;
  font-size: 16px;
  color: var(--color-accent-fg);
  text-decoration: none;
}
.category-list-link:hover {
  text-decoration: underline;
}
.category-list-count {
  display: inline-block;
  padding: 2px 5px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  color: var(--color-fg-muted);
  background-color: rgba(175,184,193,0.2);
  border-radius: 20px;
  margin-left: 4px;
}
.category-list-child {
  margin-left: 24px !important;
  margin-top: 8px;
}

/* Heatmap */
.contribution-wrapper {
  display: flex;
  gap: 24px;
  border: 1px solid var(--color-border-default);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 24px;
  background-color: var(--color-canvas-default);
}

.contribution-graph-container {
  flex: 1;
  min-width: 0;
}

.contribution-year-menu {
  width: 15%;
  min-width: 100px;
  flex-shrink: 0;
}

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

.year-link {
  display: block;
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--color-fg-default);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.year-link:hover {
  background-color: var(--color-canvas-subtle);
  text-decoration: none;
}

.year-link.active {
  background-color: var(--color-accent-fg);
  color: #ffffff;
}

.heatmap-year-container {
  width: 100%;
}

.heatmap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--color-fg-muted);
}

.heatmap-title {
  font-weight: 600;
  color: var(--color-fg-default);
  font-size: 16px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 2px;
}

.legend-item {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.heatmap-graph {
  overflow-x: auto;
}

.js-calendar-graph-svg text.month {
  font-size: 10px;
  fill: var(--color-fg-muted);
}

.js-calendar-graph-svg text.wday {
  font-size: 9px;
  fill: var(--color-fg-muted);
}

/* GitHub Heatmap Colors (Green) */
:root {
  --color-calendar-graph-day-bg: #ebedf0;
  --color-calendar-graph-day-L1-bg: #9be9a8;
  --color-calendar-graph-day-L2-bg: #40c463;
  --color-calendar-graph-day-L3-bg: #30a14e;
  --color-calendar-graph-day-L4-bg: #216e39;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
  .avatar-img {
    width: 100px;
    height: 100px;
    float: left;
    margin-right: 16px;
  }
  .post-list {
    grid-template-columns: 1fr;
  }
  
  /* Hide TOC on mobile */
  .post-toc-container {
    display: none;
  }
  .post-layout-wrapper {
    flex-direction: column;
  }
  
  .contribution-wrapper {
    flex-direction: column;
  }
  
  .contribution-year-menu {
    width: 100%;
    overflow-x: auto;
  }
  
  .year-list {
    display: flex;
    gap: 8px;
  }
  
  .year-link {
    white-space: nowrap;
  }
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--color-btn-bg);
  color: var(--color-fg-muted);
  border: 1px solid var(--color-btn-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s, background-color 0.2s;
  z-index: 999;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.back-to-top:hover {
  background-color: var(--color-btn-hover-bg);
  border-color: var(--color-btn-hover-border);
  color: var(--color-fg-default);
}

.back-to-top svg {
  fill: currentColor;
}

/* Medium Zoom Overrides */
.medium-zoom-overlay,
.medium-zoom-image--opened {
  z-index: 10000 !important;
}
