/* ==========================================================================
   ClawMetry blog theme
   Visual treatment ported from openclaw.ai/blog (CSS only, no copy).
   Loaded by every page under /blog/*.
   ========================================================================== */

:root {
  --cm-bg-deep: #050810;
  --cm-bg-surface: #0a0f1a;
  --cm-bg-elevated: #111827;

  --cm-accent: #E5443A;          /* ClawMetry red (kept) */
  --cm-accent-bright: #ff5a50;
  --cm-accent-dark: #8a1a14;
  --cm-cyan: #00e5cc;            /* used sparingly for tags / em */

  --cm-text-primary: #f0f4ff;
  --cm-text-secondary: #b9c2d6;
  --cm-text-muted: #6f7a93;

  --cm-border-subtle: rgba(255, 255, 255, 0.07);
  --cm-border-strong: rgba(255, 255, 255, 0.14);
  --cm-border-accent: rgba(229, 68, 58, 0.32);

  --cm-surface-card: rgba(10, 15, 26, 0.72);
  --cm-surface-card-strong: rgba(10, 15, 26, 0.86);
  --cm-surface-inset: rgba(255, 255, 255, 0.04);
  --cm-surface-cyan-soft: rgba(0, 229, 204, 0.13);
  --cm-surface-coral-soft: rgba(229, 68, 58, 0.13);

  --cm-shadow-coral-soft: rgba(229, 68, 58, 0.18);
  --cm-shadow-coral-mid: rgba(229, 68, 58, 0.28);

  --cm-font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --cm-font-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --cm-font-mono:    "SF Mono", "Fira Code", "JetBrains Mono", Consolas, monospace;
}

/* ---------- Constellation background (pure CSS, no JS) -------------------- */

.cm-stars {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px,  rgba(255,255,255,0.75), transparent),
    radial-gradient(2px 2px at 40px 70px,  rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 90px 40px,  rgba(255,255,255,0.55), transparent),
    radial-gradient(2px 2px at 130px 80px, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 160px 120px,rgba(255,255,255,0.65), transparent),
    radial-gradient(2px 2px at 200px 60px, rgba(0,229,204,0.45),   transparent),
    radial-gradient(1px 1px at 250px 150px,rgba(255,255,255,0.45), transparent),
    radial-gradient(2px 2px at 300px 40px, rgba(229,68,58,0.40),   transparent);
  background-size: 350px 200px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

.cm-nebula {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(229,68,58,0.10), transparent 50%),
    radial-gradient(ellipse 60% 60% at 80% 30%, rgba(0,229,204,0.06), transparent 50%),
    radial-gradient(ellipse 90% 70% at 50% 90%, rgba(229,68,58,0.05), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Page chrome --------------------------------------------------- */

html, body { background: var(--cm-bg-deep); }

body {
  font-family: var(--cm-font-body);
  color: var(--cm-text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* keep existing site nav above the constellation */
.header { position: relative; z-index: 5; background: rgba(5,8,16,0.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--cm-border-subtle); }

/* ---------- Blog list page ------------------------------------------------ */

.cm-blog-container {
  position: relative;
  z-index: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 60px);
  box-sizing: border-box;
}

.cm-blog-container,
.cm-article-container { overflow-x: hidden; }

.cm-blog-header {
  text-align: center;
  margin-bottom: 48px;
  animation: cmFadeUp 0.6s ease-out;
}

.cm-back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--cm-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}
.cm-back-link:hover { color: var(--cm-accent); text-decoration: none; }

.cm-blog-title {
  font-family: var(--cm-font-display);
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--cm-text-primary);
}

.cm-blog-title .cm-chevron {
  color: var(--cm-accent);
  font-weight: 700;
  margin-right: 4px;
}

.cm-blog-subtitle {
  color: var(--cm-text-secondary);
  font-size: 1.05rem;
  margin: 0;
}

.cm-posts-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 48px;
}

.cm-post-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px;
  border-radius: 16px;
  border: 1px solid var(--cm-border-subtle);
  background: var(--cm-surface-card-strong);
  backdrop-filter: blur(8px);
  text-decoration: none;
  color: var(--cm-text-primary);
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}
.cm-post-card:hover {
  border-color: var(--cm-accent);
  transform: translateY(-3px);
  box-shadow: 0 16px 48px var(--cm-shadow-coral-soft);
  text-decoration: none;
}

.cm-post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--cm-text-muted);
}
.cm-post-meta .cm-dot { opacity: 0.5; }

.cm-post-title {
  font-family: var(--cm-font-display);
  font-size: clamp(1.2rem, 3.4vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cm-text-primary);
  line-height: 1.3;
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cm-post-card:hover .cm-post-title { color: var(--cm-accent); }

.cm-post-excerpt {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--cm-text-secondary);
  margin: 0;
}

.cm-post-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
  padding-top: 16px;
  border-top: 1px solid var(--cm-border-subtle);
}

.cm-post-author {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cm-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--cm-border-subtle);
  background: var(--cm-bg-elevated);
  object-fit: cover;
  flex-shrink: 0;
}

.cm-author-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--cm-text-secondary);
}

.cm-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.cm-tag {
  font-size: 0.72rem;
  color: var(--cm-cyan);
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cm-surface-cyan-soft);
  border: 1px solid rgba(0, 229, 204, 0.18);
  white-space: nowrap;
}

/* ---------- Blog detail / article ---------------------------------------- */

.cm-article-container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 64px;
  box-sizing: border-box;
}

.cm-article {
  background: var(--cm-surface-card-strong);
  border: 1px solid var(--cm-border-subtle);
  border-radius: 20px;
  padding: 48px 48px 40px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: cmFadeUp 0.6s ease-out;
}

.cm-article-header { margin-bottom: 40px; }

.cm-article-title {
  font-family: var(--cm-font-display);
  font-size: clamp(1.7rem, 5vw, 2.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--cm-text-primary) 0%, var(--cm-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--cm-text-primary); /* fallback */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cm-article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--cm-surface-inset);
  border: 1px solid var(--cm-border-subtle);
}

.cm-meta-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cm-meta-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--cm-border-subtle);
  background: var(--cm-bg-elevated);
  object-fit: cover;
  flex-shrink: 0;
}

.cm-meta-author { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cm-meta-author-name { font-weight: 600; color: var(--cm-text-primary); font-size: 0.95rem; }
.cm-meta-author-links { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cm-meta-author-links a {
  font-size: 0.82rem;
  color: var(--cm-accent);
  text-decoration: none;
}
.cm-meta-author-links a:hover { text-decoration: underline; }

.cm-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--cm-text-muted);
  white-space: nowrap;
}
.cm-meta-right .cm-dot { opacity: 0.5; }

/* ---------- Animations --------------------------------------------------- */

@keyframes cmFadeUp {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- Footer ------------------------------------------------------- */

.cm-blog-footer {
  margin-top: auto;
  padding-top: 40px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--cm-text-muted);
  position: relative;
  z-index: 1;
}
.cm-blog-footer a { color: var(--cm-accent); text-decoration: none; }
.cm-blog-footer a:hover { color: var(--cm-cyan); }

/* ---------- Responsive --------------------------------------------------- */

@media (max-width: 700px) {
  .cm-blog-container,
  .cm-article-container { padding: 28px 16px 48px; }
  .cm-post-card { padding: 22px; }
  .cm-article { padding: 30px 22px 26px; border-radius: 16px; }
  .cm-post-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .cm-post-tags { justify-content: flex-start; }
  .cm-article-meta { flex-direction: column; align-items: flex-start; }
  .cm-meta-right { width: 100%; }
}
