/* ==========================================================================
   Codychat Blog — shared styles
   One font (Manrope). One accent (flat blue). No gradients, no blur,
   no colored side-borders, no decorative icons.
   ========================================================================== */

:root {
  --bg:        #0B0E13;
  --surface:   #12161D;
  --surface-2: #181D26;
  --border:    #242A35;
  --text:      #ECEEF2;
  --text-dim:  #9AA2B1;
  --text-faint:#5E6675;
  --accent:    #3B82F6;
  --accent-ink:#FFFFFF;
  --radius:    8px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ---------- Topbar (flat, solid — no blur) ---------- */
.topbar {
  position: sticky; top: 0; left: 0; right: 0;
  z-index: 90;
  height: 60px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  position: relative;
  width: 100%; max-width: 1200px; margin: 0 auto;
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
}
.tb-brand { display: flex; align-items: center; line-height: 0; flex-shrink: 0; }
.tb-logo { height: 28px; max-height: 28px; width: auto; display: block; object-fit: contain; }
.tb-nav { display: flex; align-items: center; gap: 4px; }
.tb-nav a {
  display: inline-flex;
  align-items: center;
  font-size: 14px; font-weight: 500;
  color: var(--text-dim);
  padding: 8px 14px; border-radius: 6px;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}
.tb-nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }

/* ---------- Hamburger (visible + functional on tablet & mobile) ---------- */
.burger {
  display: none;
  position: relative;
  width: 36px; height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 6px;
  flex-shrink: 0;
}
.burger:hover { background: var(--surface); }
.burger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Drawer (mobile / tablet sidebar nav) — matches login page drawer exactly ---------- */
.drawer {
  position: fixed;
  top: 0; right: -290px;
  width: 270px; height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 200;
  padding: 72px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: right 0.38s cubic-bezier(.22,1,.36,1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
}
.drawer.open { right: 0; }
.drawer-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.2s ease;
}
.drawer-close:hover { color: var(--text); border-color: var(--text-faint); }
.drawer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  border-radius: 6px;
  transition: all 0.2s ease;
}
.drawer a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.drawer a i { width: 14px; font-size: 12px; color: var(--text-faint); text-align: center; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s ease;
}
.scrim.open { opacity: 1; pointer-events: all; }

/* ---------- Page shell ---------- */
.page-wrap { min-height: 100vh; }

/* ---------- Blog index hero ---------- */
.blog-hero {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 64px 24px;
}
.blog-hero-inner { max-width: 800px; margin: 0 auto; }
.blog-hero h1 {
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  color: var(--text);
}
.blog-hero-sub {
  font-size: 16px;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 600px;
}

/* ---------- Blog grid / cards ---------- */
.blog-section { padding: 56px 24px; max-width: 1200px; margin: 0 auto; }

.blog-filters { display: flex; gap: 8px; margin-bottom: 36px; flex-wrap: wrap; }
.filter-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface);
}
.filter-btn:hover { color: var(--text); }
.filter-btn.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.blog-card:hover { background: var(--surface-2); }

/* Compact stat strip — small, sits below the card content (not a top banner) */
.blog-stats {
  display: flex;
  border-top: 1px solid var(--border);
}
.blog-stat {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
}
.blog-stat + .blog-stat { border-left: 1px solid var(--border); }
.blog-stat .num {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.blog-stat .lbl {
  display: block;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-faint);
  max-width: 100%;
}

.blog-content { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.blog-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 11px; }
.blog-category {
  display: inline-block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.blog-date { color: var(--text-faint); }
.blog-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.4; }
.blog-excerpt { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; margin-bottom: 16px; flex: 1; }
.blog-footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; }
.read-time { font-size: 12px; color: var(--text-faint); }
.read-more { font-size: 13px; font-weight: 600; color: var(--accent); }

/* ---------- Article page ---------- */
.blog-container { max-width: 720px; margin: 0 auto; padding: 56px 24px; }
.blog-breadcrumb { font-size: 13px; color: var(--text-faint); margin-bottom: 20px; }
.blog-breadcrumb a { color: var(--text-dim); }

.article-title {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  color: var(--text);
}

.article-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: 13px; color: var(--text-dim);
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

/* Small stat strip — sits below the article body, just above the CTA */
.article-stats { display: flex; gap: 0; margin: 40px 0 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.article-stats .blog-stat { background: var(--surface); padding: 14px 12px; min-height: 64px; }
.article-stats .blog-stat .num { font-size: 15px; }
.article-stats .blog-stat .lbl { font-size: 10.5px; }

/* ---------- Hero image (auto-generated brand SVG banner) ---------- */
.hero-figure {
  margin: 0 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.hero-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
}

/* ---------- FAQ section (visible Q&A, mirrors FAQPage schema) ---------- */
.faq-section {
  margin: 44px 0 8px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.faq-section h2 {
  font-size: 24px; font-weight: 800; color: var(--text);
  margin: 0 0 20px; line-height: 1.3; letter-spacing: -0.01em;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.faq-q {
  font-size: 15.5px; font-weight: 700; color: var(--text);
  margin: 0 0 8px;
}
.faq-a {
  font-size: 14.5px; color: var(--text-dim); line-height: 1.65; margin: 0;
}

/* ---------- Trust bar (below hero image) ---------- */
.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 32px;
}
.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.trust-item i { color: var(--accent); font-size: 12px; }

/* ---------- Author box (E-E-A-T trust signal) ---------- */
.author-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 40px 0 0;
}
.author-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
  object-fit: contain;
  padding: 6px;
}
.author-box-name { font-size: 14.5px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.author-box-bio { font-size: 13.5px; color: var(--text-dim); line-height: 1.6; margin: 0 0 8px; }
.author-box-meta { font-size: 12.5px; color: var(--text-faint); line-height: 1.6; margin: 0; }
.author-box a { color: var(--accent); }

.article-body { font-size: 16px; color: var(--text-dim); line-height: 1.75; }
.article-body h2 {
  font-size: 24px; font-weight: 800; color: var(--text);
  margin: 36px 0 16px; line-height: 1.3; letter-spacing: -0.01em;
}
.article-body h3 {
  font-size: 19px; font-weight: 700; color: var(--text);
  margin: 28px 0 12px;
}
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol { margin: 16px 0 16px 22px; }
.article-body li { margin-bottom: 8px; line-height: 1.7; }
.article-body strong { color: var(--text); font-weight: 700; }

/* Flat info block — no colored side-border */
.note-block {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 18px 20px;
  border-radius: var(--radius);
  margin: 24px 0;
}
.note-block p { margin: 0; color: var(--text); font-size: 14.5px; }
.note-block .note-label {
  display: block;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-faint);
  margin-bottom: 6px;
}

.cta-block {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px 24px;
  border-radius: var(--radius);
  text-align: center;
  margin: 40px 0 0;
}
.cta-block p { margin-bottom: 14px; color: var(--text-dim); font-size: 15px; }
.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 11px 24px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
}
.cta-btn:hover { text-decoration: none; opacity: 0.9; }

.steps-list { counter-reset: step; list-style: none; margin: 16px 0; }
.steps-list li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  margin-bottom: 14px;
}
.steps-list li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 24px; height: 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text);
}

/* ---------- Blog layout (main + sidebar) ---------- */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}
.blog-main { min-width: 0; }
.blog-empty-msg { color: var(--text-faint); font-size: 14px; padding: 24px 0; }

.blog-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 84px;
}

.sidebar-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.sidebar-widget-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 14px;
}

.sidebar-search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
}
.sidebar-search::placeholder { color: var(--text-faint); }
.sidebar-search:focus { outline: none; border-color: var(--accent); }

.sidebar-list { list-style: none; }
.sidebar-list li + li { margin-top: 2px; }
.sidebar-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
}
.sidebar-list li a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.sidebar-count {
  flex-shrink: 0;
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 7px;
}
.sidebar-list li a:hover .sidebar-count { color: var(--text-dim); }

.sidebar-recent li a {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px;
}
.sidebar-recent-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.4;
}
.sidebar-recent li a:hover .sidebar-recent-title { color: var(--text); }
.sidebar-recent-date { font-size: 11px; color: var(--text-faint); }

.sidebar-trust-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.sidebar-trust-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-dim); }
.sidebar-trust-list i { color: var(--accent); font-size: 12px; width: 14px; text-align: center; }
.sidebar-cta-link { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent); }

.sidebar-cta-box { text-align: center; }
.sidebar-cta-box p { font-size: 14px; color: var(--text-dim); margin-bottom: 12px; }
.sidebar-cta-btn { width: 100%; text-align: center; }

/* ---------- Related posts (bottom of article) ---------- */
.related-posts {
  margin: 44px 0 0;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.related-posts h2 {
  font-size: 22px; font-weight: 800; color: var(--text);
  margin: 0 0 18px; letter-spacing: -0.01em;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.related-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.related-card:hover { background: var(--surface-2); text-decoration: none; }
.related-card .related-category {
  display: inline-block;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 8px;
}
.related-card .related-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  line-height: 1.45; margin-bottom: 6px;
}
.related-card .related-date { font-size: 11.5px; color: var(--text-faint); }

/* ---------- Recently viewed (client-side, localStorage) ---------- */
.recently-viewed {
  margin: 32px 0 0;
}
.recently-viewed[hidden] { display: none; }
.recently-viewed h2 {
  font-size: 15px; font-weight: 700; color: var(--text-faint);
  letter-spacing: 0.02em; margin: 0 0 12px;
}
.recently-viewed-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
}
.recently-viewed-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
}
.recently-viewed-list a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.recently-viewed-list i { color: var(--text-faint); font-size: 10px; }
.recently-viewed-empty { font-size: 12.5px; color: var(--text-faint); line-height: 1.6; margin: 0; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  background: var(--bg);
}
.footer-copy { font-size: 12px; color: var(--text-faint); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 12px; color: var(--text-faint); }
.footer-links a:hover { color: var(--text-dim); }

@media (max-width: 1024px) {
  .blog-hero { padding: 48px 24px; }
  .blog-section { padding: 48px 24px; }

  /* Hamburger + drawer take over on tablets as well as phones */
  .topbar-inner { padding: 0 16px; }
  .burger { display: flex; }
  .tb-nav { display: none; }

  .blog-layout { grid-template-columns: 1fr; }
  .blog-sidebar { position: static; }
}

@media (max-width: 767px) {
  .blog-hero { padding: 36px 16px; }
  .blog-section { padding: 36px 16px; }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-container { padding: 40px 16px; }
  .article-stats { flex-direction: column; }
  .blog-stat + .blog-stat { border-left: none; border-top: 1px solid var(--border); }
  .site-footer { padding: 18px 16px; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
