/* ReplyRocket Blog Styles - Professional & Modern Theme */

/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;500;600;700&family=Roboto+Slab:wght@400;500;700&display=swap");

/* Base Styles */
.blogpost {
  --primary-color: #0066cc;
  --secondary-color: #505a64;
  --accent-color: #0066cc;
  --light-bg: #f5f7fa;
  --dark-bg: #2c3e50;
  --text-color: #333333;
  --text-light: #505a64;
  --max-width: 800px;
  --content-padding: 2rem;
  color: var(--text-color);
  line-height: 1.6;
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
    sans-serif;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
}

/* Container for blog content */
.blogpost article {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--content-padding);
  background-color: white;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Typography */
.blogpost article h1 {
  font-family: "Roboto Slab", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin-bottom: 1.25rem;
  color: var(--dark-bg);
  letter-spacing: -0.01em;
}

.blogpost articleh2 {
  font-family: "Roboto Slab", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.blogpost article p {
  margin-bottom: 1.25rem;
  color: var(--text-color);
  font-size: 1.0625rem;
}

.blogpost article h1 + p {
  font-size: 1.25rem;
  color: var(--secondary-color);
  font-weight: 500;
  line-height: 1.5;
}

/* Links */
.blogpost articlea {
  color: var(--primary-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}

.blogpost article a:hover {
  color: #004c99;
}

/* Images */
.blogpost article img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
  border: 1px solid #e5e7eb;
}

/* Alternating image alignment after h2 elements */
.blogpost article h2 + img,
.blogpost article h2 + p > img:first-child {
  max-width: 250px;
  max-height: 250px;
  object-fit: contain;
  float: left;
  margin-right: 1em;
  margin-bottom: 1em;
}

.blogpost article h2.even + img,
.blogpost article h2.even + p > img:first-child {
  float: right;
  margin-right: 0;
  margin-left: 1em;
}

/* Image alignment */
.blogpost article div > p > img {
  margin-top: 0;
  margin-bottom: 0;
}
.blogpost article .img-left {
  float: left;
  margin-right: 2rem;
  margin-bottom: 1rem;
  max-width: 350px;
}

.blogpost article .img-right {
  float: right;
  margin-left: 2rem;
  margin-bottom: 1rem;
  max-width: 350px;
}

/* Clear floats */
.blogpost article .clearfix::after {
  content: "";
  clear: both;
  display: table;
}

/* Blockquotes */
.blogpost article blockquote {
  border-left: 3px solid var(--accent-color);
  padding: 0.75rem 1.25rem;
  margin-left: 0;
  margin-right: 0;
  color: var(--secondary-color);
  font-size: 1.0625rem;
  margin: 1.5rem 0;
  background-color: #f8f9fa;
}

/* Code blocks */
.blogpost article pre {
  background-color: #f5f7fa;
  color: #2c3e50;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  margin: 1.5rem 0;
  border: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.blogpost article code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background-color: rgba(0, 0, 0, 0.04);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Lists */
.blogpost article ul,
.blogpost article ol {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.blogpost article li {
  margin-bottom: 0.5rem;
}

/* Subtle animation for content */
.blogpost article h1,
.blogpost article h2 {
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0.8;
  }
  to {
    opacity: 1;
  }
}

/* Reading progress indicator */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: var(--primary-color);
  z-index: 9999;
  transition: width 0.1s ease;
}

/* Table styles */
.blogpost article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  overflow-x: auto;
  display: block;
  font-size: 0.9375rem;
}

.blogpost article table th,
.blogpost article table td {
  padding: 0.625rem 0.75rem;
  border: 1px solid #94b5e4;
  text-align: left;
}

.blogpost article table th {
  background-color: #b5c3d7;
  font-weight: 600;
  color: var(--secondary-color);
}

.blogpost article table tr:nth-child(even) {
  background-color: #c0d7ec;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .blogpost article {
    padding: 1.25rem;
  }

  .blogpost article .img-left,
  .blogpost article .img-right {
    float: none;
    margin: 1.25rem 0;
    max-width: 100%;
  }

  .blogpost article h1 {
    font-size: 1.75rem;
  }

  .blogpost article h2 {
    font-size: 1.375rem;
  }

  .blogpost article p {
    font-size: 1rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .blogpost article {
    --text-color: #e2e8f0;
    --text-light: #94a3b8;
    --secondary-color: #a3b8cc; /* Lighter secondary color for dark mode */
  }

  .blogpost article h1 {
    color: #f8fafc;
  }

  .blogpost article h2 {
    color: #63b3ed;
  }

  /* Override Bootstrap bg-primary-subtle in dark mode */
  body.bg-primary-subtle.blogpost {
    background-color: var(--dark-bg) !important;
  }

  /* Ensure all Bootstrap background utilities work properly in dark mode */
  .bg-primary-subtle {
    background-color: var(--dark-bg) !important;
  }

  /* Ensure container has proper contrast against dark background */
  main.flex-shrink-0 {
    background-color: var(--dark-bg);
  }

  .blogpost article {
    background-color: #2d3748;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }

  .blogpost article h1 {
    color: #f8fafc;
  }

  .blogpost article h2 {
    color: #63b3ed;
  }

  .blogpost pre {
    background-color: #1a202c;
    color: #e2e8f0;
    border-color: #4a5568;
  }

  .blogpost article code {
    background-color: rgba(255, 255, 255, 0.1);
  }

  .blogpost article a {
    color: #63b3ed;
  }

  .blogpost article a:hover {
    color: #90cdf4;
  }

  .blogpost article blockquote {
    background-color: #2d3748;
  }

  /* Dark mode table styles */
  .blogpost article table th {
    background-color: #3a4a5e;
    color: #e2e8f0;
  }

  .blogpost article table td {
    border-color: #4a5568;
    color: var(--text-light);
  }

  .blogpost article table tr:nth-child(even) {
    background-color: #2d3748;
  }
}
