/* ==========================================================================
   Blog - rajuprasai.com.np/blog/
   Design tokens: identical to nepdate-docs (same accent, same scale).
   No Bootstrap. No Virtual Folio. Self-contained.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* -------- Reset & Base -------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; padding: 0; }
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 .6em; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.4em; }
li { margin-bottom: .3em; }

/* -------- Design Tokens -------- */
:root {
  --bg:            #ffffff;
  --bg-alt:        #f7f8fa;
  --bg-elev:       #ffffff;
  --bg-code:       #0d1117;
  --text:          #111827;
  --text-muted:    #4b5563;
  --text-subtle:   #6b7280;
  --border:        #e5e7eb;
  --border-strong: #d1d5db;
  --accent:        #dc3f10;
  --accent-hover:  #b3300a;
  --accent-soft:   #ffece4;
  --accent-border: #fbb39a;
  --success:       #16a34a;
  --danger:        #dc2626;
  --shadow-sm:     0 1px 2px rgba(17,24,39,.06), 0 1px 3px rgba(17,24,39,.08);
  --shadow-md:     0 4px 6px -1px rgba(17,24,39,.08), 0 2px 4px -2px rgba(17,24,39,.08);
  --shadow-lg:     0 12px 24px -8px rgba(17,24,39,.14), 0 4px 10px -4px rgba(17,24,39,.08);
  --radius-sm:     6px;
  --radius:        10px;
  --radius-lg:     14px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', 'Source Code Pro', Consolas, 'Courier New', monospace;

  --header-h: 60px;
  --content-max: 1200px;
  --post-max: 860px;
  --listing-max: 960px;
}

[data-theme="dark"] {
  --bg:            #0b1020;
  --bg-alt:        #0f172a;
  --bg-elev:       #111827;
  --bg-code:       #05070d;
  --text:          #e5e7eb;
  --text-muted:    #9ca3af;
  --text-subtle:   #6b7280;
  --border:        #1f2937;
  --border-strong: #374151;
  --accent:        #fb7045;
  --accent-hover:  #fda07a;
  --accent-soft:   rgba(251, 112, 69, .14);
  --accent-border: rgba(251, 112, 69, .38);
  --shadow-sm:     0 1px 2px rgba(0,0,0,.4);
  --shadow-md:     0 4px 8px -2px rgba(0,0,0,.5);
  --shadow-lg:     0 18px 40px -12px rgba(0,0,0,.65);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  transition: background .3s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* -------- Header -------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: var(--content-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1rem; color: var(--text);
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand .logo-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, #dc2626 100%);
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 13px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.nav-main {
  display: flex; align-items: center; gap: 2px;
  margin-left: 12px;
}
.nav-main a {
  color: var(--text-muted);
  padding: 7px 11px;
  border-radius: 8px;
  font-weight: 500;
  font-size: .9rem;
  transition: all .15s ease;
  white-space: nowrap;
}
.nav-main a:hover { background: var(--bg-alt); color: var(--text); }
.nav-main a.active { color: var(--accent); background: var(--accent-soft); }
.nav-sep {
  color: var(--border-strong);
  font-size: .75rem;
  padding: 0 2px;
  user-select: none;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text-muted);
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--bg-alt); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }

.hamburger { display: none; }

/* -------- Mobile nav -------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 90;
}
.overlay.show { opacity: 1; pointer-events: auto; }

.mobile-nav {
  display: none;
  position: fixed; top: 0; right: 0;
  width: 260px; max-width: 80vw;
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 95;
  transform: translateX(100%);
  transition: transform .25s ease;
  padding: 72px 20px 24px;
  flex-direction: column; gap: 4px;
}
.mobile-nav.show { transform: translateX(0); }
.mobile-nav a {
  display: block;
  padding: 11px 14px;
  border-radius: 8px;
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
}
.mobile-nav a:hover, .mobile-nav a.active { background: var(--accent-soft); color: var(--accent); }
.mobile-nav .divider {
  height: 1px; background: var(--border); margin: 8px 0;
}

/* -------- Blog hero (listing page) -------- */
.blog-hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
}
.blog-hero .container { max-width: var(--listing-max); margin: 0 auto; padding: 0 24px; }
.blog-eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
}
.blog-hero h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 12px;
  letter-spacing: -.025em;
}
.blog-hero .blog-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 540px;
  margin: 0;
}

/* -------- Post listing grid -------- */
.blog-listing {
  padding: 48px 0 80px;
}
.blog-listing .container { max-width: var(--listing-max); margin: 0 auto; padding: 0 24px; }
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

/* -------- Post card -------- */
.post-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: all .2s ease;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}
.post-card-meta {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.post-tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  flex-shrink: 0;
}
.post-date {
  font-size: .83rem;
  color: var(--text-subtle);
}
.read-time {
  font-size: .8rem;
  color: var(--text-subtle);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.read-time::before {
  content: '';
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
}
.post-card h2 {
  font-size: 1.15rem;
  margin-bottom: 10px;
  letter-spacing: -.01em;
}
.post-card h2 a {
  color: var(--text);
  transition: color .15s ease;
}
.post-card h2 a:hover { color: var(--accent); }
.post-card .excerpt {
  color: var(--text-muted);
  font-size: .93rem;
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
}
.read-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--accent);
  transition: gap .15s ease;
  align-self: flex-start;
}
.read-link:hover { color: var(--accent-hover); gap: 10px; }
.read-link svg { width: 14px; height: 14px; }

/* -------- Post page layout -------- */
.post-page {
  padding: 40px 0 80px;
}
.post-container {
  max-width: var(--post-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* -------- Breadcrumb -------- */
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem;
  color: var(--text-subtle);
  margin-bottom: 28px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb svg { width: 14px; height: 14px; color: var(--text-subtle); flex-shrink: 0; }

/* -------- Post header -------- */
.post-header { margin-bottom: 28px; }
.post-header .post-card-meta { margin-bottom: 16px; }
.post-header h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  letter-spacing: -.025em;
  margin-bottom: 18px;
}
.post-lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.author-row {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 0 0;
}
.author-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #dc2626);
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 15px;
  flex-shrink: 0;
}
.author-info { display: flex; flex-direction: column; gap: 2px; }
.author-name {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
}
.author-name a { color: var(--text); }
.author-name a:hover { color: var(--accent); }
.author-meta {
  font-size: .8rem;
  color: var(--text-subtle);
}

/* -------- Table of contents -------- */
.toc {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 32px;
}
.toc-label {
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-subtle);
  margin: 0 0 10px;
}
.toc-list {
  margin: 0;
  padding-left: 1.3em;
}
.toc-list li {
  margin-bottom: 5px;
  color: var(--text-muted);
}
.toc-list a {
  color: var(--text-muted);
  text-decoration: none !important;
}
.toc-list a:hover { color: var(--accent); }

/* -------- Post body prose -------- */
.post-body {
  line-height: 1.75;
}
.post-body h2 {
  font-size: 1.5rem;
  margin-top: 52px;
  margin-bottom: 14px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 16px);
  letter-spacing: -.015em;
}
.post-body h2:first-child { border-top: none; padding-top: 0; margin-top: 32px; }
.post-body h3 {
  font-size: 1.2rem;
  margin-top: 36px;
  margin-bottom: 12px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.post-body h4 {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-top: 28px;
  margin-bottom: 10px;
}
.post-body p { margin-bottom: 1.1em; }
.post-body ul, .post-body ol { margin-bottom: 1.1em; }
.post-body li { margin-bottom: .4em; color: var(--text-muted); }
.post-body li strong { color: var(--text); }
.post-body a { text-decoration: underline; text-underline-offset: 3px; }
.post-body strong { color: var(--text); font-weight: 600; }

/* Code */
code {
  font-family: var(--font-mono);
  background: var(--bg-alt);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .875em;
  color: var(--text);
  border: 1px solid var(--border);
}
[data-theme="dark"] code { border-color: #2a3449; }
pre {
  background: var(--bg-code);
  color: #e5e7eb;
  padding: 18px 22px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.65;
  margin: 0 0 22px;
  border: 1px solid rgba(255,255,255,.06);
  position: relative;
}
pre code { font-family: inherit; background: none; padding: 0; font-size: inherit; color: inherit; border: 0; border-radius: 0; }

.copy-btn {
  position: absolute; top: 10px; right: 10px;
  padding: 5px 10px;
  font-size: .72rem;
  color: #9ca3af;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease, background .15s ease;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
}
pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: #fff; background: rgba(255,255,255,.12); }
.copy-btn.copied { color: #4ade80; border-color: rgba(74,222,128,.4); }

/* Syntax tokens (GitHub Dark palette) */
.tok-kw   { color: #ff7b72; }
.tok-type { color: #79c0ff; }
.tok-str  { color: #a5d6ff; }
.tok-cmt  { color: #8b949e; font-style: italic; }
.tok-num  { color: #ffa657; }
.tok-fn   { color: #d2a8ff; }
.tok-op   { color: #e5e7eb; }
.tok-cmd  { color: #7ee787; }
.tok-var  { color: #e5e7eb; }
.tok-prop { color: #79c0ff; }

/* Blockquote */
.post-body blockquote {
  margin: 0 0 1.2em;
  padding: 14px 18px 14px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: .97rem;
}
[data-theme="dark"] .post-body blockquote { background: var(--accent-soft); }

/* Info / Note callout */
.callout {
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  margin: 0 0 22px;
  font-size: .95rem;
  color: var(--text-muted);
}
.callout strong { color: var(--text); }

/* Table */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 22px;
  font-size: .92rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}
.post-body th {
  background: var(--bg-alt);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.post-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.post-body tr:last-child td { border-bottom: none; }
.post-body tr:hover td { background: var(--bg-alt); }
.post-body td code { font-size: .82em; }

/* Post footer nav (back link) */
.post-nav {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.post-nav a {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-muted);
  transition: color .15s ease;
}
.post-nav a:hover { color: var(--accent); }
.post-nav svg { width: 16px; height: 16px; }

/* Share / author card at end */
.author-card {
  margin-top: 48px;
  padding: 24px 26px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex; gap: 18px; align-items: flex-start;
}
.author-card .author-avatar { width: 48px; height: 48px; font-size: 18px; margin-top: 2px; flex-shrink: 0; }
.author-card-body h3 { font-size: 1rem; margin-bottom: 6px; }
.author-card-body p { color: var(--text-muted); font-size: .91rem; margin-bottom: 10px; }
.author-card-links { display: flex; gap: 10px; flex-wrap: wrap; }
.author-card-links a {
  font-size: .83rem;
  font-weight: 500;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 4px;
}
.author-card-links a:hover { color: var(--accent-hover); }

/* -------- Footer -------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0 28px;
  background: var(--bg-alt);
}
.site-footer .inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-links {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: .85rem;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .15s ease;
}
.footer-links a:hover { color: var(--accent); background: var(--accent-soft); }
.footer-links .sep { color: var(--border-strong); padding: 0; }
.footer-copy {
  font-size: .82rem;
  color: var(--text-subtle);
}

/* -------- Responsive -------- */
@media (max-width: 768px) {
  .nav-main { display: none; }
  .hamburger {
    display: grid;
    place-items: center;
    width: 36px; height: 36px;
    border-radius: 8px;
  }
  .hamburger:hover { background: var(--bg-alt); }
  .hamburger span {
    display: block; width: 18px; height: 2px;
    background: var(--text); border-radius: 2px;
    position: relative;
  }
  .hamburger span::before,
  .hamburger span::after {
    content: ""; position: absolute; left: 0;
    width: 18px; height: 2px; background: var(--text); border-radius: 2px;
  }
  .hamburger span::before { top: -6px; }
  .hamburger span::after { top: 6px; }
  .mobile-nav { display: flex; }

  .post-grid { grid-template-columns: 1fr; }
  .blog-hero { padding: 40px 0 28px; }
  .blog-listing { padding: 32px 0 60px; }
  .post-body h2 { font-size: 1.35rem; margin-top: 40px; padding-top: 32px; }
  .author-card { flex-direction: column; }
  .post-nav { flex-direction: column; }
  .site-footer .inner { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 480px) {
  .post-container, .blog-listing .container, .blog-hero .container { padding: 0 16px; }
  .site-header .inner { padding: 0 16px; }
}

@media (hover: none) {
  .copy-btn { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
