/* ============================================================
   Sentrock blog — extends styles.css. Uses the existing CSS
   variables (colors/spacing) — does NOT redefine the core theme.
   Only blog-specific layout, typography, cards, callouts, code,
   TOC, and reading-progress styles live here.
   ============================================================ */

/* ── Category badge colors — a single purple family (on-brand). Kept as a
   subtle ramp so categories stay distinguishable, but all read as purple. ── */
:root {
  --cat-monitoring:  #7C3AED;   /* accent purple */
  --cat-engineering: #8B5CF6;   /* violet        */
  --cat-best:        #6D28D9;   /* deep purple   */
  --cat-security:    #A855F7;   /* bright violet */
  --cat-compliance:  #5B21B6;   /* indigo purple */
}

/* ── Reading progress bar (fixed at very top) ── */
.read-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--gradient); z-index: 200;
  transition: width .08s linear;
}

/* ── Blog index header ── */
.blog-hero { padding: 132px 0 40px; border-bottom: 1px solid var(--border); }
.blog-hero .eyebrow { color: var(--accent-2); }
.blog-hero h1 { font-size: clamp(34px, 5vw, 52px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin-top: 10px; }
.blog-hero .blog-sub { margin-top: 16px; max-width: 640px; font-size: 18px; line-height: 1.6; color: var(--text-muted); }

/* ── Category filter pills ── */
.blog-filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 28px 0 6px; }
.filter-pill {
  display: inline-flex; align-items: center; padding: 7px 16px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--text-muted);
  background: var(--card); border: 1px solid var(--border);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.filter-pill:hover { color: var(--text); border-color: var(--border-strong); }
.filter-pill.active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ── Post card grid (index + related) ── */
.post-grid { display: grid; grid-template-columns: 1fr; gap: 24px; padding: 32px 0 88px; }
@media (min-width: 760px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }

.post-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.post-card:hover { border-color: var(--border-strong); background: var(--card-hover); transform: translateY(-3px); }
.post-card a.card-link { display: flex; flex-direction: column; height: 100%; }
.post-card .thumb { width: 100%; aspect-ratio: 600 / 340; object-fit: cover; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.post-card .card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 22px; }
.post-card h2, .post-card h3 { font-size: 19px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; color: var(--text); margin: 12px 0 8px; }
.post-card:hover h2, .post-card:hover h3 { color: #fff; }
.post-card .excerpt { font-size: 14.5px; line-height: 1.6; color: var(--text-muted); flex: 1; }
.post-card .card-meta { display: flex; gap: 12px; align-items: center; margin-top: 16px; font-size: 12.5px; color: var(--text-dim); font-family: var(--mono); }
.post-card .read-more { margin-top: 14px; font-size: 13.5px; font-weight: 600; color: var(--accent-2); }

/* ── Category badge ── */
.cat-badge {
  display: inline-flex; align-items: center; align-self: flex-start;
  padding: 4px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #0A0E1A;
}
.cat-badge.cat-monitoring  { background: var(--cat-monitoring);  color: #fff; }
.cat-badge.cat-engineering { background: var(--cat-engineering); }
.cat-badge.cat-best        { background: var(--cat-best); }
.cat-badge.cat-security    { background: var(--cat-security); }
.cat-badge.cat-compliance  { background: var(--cat-compliance); }

/* ── Post page layout ── */
.post-header { padding: 120px 0 0; }
.post-header .breadcrumb { font-size: 13px; color: var(--text-dim); margin-bottom: 18px; letter-spacing: .01em; }
.post-header .breadcrumb a { color: var(--text-muted); transition: color .15s ease; }
.post-header .breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.post-header .breadcrumb .sep { margin: 0 8px; color: var(--text-dim); }
.post-header .breadcrumb .current { color: var(--text-muted); }
.post-header h1 { font-size: clamp(30px, 4.6vw, 46px); font-weight: 800; letter-spacing: -.03em; line-height: 1.08; margin: 14px 0 0; max-width: 15ch; }
.post-meta-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 18px; font-size: 13.5px; color: var(--text-muted); font-family: var(--mono); }
.post-meta-row .sep { color: var(--text-dim); }
.post-hero-img { width: 100%; aspect-ratio: 1200 / 680; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius); margin: 28px 0 0; background: var(--bg-2); }
.post-divider { border: 0; border-top: 1px solid var(--border); margin: 32px 0 0; }

.post-layout { display: grid; grid-template-columns: 1fr; gap: 40px; padding: 36px 0 88px; }
@media (min-width: 1000px) { .post-layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 56px; } }

/* ── Post body typography ── */
.post-body { max-width: 720px; }
.post-body > p, .post-body > ul, .post-body > ol { font-size: 17.5px; line-height: 1.8; color: var(--text-muted); margin-bottom: 20px; }
.post-body > h2 {
  font-size: 27px; font-weight: 700; letter-spacing: -.02em; color: var(--text);
  margin: 44px 0 16px; padding-left: 14px; border-left: 3px solid var(--accent); scroll-margin-top: 90px;
}
.post-body > h3 { font-size: 20px; font-weight: 700; color: var(--text); margin: 30px 0 12px; scroll-margin-top: 90px; }
/* Body subheadings stay in the dark text color (matching the <h2> scale). The
   previous teal made every article subheading read as off-brand green. */
.post-body h3 { color: var(--text); }
.post-body strong { color: var(--text); font-weight: 600; }
.post-body em { color: var(--text-muted); }
.post-body ul, .post-body ol { padding-left: 24px; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li { margin-bottom: 10px; }
.post-body li::marker { color: var(--accent); }
.post-body a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: rgba(168,85,247,.4); transition: text-decoration-color .15s ease; }
.post-body a:hover { text-decoration-color: var(--accent-2); }

/* ── Inline code + code blocks ── */
.post-body :not(pre) > code {
  font-family: var(--mono); font-size: .88em; padding: 2px 7px; border-radius: 6px;
  background: rgba(124,58,237,.14); color: #C4B5FD; border: 1px solid rgba(124,58,237,.22);
}
.code-block { position: relative; margin: 8px 0 24px; }
.code-block pre {
  overflow-x: auto; background: var(--bg-3); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 18px 20px; font-family: var(--mono);
  font-size: 13.5px; line-height: 1.65; color: #E4E9F2;
}
.code-block pre code { font-family: inherit; background: none; border: 0; padding: 0; color: inherit; }
.copy-btn {
  position: absolute; top: 10px; right: 10px; padding: 5px 11px; border-radius: 7px;
  font-size: 12px; font-weight: 600; font-family: var(--mono); cursor: pointer;
  background: var(--card); color: var(--text-muted); border: 1px solid var(--border);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-strong); }
.copy-btn.copied { color: #34D399; border-color: rgba(52,211,153,.5); }

/* ── Callout boxes ── */
.callout-info, .callout-warning, .callout-tip {
  display: flex; gap: 14px; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); margin: 8px 0 24px; font-size: 16px; line-height: 1.65;
}
.callout-info    { background: rgba(56,189,248,.08);  border-color: rgba(56,189,248,.30); }
.callout-warning { background: rgba(245,158,11,.08);  border-color: rgba(245,158,11,.32); }
.callout-tip     { background: rgba(52,211,153,.08);  border-color: rgba(52,211,153,.30); }
.callout-info::before, .callout-warning::before, .callout-tip::before {
  flex-shrink: 0; font-size: 18px; line-height: 1.5;
}
.callout-info::before    { content: "ℹ️"; }
.callout-warning::before { content: "⚠️"; }
.callout-tip::before     { content: "💡"; }
.callout-info p, .callout-warning p, .callout-tip p { margin: 0 0 8px; color: var(--text-muted); }
.callout-info p:last-child, .callout-warning p:last-child, .callout-tip p:last-child { margin-bottom: 0; }
.callout-info strong, .callout-warning strong, .callout-tip strong { color: var(--text); }

/* ── Blockquote ── */
.post-body blockquote {
  border-left: 3px solid var(--accent); padding: 6px 0 6px 20px; margin: 8px 0 24px;
  font-style: italic; color: var(--text-muted); font-size: 18px; line-height: 1.7;
}

/* ── Author / publisher block ── */
.post-author {
  display: flex; gap: 16px; align-items: flex-start; margin-top: 44px; padding: 24px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.post-author .brand-mark { flex-shrink: 0; }
.post-author h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.post-author p { font-size: 14.5px; line-height: 1.6; color: var(--text-muted); margin-bottom: 12px; }
.post-author .text-link { font-size: 14px; font-weight: 600; color: var(--accent-2); }

/* ── Related posts ── */
.related { margin-top: 56px; }
.related > h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--text); margin-bottom: 20px; }
.related .post-grid { padding: 0; }

/* ── Sidebar (TOC + CTA) ── */
.post-sidebar { display: none; }
@media (min-width: 1000px) {
  .post-sidebar { display: block; position: sticky; top: 90px; align-self: start; }
}
.toc-box { margin-bottom: 24px; }
.toc-box h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-dim); margin-bottom: 14px; }
.toc-box ol { list-style: none; display: flex; flex-direction: column; gap: 1px; max-height: 52vh; overflow-y: auto; }
.toc-box a { display: block; padding: 6px 12px; font-size: 13.5px; line-height: 1.35; color: var(--text-muted); border-left: 2px solid transparent; border-radius: 0 6px 6px 0; transition: color .15s ease, background .15s ease, border-color .15s ease; }
.toc-box a:hover { color: var(--text); background: rgba(124,58,237,.06); }
.toc-box a.active { color: var(--text); border-left-color: var(--accent); background: rgba(124,58,237,.10); font-weight: 600; }

.sidebar-cta {
  position: relative; border-radius: var(--radius); padding: 22px; background: var(--card);
  border: 1px solid transparent; background-clip: padding-box;
}
.sidebar-cta::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius); padding: 1px;
  background: var(--gradient); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.sidebar-cta h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.sidebar-cta p { font-size: 13.5px; line-height: 1.6; color: var(--text-muted); margin-bottom: 16px; }

/* Reduced-motion: disable the progress-bar/card transitions. */
@media (prefers-reduced-motion: reduce) {
  .read-progress, .post-card, .filter-pill, .copy-btn, .toc-box a { transition: none; }
}

/* =====================================================================
   Light-mode overrides (commercial site experiment).
   blog.css above is theme-variable driven; these fix the handful of
   values that were hardcoded for the dark original.
   ===================================================================== */
/* Card hover kept the heading readable on a LIGHT hover surface */
.post-card:hover { background: var(--card-hover); box-shadow: var(--shadow-md); }
.post-card:hover h2, .post-card:hover h3 { color: var(--accent); }

/* Inline code: darker purple on a soft lavender chip (was light-on-light) */
.post-body :not(pre) > code {
  background: rgba(124,58,237,.09); color: #6D28D9; border-color: rgba(124,58,237,.20);
}

/* Code blocks: a deliberate dark block on the light page (was near-white text on a light surface) */
.code-block pre { background: #17141F; border-color: rgba(124,58,237,.28); color: #E7E9F0; }

/* Category badges are now all dark-purple backgrounds, so text is white */
.cat-badge { color: #fff; }

/* Light post-card graphics are 16:9. The SVGs are self-contained (white bg, no
   bleed) and already exactly 16:9, so `contain` shows the whole graphic with no
   crop — `cover` was zooming/clipping the text on narrow cards + phones. */
.post-card .thumb { aspect-ratio: 16 / 9; object-fit: contain; background: #fff; }
.post-hero-img { aspect-ratio: 16 / 9; max-width: 100%; object-fit: contain; background: #fff; }
/* Tighten the large top gap the original design left for a fixed nav */
.blog-hero { padding: 52px 0 40px; }
.post-header { padding: 44px 0 0; }

/* =====================================================================
   Related-articles cards render INSIDE .post-body, so the prose link
   styles (teal <h3>, underlined <a>) were leaking into them — the cards
   showed green underlined headings. Reset them to normal card styling.
   ===================================================================== */
.related .post-card h3 { color: var(--text); }
.related .post-card:hover h3 { color: var(--accent); }
.related .card-link,
.related .card-link:hover,
.related .post-card .excerpt,
.related .post-card .read-more { text-decoration: none; }
.related .post-card .excerpt { color: var(--text-muted); }
.related .post-card .read-more { color: var(--accent); }

/* =====================================================================
   Mobile reading comfort (phones). The 17.5px body + 24px gutter read
   edge-to-edge on a 390px screen; ease the type down and the hero image
   size so long-form posts breathe.
   ===================================================================== */
@media (max-width: 640px) {
  .post-header { padding-top: 28px; }
  .post-header h1 { max-width: none; font-size: clamp(26px, 8vw, 34px); }
  .post-hero-img { margin-top: 18px; border-radius: var(--radius-sm); }
  .post-layout { padding-top: 26px; gap: 32px; }
  .post-body { max-width: none; }
  .post-body > p, .post-body > ul, .post-body > ol { font-size: 16px; line-height: 1.72; margin-bottom: 18px; }
  .post-body > h2 { font-size: 22px; margin: 34px 0 12px; }
  .post-body > h3 { font-size: 18px; margin-top: 26px; }
  .post-body blockquote { font-size: 16.5px; }
  .code-block pre { font-size: 12.5px; padding: 14px 15px; }
  .related { margin-top: 44px; }
  .related > h2 { font-size: 20px; }
  .blog-hero h1 { font-size: clamp(28px, 8.5vw, 40px); }
  .blog-hero .blog-sub { font-size: 16px; }
}
