/* ============================================
   BLOG STYLES - Modern & Premium Design
   ============================================ */

/* Container */
.blog-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Hero Section */
.blog-hero {
  padding: 4rem 0 3rem;
  text-align: center;
  background: linear-gradient(135deg, hsl(var(--p)) 0%, hsl(var(--s)) 100%);
  margin: 0 -1.5rem 3rem;
  position: relative;
  overflow: hidden;
}

.blog-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

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

.blog-hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  color: white;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.blog-hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255,255,255,0.9);
  max-width: 600px;
  margin: 0 auto;
}

/* Category Filter */
.blog-categories {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
  justify-content: center;
}

.category-chip {
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  background: hsl(var(--b2));
  color: hsl(var(--bc));
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.category-chip:hover {
  background: hsl(var(--b3));
  transform: translateY(-2px);
}

.category-chip.active {
  background: hsl(var(--p));
  color: hsl(var(--pc));
  border-color: hsl(var(--p));
}

/* Blog Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

/* Blog Card */
.blog-card {
  background: hsl(var(--b1));
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.blog-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.blog-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: hsl(var(--b2));
  position: relative;
}

.blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
  transform: scale(1.05);
}

.blog-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--bc) / 0.3);
}

.blog-card-content {
  padding: 1.5rem;
}

.blog-card-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: hsl(var(--p) / 0.1);
  color: hsl(var(--p));
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.blog-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: hsl(var(--bc));
}

.blog-card-subtitle {
  font-size: 0.9375rem;
  color: hsl(var(--bc) / 0.7);
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: hsl(var(--bc) / 0.6);
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--bc) / 0.1);
}

.blog-card-info {
  display: flex;
  gap: 1rem;
}

/* Empty State */
.blog-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: hsl(var(--bc) / 0.5);
}

.blog-empty svg {
  margin: 0 auto 1.5rem;
  opacity: 0.5;
}

.blog-empty h3 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: hsl(var(--bc));
}

/* Pagination */
.blog-pagination {
  display: flex;
  justify-content: center;
  margin: 3rem 0;
}

/* ============================================
   ARTICLE PAGE
   ============================================ */

.blog-article-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Breadcrumb */
.blog-article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 2rem;
  color: hsl(var(--bc) / 0.6);
}

.breadcrumb-link {
  color: hsl(var(--p));
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb-link:hover {
  color: hsl(var(--pf));
}

.breadcrumb-separator {
  color: hsl(var(--bc) / 0.3);
}

/* Article Header */
.blog-article-header {
  margin-bottom: 3rem;
}

.blog-article-meta-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.blog-article-category {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 1rem;
  background: hsl(var(--p) / 0.1);
  color: hsl(var(--p));
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-article-reading-time {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: hsl(var(--bc) / 0.6);
}

.blog-article-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: hsl(var(--bc));
  letter-spacing: -0.02em;
}

.blog-article-subtitle {
  font-size: 1.25rem;
  color: hsl(var(--bc) / 0.7);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.blog-article-author-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--bc) / 0.1);
}

.blog-article-author {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: hsl(var(--p));
  color: hsl(var(--pc));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.author-details {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.author-name {
  font-weight: 600;
  color: hsl(var(--bc));
}

.blog-article-date {
  font-size: 0.875rem;
  color: hsl(var(--bc) / 0.6);
}

.blog-article-stats {
  display: flex;
  gap: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: hsl(var(--bc) / 0.6);
}

/* Featured Image */
.blog-article-featured-image {
  width: 100%;
  margin-bottom: 3rem;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.blog-article-featured-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* Article Content — Editorial / Medium Style */
.blog-article-content,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  line-height: 2;
  color: hsl(var(--bc) / 0.84);
  margin-bottom: 3rem;
  letter-spacing: -0.003em;
  word-break: break-word;
}

.blog-article-content .trix-content,
.blog-article-content .lexxy-content > * + * {
  margin-top: 1.75rem;
}

.blog-article-content p,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content p {
  margin-bottom: 1.75rem;
}

.blog-article-content strong,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content strong {
  color: hsl(var(--bc));
  font-weight: 700;
}

.blog-article-content h1,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content h1 {
  font-family: "Bricolage Grotesque", "Inter", sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  margin-top: 3.5rem;
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: hsl(var(--bc));
}

.blog-article-content h2,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content h2 {
  font-family: "Bricolage Grotesque", "Inter", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 0.875rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: hsl(var(--bc));
}

.blog-article-content h3,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content h3 {
  font-family: "Inter", sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: hsl(var(--bc) / 0.6);
}

.blog-article-content ul,
.blog-article-content ol,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content ul,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content ol {
  margin-bottom: 1.75rem;
  padding-left: 0;
  list-style: none;
}

.blog-article-content ul li,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.blog-article-content ul li::before,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(var(--bc) / 0.3);
}

.blog-article-content ol,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content ol {
  counter-reset: ol-counter;
}

.blog-article-content ol li,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content ol li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.75rem;
  counter-increment: ol-counter;
}

.blog-article-content ol li::before,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content ol li::before {
  content: counter(ol-counter) ".";
  position: absolute;
  left: 0;
  font-weight: 600;
  color: hsl(var(--bc) / 0.4);
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
}

.blog-article-content li strong,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content li strong {
  color: hsl(var(--bc));
}

.blog-article-content a,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content a {
  color: hsl(var(--bc));
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: hsl(var(--bc) / 0.3);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s ease;
}

.blog-article-content a:hover,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content a:hover {
  text-decoration-color: hsl(var(--bc));
}

.blog-article-content blockquote,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content blockquote {
  margin: 2.5rem 0;
  padding: 1.5rem 0 1.5rem 2rem;
  border-left: 3px solid hsl(var(--bc) / 0.15);
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1.75;
  color: hsl(var(--bc));
  background: transparent;
}

.blog-article-content blockquote p,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content blockquote p {
  margin-bottom: 0;
}

/* Section dividers (horizontal rules) */
.blog-article-content hr,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content hr {
  border: none;
  text-align: center;
  margin: 3rem 0;
}

.blog-article-content hr::before,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content hr::before {
  content: '...';
  font-family: Georgia, serif;
  font-size: 1.75rem;
  letter-spacing: 0.6em;
  color: hsl(var(--bc) / 0.25);
}

.blog-article-content .attachment,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content .attachment,
.blog-article-content action-text-attachment,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content action-text-attachment {
  display: block;
  margin: 2.5rem 0;
}

.blog-article-content figure,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content figure {
  margin: 2.5rem -2rem;
}

.blog-article-content figure img,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content figure img,
.blog-article-content .attachment img,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content .attachment img {
  border-radius: 0.5rem;
  width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  .blog-article-content figure,
  .blog-article-content .trix-content,
.blog-article-content .lexxy-content figure {
    margin-left: -1rem;
    margin-right: -1rem;
  }
}

/* Share Section */
.blog-article-share {
  padding: 2rem;
  background: hsl(var(--b2));
  border-radius: 1rem;
  margin-bottom: 3rem;
}

.blog-article-share h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: hsl(var(--bc));
}

.share-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.share-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
}

.share-twitter {
  background: #1DA1F2;
  color: white;
}

.share-twitter:hover {
  background: #1a8cd8;
  transform: translateY(-2px);
}

.share-facebook {
  background: #1877F2;
  color: white;
}

.share-facebook:hover {
  background: #166fe5;
  transform: translateY(-2px);
}

.share-linkedin {
  background: #0A66C2;
  color: white;
}

.share-linkedin:hover {
  background: #004182;
  transform: translateY(-2px);
}

/* Related Articles */
.blog-related {
  margin-bottom: 3rem;
}

.related-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: hsl(var(--bc));
}

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

.related-card {
  background: hsl(var(--b1));
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.related-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.related-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: hsl(var(--b2));
}

.related-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.related-card:hover .related-card-image img {
  transform: scale(1.05);
}

.related-card-placeholder {
  width: 100%;
  height: 100%;
  background: hsl(var(--b2));
}

.related-card-content {
  padding: 1.25rem;
}

.related-card-category {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  background: hsl(var(--p) / 0.1);
  color: hsl(var(--p));
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.related-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  color: hsl(var(--bc));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-card-date {
  font-size: 0.875rem;
  color: hsl(var(--bc) / 0.6);
}

/* Back Button */
.blog-back {
  text-align: center;
  margin-top: 3rem;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: hsl(var(--b2));
  color: hsl(var(--bc));
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.back-button:hover {
  background: hsl(var(--b3));
  transform: translateX(-4px);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .blog-hero-title {
    font-size: 2.5rem;
  }
  
  .blog-hero-subtitle {
    font-size: 1rem;
  }
  
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .blog-article-title {
    font-size: 2rem;
  }
  
  .blog-article-subtitle {
    font-size: 1.125rem;
  }
  
  .blog-article-content {
    font-size: 1rem;
  }
  
  .blog-article-author-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .related-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .blog-categories {
    justify-content: flex-start;
  }

  .blog-card-title {
    font-size: 1.25rem;
  }

  .share-buttons {
    flex-direction: column;
  }

  .share-button {
    justify-content: center;
  }
}

/* ============================================
   HIGHLIGHT — Inline text mark
   Works in both Trix editor and published blog
   ============================================ */

.blog-article-content mark,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content mark,
trix-editor mark {
  background: linear-gradient(120deg, #fff3bf 0%, #ffe066 100%);
  padding: 0.1em 0.25em;
  border-radius: 0.2em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ============================================
   CALLOUT — Block-level callout box
   Works in both Trix editor and published blog
   ============================================ */

.blog-callout,
.blog-article-content .blog-callout,
.blog-article-content .trix-content,
.blog-article-content .lexxy-content .blog-callout,
trix-editor .blog-callout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 0.75rem;
  font-family: "Inter", -apple-system, sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #1e3a5f;
}

.blog-callout__icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.65;
}

.blog-callout__text {
  flex: 1;
  min-width: 0;
}

/* Callout variants via data attribute */
.blog-callout[data-variant="warning"] {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}

.blog-callout[data-variant="success"] {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #14532d;
}

.blog-callout[data-variant="error"] {
  background: #fef2f2;
  border-color: #fecaca;
  color: #7f1d1d;
}

/* ============================================
   TRIX EDITOR — Preview mode (blog-like)
   Applied to trix-editor inside Madmin forms
   ============================================ */

trix-editor.blog-editor-preview {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.9;
  color: #333;
  letter-spacing: -0.003em;
  padding: 1.5rem;
  min-height: 400px;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
}

trix-editor.blog-editor-preview h1 {
  font-family: -apple-system, "Inter", sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #111;
}

trix-editor.blog-editor-preview blockquote {
  border-left: 3px solid #d1d5db;
  padding: 1rem 0 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  font-size: 1.2rem;
  color: #111;
}

trix-editor.blog-editor-preview ul,
trix-editor.blog-editor-preview ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}

trix-editor.blog-editor-preview li {
  margin-bottom: 0.5rem;
}

trix-editor.blog-editor-preview a {
  color: #111;
  text-decoration: underline;
  text-decoration-color: #9ca3af;
  text-underline-offset: 0.2em;
}

trix-editor.blog-editor-preview pre {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: 0.875rem;
}

/* ============================================
   TRIX TOOLBAR — Custom button icons
   ============================================ */

trix-toolbar .trix-button--icon-highlight {
  position: relative;
}

trix-toolbar .trix-button--icon-highlight svg,
trix-toolbar .trix-button--icon-callout svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

trix-toolbar .trix-button--icon-highlight.trix-active svg,
trix-toolbar .trix-button--icon-callout.trix-active svg {
  opacity: 1;
}

trix-toolbar .trix-button--icon-highlight {
  text-indent: 0;
  font-size: 0;
}

trix-toolbar .trix-button--icon-callout {
  text-indent: 0;
  font-size: 0;
}
