/* Simple Blog Readability Enhancements */
/* Works with existing Tailwind prose classes */

/* Optimal reading width and spacing */
.prose {
  max-width: 75ch !important;
  line-height: 1.8 !important;
  font-size: 1.125rem !important;
  color: #1f2937 !important;
}

.dark .prose {
  color: #e5e7eb !important;
}

/* Better heading hierarchy */
.prose h1 {
  font-size: 2.5rem !important;
  line-height: 1.2 !important;
  margin-top: 0 !important;
  margin-bottom: 1.5rem !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
  color: #111827 !important;
}

.dark .prose h1 {
  color: #f9fafb !important;
}

.prose h2 {
  font-size: 2rem !important;
  line-height: 1.3 !important;
  margin-top: 3rem !important;
  margin-bottom: 1rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  color: #111827 !important;
  padding-bottom: 0.5rem !important;
  border-bottom: 2px solid #e5e7eb !important;
}

.dark .prose h2 {
  color: #f9fafb !important;
  border-bottom-color: #374151 !important;
}

.prose h3 {
  font-size: 1.5rem !important;
  line-height: 1.4 !important;
  margin-top: 2rem !important;
  margin-bottom: 0.75rem !important;
  font-weight: 600 !important;
  color: #111827 !important;
}

.dark .prose h3 {
  color: #f9fafb !important;
}

.prose h4, .prose h5, .prose h6 {
  font-weight: 600 !important;
  color: #111827 !important;
}

.dark .prose h4, .dark .prose h5, .dark .prose h6 {
  color: #f3f4f6 !important;
}

/* Better paragraph spacing */
.prose p {
  margin-bottom: 1.5rem !important;
}

/* Improved links */
.prose a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  text-decoration-thickness: 1.5px !important;
  transition: all 0.2s ease !important;
}

.prose a:hover {
  text-decoration-thickness: 2px !important;
}

/* Better code blocks - Terminal style */
.prose pre {
  position: relative !important;
  padding: 0 !important;
  margin: 2rem 0 !important;
  border-radius: 0.75rem !important;
  background: #1e1e1e !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
  overflow: hidden !important;
}

/* Terminal header bar */
.prose pre::before {
  content: '' !important;
  display: block !important;
  height: 40px !important;
  background: #323233 !important;
  border-bottom: 1px solid #1a1a1a !important;
  background-image:
    radial-gradient(circle at 20px 20px, #ff5f56 6px, transparent 6px),
    radial-gradient(circle at 50px 20px, #ffbd2e 6px, transparent 6px),
    radial-gradient(circle at 80px 20px, #27c93f 6px, transparent 6px) !important;
  background-repeat: no-repeat !important;
  background-position: 15px 10px, 45px 10px, 75px 10px !important;
}

/* Code container with scroll */
.prose pre > code {
  display: block !important;
  padding: 1.5rem !important;
  background: transparent !important;
  font-size: 0.9em !important;
  line-height: 1.6 !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  max-height: 600px !important;
  font-family: 'Monaco', 'Courier New', monospace !important;
}

/* Ensure syntax highlighting colors are visible */
.prose pre code .line {
  color: #abb2bf !important;
}

/* Override any dim colors in syntax highlighting */
.prose pre code * {
  color: inherit;
}

/* Custom scrollbar for code blocks */
.prose pre > code::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

.prose pre > code::-webkit-scrollbar-track {
  background: #2d2d2d !important;
  border-radius: 4px !important;
}

.prose pre > code::-webkit-scrollbar-thumb {
  background: #555 !important;
  border-radius: 4px !important;
}

.prose pre > code::-webkit-scrollbar-thumb:hover {
  background: #666 !important;
}

/* Inline code (not in pre blocks) */
.prose :not(pre) > code {
  padding: 0.2rem 0.4rem !important;
  border-radius: 0.25rem !important;
  font-size: 0.875em !important;
  background: #f3f4f6 !important;
  color: #ef4444 !important;
  font-weight: 600 !important;
  font-family: 'Monaco', 'Courier New', monospace !important;
}

.dark .prose :not(pre) > code {
  background: #374151 !important;
  color: #fca5a5 !important;
}

/* Images */
.prose img {
  border-radius: 0.75rem !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
  margin: 2rem auto !important;
  max-width: 100% !important;
  height: auto !important;
}

.dark .prose img {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
}

/* Strong/Bold text */
.prose strong {
  font-weight: 700 !important;
  color: #111827 !important;
}

.dark .prose strong {
  color: #f3f4f6 !important;
}

/* Better blockquotes */
.prose blockquote {
  border-left: 4px solid #3b82f6 !important;
  padding: 1rem 1.5rem !important;
  margin: 2rem 0 !important;
  font-style: italic !important;
  background: linear-gradient(to right, rgba(59, 130, 246, 0.05), transparent) !important;
  border-radius: 0 0.5rem 0.5rem 0 !important;
  color: #374151 !important;
}

.dark .prose blockquote {
  background: linear-gradient(to right, rgba(59, 130, 246, 0.1), transparent) !important;
  color: #d1d5db !important;
  border-left-color: #60a5fa !important;
}

.prose blockquote p {
  margin: 0 !important;
}

/* Better tables */
.prose table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin: 2rem 0 !important;
  border-radius: 0.5rem !important;
  overflow: hidden !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

.prose th,
.prose td {
  padding: 1rem 1.25rem !important;
  border-bottom: 1px solid #e5e7eb !important;
  text-align: left !important;
}

.dark .prose th,
.dark .prose td {
  border-bottom-color: #374151 !important;
}

.prose th {
  background: #f3f4f6 !important;
  font-weight: 700 !important;
  color: #111827 !important;
  text-transform: uppercase !important;
  font-size: 0.85rem !important;
  letter-spacing: 0.05em !important;
}

.dark .prose th {
  background: #1f2937 !important;
  color: #f9fafb !important;
}

.prose tbody tr:hover {
  background: rgba(59, 130, 246, 0.05) !important;
}

.dark .prose tbody tr:hover {
  background: rgba(59, 130, 246, 0.1) !important;
}

/* Better lists */
.prose ul,
.prose ol {
  margin: 1.5rem 0 !important;
  padding-left: 1.75rem !important;
}

.prose li {
  margin-bottom: 0.75rem !important;
  line-height: 1.8 !important;
}

.prose ul > li {
  position: relative !important;
  padding-left: 0.5rem !important;
}

.prose ul > li::marker {
  color: #3b82f6 !important;
  font-size: 1.2em !important;
}

.prose ol > li::marker {
  color: #3b82f6 !important;
  font-weight: 700 !important;
}

.dark .prose ul > li::marker,
.dark .prose ol > li::marker {
  color: #60a5fa !important;
}

/* Nested lists */
.prose ul ul,
.prose ul ol,
.prose ol ul,
.prose ol ol {
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
}

/* TOC styling */
.toc {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 8rem);
  overflow: auto;
  padding: 1.5rem;
  border: 1px solid;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.02);
  margin: 2rem 0;
}

.dark .toc {
  background: rgba(255, 255, 255, 0.05);
}

.toc a {
  display: block;
  padding: 0.25rem 0;
  text-decoration: none !important;
  color: inherit;
}

.toc a:hover {
  text-decoration: underline !important;
}

/* Heading anchors */
a.anchor {
  margin-left: 0.5rem;
  opacity: 0;
  text-decoration: none !important;
  color: #3b82f6;
  font-size: 0.75em;
  transition: opacity 0.2s ease;
  vertical-align: middle;
}

.prose h1:hover a.anchor,
.prose h2:hover a.anchor,
.prose h3:hover a.anchor,
.prose h4:hover a.anchor,
.prose h5:hover a.anchor,
.prose h6:hover a.anchor {
  opacity: 0.6;
}

a.anchor:hover {
  opacity: 1 !important;
  color: #2563eb;
}

.dark a.anchor {
  color: #60a5fa;
}

.dark a.anchor:hover {
  color: #93c5fd;
}
