/* ============================================================
   GrowBit Blog Stylesheet
   Accent color: #7CB342
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #7CB342;
  --accent-dark:  #558B2F;
  --accent-light: #86efac;
  --bg:           #f1f5f9;
  --bg-card:      #ffffff;
  --bg-alt:       #f8fafc;
  --bg-code:      #1e2228;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --border:       #e2e8f0;
  --sidebar-w:    240px;
  --header-h:     56px;
  --font-body:    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "Fira Code", "Cascadia Code", "Consolas", "Menlo", monospace;
  --radius:       8px;
  --shadow:       0 1px 8px rgba(0,0,0,.06);
}

body.dark-mode {
  --bg:         #0f172a;
  --bg-card:    #1e293b;
  --bg-alt:     #1e293b;
  --bg-code:    #0d1117;
  --text:       #e2e8f0;
  --text-muted: #94a3b8;
  --border:     #334155;
  --shadow:     0 1px 4px rgba(0,0,0,.35);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

/* ---------- Header ---------- */
.blog-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  box-shadow: var(--shadow);
}

.blog-logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.blog-logo img { height: 20px; width: auto; display: block; }
.blog-logo:hover { color: var(--accent-dark); text-decoration: none; }

.blog-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.blog-header nav a {
  font-size: .9rem;
  color: var(--text-muted);
  font-weight: 500;
}
.blog-header nav a:hover { color: var(--accent); text-decoration: none; }

.blog-header .btn-play {
  background: var(--accent);
  color: #fff;
  padding: .35rem .9rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: .875rem;
  transition: background .15s;
}
.blog-header .btn-play:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }

/* ---------- Page Shell ---------- */
.blog-shell {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  align-items: flex-start;
}

/* ---------- Sidebar ---------- */
.blog-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 1.25rem .75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.sidebar-title {
  font-size: .95rem;
  font-weight: 700;
  padding: .25rem .5rem .75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
}
.sidebar-title a { color: var(--text); text-decoration: none; }
.sidebar-title a:hover { color: var(--accent); }

.nav-group {
  border: none;
  outline: none;
}

.nav-group summary {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  cursor: pointer;
  padding: .4rem .5rem;
  border-radius: 4px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .35rem;
  user-select: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::before {
  content: "▸";
  font-size: .7rem;
  transition: transform .2s;
  color: var(--text-muted);
}
.nav-group[open] summary::before { transform: rotate(90deg); }
.nav-group summary:hover { background: var(--border); border-radius: 4px; }

.nav-group ul {
  list-style: none;
  padding: .25rem 0 .25rem .75rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-group ul li a {
  display: block;
  font-size: .875rem;
  color: var(--text-muted);
  padding: .3rem .5rem;
  border-radius: 4px;
  transition: background .1s, color .1s;
  text-decoration: none;
}
.nav-group ul li a:hover { background: var(--border); color: var(--text); }
.nav-group ul li a.active {
  background: #7CB34222;
  color: var(--accent-dark);
  font-weight: 600;
}
body.dark-mode .nav-group ul li a.active { color: var(--accent-light); background: #7CB34230; }

.sidebar-cta {
  margin-top: auto;
  padding-top: 1rem;
}
.sidebar-cta a {
  display: block;
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: .6rem .75rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.sidebar-cta a:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }

/* ---------- Main Content ---------- */
.blog-main {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem 3rem;
}

/* ---------- Article Typography ---------- */
.blog-article h1 {
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: .5rem;
}

.blog-article .article-meta {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.blog-article .article-meta .tag {
  background: #7CB34218;
  color: var(--accent-dark);
  padding: .15rem .55rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: .78rem;
}
body.dark-mode .blog-article .article-meta .tag { color: var(--accent-light); }

.blog-article h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 2.25rem 0 .6rem;
  color: var(--text);
  padding-bottom: .3rem;
  border-bottom: 2px solid var(--border);
}

.blog-article h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 .4rem;
  color: var(--text);
}

.blog-article p {
  margin-bottom: 1rem;
  max-width: 72ch;
}

.blog-article ul, .blog-article ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  max-width: 68ch;
}
.blog-article li { margin-bottom: .3rem; }

.blog-article strong { font-weight: 700; }
.blog-article em { font-style: italic; }

/* ---------- Inline Code ---------- */
.blog-article code:not(pre code) {
  font-family: var(--font-mono);
  font-size: .875em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: .1em .35em;
  border-radius: 4px;
  color: var(--accent-dark);
}
body.dark-mode .blog-article code:not(pre code) { color: var(--accent-light); }

/* ---------- Code Blocks ---------- */
.code-block {
  position: relative;
  margin: 1.25rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2a3040;
  padding: .4rem .75rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: #7a8899;
}
.code-block-header .lang-label { color: #aab4c4; font-weight: 600; letter-spacing: .04em; }

.copy-btn {
  background: transparent;
  border: 1px solid #3d4f60;
  color: #aab4c4;
  border-radius: 4px;
  padding: .15rem .55rem;
  font-size: .72rem;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: var(--font-body);
}
.copy-btn:hover { background: #3d4f60; color: #e0e8f0; }
.copy-btn.copied { color: #7CB342; border-color: #7CB342; }

.blog-article pre {
  background: var(--bg-code);
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  tab-size: 4;
}

.blog-article pre code {
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.7;
  color: #c9d1d9;
  background: transparent;
  border: none;
  padding: 0;
}

/* Simple syntax tinting via CSS (no JS dependency) */
.blog-article pre code .kw  { color: #ff7b72; }  /* keywords */
.blog-article pre code .str { color: #a5d6ff; }  /* strings */
.blog-article pre code .cm  { color: #8b949e; font-style: italic; } /* comments */
.blog-article pre code .num { color: #79c0ff; }  /* numbers */
.blog-article pre code .fn  { color: #d2a8ff; }  /* functions */

/* ---------- Callout / Tip Box ---------- */
.callout {
  border-left: 4px solid var(--accent);
  background: #7CB34210;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .75rem 1rem;
  margin: 1.25rem 0;
  font-size: .925rem;
}
.callout strong { color: var(--accent-dark); }
body.dark-mode .callout { background: #7CB34218; }
body.dark-mode .callout strong { color: var(--accent-light); }

/* ---------- Next Steps ---------- */
.next-steps {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 2.5rem;
  background: var(--bg-card);
}
.next-steps h3 { margin-top: 0; font-size: 1rem; border: none; }
.next-steps ul { margin-bottom: 0; }
.next-steps ul li a { font-weight: 600; }

/* ---------- Blog Index (Hub) ---------- */
.blog-hub h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: .5rem;
}
.blog-hub .hub-intro {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 60ch;
  margin-bottom: 2.25rem;
}

.blog-hub h2 {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin: 2rem 0 .9rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--border);
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.article-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  transition: box-shadow .15s, border-color .15s;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.article-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  border-color: var(--accent);
}
.article-card .card-emoji { font-size: 1.5rem; line-height: 1; }
.article-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.article-card p {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0;
  flex: 1;
}
.article-card a.read-more {
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: .25rem;
}

.hub-cta {
  margin-top: 2.5rem;
  background: linear-gradient(135deg, #7CB342 0%, #558B2F 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.hub-cta p { font-size: 1.05rem; font-weight: 600; margin: 0; }
.hub-cta a {
  display: inline-block;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 700;
  padding: .6rem 1.4rem;
  border-radius: 24px;
  white-space: nowrap;
  text-decoration: none;
  font-size: .95rem;
  transition: opacity .15s;
}
.hub-cta a:hover { opacity: .9; text-decoration: none; }

/* ---------- Footer ---------- */
.blog-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.25rem 1rem;
  font-size: .85rem;
  color: var(--text-muted);
}
.blog-footer a { color: var(--text-muted); }
.blog-footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .blog-shell { flex-direction: column; }

  .blog-sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: .75rem;
    overflow: visible;
  }

  .sidebar-cta { margin-top: .75rem; }

  .blog-main { padding: 1.25rem 1rem 2rem; }

  .blog-article h1, .blog-hub h1 { font-size: 1.6rem; }
  .blog-article h2 { font-size: 1.15rem; }

  .article-grid { grid-template-columns: 1fr; }

  .hub-cta { flex-direction: column; text-align: center; }

  .blog-header { padding: 0 1rem; }
  .blog-header nav { gap: .75rem; }
}

@media (max-width: 480px) {
  .blog-header nav a:not(.btn-play) { display: none; }
}

/* ---------- Lang Switcher & Dark Toggle ---------- */
.blog-lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
}

.blog-lang-btn {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: .73rem;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition: background .1s, color .1s;
  line-height: 1.5;
}
.blog-lang-btn:hover, .blog-lang-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.blog-dark-btn {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: .85rem;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-body);
  transition: background .1s;
  line-height: 1.5;
}
.blog-dark-btn:hover {
  background: var(--bg-alt);
}

@media (max-width: 480px) {
  .blog-lang-switcher { display: none; }
}

/* ---------- Scrollbar (webkit) ---------- */
.blog-sidebar::-webkit-scrollbar { width: 4px; }
.blog-sidebar::-webkit-scrollbar-track { background: transparent; }
.blog-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ---------- Copy Button Script Support ---------- */
.code-block pre { margin: 0; }
