/* Modern Blog Styling with CSS Custom Properties */

:root {
  /* Color Palette */
  --primary-color: #0d6efd;
  --primary-dark: #0b5ed7;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --info-color: #0dcaf0;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  
  /* Typography */
  --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-family-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 3rem;
  
  /* Border Radius */
  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.375rem;
  --border-radius-lg: 0.5rem;
  --border-radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
  
  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
}

/* Dark theme variables */
[data-bs-theme="dark"] {
  --primary-color: #0d6efd;
  --primary-dark: #0b5ed7;
  --secondary-color: #6c757d;
  --light-color: #212529;
  --dark-color: #f8f9fa;
}

/* Base Typography */
body {
  font-family: var(--font-family-sans);
  line-height: 1.7;
  color: var(--bs-body-color);
  background-color: var(--bs-body-bg);
  font-size: 1rem;
}

/* Improved heading styles */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
  color: var(--bs-heading-color);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.1rem; }

/* Post content styling */
.post-content {
  font-size: 1rem;
  line-height: 1.8;
  max-width: none;
}

/* Optimize reading width for different screen sizes */
@media (min-width: 992px) {
  .post-content {
    font-size: 1.05rem;
    line-height: 1.8;
  }
  
  .post-content p {
    max-width: 75ch; /* Optimal reading line length */
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content h1,
  .post-content h2,
  .post-content h3,
  .post-content h4,
  .post-content h5,
  .post-content h6 {
    max-width: 75ch;
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content ul,
  .post-content ol {
    max-width: 75ch;
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content blockquote {
    max-width: 75ch;
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content pre {
    max-width: 75ch;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 1200px) {
  .post-content {
    font-size: 1.1rem;
    line-height: 1.8;
  }
  
  .post-content p {
    max-width: 80ch; /* Slightly wider for very large screens */
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content h1,
  .post-content h2,
  .post-content h3,
  .post-content h4,
  .post-content h5,
  .post-content h6 {
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content ul,
  .post-content ol {
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content blockquote {
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
  }
  
  .post-content pre {
    max-width: 80ch;
    margin-left: auto;
    margin-right: auto;
  }
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--bs-border-color);
}

.post-content h1:first-child,
.post-content h2:first-child,
.post-content h3:first-child {
  margin-top: 0;
}

/* Code styling */
.post-content code {
  background-color: var(--bs-gray-100);
  color: var(--bs-danger);
  padding: 0.2em 0.4em;
  border-radius: var(--border-radius-sm);
  font-size: 0.9em;
  font-family: var(--font-family-mono);
}

[data-bs-theme="dark"] .post-content code {
  background-color: var(--bs-gray-800);
  color: var(--bs-warning);
}

.post-content pre {
  background-color: var(--bs-gray-100);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--border-radius-md);
  padding: var(--spacing-lg);
  overflow-x: auto;
  margin: var(--spacing-lg) auto;
}

[data-bs-theme="dark"] .post-content pre {
  background-color: var(--bs-gray-900);
  border-color: var(--bs-gray-700);
}

.post-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
}

/* Blockquotes */
.post-content blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  font-style: italic;
  color: var(--bs-secondary);
  background-color: var(--bs-gray-50);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-md);
}

[data-bs-theme="dark"] .post-content blockquote {
  background-color: var(--bs-gray-800);
}

/* Lists */
.post-content ul,
.post-content ol {
  margin-bottom: var(--spacing-lg);
  padding-left: var(--spacing-xl);
}

.post-content li {
  margin-bottom: var(--spacing-sm);
}

/* Links */
.post-content a {
  color: var(--primary-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition-fast);
}

.post-content a:hover {
  color: var(--primary-dark);
  border-bottom-color: var(--primary-color);
}

/* Images */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-md);
  margin: var(--spacing-lg) auto;
  display: block;
}

/* Tables */
.post-content table {
  width: 100%;
  margin: var(--spacing-lg) 0;
  border-collapse: collapse;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.post-content th,
.post-content td {
  padding: var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--bs-border-color);
}

.post-content th {
  background-color: var(--bs-gray-100);
  font-weight: 600;
  color: var(--bs-heading-color);
}

[data-bs-theme="dark"] .post-content th {
  background-color: var(--bs-gray-800);
}

/* Horizontal rules */
.post-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--bs-border-color), transparent);
  margin: var(--spacing-xl) 0;
}

/* Custom card enhancements */
.card {
  transition: var(--transition-normal);
  border: 1px solid var(--bs-border-color);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg) !important;
}

/* Badge enhancements */
.badge {
  font-weight: 500;
  padding: 0.5em 0.75em;
  border-radius: var(--border-radius-lg);
  transition: var(--transition-fast);
}

.badge:hover {
  transform: scale(1.05);
}

/* Button enhancements */
.btn {
  border-radius: var(--border-radius-md);
  font-weight: 500;
  transition: var(--transition-fast);
  border-width: 2px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Navigation enhancements */
.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
}

.nav-link {
  font-weight: 500;
  transition: var(--transition-fast);
  border-radius: var(--border-radius-md);
  margin: 0 var(--spacing-xs);
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* Theme toggle button alignment */
.navbar-nav .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  min-width: 2.5rem;
  padding: 0.5rem;
  margin: 0;
  border-radius: var(--border-radius-md);
  transition: var(--transition-fast);
}

.navbar-nav .btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Footer enhancements */
.footer-section {
  background-color: var(--bs-dark);
  color: var(--bs-light);
  border-top: 1px solid var(--bs-border-color);
}

[data-bs-theme="light"] .footer-section {
  background-color: var(--bs-dark);
  color: var(--bs-light);
}

[data-bs-theme="dark"] .footer-section {
  background-color: var(--bs-gray-900);
  color: var(--bs-light);
}

.footer-section h5,
.footer-section h6,
.footer-heading {
  color: var(--bs-light) !important;
}

.footer-text {
  color: var(--bs-gray-300) !important;
}

.footer-link {
  color: var(--bs-gray-300) !important;
  transition: var(--transition-fast);
}

.footer-link:hover {
  color: var(--primary-color) !important;
  transform: translateY(-1px);
}

footer a {
  transition: var(--transition-fast);
}

footer a:hover {
  color: var(--primary-color) !important;
  transform: translateY(-1px);
}

/* Hero section styling */
.hero-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  padding: var(--spacing-lg) 0;
  margin-bottom: var(--spacing-xl);
  border-radius: var(--border-radius-xl);
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
}

.hero-content {
  position: relative;
  z-index: 1;
}

/* Personal hero message styling */
.hero-message {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-greeting {
  font-size: 1.5rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 1.5rem;
}

.hero-description {
  font-size: 1.1rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.5rem;
}

.hero-invitation {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.85);
  font-style: italic;
  margin-bottom: 2rem;
}

.hero-actions .btn {
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-lg);
  transition: var(--transition-normal);
}

.hero-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.hero-signature p {
  font-size: 1.1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
}

.hero-divider {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
  margin: 2rem 0;
}

/* Responsive adjustments for hero */
@media (max-width: 768px) {
  .hero-greeting {
    font-size: 1.3rem;
  }
  
  .hero-description {
    font-size: 1rem;
  }
  
  .hero-invitation {
    font-size: 0.95rem;
  }
  
  .hero-actions .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
  
  .hero-signature p {
    font-size: 1rem;
  }
  
  .hero-divider {
    margin: 1.5rem 0;
  }
}

/* RSS info styling */
.rss-info {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--bs-border-color);
}

.rss-info a {
  color: var(--primary-color);
  font-weight: 500;
  transition: var(--transition-fast);
}

.rss-info a:hover {
  color: var(--primary-dark);
  text-decoration: underline !important;
}

/* Stay Updated section dark mode improvements */
[data-bs-theme="dark"] .card.bg-light {
  background-color: var(--bs-gray-800) !important;
  border: 1px solid var(--bs-gray-700) !important;
}

[data-bs-theme="dark"] .card.bg-light h3,
[data-bs-theme="dark"] .card.bg-light h4 {
  color: var(--bs-light) !important;
}

[data-bs-theme="dark"] .card.bg-light .text-muted {
  color: var(--bs-gray-300) !important;
}

/* Post list styling */
.post-list-item {
  transition: var(--transition-normal);
  border-left: 4px solid transparent;
}

.post-list-item:hover {
  border-left-color: var(--primary-color);
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
}

/* Responsive adjustments */
@media (max-width: 991px) {
  /* Add top margin to Quick Links section on mobile when it stacks below social links */
  .footer-section .col-lg-4 {
    margin-top: 2rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 1rem;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
  
  .post-content {
    font-size: 1rem;
  }
  
  .hero-section {
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-lg);
  }
  
  .card-body {
    padding: var(--spacing-lg) !important;
  }
}

@media (max-width: 576px) {
  .container {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
  }
  
  .post-content h1,
  .post-content h2,
  .post-content h3 {
    font-size: 1.5rem;
  }
  
  .display-4 {
    font-size: 2rem !important;
  }
}

/* Post title styling - make display-4 smaller for post titles */
.post-title {
  font-size: 3rem !important;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .post-title {
    font-size: 2.5rem !important;
  }
}

@media (max-width: 576px) {
  .post-title {
    font-size: 2.25rem !important;
  }
}

/* Print styles */
@media print {
  .navbar,
  .btn,
  footer,
  .card {
    display: none !important;
  }
  
  .post-content {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .post-content h1,
  .post-content h2,
  .post-content h3 {
    page-break-after: avoid;
  }
  
  .post-content pre,
  .post-content blockquote {
    page-break-inside: avoid;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for better accessibility */
.btn:focus,
.nav-link:focus,
a:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Dark mode button fixes */
[data-bs-theme="dark"] .btn-outline-dark {
  color: var(--bs-light);
  border-color: var(--bs-light);
}

[data-bs-theme="dark"] .btn-outline-dark:hover {
  color: var(--bs-dark);
  background-color: var(--bs-light);
  border-color: var(--bs-light);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .card {
    border-width: 2px;
  }
  
  .btn {
    border-width: 2px;
  }
  
  .post-content code {
    border: 1px solid currentColor;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bs-gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--bs-gray-400);
  border-radius: var(--border-radius-md);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bs-gray-500);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bs-gray-800);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--bs-gray-600);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--bs-gray-500);
}