/* blog.css — builds on page.css (requires CSS variables defined there) */

/* === Blog Index Layout === */

.blog-container {
  max-width: 900px;
  margin: 0 auto;
}

/* Category filter */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Blog card grid */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 560px) {
  .blog-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 860px) {
  .blog-grid { grid-template-columns: 1fr 1fr 1fr; }
}

/* Blog intro section */
.blog-intro {
  background: #f0f8ff;
  border-left: 4px solid var(--accent, #3AA8E8);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin-bottom: 28px;
  font-size: 14px;
  line-height: 1.8;
  color: #444;
}

.blog-intro p {
  margin: 0 0 10px;
}

.blog-intro p:last-child {
  margin-bottom: 0;
}

/* Blog card */
.blog-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.blog-card-img {
  aspect-ratio: 16/9;
  overflow: hidden;
}

.blog-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.blog-card-img-placeholder {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--surface2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.blog-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.blog-card-category {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  align-self: flex-start;
}

.blog-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
}

.blog-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.blog-card-meta {
  font-size: 12px;
  color: var(--text-subtle);
  display: flex;
  gap: 10px;
}

/* === Article Page === */

.article-container {
  max-width: 740px;
  margin: 0 auto;
}

/* Article header */
.article-header {
  margin-bottom: 24px;
}

.article-category {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.article-title {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  color: var(--text);
  line-height: 1.45;
  letter-spacing: -0.4px;
  margin-bottom: 14px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-subtle);
}

.article-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Featured image */
.article-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  margin: 20px 0 28px;
  display: block;
}

.article-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--surface2) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  margin: 20px 0 28px;
}

/* Table of contents */
.toc {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 32px;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  padding: 0;
  counter-reset: toc-h2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-list > li {
  counter-increment: toc-h2;
}

.toc-list > li > a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.toc-list > li > a::before {
  content: counter(toc-h2) ".";
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  min-width: 18px;
  font-size: 13px;
}

.toc-list > li > a:hover { color: var(--accent); }

.toc-sub {
  list-style: none;
  padding-left: 24px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-sub a {
  color: var(--text-subtle);
  text-decoration: none;
  font-size: 13px;
  display: block;
  padding: 1px 0;
}

.toc-sub a::before { content: "–  "; }
.toc-sub a:hover { color: var(--accent); }

/* Article body */
.article-body {
  font-size: 16px;
  line-height: 1.9;
  color: var(--text-muted);
}

.article-body h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 44px 0 16px;
  padding: 12px 16px;
  background: var(--surface2);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.4;
}

.article-body h2:first-child { margin-top: 0; }

.article-body h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.article-body h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 22px 0 8px;
}

.article-body p { margin-bottom: 18px; }
.article-body p:last-child { margin-bottom: 0; }

.article-body ul,
.article-body ol {
  padding-left: 24px;
  margin-bottom: 18px;
}

.article-body li { margin-bottom: 8px; line-height: 1.7; }

.article-body a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.article-body strong { color: var(--text); font-weight: 700; }

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 8px 0 20px;
  box-shadow: var(--shadow);
  display: block;
}

/* Note box */
.note-box {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin: 22px 0;
  font-size: 14px;
  line-height: 1.7;
}

.note-box .note-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

/* Comparison table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 20px 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.compare-table th {
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 13px;
}

.compare-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.compare-table tr:last-child td { border-bottom: none; }

.compare-table tr:nth-child(even) td {
  background: var(--surface2);
}

/* Code block */
.article-body pre {
  background: #1e293b;
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 20px 0;
  font-size: 13px;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

.article-body pre code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: #e2e8f0;
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
}

.article-body :not(pre) > code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

/* Step list */
.step-list {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-list li {
  counter-increment: step-counter;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 0;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
  flex-shrink: 0;
}

.step-body { flex: 1; }
.step-body strong { color: var(--text); display: block; margin-bottom: 4px; }

/* Horizontal rule */
.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}

/* CTA box */
.cta-box {
  background: var(--accent);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  margin: 44px 0;
}

.cta-box-title {
  font-size: 18px;
  font-weight: 800;
  color: white;
  margin-bottom: 8px;
  line-height: 1.4;
}

.cta-box-desc {
  font-size: 14px;
  color: rgba(255,255,255,0.88);
  margin-bottom: 20px;
  line-height: 1.7;
}

.cta-btn {
  display: inline-block;
  background: white;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  padding: 13px 32px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.cta-note {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 10px;
}

/* Related articles */
.related-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--border);
}

.related-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .related-grid { grid-template-columns: 1fr 1fr; }
}

.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
  -webkit-tap-highlight-color: transparent;
}

.related-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

.related-card-icon { font-size: 28px; flex-shrink: 0; }

.related-card-label {
  font-size: 10px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  margin-bottom: 4px;
}

.related-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

/* Share row */
.share-row {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.share-label {
  font-size: 13px;
  color: var(--text-subtle);
  font-weight: 600;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}

.share-btn:hover { opacity: 0.8; }
.share-btn-x { background: #000; color: white; }

/* Mobile adjustments */
@media (max-width: 480px) {
  .article-body { font-size: 15px; line-height: 1.85; }
  .article-body h2 { font-size: 17px; padding: 10px 14px; }
  .article-body h3 { font-size: 15px; }
  .cta-box { padding: 22px 18px; }
  .cta-box-title { font-size: 16px; }
  .toc { padding: 16px 18px; }
}
