/* ═══════════════════════════════════════════════════════════════════════════
   Kanta Raj Luitel — Impeccable Article & Technical Case Study Stylesheet
   Designed with precision typography, responsive media, and crafted dark aesthetics.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&display=swap');

:root {
  --bg: #0b0f19;
  --bg-surface: #151122;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(196, 129, 255, 0.05) 0%, rgba(11, 15, 25, 0) 70%);
  --card-bg: #151122;
  --card-border: #2e2342;
  --card-hover: rgba(196, 181, 253, 0.28);
  --text-primary: #ffffff;
  --text-secondary: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #c4b5fd;
  --accent-light: #ddd6fe;
  --accent-dark: #7c3aed;
  --accent-glow: rgba(196, 181, 253, 0.35);
  --badge-bg: #382b52;
  --badge-text: #c4b5fd;
  --btn-primary-bg: #e11d48;
  --cyan: #38bdf8;
  --emerald: #34d399;
  --amber: #f59e0b;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.7);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-repeat: no-repeat;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

::selection {
  background: var(--accent);
  color: #0b080e;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0b080e;
}
::-webkit-scrollbar-thumb {
  background: rgba(194, 164, 255, 0.22);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(194, 164, 255, 0.45);
}

/* ── Fixed Reading Progress Bar ────────────────────────────────────────── */
#progress-bar,
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #c481ff, #38bdf8);
  width: 0%;
  z-index: 10000;
  transition: width 0.08s linear;
  box-shadow: 0 0 12px rgba(196, 129, 255, 0.7);
}

/* ── Sticky Frosted Header ─────────────────────────────────────────────── */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(11, 8, 14, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
  padding: 14px 24px;
}

.header-inner,
.nav-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand,
.brand-link {
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.02em;
}

.brand span {
  color: var(--accent);
}

.site-header img,
.header-inner img,
.nav-content img,
.brand-avatar {
  width: 40px !important;
  height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  border: 2px solid var(--accent) !important;
  flex-shrink: 0 !important;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.2;
}

.brand-role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.header-links,
.nav-links {
  display: flex;
  gap: 18px;
  font-size: 0.92rem;
  font-weight: 600;
  align-items: center;
  flex-wrap: wrap;
}

.header-links a,
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.18s;
}

.header-links a:hover,
.nav-links a:hover {
  color: var(--accent);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent) !important;
  border: 1px solid rgba(196, 129, 255, 0.3);
  background: rgba(196, 129, 255, 0.08);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: rgba(196, 129, 255, 0.2);
  border-color: var(--accent);
  color: #fff !important;
  transform: translateY(-1px);
}

/* ── Article Canvas Container (Commit 9e79b0610f Restored) ──────────────── */
.article-container,
main.container,
.container {
  max-width: 850px;
  margin: 36px auto;
  background: #151122;
  padding: 36px;
  border-radius: 16px;
  border: 1px solid #2e2342;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ── Badge Pill (Commit 9e79b0610f Restored) ──────────────────────────── */
.badge-pill,
.badge {
  display: inline-block;
  background: #382b52;
  color: #c4b5fd;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  border: none;
  letter-spacing: 0.02em;
}

/* Legacy buttons from commit 9e79b0610f */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  background: #e11d48;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 14px;
  margin-right: 12px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.btn:hover {
  background: #be123c;
  transform: translateY(-1px);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* ── Typography ───────────────────────────────────────────────────────── */
h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 22px;
}

h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 800;
  color: var(--text-primary);
  margin: 56px 0 20px;
  letter-spacing: -0.02em;
  position: relative;
  padding-left: 18px;
  line-height: 1.25;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), var(--cyan));
  border-radius: 2px;
}

h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 36px 0 16px;
  line-height: 1.35;
}

h4 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e2e8f0;
  margin: 28px 0 12px;
}

p {
  margin-bottom: 24px;
  font-size: 1.1rem;
  line-height: 1.82;
  color: var(--text-secondary);
}

strong {
  color: #fff;
  font-weight: 700;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-light);
}

ul, ol {
  margin: 0 0 24px;
  padding-left: 28px;
}

li {
  margin-bottom: 10px;
  color: var(--text-secondary);
  line-height: 1.75;
}

li::marker {
  color: var(--accent);
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196, 129, 255, 0.25), transparent);
  margin: 56px 0;
}

/* ── Byline Row ───────────────────────────────────────────────────────── */
.byline {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 0.95rem;
}

.byline-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.byline-author {
  color: #fff;
  font-weight: 700;
}

.byline-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ── Hero / Cover Image ───────────────────────────────────────────────── */
.cover-hero {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  margin-bottom: 40px;
  display: block;
}

/* ── Media / Figure Boxes ─────────────────────────────────────────────── */
.figure-box,
figure {
  margin: 36px 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.figure-box:hover,
figure:hover {
  border-color: rgba(196, 129, 255, 0.35);
}

.figure-box img,
figure img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.figcaption,
figcaption {
  padding: 12px 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
  background: #110e17;
  border-top: 1px solid var(--card-border);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}

.figcaption span,
figcaption span {
  color: var(--accent);
  font-weight: 700;
}

/* ── Blockquotes ──────────────────────────────────────────────────────── */
blockquote {
  border-left: 3px solid var(--accent);
  background: rgba(196, 129, 255, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 26px;
  margin: 32px 0;
  color: #e2e8f0;
  font-size: 1.08rem;
  line-height: 1.75;
  font-style: italic;
}

blockquote p {
  margin-bottom: 0;
}

/* ── Code Blocks ──────────────────────────────────────────────────────── */
code {
  background: rgba(196, 129, 255, 0.1);
  border: 1px solid rgba(196, 129, 255, 0.2);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--accent-light);
}

pre {
  position: relative;
  background: #0e0c14;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 32px 0;
  overflow-x: auto;
  box-shadow: var(--shadow);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.7;
  color: #38bdf8;
}

pre code {
  background: transparent;
  border: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.code-copy-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.code-copy-btn.copied {
  color: var(--emerald);
  border-color: rgba(52, 211, 153, 0.4);
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 32px 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: var(--card-bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th {
  background: rgba(196, 129, 255, 0.08);
  color: #fff;
  padding: 14px 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ── CTA Action Banner ────────────────────────────────────────────────── */
.cta-banner {
  margin: 36px 0 44px;
  padding: 24px 28px;
  background: rgba(196, 129, 255, 0.07);
  border: 1px solid rgba(196, 129, 255, 0.25);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
}

.cta-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  background: var(--accent);
  color: #0b080e !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s ease;
}

.cta-btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.cta-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

.cta-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* ── Author Hub Card ──────────────────────────────────────────────────── */
.author-card {
  background: linear-gradient(135deg, #15111e, #0e0b14);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px;
  margin: 64px 0 36px;
  display: flex;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .author-card {
    flex-direction: column;
    text-align: center;
  }
}

.author-img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 0 16px var(--accent-glow);
}

.author-info h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  color: #fff;
}

.author-info p {
  margin-bottom: 16px;
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.author-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .author-links {
    justify-content: center;
  }
}

.author-links a {
  background: #1c1826;
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--card-border);
  transition: all 0.18s ease;
}

.author-links a:hover {
  background: rgba(196, 129, 255, 0.2);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ── Footer Navigation ────────────────────────────────────────────────── */
.footer-nav {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.18s;
}

.footer-nav a:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

/* ── Lightbox Modal ───────────────────────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 20000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}

#lightbox.active {
  display: flex;
}

#lightbox img {
  max-width: 95%;
  max-height: 92%;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.85);
  border: 1px solid var(--card-border);
}

/* ── Responsive Adjustments & Bulletproof Mobile Layout ───────────────── */
@media (max-width: 890px) {
  .article-container,
  main.container,
  .container {
    margin: 20px 16px;
    padding: 28px 20px;
    border-radius: 14px;
    max-width: calc(100% - 32px);
  }
}

@media (max-width: 768px) {
  body {
    font-size: 1rem;
    line-height: 1.75;
  }

  header.site-header {
    padding: 12px 16px;
  }

  .header-inner,
  .nav-content {
    gap: 12px;
  }

  .brand,
  .brand-link {
    font-size: 1rem;
  }

  .header-links,
  .nav-links {
    gap: 12px;
    font-size: 0.85rem;
  }

  h1 {
    font-size: clamp(1.8rem, 6vw, 2.4rem);
    line-height: 1.2;
    margin-bottom: 16px;
  }

  h2::before {
    display: none;
  }

  h2 {
    padding-left: 0;
    margin: 40px 0 16px;
    font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  }

  h3 {
    margin: 28px 0 12px;
    font-size: 1.2rem;
  }

  .article-container,
  main.container,
  .container {
    margin: 16px auto;
    padding: 24px 18px;
    border-radius: 12px;
    width: 100%;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
  }

  .cta-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 20px;
    gap: 14px;
  }

  .cta-btn-primary,
  .cta-btn-secondary {
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
  }

  .btn,
  .btn-outline {
    display: inline-flex;
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
    justify-content: center;
    box-sizing: border-box;
  }

  pre {
    padding: 16px 14px;
    font-size: 0.84rem;
    margin: 20px 0;
    border-radius: 10px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .figure-box,
  figure {
    margin: 24px 0;
    border-radius: 10px;
  }

  .figure-box img,
  figure img,
  article.content img,
  .content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
  }

  .figcaption,
  figcaption {
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .table-wrap {
    margin: 20px 0;
    border-radius: 8px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 0.85rem;
    min-width: 500px;
  }

  th, td {
    padding: 10px 12px;
  }

  .author-card {
    padding: 22px 18px;
    margin: 44px 0 24px;
    border-radius: 12px;
  }

  .footer-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 0.96rem;
    line-height: 1.7;
  }

  header.site-header {
    padding: 10px 12px;
  }

  .site-header img,
  .header-inner img,
  .nav-content img,
  .brand-avatar {
    width: 32px !important;
    height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;
  }

  .brand-name {
    font-size: 0.92rem;
  }

  .brand-role {
    font-size: 0.65rem;
  }

  .header-links,
  .nav-links {
    gap: 8px;
    font-size: 0.78rem;
    width: 100%;
    justify-content: space-between;
  }

  .article-container,
  main.container,
  .container {
    margin: 12px auto;
    padding: 18px 14px;
    border-radius: 10px;
    max-width: calc(100% - 16px);
  }

  h1 {
    font-size: 1.65rem;
    line-height: 1.25;
    margin-bottom: 14px;
  }

  .byline {
    gap: 12px;
    padding-bottom: 18px;
    margin-bottom: 24px;
  }

  .byline-avatar {
    width: 40px;
    height: 40px;
  }

  .byline-author {
    font-size: 0.9rem;
  }

  .byline-meta {
    font-size: 0.8rem;
  }

  .author-card {
    padding: 18px 14px;
  }

  .author-img {
    width: 72px;
    height: 72px;
  }

  .author-info h3 {
    font-size: 1.15rem;
  }

  .author-info p {
    font-size: 0.88rem;
  }

  .author-links a {
    font-size: 0.8rem;
    padding: 5px 10px;
  }
}

