/* Blog-specific styles */

/* Ensure header stays above blog content when scrolling */
.header {
  position: relative;
  z-index: 9999 !important;
  background-color: white;
}

@media screen and (min-width: 1024px) {
  .header {
    position: fixed;
    z-index: 9999 !important;
  }

  .blog-main {
    padding-top: 180px !important;
  }
}

.blog-main {
  min-height: 60vh;
  padding: 4rem 0;
  position: relative;
  z-index: 1;
}

/* Blog Header */
.blog-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid #e5e7eb;
}

.blog-header h1 {
  font-size: 3rem;
  color: #403a80;
  margin-bottom: 0.5rem;
}

.blog-header p {
  font-size: 1.25rem;
  color: #6b7280;
}

/* Blog Grid — Featured + 2-column layout */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
  margin-bottom: 3rem;
}

/* ── Base Card ── */
.blog-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ── Card Image — natural ratio, no cropping ── */
.blog-card__image {
  width: 100%;
  max-height: 240px;
  overflow: hidden;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blog-card__image img {
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.blog-card:hover .blog-card__image img {
  transform: scale(1.03);
}

/* ── Featured Card — full-width hero row ── */
.blog-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(64, 58, 128, 0.10);
}

.blog-card--featured .blog-card__image {
  max-height: 380px;
  border-radius: 14px 0 0 14px;
  min-height: 260px;
}

.blog-card--featured .blog-card__image img {
  max-height: 380px;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px 0 0 14px;
}

.blog-card--featured .blog-card__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2.5rem;
}

.blog-card--featured .blog-card__title {
  font-size: 1.85rem;
  white-space: normal;
  text-align: left;
  line-height: 1.25;
}

.blog-card--featured .blog-card__excerpt {
  text-align: left;
  font-size: 1.05rem;
  -webkit-line-clamp: 4;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card--featured .blog-card__date {
  text-align: left;
}

.blog-card--featured:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(64, 58, 128, 0.14);
}

/* ── Card Content ── */
.blog-card__content {
  padding: 1.25rem 1.5rem;
  position: relative;
}

.blog-card__date {
  text-align: right;
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 0.4rem;
}

.blog-card__title {
  font-size: 1.35rem;
  margin-bottom: 0.6rem;
  text-align: center;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__title a {
  color: #232938;
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-card__title a:hover {
  color: #403a80;
}

.blog-card__excerpt {
  color: #4b5563;
  line-height: 1.6;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.blog-card__link {
  color: #403a80;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.blog-card__link:hover {
  color: #5a54a0;
}

.blog-card__author {
  font-size: 0.8rem;
  color: #6b7280;
  font-style: italic;
}

/* Blog Post Page */
.blog-post {
  max-width: 1000px;
  margin: 0 auto;
}

.blog-post__header {
  margin-bottom: 3rem;
  text-align: center;
}

.blog-post__title {
  font-size: 2.5rem;
  color: #232938;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.blog-post__meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 2rem;
}

.blog-post__preview-image {
  text-align: center;
  margin: 0 auto 2rem;
}

.blog-post__preview-image img {
  max-width: 100%;
  max-height: 500px;
  width: auto;
  height: auto;
  display: inline-block;
  border-radius: 12px;
}

.blog-post__content {
  font-size: 1.125rem;
  line-height: 1.7;
  color: #374151;
}

/* Remove excessive spacing between consecutive paragraphs */
.blog-post__content p + p {
  margin-top: -0.15rem;
}

.blog-post__content h2 {
  font-size: 2rem;
  color: #403a80;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.blog-post__content h3 {
  font-size: 1.5rem;
  color: #403a80;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.blog-post__content p {
  margin-bottom: 0.25rem;
}

/* Empty paragraphs (line breaks in Quill) should create actual spacing */
.blog-post__content p:empty,
.blog-post__content p br:only-child {
  margin-bottom: 0.5rem;
}

.blog-post__content ul,
.blog-post__content ol {
  margin-bottom: 1rem;
  margin-left: 0;
  padding-left: 2rem;
}

.blog-post__content ul {
  list-style-type: disc;
}

.blog-post__content ol {
  list-style-type: decimal;
}

.blog-post__content li {
  margin-bottom: 0.25rem;
}

/* Quill editor generates nested lists with ql-indent classes */
.blog-post__content .ql-indent-1 {
  padding-left: 3rem;
}

.blog-post__content .ql-indent-2 {
  padding-left: 6rem;
}

/* Quill alignment classes */
.blog-post__content .ql-align-center {
  text-align: center;
}

.blog-post__content .ql-align-right {
  text-align: right;
}

.blog-post__content .ql-align-justify {
  text-align: justify;
}

.blog-post__content a {
  color: #403a80;
  text-decoration: underline;
}

.blog-post__content a:hover {
  color: #5a54a0;
}

.blog-post__content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 2rem 0;
}

.blog-post__content blockquote {
  border-left: 4px solid #403a80;
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: #6b7280;
}

.blog-post__content code {
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Monaco', 'Menlo', monospace;
}

.blog-post__content pre {
  background: #1f2937;
  color: #f3f4f6;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 2rem 0;
}

.blog-post__content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.blog-post__footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid #e5e7eb;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.btn-secondary:hover {
  background: #d1d5db;
}

/* No Posts Message */
.no-posts {
  text-align: center;
  padding: 4rem 2rem;
  color: #6b7280;
}

.no-posts p {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* Category filter pills */
.blog-category-filter {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
  padding: 8px;
}

.blog-filter-pill {
  padding: 0.4rem 1.2rem;
  border: 1px solid rgba(64, 58, 128, 0.2);
  border-radius: 20px;
  background: white;
  color: #403a80;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.blog-filter-pill:hover {
  border-color: #403a80;
  background: rgba(64, 58, 128, 0.05);
}

.blog-filter-pill.active {
  background: #403a80;
  color: white;
  border-color: #403a80;
}

/* Category badge on cards */
.blog-card__category {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 12px;
  background: rgba(64, 58, 128, 0.1);
  color: #403a80;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Post page category */
.blog-post__category {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: 12px;
  background: rgba(64, 58, 128, 0.1);
  color: #403a80;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Tags */
.blog-post__tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  justify-content: center;
}

.blog-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 0.8rem;
}

/* Related posts */
.related-posts {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.related-posts h2 {
  font-size: 1.5rem;
  color: #403a80;
  margin-bottom: 1.5rem;
}

.related-posts__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.related-post-card {
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.related-post-card img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #f3f4f6;
}

.related-post-card h3 {
  padding: 1rem;
  font-size: 1rem;
  color: #403a80;
}

/* No results in blog filter */
.blog-no-results {
  grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 768px) {
  .blog-header h1 {
    font-size: 2rem;
  }

  .blog-header p {
    font-size: 1rem;
  }

  /* Stack to single column on mobile */
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Featured card stacks vertically on mobile */
  .blog-card--featured {
    display: block;
  }

  .blog-card--featured .blog-card__image {
    border-radius: 12px 12px 0 0;
    max-height: 260px;
    min-height: 0;
  }

  .blog-card--featured .blog-card__image img {
    border-radius: 12px 12px 0 0;
    max-height: 260px;
  }

  .blog-card--featured .blog-card__content {
    padding: 1.25rem 1.5rem;
  }

  .blog-card--featured .blog-card__title {
    font-size: 1.5rem;
    text-align: center;
  }

  .blog-card--featured .blog-card__excerpt {
    text-align: center;
  }

  .blog-card--featured .blog-card__date {
    text-align: right;
  }

  .blog-post__title {
    font-size: 2rem;
  }

  .blog-post__content {
    font-size: 1rem;
  }

  .blog-post__content h2 {
    font-size: 1.5rem;
  }

  .blog-post__content h3 {
    font-size: 1.25rem;
  }
}
