@import url("base.css");

/* ── Blog layout ─────────────────────────────────────────────────── */
.blog-layout {
  font-size: var(--fs-xl);
  line-height: 1.6;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 64px);
}

.blog-content {
  width: 100%;
  max-width: 800px;
  padding: 40px 48px 80px;
}

/* ── Breadcrumb ──────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-md);
  color: var(--text-dim);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { opacity: 0.4; }

/* ── Article typography ──────────────────────────────────────────── */
.article a { color: var(--accent); text-decoration: none; }
.article a:hover { text-decoration: underline; }
.article a.blog-card:hover { text-decoration: none; }

.article-meta {
  font-size: var(--fs-md);
  color: var(--text-dim);
  margin-bottom: 32px;
}

.article h1 {
  font-size: calc(var(--fs-base) + 14px);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
}

.article h2 {
  font-size: calc(var(--fs-base) + 4px);
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.article h3 {
  font-size: var(--fs-xl);
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--text);
}

.article p { margin-bottom: 16px; }

.article ul, .article ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.article li { margin-bottom: 6px; }

.article code {
  font-family: var(--mono);
  font-size: var(--fs-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--accent);
}

.article pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.article pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--fs-md);
  color: var(--text);
}

.article strong { font-weight: 600; }

/* ── Blog article meta (date + reading time on article page) ───── */
.blog-article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  color: var(--text-dim);
  margin-bottom: 32px;
}

.blog-article-meta .blog-card-dot { color: var(--text-muted); }

/* ── Callout boxes ───────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: var(--fs-lg);
  line-height: 1.5;
  display: flex;
  gap: 12px;
}

.callout-icon { flex-shrink: 0; font-size: calc(var(--fs-base) + 2px); margin-top: 1px; }

.callout-info {
  background: var(--blue-bg);
  border: 1px solid var(--blue);
  border-color: color-mix(in srgb, var(--blue) 30%, transparent);
  color: var(--text);
}

.callout-warn {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow);
  border-color: color-mix(in srgb, var(--yellow) 30%, transparent);
  color: var(--text);
}

.callout-success {
  background: var(--green-bg);
  border: 1px solid var(--green);
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
  color: var(--text);
}

/* ── Tables ─────────────────────────────────────────────────────── */
.article table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
  margin-bottom: 16px;
  display: block;
  overflow-x: auto;
}
.article thead tr { border-bottom: 1px solid var(--border); }
.article th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
}
.article td { padding: 8px 12px; }
.article tbody tr { border-bottom: 1px solid var(--border); }
.article small { font-size: var(--fs-sm); color: var(--text-dim); }

/* ── Blog index grid ─────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.blog-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  text-decoration: none;
}

.light .blog-card {
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.light .blog-card:hover {
  box-shadow: var(--shadow-md);
}
.light .blog-toc,
.light .blog-cta {
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.blog-tag {
  display: inline-block;
  font-size: calc(var(--fs-base) - 3px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.blog-card-title {
  font-size: calc(var(--fs-base) + 2px);
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.35;
  color: var(--text);
}

.blog-card-desc {
  font-size: var(--fs-md);
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 16px;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.blog-card-dot { color: var(--text-muted); }

/* ── Table of contents ──────────────────────────────────────────── */
.blog-toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 32px;
}

.blog-toc strong {
  font-size: var(--fs-md);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.blog-toc ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.blog-toc li { margin-bottom: 4px; }

.blog-toc a {
  font-size: var(--fs-lg);
  color: var(--accent);
  text-decoration: none;
}

.blog-toc a:hover { text-decoration: underline; }

/* ── FAQ accordion ──────────────────────────────────────────────── */
.blog-faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-sm);
  overflow: hidden;
}

.blog-faq-item h3 {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 18px;
  margin: 0;
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s;
}

.blog-faq-item h3:hover { background: var(--bg-input); }

.blog-faq-item h3::after {
  content: "▾";
  margin-left: auto;
  font-size: calc(var(--fs-base) - 3px);
  color: var(--text-dim);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.blog-faq-item.open h3::after { transform: rotate(180deg); }

.blog-faq-item > :not(h3) {
  display: none;
}

.blog-faq-item.open > :not(h3) {
  display: block;
}

.blog-faq-item.open > h3 + * {
  padding: 14px 18px 16px;
  border-top: 1px solid var(--border);
}

.blog-faq-item p {
  margin: 0;
  color: var(--text-dim);
}

/* ── Blog CTA block (end of article) ────────────────────────────── */
.blog-cta {
  margin-top: 48px;
  padding: 28px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.blog-cta-title {
  font-size: calc(var(--fs-base) + 4px);
  font-weight: 700;
  margin-bottom: 8px;
}

.blog-cta-desc {
  font-size: var(--fs-lg);
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
}

.article .blog-cta-btn,
.blog-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent), #fff 10%) 0%, var(--accent) 50%, color-mix(in srgb, var(--accent), #000 20%) 100%);
  color: var(--on-accent);
  font-family: var(--font);
  font-size: var(--fs-lg);
  font-weight: 700;
  border-radius: var(--radius);
  text-decoration: none;
  transition: filter var(--dur-fast), transform var(--dur-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}

.article .blog-cta-btn:hover,
.blog-cta-btn:hover {
  filter: brightness(1.15);
  color: var(--on-accent);
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25), 0 6px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}
.article .blog-cta-btn:active,
.blog-cta-btn:active { transform: scale(0.97); }

.light .blog-cta-btn,
.light .article .blog-cta-btn {
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 4px 12px var(--accent-glow);
}
.light .blog-cta-btn:hover,
.light .article .blog-cta-btn:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.15), 0 6px 20px var(--accent-glow);
}

.blog-cta--inline {
  margin-top: 24px;
  margin-bottom: 8px;
}

/* ── Related articles ────────────────────────────────────────────── */
.blog-related {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.blog-related-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* ── Tags navigation ─────────────────────────────────────────────── */
.blog-tags-nav {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.blog-tags-nav::-webkit-scrollbar { display: none; }

.blog-tag-link {
  display: inline-block;
  font-size: calc(var(--fs-base) - 3px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.blog-tag-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.blog-tag-link.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: var(--accent);
}

/* ── Author block ────────────────────────────────────────────────── */
a.blog-author {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-decoration: none;
  transition: opacity 0.2s;
}

a.blog-author:hover { opacity: 0.8; }

.blog-author-avatar { flex-shrink: 0; }

.blog-author-name {
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-lg);
}

.blog-author-desc {
  color: var(--text-dim);
  font-size: var(--fs-md);
  margin-top: 2px;
}

/* ── Author profile page ─────────────────────────────────────────── */
.author-profile {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.author-profile-avatar { flex-shrink: 0; }

.author-profile h1 {
  margin-bottom: 2px;
}

.author-profile-desc {
  color: var(--text-dim);
  line-height: 1.5;
  font-size: var(--fs-md);
  margin-bottom: 0;
}

/* ── Author about ────────────────────────────────────────────────── */
.author-about {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.author-about h2 {
  font-size: calc(var(--fs-base) + 4px);
  margin: 0 0 12px;
}

.author-about h3 {
  font-size: calc(var(--fs-base) + 1px);
  margin: 20px 0 8px;
}

.author-about p {
  font-size: var(--fs-lg);
  color: var(--text-dim);
  line-height: 1.7;
  margin: 0 0 10px;
}

.author-about ul {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.author-about li {
  position: relative;
  padding-left: 18px;
  font-size: var(--fs-lg);
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 4px;
}

.author-about li::before {
  content: '\2022';
  position: absolute;
  left: 2px;
  color: var(--accent);
  font-weight: 700;
}

.author-about a {
  color: var(--accent);
  text-decoration: none;
}

.author-about a:hover {
  text-decoration: underline;
}

/* ── Back link ───────────────────────────────────────────────────── */
.blog-back-link {
  display: inline-block;
  margin-top: var(--space-xl);
  font-size: var(--fs-md);
  color: var(--accent);
  text-decoration: none;
}

.blog-back-link:hover { text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .blog-content { padding: 24px 20px 60px; }
  .article h1 { font-size: calc(var(--fs-base) + 8px); }
  .article h2 { font-size: calc(var(--fs-base) + 3px); }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-cta { padding: 20px; }
  .blog-author { gap: var(--space-md); }
}
