/* Wes McKinney Blog - Custom Styles */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* Variables */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Lora', 'Georgia', 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', 'Menlo', monospace;
}

/* Remove all top spacing */
html, body {
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure header starts at top */
#quarto-header {
  margin-top: 0 !important;
}

/* Typography - Medium/Substack style */
body {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.7;
  color: #1a1a1a;
  background-color: white;
}

html[data-bs-theme="dark"] body {
  background-color: #1a1a1a;
}

/* Use sans-serif for headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #0a0a0a;
}

h1 {
  font-size: 2.5rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.9rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

/* Dark mode adjustments */
html[data-bs-theme="dark"] h1,
html[data-bs-theme="dark"] h2,
html[data-bs-theme="dark"] h3,
html[data-bs-theme="dark"] h4,
html[data-bs-theme="dark"] h5,
html[data-bs-theme="dark"] h6 {
  color: #f5f5f5;
}

/* Better code blocks */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

pre code {
  font-size: 14px;
  line-height: 1.5;
}

/* Improved readability - wider for serif */
article p,
article li,
.column-page p,
.column-page li {
  max-width: 680px;
}


/* Better paragraph spacing */
article p {
  margin-bottom: 1.5rem;
}

/* Drop cap for first paragraph in articles */
article .column-body > p:first-of-type::first-letter {
  font-size: 3.5em;
  line-height: 0.85;
  float: left;
  margin: 0.1em 0.1em 0 0;
  font-weight: 700;
  font-family: var(--font-sans);
}

/* Use sans-serif for UI elements */
.navbar,
.nav-footer,
.listing-category,
.metadata,
.quarto-title-meta,
button,
.btn {
  font-family: var(--font-sans);
}

/* About page enhancements */
.about-entity .about-image {
  border-radius: 50%;
}

.about-entity .about-links .about-link {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.about-entity .about-links .about-link:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

/* Blog listing improvements */
.quarto-listing .listing-item {
  padding: 2rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}

.quarto-listing .listing-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.25;
  font-family: var(--font-sans);
}

.quarto-listing .listing-description {
  line-height: 1.7;
  margin-top: 0.75rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.quarto-listing .listing-date {
  font-size: 0.9rem;
  font-weight: 500;
  font-family: var(--font-sans);
}

.quarto-listing .listing-category {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Modern navbar styling */
.navbar {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: saturate(180%) blur(10px);
  position: sticky !important;
  top: 0 !important;
  z-index: 1000;
}

/* Prevent Quarto from hiding the navbar on scroll */
#quarto-header {
  position: sticky !important;
  top: 0 !important;
}

.navbar.navbar-expand-lg {
  position: sticky !important;
  top: 0 !important;
}

/* Override any headroom.js behavior */
.headroom {
  position: sticky !important;
  top: 0 !important;
}

.headroom--pinned,
.headroom--unpinned,
.headroom--top,
.headroom--not-top {
  transform: none !important;
  position: sticky !important;
  top: 0 !important;
}

.navbar .navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.95) !important;
  transition: color 0.2s ease;
}

.navbar .navbar-brand:hover {
  color: rgba(255, 255, 255, 1) !important;
}

.navbar .nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 1rem !important;
  margin: 0 0.25rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  color: rgba(255, 255, 255, 0.75) !important;
}

.navbar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95) !important;
}

.navbar .nav-link.active {
  color: rgba(255, 255, 255, 1) !important;
  font-weight: 600;
  background-color: rgba(255, 255, 255, 0.15);
}

/* Hide book cover thumbnails from listing cards */
.quarto-listing .listing-item .card-img-top,
.quarto-listing .listing-item .thumbnail-image,
.quarto-listing .listing-item .thumbnail {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Page layout - minimal spacing */
#quarto-content {
  padding-top: 1.5rem;
}

#quarto-header {
  border-bottom: none;
}

/* Ensure page columns align at top */
.page-columns {
  align-items: flex-start;
}

/* Fix right sidebar positioning below navbar */
#quarto-margin-sidebar {
  position: sticky;
  top: 4rem !important;
  align-self: flex-start;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 0.5rem !important;
  margin-top: 0 !important;
}

/* Hide scrollbar but keep functionality */
#quarto-margin-sidebar::-webkit-scrollbar {
  width: 6px;
}

#quarto-margin-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

#quarto-margin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

#quarto-margin-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

html[data-bs-theme="dark"] #quarto-margin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

html[data-bs-theme="dark"] #quarto-margin-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Ensure TOC/Categories title is visible */
.sidebar-title,
#quarto-margin-sidebar .sidebar-title {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Categories on archives page - ensure immediate visibility */
.quarto-listing-category-title,
.quarto-listing-category {
  margin-top: 0 !important;
}

#quarto-margin-sidebar .quarto-listing-category {
  padding-top: 0;
}

/* Archives page specific - align main content and sidebar */
.page-layout-full .page-columns {
  margin-top: 0 !important;
  align-items: flex-start !important;
}

.page-layout-full #quarto-content > .page-columns > * {
  margin-top: 0 !important;
}

/* Hide the toggle/unpinned sidebar to prevent duplication */
#quarto-toc-toggle,
.quarto-sidebar-toggle {
  display: none !important;
}

/* Show only the regular pinned sidebar */
#quarto-margin-sidebar {
  display: block !important;
  pointer-events: auto !important;
  z-index: 10 !important;
}

.quarto-listing-category-title,
.quarto-listing-category {
  opacity: 1 !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

/* Ensure category links are clickable */
#quarto-margin-sidebar .category {
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* Highlight active/selected category */
#quarto-margin-sidebar .category.active,
#quarto-margin-sidebar .category:hover {
  background-color: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
  border-radius: 4px;
  padding: 0.25rem 0.5rem !important;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

/* Lock font size and styling for categories sidebar */
#quarto-margin-sidebar .quarto-listing-category-title {
  font-size: 1rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.75rem !important;
}

#quarto-margin-sidebar .category {
  font-size: 0.9rem !important;
  padding: 0.25rem 0 !important;
  font-weight: normal !important;
}

article .metadata {
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--bs-border-color);
}

/* Better blockquotes */
blockquote {
  border-left: 3px solid var(--bs-primary);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  opacity: 0.9;
}

/* Article title styling */
article .title {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}

article .description {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.5;
  font-style: italic;
  color: #666;
  margin-bottom: 2rem;
}

html[data-bs-theme="dark"] article .description {
  color: #aaa;
}

/* Responsive improvements */
@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.3rem; }

  article .title { font-size: 2rem; }
  article .description { font-size: 1.15rem; }

  /* Disable drop cap on mobile */
  article .column-body > p:first-of-type::first-letter {
    font-size: inherit;
    line-height: inherit;
    float: none;
    margin: 0;
    font-weight: inherit;
  }

  /* Mobile navbar adjustments */
  .navbar {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .navbar .navbar-brand {
    font-size: 1.05rem;
  }

  .navbar .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem !important;
    margin: 0.125rem 0;
  }

  #quarto-content {
    padding-top: 1.5rem;
  }

  /* Hide categories sidebar on mobile */
  .quarto-listing-category-title,
  .quarto-listing-category,
  #quarto-margin-sidebar .quarto-listing-category-title,
  #quarto-margin-sidebar .quarto-listing-category {
    display: none !important;
  }
}

/* Smooth transitions */
a, .about-link, .listing-category {
  transition: all 0.2s ease;
}

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}
