/* Dark mode transitions */
html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

/* Prose Styles for Article Content */
.prose {
  color: #111827;
}

html[data-theme="dark"] .prose {
  color: #f3f4f6;
}

.prose h1 {
  font-size: 1.875rem;
  line-height: 2.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: #111827;
}

html[data-theme="dark"] .prose h1 {
  color: #f9fafb;
}

.prose h2 {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

html[data-theme="dark"] .prose h2 {
  color: #f9fafb;
  border-bottom-color: #374151;
}

.prose h3 {
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: #111827;
}

html[data-theme="dark"] .prose h3 {
  color: #f9fafb;
}

.prose p {
  margin-bottom: 1rem;
  line-height: 1.75;
}

.prose a {
  color: #2563eb;
  text-decoration: underline;
}

html[data-theme="dark"] .prose a {
  color: #3b82f6;
}

.prose ul, .prose ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.prose ul {
  list-style-type: disc;
}

.prose ol {
  list-style-type: decimal;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose blockquote {
  border-left: 4px solid #3b82f6;
  padding-left: 1rem;
  font-style: italic;
  color: #4b5563;
  margin: 1.5rem 0;
}

html[data-theme="dark"] .prose blockquote {
  color: #9ca3af;
}

.prose code {
  background-color: #f3f4f6;
  color: #111827;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

html[data-theme="dark"] .prose code {
  background-color: #374151;
  color: #f3f4f6;
}

.prose pre {
  background-color: #1f2937;
  color: #f3f4f6;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  max-width: 100%;
}

.prose pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  white-space: pre;
  word-wrap: normal;
  word-break: keep-all;
  display: block;
  min-width: 100%;
}

.prose img {
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin: 1.5rem 0;
  max-width: 100%;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.prose th, .prose td {
  border: 1px solid #d1d5db;
  padding: 0.5rem;
}

html[data-theme="dark"] .prose th,
html[data-theme="dark"] .prose td {
  border-color: #4b5563;
}

.prose th {
  background-color: #f3f4f6;
  font-weight: 600;
}

html[data-theme="dark"] .prose th {
  background-color: #374151;
}

.prose hr {
  border-color: #e5e7eb;
  margin: 2rem 0;
}

html[data-theme="dark"] .prose hr {
  border-color: #4b5563;
}

/* Donation Modal Styles */
.donation-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.donation-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.donation-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.95);
  transition: all 0.3s;
  max-width: 28rem;
  width: 100%;
  margin: 0 1rem;
}

html[data-theme="dark"] .donation-modal {
  background-color: #1f2937;
}

.donation-modal.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.donation-modal-content {
  padding: 1.5rem;
  position: relative;
}

.donation-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: #9ca3af;
  font-size: 1.5rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  transition: background-color 0.2s;
}

.donation-close:hover {
  background-color: #f3f4f6;
  color: #4b5563;
}

html[data-theme="dark"] .donation-close:hover {
  background-color: #374151;
  color: #d1d5db;
}

.donation-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.donation-tab {
  flex: 1;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.donation-tab.active {
  background-color: #2563eb;
  color: white;
}

.donation-tab:not(.active) {
  background-color: #f3f4f6;
  color: #4b5563;
}

html[data-theme="dark"] .donation-tab:not(.active) {
  background-color: #374151;
  color: #9ca3af;
}

.donation-tab:not(.active):hover {
  background-color: #e5e7eb;
}

html[data-theme="dark"] .donation-tab:not(.active):hover {
  background-color: #4b5563;
}

.donation-qr {
  position: relative;
}

.donation-qr img {
  width: 100%;
  max-width: 16rem;
  margin: 0 auto;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.donation-qr img:not(.active) {
  display: none;
}

/* Code Block Styles - Fix overflow issues */
.highlight {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  background-color: #282c34;
}

.highlight table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.highlight td {
  padding: 0;
  vertical-align: top;
}

.highlight td.gutter {
  width: 3rem;
  background-color: rgba(0, 0, 0, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  text-align: right;
}

.highlight td.gutter pre {
  margin: 0;
  padding: 0.75rem 0.5rem;
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: right;
  overflow: hidden;
}

.highlight td.code {
  width: 100%;
  overflow-x: auto;
}

.highlight td.code pre {
  margin: 0;
  padding: 0.75rem 1rem;
  background-color: transparent;
  color: #f3f4f6;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre;
  word-wrap: normal;
  word-break: keep-all;
  overflow-x: auto;
}

.highlight .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #9ca3af;
  background-color: rgba(55, 65, 81, 0.5);
  border-radius: 0.25rem;
  transition: background-color 0.2s, color 0.2s;
  opacity: 0;
}

.highlight:hover .copy-btn {
  opacity: 1;
}

.highlight .copy-btn:hover {
  background-color: rgba(55, 65, 81, 0.8);
  color: #f3f4f6;
}

/* Mobile Menu */
#mobile-menu {
  transition: all 0.3s ease-in-out;
}

/* Print Styles */
@media print {
  header, footer, .donation-modal, .donation-overlay {
    display: none;
  }

  main {
    max-width: none;
    margin: 0;
    padding: 0;
  }
}
