/* ==========================================================================
   LunatechLab — Blog styles
   ========================================================================== */

/* ===== Blog grid ===== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 640px) { .blog-grid { grid-template-columns: 1fr; } }

/* ===== Posts section (blog index) ===== */
.blog-posts-section {
  background-color: #ffffff;
  padding: 3.5rem 1.5rem 6rem;
}
@media (max-width: 640px) {
  .blog-posts-section { padding: 2.5rem 1rem 4rem; }
}

/* ===== Blog cards ===== */
.blog-card {
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  border: 1px solid #eef0f3;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 4px 12px rgba(15, 23, 42, 0.03);
}
.blog-card:hover {
  border-color: rgba(251, 146, 60, 0.4);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(251, 146, 60, 0.15), 0 4px 10px rgba(15, 23, 42, 0.05);
}
.blog-cover {
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: #fef3c7;
}
.blog-cover-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  color: rgba(251, 146, 60, 0.5);
  font-size: 2.5rem;
}
.blog-card-body {
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 0.5rem; flex: 1;
}
.blog-card-meta {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 0.72rem; color: #94a3b8;
}
.blog-date i { margin-right: 0.25rem; }
.blog-draft-pill {
  background: #fef3c7; color: #92400e;
  padding: 0.1rem 0.4rem; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
}
.blog-card-title {
  font-size: 1.05rem; font-weight: 700; color: #0f172a;
  line-height: 1.3; margin: 0;
}
.blog-card-excerpt {
  font-size: 0.85rem; color: #64748b; line-height: 1.5; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.blog-card-tags {
  display: flex; flex-wrap: wrap; gap: 0.25rem;
  margin-top: auto; padding-top: 0.5rem;
}

/* ==========================================================================
   Tag filter bar (blog index)
   ========================================================================== */

.blog-tag-bar {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 2.25rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.blog-tag-bar::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.18), transparent 70%);
  pointer-events: none;
}

.blog-tag-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.blog-tag-list-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.4rem;
  padding-right: 0.9rem;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}
.blog-tag-list-label i { color: #f97316; font-size: 0.75rem; }

@media (max-width: 640px) {
  .blog-tag-bar { padding: 1.75rem 1rem; }
  .blog-tag-list-label { display: none; }
}

/* Tag pills */
.blog-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1;
}
.blog-tag:hover {
  border-color: #f97316;
  color: #fb923c;
  background: rgba(251, 146, 60, 0.12);
  transform: translateY(-1px);
}
.blog-tag.active {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(249, 115, 22, 0.45);
}
.blog-tag-all { font-weight: 700; }
.blog-tag-all i { font-size: 0.78rem; }
.blog-tag-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: rgba(249, 115, 22, 0.18);
  color: #fb923c;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}
.blog-tag.active .blog-tag-count {
  background: rgba(255, 255, 255, 0.28);
  color: white;
}

/* ===== Blog pagination ===== */
.blog-pagination {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 600px; margin: 3rem auto 0; gap: 1rem;
}
.blog-page-info { font-size: 0.8rem; color: #64748b; font-weight: 600; }

/* ===== Blog post meta ===== */
.blog-post-meta {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 1rem; font-size: 0.78rem; color: #94a3b8;
}
.blog-post-meta i { margin-right: 0.25rem; }

/* ===== Blog post cover ===== */
.blog-post-cover {
  max-width: 800px; margin: 0 auto 2.5rem;
  border-radius: 16px; overflow: hidden;
}
.blog-post-cover img { width: 100%; height: auto; display: block; }

/* ===== Breadcrumb ===== */
.blog-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
  padding: 1.5rem 1.5rem 0.5rem;
}
.blog-breadcrumb a {
  color: #64748b;
  text-decoration: none;
  transition: color 0.2s ease;
}
.blog-breadcrumb a:hover { color: #ea580c; }
.blog-breadcrumb-sep { font-size: 0.6rem; opacity: 0.5; }
.blog-breadcrumb-current { color: #0f172a; font-weight: 500; }

/* ===== Post header ===== */
.blog-post-header { margin-bottom: 2rem; }
.blog-post-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
  margin: 0 0 1rem;
}
.blog-post-excerpt {
  font-size: 1rem;
  line-height: 1.6;
  color: #475569;
  max-width: 40rem;
  margin: 0 auto;
}

/* ==========================================================================
   Reading card
   ========================================================================== */

.blog-post-reading {
  --read-bg: #ffffff;
  --read-text: #334155;
  --read-heading: #0f172a;
  --read-code-bg: #f1f5f9;
  --read-code-text: #be123c;
  --read-quote-bg: linear-gradient(135deg, #fff7ed, #ffedd5);
  --read-link: #ea580c;
  --read-link-underline: rgba(251, 146, 60, 0.4);
  --read-hr: rgba(251, 146, 60, 0.25);
  --read-border: rgba(251, 146, 60, 0.12);
  --read-th-bg: rgba(251, 146, 60, 0.06);
  --read-td-border: rgba(0, 0, 0, 0.06);
  --read-td-even: rgba(251, 146, 60, 0.025);
  --read-pre-bg: #1e293b;
  --read-pre-text: #e2e8f0;
  --read-shadow: 0 8px 40px rgba(120, 70, 20, 0.09);

  background: var(--read-bg);
  color: var(--read-text);
  border-radius: 22px;
  padding: 3rem 2.75rem;
  box-shadow: var(--read-shadow);
  border: 1px solid rgba(251, 146, 60, 0.08);
  max-width: 780px;
  margin: 0 auto;
}
@media (max-width: 640px) {
  .blog-post-reading { padding: 1.75rem 1.25rem; border-radius: 16px; }
}

/* Warm theme */
html[data-blog-theme="warm"] .blog-post-reading {
  --read-bg: #f7ecd7;
  --read-text: #4a3520;
  --read-heading: #1f1409;
  --read-code-bg: #ebd9b6;
  --read-code-text: #9a2222;
  --read-quote-bg: linear-gradient(135deg, #f1dfb9, #e6d2a5);
  --read-link: #b45309;
  --read-link-underline: rgba(180, 83, 9, 0.5);
  --read-th-bg: rgba(140, 90, 30, 0.09);
  --read-td-border: rgba(80, 50, 20, 0.1);
  --read-td-even: rgba(140, 90, 30, 0.04);
  --read-border: rgba(140, 90, 30, 0.15);
  --read-shadow: 0 8px 40px rgba(100, 60, 20, 0.13);
  border-color: rgba(180, 83, 9, 0.12);
}

/* Dark theme */
html[data-blog-theme="dark"] .blog-post-reading {
  --read-bg: #1e293b;
  --read-text: #cbd5e1;
  --read-heading: #f8fafc;
  --read-code-bg: #0f172a;
  --read-code-text: #fb923c;
  --read-quote-bg: linear-gradient(135deg, #263449, #1e293b);
  --read-link: #fb923c;
  --read-link-underline: rgba(251, 146, 60, 0.45);
  --read-hr: rgba(251, 146, 60, 0.3);
  --read-border: rgba(255, 255, 255, 0.08);
  --read-th-bg: rgba(255, 255, 255, 0.04);
  --read-td-border: rgba(255, 255, 255, 0.08);
  --read-td-even: rgba(255, 255, 255, 0.02);
  --read-pre-bg: #0a0f1a;
  --read-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.06);
}

/* Page backgrounds per theme */
html[data-blog-theme="warm"] body,
html[data-blog-theme="warm"] .cohesive-bg {
  background: linear-gradient(135deg, #f3e2c2 0%, #ebd7ae 100%);
}
html[data-blog-theme="dark"] body,
html[data-blog-theme="dark"] .cohesive-bg {
  background: linear-gradient(135deg, #0a0f1a 0%, #111827 100%);
}

/* ==========================================================================
   Content typography
   ========================================================================== */

.blog-content {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--read-text);
}
.blog-content h1,
.blog-content h2,
.blog-content h3,
.blog-content h4 {
  color: var(--read-heading);
  font-weight: 700;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
}
.blog-content h1 { font-size: 1.9rem; }
.blog-content h2 { font-size: 1.5rem; }
.blog-content h3 { font-size: 1.2rem; }
.blog-content h4 { font-size: 1.05rem; }
.blog-content p { margin: 0 0 1.25rem; }
.blog-content a {
  color: var(--read-link);
  text-decoration: underline;
  text-decoration-color: var(--read-link-underline);
  text-underline-offset: 2px;
}
.blog-content a:hover { text-decoration-color: var(--read-link); }
.blog-content strong { color: var(--read-heading); font-weight: 700; }
.blog-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 1.5rem 0;
}
.blog-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid #f97316;
  background: var(--read-quote-bg);
  border-radius: 0 14px 14px 0;
  font-style: italic;
}
.blog-content blockquote p:last-child { margin-bottom: 0; }
.blog-content ul,
.blog-content ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
.blog-content li { margin-bottom: 0.4rem; }
.blog-content hr {
  border: none;
  border-top: 1px dashed var(--read-hr);
  margin: 2rem 0;
}
.blog-content code {
  font-family: 'SF Mono', Consolas, Monaco, monospace;
  font-size: 0.9em;
  background: var(--read-code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--read-code-text);
}
.blog-content pre {
  background: var(--read-pre-bg);
  color: var(--read-pre-text);
  padding: 1.15rem 1.25rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
}
.blog-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.blog-content iframe {
  max-width: 100%;
  border-radius: 12px;
  margin: 1.5rem 0;
  display: block;
}

/* ===== Tables ===== */
.table-wrap-content {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: 14px;
  border: 1px solid var(--read-border);
  background: var(--read-bg);
  -webkit-overflow-scrolling: touch;
}
.blog-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 480px;
}
.blog-content th {
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--read-border);
  background: var(--read-th-bg);
  color: var(--read-heading);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.blog-content td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--read-td-border);
  color: var(--read-text);
  vertical-align: top;
}
.blog-content tbody tr:last-child td { border-bottom: none; }
.blog-content tbody tr:nth-child(even) td { background: var(--read-td-even); }
.blog-content tbody tr:hover td { background: var(--read-th-bg); }

/* ==========================================================================
   Theme toggle
   ========================================================================== */

.theme-toggle {
  position: fixed;
  left: 20px; bottom: 25px;
  background: white;
  border-radius: 999px;
  padding: 5px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  display: flex;
  gap: 2px;
  z-index: 40;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
html[data-blog-theme="dark"] .theme-toggle {
  background: #1e293b;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}
html[data-blog-theme="warm"] .theme-toggle {
  background: #fbf3e0;
  box-shadow: 0 4px 18px rgba(120, 70, 20, 0.15);
}
.theme-toggle button {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.theme-toggle button:hover { color: #f97316; }
.theme-toggle button.active {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}
@media (max-width: 640px) {
  .theme-toggle { left: 12px; bottom: 85px; padding: 4px; }
  .theme-toggle button { width: 32px; height: 32px; font-size: 0.78rem; }
}

/* ==========================================================================
   Share bar
   ========================================================================== */

.share-bar {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--read-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.share-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.share-label::before,
.share-label::after {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: currentColor;
  opacity: 0.3;
}
html[data-blog-theme="dark"] .share-label { color: #64748b; }
html[data-blog-theme="warm"] .share-label { color: #a16207; }
.share-label i { color: #f97316; font-size: 0.8rem; }

.share-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.share-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: white;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 0;
}
.share-btn svg { display: block; }
.share-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.share-fb   { background: #1877f2; }
.share-x    { background: #0f1419; }
.share-li   { background: #0a66c2; }
.share-wa   { background: #25d366; }
.share-rd   { background: #ff4500; }
.share-copy { background: #64748b; }
.share-copy.copied { background: #34d399; }

@media (max-width: 480px) {
  .share-btn { width: 40px; height: 40px; font-size: 0.9rem; }
  .share-buttons { gap: 0.55rem; }
}

/* ==========================================================================
   Creative-quote CTA block
   ========================================================================== */

.creative-quote-title {
  color: #1f2937;
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0 0 0.25rem;
}
.creative-quote-body {
  color: #4b5563;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 0 0 0.75rem;
}
.creative-quote-link {
  display: inline-flex;
  align-items: center;
  color: #ea580c;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}
.creative-quote-link:hover { color: #c2410c; }

html[data-blog-theme="dark"] .creative-quote {
  background: linear-gradient(135deg, #263449, #1e293b);
  border-left-color: #f97316;
}
html[data-blog-theme="dark"] .creative-quote::before { color: rgba(251, 146, 60, 0.15); }
html[data-blog-theme="dark"] .creative-quote-title { color: #f8fafc; }
html[data-blog-theme="dark"] .creative-quote-body { color: #cbd5e1; }
html[data-blog-theme="dark"] .creative-quote-link { color: #fb923c; }

html[data-blog-theme="warm"] .creative-quote {
  background: linear-gradient(135deg, #f1dfb9, #e6d2a5);
}
html[data-blog-theme="warm"] .creative-quote-title { color: #1f1409; }
html[data-blog-theme="warm"] .creative-quote-body { color: #4a3520; }
html[data-blog-theme="warm"] .creative-quote-link { color: #b45309; }

/* ==========================================================================
   Related posts section
   ========================================================================== */

.blog-related-section {
  background: #fef9f3;
  padding: 3rem 1.5rem 4rem;
}
.blog-related-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

html[data-blog-theme="dark"] .blog-related-section { background: #0f172a; }
html[data-blog-theme="dark"] .blog-related-heading { color: #f8fafc; }

html[data-blog-theme="warm"] .blog-related-section { background: #f3e2c2; }
html[data-blog-theme="warm"] .blog-related-heading { color: #1f1409; }

/* ==========================================================================
   Dark/warm theme overrides
   ========================================================================== */

html[data-blog-theme="dark"] .blog-breadcrumb,
html[data-blog-theme="dark"] .blog-breadcrumb a { color: #94a3b8; }
html[data-blog-theme="dark"] .blog-breadcrumb a:hover { color: #fb923c; }
html[data-blog-theme="dark"] .blog-breadcrumb-current { color: #e2e8f0; }

html[data-blog-theme="dark"] .blog-post-title { color: #f8fafc; }
html[data-blog-theme="dark"] .blog-post-excerpt { color: #cbd5e1; }
html[data-blog-theme="dark"] .blog-post-meta { color: #94a3b8; }

html[data-blog-theme="dark"] .use-case-tag {
  background: rgba(251, 146, 60, 0.15);
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.3);
}

html[data-blog-theme="dark"] .btn-subtle {
  color: #e2e8f0;
  border-color: rgba(251, 146, 60, 0.4);
}
html[data-blog-theme="dark"] .btn-subtle:hover {
  background: rgba(251, 146, 60, 0.15);
  border-color: #f97316;
}

html[data-blog-theme="dark"] .blog-posts-section { background: #0f172a; }
html[data-blog-theme="dark"] .blog-tag-bar {
  background: linear-gradient(135deg, #050810 0%, #0f172a 100%);
}
html[data-blog-theme="dark"] .blog-card {
  background-color: #1e293b;
  border-color: #334155;
}
html[data-blog-theme="dark"] .blog-card:hover { border-color: #f97316; }
html[data-blog-theme="dark"] .blog-card-title { color: #f8fafc; }
html[data-blog-theme="dark"] .blog-card-excerpt { color: #94a3b8; }

html[data-blog-theme="warm"] .blog-posts-section { background: #fdf8ee; }
html[data-blog-theme="warm"] .blog-card {
  background-color: #fbf3e0;
  border-color: rgba(180, 83, 9, 0.15);
}
html[data-blog-theme="warm"] .blog-card-title { color: #1f1409; }
html[data-blog-theme="warm"] .blog-card-excerpt { color: #6b4f33; }