:root {
  --gradient-start: #2563eb;
  --gradient-end: #7c3aed;
  --card-bg: #ffffff;
  --text-muted: #6b7280;
  --text-strong: #111827;
  --border: #e5e7eb;
}

html, body { height: 100%; }
body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.main { padding: 32px 16px; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 1000; padding: 10px 0; background: rgba(255,255,255,0.08); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(255,255,255,0.18); }
.topbar .brand-link { font-weight: 800; color: #ffffff; text-decoration: none; letter-spacing: .2px; }
.topbar .brand-link:hover { opacity: .9; }

.card-modern {
  max-width: 880px;
  margin: 0 auto;
  border: 0;
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: 0 20px 60px rgba(0,0,0,.12);
}
.post-header { padding: 28px 28px 0 28px; }
.post-body { padding: 0 28px 28px 28px; font-size: 1.05rem; line-height: 1.75; text-rendering: optimizeLegibility; }
.post-header h1 { font-weight: 800; letter-spacing: .2px; }
.post-body h2 { margin-top: 1.75rem; margin-bottom: .75rem; font-weight: 800; font-size: 1.45rem; letter-spacing: .1px; }
.post-body h3 { margin-top: 1.25rem; margin-bottom: .5rem; font-weight: 700; font-size: 1.2rem; }
.post-body h4 { margin-top: 1.1rem; margin-bottom: .35rem; font-weight: 700; }
.post-body p, .post-body li { color: var(--text-strong); line-height: 1.75; }
.post-body p { margin: 0 0 1rem 0; }
.post-body ul, .post-body ol { padding-left: 1.25rem; margin: 0 0 .9rem 0; }
.post-body li::marker { color: #94a3b8; }
.post-body .lead { font-size: 1.1rem; color: #0f172a; }
.post-body hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.post-body blockquote { border-left: 4px solid #c7d2fe; padding: .75rem 1rem; background: #f8fafc; color: #1f2937; border-radius: 6px; margin: 1rem 0; }
.post-body code { background: #f3f4f6; padding: 2px 6px; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.post-body pre { background: #0f172a; color: #e5e7eb; padding: 12px; border-radius: 8px; overflow: auto; }
.post-body a { color: #2563eb; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.post-body a:hover { text-decoration-thickness: 2px; }

/* Media / figures */
.post-body img, .post-body video { display: block; max-width: 100%; height: auto; border-radius: 12px; margin: 1rem 0; }
.post-body figure { margin: 1.25rem auto; text-align: center; }
.post-body figcaption { color: var(--text-muted); font-size: .9rem; margin-top: .35rem; }

/* Tables */
.post-body table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: .6rem .75rem; text-align: left; }
.post-body thead th { background: #f8fafc; font-weight: 700; }

/* Callouts */
.post-body .note { border: 1px solid #bfdbfe; background: #eff6ff; padding: .75rem 1rem; border-radius: 8px; }
.post-body .warning { border: 1px solid #fecaca; background: #fef2f2; padding: .75rem 1rem; border-radius: 8px; }
.meta { color: var(--text-muted); font-size: .95rem; }
.badge-cat { background: #eef2ff; color: #3730a3; font-weight: 600; }

/* Breadcrumb */
.breadcrumb-wrapper { padding: 4px 0; }
.breadcrumb { --bs-breadcrumb-divider: '>'; margin-bottom: 0; }
.breadcrumb .breadcrumb-item a { text-decoration: none; }

/* Related */
.related-section { padding: 0 28px 28px 28px; }
.related-title { font-weight: 700; margin: 8px 0 16px 0; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-card { border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.06); height: 100%; transition: transform .15s ease, box-shadow .15s ease; }
.related-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.10); }
.related-card a { text-decoration: none; color: inherit; }
.related-card .cat { font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; }
.related-card h3 { font-size: 1rem; margin: 0 0 6px 0; }
.related-card p { font-size: .9rem; color: var(--text-muted); margin: 0; }

@media (max-width: 576px) {
  .card-modern { border-radius: 16px; }
  .post-header, .post-body, .related-section { padding: 18px; }
  .related-grid { grid-template-columns: 1fr; }
}

/* Post navigation */
.post-nav { padding: 0 28px 28px 28px; }
.post-nav .btn { border-radius: 10px; }
.post-nav .spacer { flex: 1 1 auto; }

