/* Custom overrides for Pico CSS */

/* Reduce all font sizes */
html {
  font-size: 16px;
}

header h1 {
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
}
header p {
  margin-top: 0;
  opacity: 0.8;
  font-size: 0.95rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }

.post-meta { color: var(--pico-muted-color); font-size: 0.85em; }
.post-excerpt { margin: 1rem 0; font-size: 0.95rem; }
.view-count { color: var(--pico-muted-color); font-size: 0.85em; }
aside h3 { margin-top: 0; }
.popular-post { margin-bottom: 0.75rem; }

/* Limit container width for better readability */
.container {
  max-width: 1200px;
}

/* Grid layout: main content takes 70%, sidebar takes 30% */
main .grid {
  grid-template-columns: 2fr 1fr;
  column-gap: 2rem;
}

/* Ensure sidebar has minimum width */
main .grid aside {
  min-width: 280px;
}

/* Mobile: stack vertically */
@media (max-width: 768px) {
  main .grid {
    grid-template-columns: 1fr;
  }

  main .grid aside {
    min-width: auto;
  }
}

/* Theme toggle button */
#theme-toggle {
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  background-color: rgba(128, 128, 128, 0.15);
}

#theme-toggle:hover {
  background-color: rgba(128, 128, 128, 0.25);
}

/* Avatar styling */
.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  display: block;
  margin: 0 auto 1rem auto;
  object-fit: cover;
}

/* Code block styling */
pre[class*="language-"] {
  border-radius: 6px;
  margin: 1.5rem 0;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

code[class*="language-"] {
  font-family: 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
}

/* Inline code */
:not(pre) > code {
  background-color: rgba(128, 128, 128, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Consolas', 'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
}

/* Tag link styling */
.tag-link {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.875rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  transition: background-color 0.2s;
}

.tag-link:hover {
  background: var(--primary-hover);
  color: white;
}

/* Small tag links for post footers */
.post-tags-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(128, 128, 128, 0.2);
}

.tag-link-small {
  text-decoration: none;
  font-size: 0.8rem;
}

.tag-link-small:hover {
  text-decoration: underline;
}

/* Tag filter UI */
.tag-filters {
  margin-bottom: 2rem;
  padding: 1rem;
  background: rgba(128, 128, 128, 0.05);
  border-radius: 6px;
}

.tag-filters h3 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

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

.tag-filter-item {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.tag-filter-item:hover {
  background: var(--primary);
  color: white;
}

.tag-filter-item.active {
  background: var(--primary);
  color: white;
  font-weight: bold;
}

/* Heading anchor styling */
.heading-anchor {
  opacity: 0;
  margin-left: 0.5rem;
  text-decoration: none;
  color: var(--pico-muted-color);
  font-weight: normal;
  transition: opacity 0.2s;
}

h1:hover > .heading-anchor,
h2:hover > .heading-anchor,
h3:hover > .heading-anchor,
h4:hover > .heading-anchor,
.heading-anchor:hover {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--primary);
}
