/* ============================================================================
   TracRHQ Blog — chrome + article typography.
   Built entirely on the shared tokens in colors_and_type.css so the blog stays
   visually consistent with the app and landing page. No page-specific colors.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

.blog-container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 24px;
}
.blog-container--narrow { max-width: 720px; }

/* ── Brand + buttons (mirrors the marketing site's components via tokens) ── */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; }
.brand-name { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -0.01em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-sm);
  font-family: var(--font-sans); font-weight: 600; font-size: 0.95rem;
  border: 1px solid transparent; cursor: pointer; transition: background .15s ease, color .15s ease;
}
.btn-primary { background: var(--accent-strong); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.blog-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.blog-header .blog-container {
  display: flex; align-items: center; gap: 20px; height: 64px;
}
.blog-nav { display: flex; gap: 22px; margin-left: 12px; flex: 1; }
.blog-nav a { color: var(--text-2); font-weight: 500; font-size: 0.95rem; }
.blog-nav a:hover, .blog-nav a[aria-current="page"] { color: var(--text); text-decoration: none; }
.blog-header-actions { display: flex; align-items: center; gap: 14px; }
.blog-login { color: var(--text-2); font-weight: 500; font-size: 0.95rem; }
.blog-login:hover { color: var(--text); text-decoration: none; }
.nav-toggle { display: none; }

/* Mobile drawer (hidden on desktop) — mirrors the marketing page's menu. */
.mobile-menu { display: none; }

@media (max-width: 760px) {
  .blog-nav, .blog-login { display: none; }
  .blog-header .blog-container { gap: 12px; }
  /* Start free + hamburger dock at the far right, hamburger last — same as the landing page. */
  .blog-header-actions { margin-left: auto; gap: 10px; }
  .blog-header-actions .btn-primary { padding: 9px 14px; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--r-md); border: 1px solid var(--border);
    background: var(--surface); color: var(--text); cursor: pointer; font-size: 17px;
  }

  .mobile-menu {
    display: block; position: fixed; inset: 64px 0 auto 0; z-index: 49;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md); padding: 12px 24px 20px;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
  }
  .mobile-menu.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .mobile-menu a { display: block; padding: 13px 8px; font: 500 16px var(--font-sans); color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-soft); }
  .mobile-menu a:last-child { border-bottom: 0; }
  .mobile-menu .btn { width: 100%; margin-top: 14px; justify-content: center; border-bottom: 0; }
  /* The CTA is an <a>, so keep its button text colour (not the menu-link colour). */
  .mobile-menu .btn-primary { color: #fff; }
}

/* ── Main ────────────────────────────────────────────────────────────────── */
.blog-main { flex: 1; padding-block: 56px 72px; }

/* ── Listing hero ────────────────────────────────────────────────────────── */
.blog-hero { max-width: 720px; margin-bottom: 44px; }
.blog-eyebrow {
  text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; font-weight: 600;
  color: var(--accent); margin: 0 0 10px;
}
.blog-hero h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
  font-size: clamp(2rem, 4vw, 2.7rem); line-height: 1.1; margin: 0 0 14px;
}
.blog-hero-sub { color: var(--text-2); font-size: 1.12rem; margin: 0; }
.blog-empty { color: var(--text-2); }

/* ── Post list ───────────────────────────────────────────────────────────── */
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
@media (min-width: 720px) { .post-list { grid-template-columns: 1fr 1fr; } }

.post-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.post-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border); }
.post-card-link { display: block; padding: 22px 22px 20px; color: inherit; }
.post-card-link:hover { text-decoration: none; }
.post-card-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--text-3); font-size: 0.85rem; }
.post-card-title {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
  font-size: 1.28rem; line-height: 1.25; margin: 0 0 8px; color: var(--text);
}
.post-card-desc { color: var(--text-2); margin: 0 0 14px; font-size: 0.98rem; }
.post-card-more { color: var(--accent); font-weight: 600; font-size: 0.92rem; }
.post-card-more .pi { font-size: 0.8rem; vertical-align: middle; transition: transform .15s ease; }
.post-card:hover .post-card-more .pi { transform: translateX(3px); }

.post-tag {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 3px 10px; font-size: 0.76rem; font-weight: 600;
  text-transform: capitalize;
}

/* ── Article ─────────────────────────────────────────────────────────────── */
.post-breadcrumb { color: var(--text-3); font-size: 0.85rem; margin-bottom: 24px; }
.post-breadcrumb a { color: var(--text-2); }
.post-breadcrumb span[aria-hidden] { margin-inline: 6px; color: var(--border); }

.post-header { margin-bottom: 32px; }
.post-header h1 {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
  font-size: clamp(2rem, 4.5vw, 2.9rem); line-height: 1.12; margin: 14px 0 12px;
}
.post-byline { color: var(--text-3); font-size: 0.92rem; margin: 0; }

/* Prose — comfortable long-form reading */
.post-prose { font-size: 1.1rem; line-height: 1.75; color: var(--text); }
.post-prose > * + * { margin-top: 1.25em; }
.post-prose h2 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em;
  font-size: 1.6rem; line-height: 1.25; margin-top: 2em; margin-bottom: 0.6em;
}
.post-prose h3 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.28rem; margin-top: 1.6em; margin-bottom: 0.5em;
}
.post-prose p { margin: 0; }
.post-prose ul, .post-prose ol { margin: 0; padding-left: 1.4em; }
.post-prose li + li { margin-top: 0.4em; }
.post-prose a { text-decoration: underline; text-underline-offset: 2px; }
.post-prose strong { font-weight: 600; }
.post-prose blockquote {
  border-left: 3px solid var(--accent); margin: 1.5em 0; padding: 4px 0 4px 20px;
  color: var(--text-2); font-style: italic;
}
.post-prose code {
  font-family: var(--font-mono); font-size: 0.9em;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 5px; padding: 1px 6px;
}
.post-prose pre {
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 18px; overflow-x: auto;
}
.post-prose pre code { background: none; border: none; padding: 0; }
.post-prose img { border-radius: var(--r-md); border: 1px solid var(--border); }
.post-prose hr { border: none; border-top: 1px solid var(--border); margin: 2.4em 0; }

/* ── Bottom CTA ──────────────────────────────────────────────────────────── */
.post-cta {
  margin-top: 56px; padding: 32px; text-align: center;
  background: var(--accent-soft); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
}
.post-cta h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; margin: 0 0 8px; }
.post-cta p { color: var(--text-2); margin: 0 0 20px; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.blog-footer { border-top: 1px solid var(--border-soft); padding-block: 32px; background: var(--surface-2); }
.blog-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.blog-footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.blog-footer-links a { color: var(--text-2); font-size: 0.92rem; }
.blog-footer-links a:hover { color: var(--text); text-decoration: none; }
.blog-footer-legal { color: var(--text-3); font-size: 0.85rem; margin: 18px 0 0; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  body { font-size: 16px; }
  .blog-nav { display: none; }
  .blog-login { display: none; }
  .blog-main { padding-block: 36px 52px; }
  .post-prose { font-size: 1.05rem; }
}
