/* Custom Styles for GitHub-Style Theme */

/* Global Styles */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --accent-color: #3b82f6;
  --text-color: #1f2937;
  --bg-color: #ffffff;
  --border-color: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Language Toggle Button in Header */
.language-toggle-container {
  display: flex;
  gap: 4px;
}

.language-toggle-link {
  color: var(--color-fg-default);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  display: inline-block;
}

/* Ensure proper color inheritance from GitHub's CSS variables */
.language-toggle-link,
.language-toggle-link:visited {
  color: inherit;
}

/* Enhanced GitHub-style elements */
.markdown-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3em;
}

.markdown-body blockquote {
  border-left: 4px solid var(--primary-color);
  background: #f8fafc;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
}

.markdown-body code {
  background-color: #f6f8fa;
  border-radius: 6px;
  font-size: 85%;
  padding: 0.2em 0.4em;
}

.markdown-body pre {
  background-color: #f6f8fa;
  border-radius: 6px;
  padding: 16px;
  overflow: auto;
}

.markdown-body pre code {
  background-color: transparent;
  padding: 0;
}

/* Modern Black & White Scrollbar */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #111;
  border-radius: 10px;
  border: 2px solid #f0f0f0;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #2b2b2b;
}

::-webkit-scrollbar-thumb:active {
  background: #000;
}

/* Firefox */
body,
html,
.markdown-body,
.markdown-body pre,
#toc-list,
.SelectMenu-modal,
.SelectMenu-list {
  scrollbar-width: thin;
  scrollbar-color: #111 #f0f0f0;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #111 #f0f0f0;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  ::-webkit-scrollbar-track {
    background: #0f0f10;
  }

  ::-webkit-scrollbar-thumb {
    background: #cfcfcf;
    border-color: #0f0f10;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #e0e0e0;
  }

  ::-webkit-scrollbar-thumb:active {
    background: #f5f5f5;
  }

  body,
  html,
  .markdown-body,
  .markdown-body pre,
  #toc-list,
  .SelectMenu-modal,
  .SelectMenu-list {
    scrollbar-color: #d0d0d0 #0f0f10;
  }

  * {
    scrollbar-color: #d0d0d0 #0f0f10;
  }
}

/* Hide post previews/summaries in article lists
 * This prevents Hugo from showing article content previews in the post listing pages
 * Only shows article titles, tags, and dates for a cleaner look
 */
.col-12.d-inline-block.text-gray.mb-2.pr-4 {
  display: none !important;
}

/* Hide tags display - only show categories */
.f6.text-gray.mt-2 a[href*="/tags/"],
.f6.text-gray.mt-2 a[href*="/zh/tags/"],
.muted-link[href*="/tags/"],
.muted-link[href*="/zh/tags/"],
a[href*="/tags/"],
a[href*="/zh/tags/"] {
  display: none !important;
}

/* Fix pinned items text preview and code overflow */
.pinned-item-desc {
  /* Limit text preview to 10 lines maximum */
  display: -webkit-box;
  -webkit-line-clamp: 10;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  max-height: calc(1.4em * 10); /* 10 lines * line-height */
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* Handle code blocks within pinned item descriptions */
.pinned-item-desc pre {
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.8em;
  margin: 0.5em 0;
  padding: 0.5em;
  background-color: var(--color-canvas-subtle);
  border-radius: 4px;
  border: 1px solid var(--color-border-default);
}

.pinned-item-desc code {
  font-size: 0.85em;
  background-color: var(--color-canvas-subtle);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--color-border-default);
}

/* Search Results Styling */
#search-result {
  background-color: var(--color-canvas-default);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#search-result .search-results-count {
  background: var(--color-canvas-default);
  color: var(--color-fg-default);
  border-radius: 8px 8px 0 0;
  padding: 16px 20px;
  margin: 0;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border-default);
}

#search-result .search-results-count svg {
  margin-right: 8px;
  vertical-align: middle;
}

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

#search-result li {
  border-bottom: 1px solid var(--color-border-default);
  transition: background-color 0.2s ease;
  padding: 16px 20px;
}

#search-result li:hover {
  background-color: var(--color-canvas-subtle);
}

#search-result li:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}

#search-result .search-result-header {
  margin-bottom: 8px;
}

#search-result .search-result-content {
  padding-left: 0;
}

#search-result h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
}

#search-result h3 a {
  color: var(--color-accent-fg);
  text-decoration: none;
  transition: color 0.2s ease;
}

#search-result h3 a:hover {
  color: var(--color-accent-emphasis);
  text-decoration: underline;
}

#search-result .search-result-content {
  color: var(--color-fg-muted);
  line-height: 1.5;
  font-size: 14px;
  margin-bottom: 12px;
}

#search-result .search-result-content span[style="color: red;"] {
  background-color: var(--color-attention-subtle);
  color: var(--color-attention-fg);
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 500;
}

#search-result .back-button {
  background: var(--color-btn-bg);
  color: var(--color-btn-text);
  border: 1px solid var(--color-btn-border);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 16px 20px;
}

#search-result .back-button:hover {
  background: var(--color-btn-hover-bg);
  border-color: var(--color-btn-hover-border);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#search-result .no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-fg-muted);
  font-style: italic;
}

/* Avatar Styling - Soft blur edges and shadow */
.avatar-user,
.avatar {
  /* Soft shadow for depth */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.12);
  
  /* Smooth transition for hover effects */
  transition: all 0.3s ease;
  
  /* Subtle border to blend with background */
  border: 2px solid rgba(255, 255, 255, 0.8) !important;
  
  /* Circular avatar for softer look - comment this out if you prefer square */
  border-radius: 50% !important;
  
  /* Alternative: Enhanced border radius for softer square look - uncomment if you prefer square */
  /* border-radius: 8px !important; */
}

/* Hover effect for avatar */
.avatar-user:hover,
.avatar:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Large avatar specific styling */
.avatar.width-full {
  /* Gradient overlay to soften harsh backgrounds */
  position: relative;
  overflow: hidden;
}

.avatar.width-full::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    rgba(255, 255, 255, 0.05) 50%, 
    transparent 100%);
  pointer-events: none;
  border-radius: inherit;
}

/* For green background specifically - add a subtle filter */
.avatar-user[src*="avatar"],
.avatar[src*="avatar"] {
  /* Slight desaturation to reduce color intensity */
  filter: saturate(0.85) contrast(1.05);
}

/* Alternative: If you want a circular avatar instead of rounded square */
.avatar-circular {
  border-radius: 50% !important;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  #search-result {
    margin: 8px;
    border-radius: 6px;
  }
  
  #search-result .search-results-count {
    padding: 12px 16px;
    font-size: 14px;
  }
  
  #search-result h3 {
    font-size: 16px;
  }
  
  #search-result .search-result-content {
    font-size: 13px;
  }
  
  #search-result .back-button {
    margin: 12px 16px;
    padding: 6px 12px;
    font-size: 13px;
  }
  
  /* Mobile avatar adjustments */
  .avatar-user,
  .avatar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }
}
