/*
 * NetYogi Blog CSS Library
 * Updated: 2026-02-20
 * 3-column layout: left TOC, center content, right related tools/articles.
 * Collapses to 2-col at 1024-1279px, single column below 1024px.
 * Polished sidebar styling, hidden duplicate toctitle, proper spacing.
 */


/* ==========================================================================
   01. Layout & Containers
   ========================================================================== */

.learn-article-page,
.learn-list-page {
  background: hsl(var(--background));
  min-height: 100vh;
}

.article-outer {
  max-width: 52rem;
}

@media (min-width: 1024px) {
  .article-outer {
    max-width: 80rem;
  }
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  position: relative;
  padding-top: 2.5rem;
}

@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
  }
}

@media (min-width: 1280px) {
  .article-layout {
    grid-template-columns: 220px 1fr 260px;
  }
}

.article-content {
  order: 1;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 1024px) {
  .article-content {
    order: 2;
  }
}


/* ==========================================================================
   02. Article Header (breadcrumbs, title, meta, author)
   ========================================================================== */

.article-header {
  background: linear-gradient(180deg, hsl(var(--muted)) 0%, hsl(var(--background)) 100%);
  border-bottom: 1px solid hsl(var(--border));
}

.article-title {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  color: hsl(var(--foreground));
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.article-meta {
  margin-bottom: 1.5rem;
}

.article-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.article-info svg {
  width: 1rem;
  height: 1rem;
}

.article-info > div {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}


/* ==========================================================================
   03. Table of Contents - Desktop Sidebar
   ========================================================================== */

.article-toc {
  order: 2;
  display: none;
}

@media (min-width: 1024px) {
  .article-toc {
    display: block;
    order: 1;
  }
}

.toc-sticky {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

/* Right sidebar -- visible only at 1280px+ (3-column) */
.article-sidebar-right {
  display: none;
}

@media (min-width: 1280px) {
  .article-sidebar-right {
    display: block;
    order: 3;
  }
}

.sidebar-right-sticky {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.toc-sticky::-webkit-scrollbar,
.sidebar-right-sticky::-webkit-scrollbar {
  width: 4px;
}

.toc-sticky::-webkit-scrollbar-track,
.sidebar-right-sticky::-webkit-scrollbar-track {
  background: transparent;
}

.toc-sticky::-webkit-scrollbar-thumb,
.sidebar-right-sticky::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 2px;
}

.toc-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.875rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid hsl(var(--border));
}

/* Hide the duplicate title generated by Python-Markdown TOC extension */
.toc-content .toctitle {
  display: none;
}

.toc-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-content li {
  margin-bottom: 0.25rem;
}

.toc-content a {
  display: block;
  padding: 0.375rem 0.75rem;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.15s;
  font-size: 0.8125rem;
  line-height: 1.45;
  border-left: 2px solid transparent;
}

.toc-content a:hover {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
  border-left-color: hsl(var(--primary) / 0.3);
}

.toc-content a.active {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
  border-left-color: hsl(var(--primary));
  font-weight: 600;
}

.toc-content ul ul {
  margin-left: 0.75rem;
  margin-top: 0.125rem;
}


/* ==========================================================================
   04. Table of Contents - Mobile Drawer
   ========================================================================== */

.mobile-toc {
  display: block;
  margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
  .mobile-toc {
    display: none;
  }
}

.mobile-toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s;
}

.mobile-toc-toggle:hover {
  border-color: hsl(var(--primary) / 0.5);
}

.mobile-toc-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  color: hsl(var(--muted-foreground));
  transition: transform 0.2s;
}

.mobile-toc[open] .mobile-toc-toggle svg {
  transform: rotate(180deg);
}

.mobile-toc-content {
  padding: 0.75rem 1rem 1rem;
  border: 1px solid hsl(var(--border));
  border-top: none;
  border-radius: 0 0 0.75rem 0.75rem;
  background: hsl(var(--card));
  margin-top: -0.5rem;
}

.mobile-toc-content .toctitle {
  display: none;
}

.mobile-toc-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-toc-content li {
  margin-bottom: 0.125rem;
}

.mobile-toc-content a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.mobile-toc-content a:hover {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
}

.mobile-toc-content ul ul {
  margin-left: 1rem;
}


/* ==========================================================================
   05. Article Typography
   ========================================================================== */

.blog-article {
  font-size: 1.125rem;
  line-height: 1.8;
  color: hsl(var(--foreground));
}

.blog-article h2 {
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid hsl(var(--border));
  line-height: 1.3;
  letter-spacing: -0.01em;
  scroll-margin-top: 100px;
}

.blog-article h3 {
  font-size: clamp(1.125rem, 3vw, 1.375rem);
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.4;
  scroll-margin-top: 100px;
}

.blog-article h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.blog-article .headerlink {
  text-decoration: none;
  color: hsl(var(--muted-foreground));
  opacity: 0;
  font-size: 0.75em;
  margin-left: 0.5rem;
  transition: opacity 0.15s;
}

.blog-article h2:hover .headerlink,
.blog-article h3:hover .headerlink,
.blog-article h4:hover .headerlink {
  opacity: 0.4;
}

.blog-article .headerlink:hover {
  opacity: 1;
  color: hsl(var(--primary));
}

.blog-article p {
  margin-bottom: 1.25rem;
  color: hsl(var(--foreground) / 0.9);
}

.blog-article p:last-child {
  margin-bottom: 0;
}

.blog-article a {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: hsl(var(--primary) / 0.4);
  transition: text-decoration-color 0.2s;
}

.blog-article a:hover {
  text-decoration-color: hsl(var(--primary));
  text-decoration-thickness: 2px;
}

.blog-article strong {
  font-weight: 700;
  color: hsl(var(--foreground));
}

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


/* ==========================================================================
   06. Lists (ul, ol, nested, checklist)
   ========================================================================== */

.blog-article ul,
.blog-article ol {
  margin: 1.5rem 0;
  padding-left: 1.75rem;
}

.blog-article ul {
  list-style-type: disc;
}

.blog-article ol {
  list-style-type: decimal;
}

.blog-article li {
  margin-bottom: 0.625rem;
  line-height: 1.75;
  color: hsl(var(--foreground) / 0.9);
}

.blog-article li > ul,
.blog-article li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.blog-article ul ul {
  list-style-type: circle;
}

.blog-article ul ul ul {
  list-style-type: square;
}


/* ==========================================================================
   07. Code Blocks (inline, pre, language label, copy button)
   ========================================================================== */

.blog-article code {
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  background: hsl(var(--muted));
  color: hsl(var(--primary));
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-weight: 500;
  word-break: break-word;
}

.blog-article pre {
  position: relative;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid #1e293b;
}

.blog-article pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.7;
  font-weight: 400;
  word-break: normal;
}

/* Language label */
.highlight[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.25rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  background: #1e293b;
  border-radius: 0 0.75rem 0 0.5rem;
  border-bottom: 1px solid #334155;
  border-left: 1px solid #334155;
}

/* Copy button */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.625rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  color: #94a3b8;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.highlight:hover .code-copy-btn,
.blog-article pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: #334155;
  color: #e2e8f0;
}

.code-copy-btn.copied {
  color: hsl(142 76% 50%);
  border-color: hsl(142 76% 36% / 0.5);
}

.code-copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Code block scrollbar */
.blog-article pre::-webkit-scrollbar {
  height: 6px;
}

.blog-article pre::-webkit-scrollbar-track {
  background: #1e293b;
  border-radius: 3px;
}

.blog-article pre::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 3px;
}

.blog-article pre::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* When language label is present, shift copy button */
.highlight[data-lang] .code-copy-btn {
  top: 2rem;
}


/* ==========================================================================
   08. Tables (standard + comparison variant)
   ========================================================================== */

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 2rem 0;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
}

.blog-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.9375rem;
}

.blog-article thead {
  background: hsl(var(--primary));
  color: white;
}

.blog-article th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-article td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground) / 0.9);
}

.blog-article tbody tr:last-child td {
  border-bottom: none;
}

.blog-article tbody tr {
  background: hsl(var(--card));
  transition: background 0.15s;
}

.blog-article tbody tr:hover {
  background: hsl(var(--muted));
}

/* Comparison table variant */
.comparison-table {
  margin: 2rem 0;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  overflow: hidden;
}

.comparison-table table {
  margin: 0;
}

.comparison-table thead {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.comparison-table th {
  color: hsl(var(--foreground));
  font-weight: 700;
}

.comparison-table th:first-child {
  background: hsl(var(--muted));
}

.comparison-table td:first-child {
  font-weight: 600;
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.5);
}

@media (max-width: 768px) {
  .blog-article table {
    font-size: 0.8125rem;
  }

  .blog-article th,
  .blog-article td {
    padding: 0.625rem 0.5rem;
  }
}


/* ==========================================================================
   09. Callout Boxes (tip, warning, note, info, danger)
   ========================================================================== */

.callout {
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  margin: 2rem 0;
  border-left: 4px solid;
  position: relative;
}

.callout-tip {
  background: hsl(142 76% 36% / 0.08);
  border-color: hsl(142 76% 36%);
  color: hsl(var(--foreground));
}

.callout-warning {
  background: hsl(45 93% 47% / 0.08);
  border-color: hsl(45 93% 47%);
  color: hsl(var(--foreground));
}

.callout-note {
  background: hsl(217 91% 60% / 0.08);
  border-color: hsl(217 91% 60%);
  color: hsl(var(--foreground));
}

.callout-info {
  background: hsl(258 90% 66% / 0.08);
  border-color: hsl(258 90% 66%);
  color: hsl(var(--foreground));
}

.callout-danger {
  background: hsl(0 72% 51% / 0.08);
  border-color: hsl(0 72% 51%);
  color: hsl(var(--foreground));
}

.callout p {
  margin-bottom: 0.625rem;
  color: inherit;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout strong {
  color: inherit;
  font-weight: 700;
}

.callout code {
  background: hsl(var(--foreground) / 0.06);
  color: inherit;
}


/* ==========================================================================
   10. TL;DR Box
   ========================================================================== */

.tldr-box {
  background: linear-gradient(135deg, hsl(var(--primary) / 0.05) 0%, hsl(var(--primary) / 0.1) 100%);
  border: 1px solid hsl(var(--primary) / 0.2);
  border-radius: 1rem;
  padding: 1.5rem;
  margin: 2rem 0;
}

.tldr-label {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  margin-bottom: 1rem;
}

.tldr-content p {
  font-size: 1rem;
  line-height: 1.6;
  color: hsl(var(--foreground));
  margin-bottom: 0.875rem;
}

.tldr-content p:last-child {
  margin-bottom: 0;
}

.tldr-content strong {
  font-weight: 700;
  color: hsl(var(--foreground));
}


/* ==========================================================================
   11. Tool CTA Box
   ========================================================================== */

.tool-cta-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  background: hsl(var(--primary) / 0.04);
  border-left: 3px solid hsl(var(--primary));
  border-radius: 0 0.5rem 0.5rem 0;
}

.tool-cta-box::before {
  content: '\2192';
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.125rem;
  color: hsl(var(--primary));
  font-weight: 700;
  font-size: 1rem;
}

.tool-cta-box p {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: hsl(var(--foreground) / 0.9);
  margin: 0;
}

.tool-cta-box a {
  color: hsl(var(--primary));
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-color: hsl(var(--primary) / 0.3);
  transition: text-decoration-color 0.15s;
}

.tool-cta-box a:hover {
  text-decoration-color: hsl(var(--primary));
}


/* ==========================================================================
   12. Images, Figures & Diagrams
   ========================================================================== */

.blog-article img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin: 2rem auto;
  display: block;
  border: 1px solid hsl(var(--border));
}

.blog-article figure {
  margin: 2rem 0;
}

.blog-article figcaption {
  text-align: center;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.75rem;
  font-style: italic;
}

.diagram-container {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin: 2rem 0;
  text-align: center;
}

.diagram-container img {
  margin: 0 auto;
  border: none;
}

.diagram-container figcaption {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid hsl(var(--border));
}


/* ==========================================================================
   13. Blockquotes
   ========================================================================== */

.blog-article blockquote {
  border-left: 4px solid hsl(var(--primary));
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: hsl(var(--primary) / 0.03);
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: italic;
  color: hsl(var(--foreground) / 0.85);
}

.blog-article blockquote p {
  margin-bottom: 0.625rem;
  color: inherit;
}

.blog-article blockquote p:last-child {
  margin-bottom: 0;
}


/* ==========================================================================
   14. Horizontal Rules
   ========================================================================== */

.blog-article hr {
  border: none;
  border-top: 2px solid hsl(var(--border));
  margin: 3rem 0;
}


/* ==========================================================================
   15. Definition Lists (dl/dt/dd)
   ========================================================================== */

.blog-article dl {
  margin: 1.5rem 0;
}

.blog-article dt {
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.blog-article dt:first-child {
  margin-top: 0;
}

.blog-article dd {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: hsl(var(--foreground) / 0.85);
  line-height: 1.7;
  padding-left: 1rem;
  border-left: 2px solid hsl(var(--border));
}


/* ==========================================================================
   16. Keyboard Shortcuts (kbd)
   ========================================================================== */

.blog-article kbd {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8em;
  color: hsl(var(--foreground));
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  box-shadow: 0 1px 0 hsl(var(--border));
  white-space: nowrap;
}


/* ==========================================================================
   17. Footnotes
   ========================================================================== */

.blog-article .footnote {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid hsl(var(--border));
  font-size: 0.875rem;
}

.blog-article .footnote ol {
  padding-left: 1.5rem;
}

.blog-article .footnote li {
  margin-bottom: 0.5rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
}

.blog-article sup a.footnote-ref {
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 600;
  font-size: 0.75em;
}

.blog-article a.footnote-backref {
  text-decoration: none;
  color: hsl(var(--primary));
  margin-left: 0.25rem;
}


/* ==========================================================================
   18. Accordion (details/summary)
   ========================================================================== */

.blog-article details,
.accordion-block {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  overflow: hidden;
  transition: border-color 0.2s;
}

.blog-article details[open],
.accordion-block[open] {
  border-color: hsl(var(--primary) / 0.3);
}

.blog-article details > summary,
.accordion-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  color: hsl(var(--foreground));
  list-style: none;
  transition: background 0.15s;
}

.blog-article details > summary::-webkit-details-marker,
.accordion-summary::-webkit-details-marker {
  display: none;
}

.blog-article details > summary:hover,
.accordion-summary:hover {
  background: hsl(var(--muted) / 0.5);
}

.blog-article details > summary::after,
.accordion-summary::after {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid hsl(var(--muted-foreground));
  border-bottom: 2px solid hsl(var(--muted-foreground));
  transform: rotate(45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-left: 1rem;
}

.blog-article details[open] > summary::after,
.accordion-block[open] .accordion-summary::after {
  transform: rotate(-135deg);
}

.accordion-content {
  padding: 0 1.25rem 1.25rem;
}


/* ==========================================================================
   19. Numbered Steps Process
   ========================================================================== */

.steps-container {
  counter-reset: step-counter;
  margin: 2rem 0;
  position: relative;
  padding-left: 3rem;
}

.steps-container::before {
  content: '';
  position: absolute;
  left: 1.0625rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: hsl(var(--border));
}

.steps-container h3 {
  counter-increment: step-counter;
  position: relative;
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 2rem;
}

.steps-container h3:first-child {
  margin-top: 0;
}

.steps-container h3::before {
  content: counter(step-counter);
  position: absolute;
  left: -3rem;
  width: 2.125rem;
  height: 2.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--primary));
  color: white;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 50%;
  z-index: 1;
}


/* ==========================================================================
   20. Video Embed Responsive
   ========================================================================== */

.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 2rem 0;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
}

.video-embed iframe,
.video-embed video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}


/* ==========================================================================
   21. Author Section
   ========================================================================== */

.article-author {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  margin-top: 3rem;
}

.article-author-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid hsl(var(--border));
  flex-shrink: 0;
}

.article-author-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.125rem;
}

.article-author-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin: 0 0 0.25rem;
}

.article-author-name a {
  color: inherit;
  text-decoration: none;
}

.article-author-name a:hover {
  color: hsl(var(--primary));
}

.article-author-bio {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
  margin: 0;
}


/* ==========================================================================
   22. Article Navigation (Prev/Next)
   ========================================================================== */

.article-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid hsl(var(--border));
}

.article-nav-link {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  text-decoration: none;
  transition: all 0.2s;
}

.article-nav-link:hover {
  border-color: hsl(var(--primary) / 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px hsl(var(--foreground) / 0.06);
}

.article-nav-next {
  text-align: right;
}

.article-nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.375rem;
}

.article-nav-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  line-height: 1.3;
}

.article-nav-link:hover .article-nav-title {
  color: hsl(var(--primary));
}

@media (max-width: 640px) {
  .article-nav {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   23. Related Tools & Articles Cards (Sidebar + Mobile)
   ========================================================================== */

/* Right sidebar sections */
.sidebar-related {
  margin-bottom: 0;
}

.sidebar-related-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.sidebar-related-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-related-link {
  display: block;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  text-decoration: none;
  border-radius: 0.5rem;
  line-height: 1.35;
  transition: all 0.15s;
}

.sidebar-related-link:hover {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
}

.sidebar-related-link span {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* Right sidebar card wrappers */
.sidebar-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  padding: 1.125rem;
  margin-bottom: 1rem;
}

.sidebar-card .sidebar-related + .sidebar-related {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
}

/* Fallback related sections (below article when right sidebar hidden) */
.related-tools-section,
.related-articles-section {
  display: block;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid hsl(var(--border));
}

@media (min-width: 1280px) {
  .related-tools-section,
  .related-articles-section {
    display: none;
  }
}

.related-section-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 1.25rem;
}

.related-grid {
  display: grid;
  gap: 0.75rem;
}

.related-tools-section .related-grid {
  grid-template-columns: 1fr;
}

.related-articles-section .related-grid {
  grid-template-columns: 1fr;
}

.tool-card-link,
.article-card-link {
  display: block;
  padding: 1rem;
  border-radius: 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.tool-card-link {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
}

.tool-card-link:hover {
  border-color: hsl(var(--primary) / 0.5);
}

.article-card-link {
  background: hsl(var(--muted));
}

.article-card-link:hover {
  background: hsl(var(--muted) / 0.6);
}

.tool-card-link h3,
.article-card-link h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.25rem;
}

.tool-card-link p,
.article-card-link p {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
  margin: 0;
}


/* ==========================================================================
   24. Social Share Buttons
   ========================================================================== */

.article-share {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.article-share-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  margin-right: 0.25rem;
}

.article-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0.375rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.article-share-btn:hover {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
}

.article-share-btn svg {
  width: 16px;
  height: 16px;
}

.article-share-btn.copied {
  border-color: hsl(142 76% 36%);
  color: hsl(142 76% 36%);
}


/* ==========================================================================
   25. Back to Top Button
   ========================================================================== */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 40;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 50%;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s;
  box-shadow: 0 2px 8px hsl(var(--foreground) / 0.08);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: hsl(var(--primary));
  color: white;
  border-color: hsl(var(--primary));
}

.back-to-top svg {
  width: 20px;
  height: 20px;
}


/* ==========================================================================
   26. Reading Progress Bar
   ========================================================================== */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: hsl(var(--primary));
  z-index: 9999;
  transition: width 0.1s ease-out;
}


/* ==========================================================================
   27. Newsletter/CTA Banner
   ========================================================================== */

.article-cta-banner {
  position: relative;
  margin-top: 3rem;
  padding: 2.5rem 2rem;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary) / 0.8));
  border-radius: 1rem;
  text-align: center;
  overflow: hidden;
}

.article-cta-banner::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: white;
  opacity: 0.08;
}

.article-cta-banner::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: white;
  opacity: 0.06;
}

.article-cta-title {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 800;
  color: white;
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 1;
}

.article-cta-subtitle {
  font-size: 0.9375rem;
  color: white;
  opacity: 0.9;
  margin-bottom: 1.25rem;
  position: relative;
  z-index: 1;
}

.article-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: white;
  color: hsl(var(--primary));
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 0.75rem;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.article-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.article-cta-btn svg {
  width: 18px;
  height: 18px;
}


/* ==========================================================================
   28. Article List Page
   ========================================================================== */

.learn-list-hero {
  background: linear-gradient(180deg, hsl(var(--muted)) 0%, hsl(var(--background)) 100%);
  border-bottom: 1px solid hsl(var(--border));
  padding: 3rem 1rem 2.5rem;
  text-align: center;
}

.learn-list-title {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  color: hsl(var(--foreground));
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.learn-list-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  color: hsl(var(--muted-foreground));
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Category filter pills */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.category-pill {
  display: inline-block;
  padding: 0.375rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 9999px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}

.category-pill:hover {
  border-color: hsl(var(--primary) / 0.5);
  color: hsl(var(--primary));
}

.category-pill.active {
  background: hsl(var(--primary));
  color: white;
  border-color: hsl(var(--primary));
}

/* Article list container */
.learn-list-container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

/* Article grid */
.learn-list-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .learn-list-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .learn-list-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Article card */
.learn-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  overflow: hidden;
  transition: all 0.2s;
}

.learn-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px hsl(var(--foreground) / 0.08);
  border-color: hsl(var(--primary) / 0.3);
}

.learn-card a {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Featured card -- spans full width */
.learn-card--featured {
  grid-column: 1 / -1;
}

@media (min-width: 640px) {
  .learn-card--featured a {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .learn-card--featured .learn-card-image {
    height: 100%;
  }

  .learn-card--featured .learn-card-image img {
    height: 100%;
    object-fit: cover;
  }
}

/* Card image */
.learn-card-image {
  background: hsl(var(--muted));
  overflow: hidden;
}

.learn-card-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s;
}

.learn-card:hover .learn-card-image img {
  transform: scale(1.03);
}

/* Card body */
.learn-card-body {
  padding: 1.25rem;
}

.learn-card-category {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
  padding: 0.2rem 0.625rem;
  border-radius: 0.25rem;
  margin-bottom: 0.75rem;
}

.learn-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.learn-card:hover .learn-card-title {
  color: hsl(var(--primary));
}

.learn-card-desc {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.learn-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.learn-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.learn-card-meta svg {
  width: 14px;
  height: 14px;
}

/* Empty state */
.learn-list-empty {
  text-align: center;
  padding: 4rem 1rem;
  color: hsl(var(--muted-foreground));
  font-size: 1rem;
  grid-column: 1 / -1;
}


/* ==========================================================================
   29. Category Badge & Tags
   ========================================================================== */

.category-badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.25rem;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 1rem;
}

.article-tag {
  display: inline-block;
  padding: 0.2rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  border-radius: 0.25rem;
  text-decoration: none;
  transition: all 0.15s;
}

.article-tag:hover {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.08);
}

/* Difficulty indicator */
.difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.difficulty-badge--beginner { color: hsl(142 76% 36%); }
.difficulty-badge--intermediate { color: hsl(45 93% 47%); }
.difficulty-badge--advanced { color: hsl(0 72% 51%); }

/* Series indicator */
.article-series {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: hsl(var(--primary) / 0.05);
  border: 1px solid hsl(var(--primary) / 0.15);
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  margin-bottom: 1rem;
}

.article-series-label {
  font-weight: 600;
  color: hsl(var(--primary));
}


/* ==========================================================================
   30. Breadcrumbs
   ========================================================================== */

.breadcrumbs {
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.breadcrumbs a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumbs a:hover {
  color: hsl(var(--primary));
}

.breadcrumbs .separator {
  color: hsl(var(--muted-foreground) / 0.4);
  font-size: 0.75rem;
}

.breadcrumbs .current {
  font-weight: 500;
  color: hsl(var(--foreground));
}


/* ==========================================================================
   31. Dark Mode Overrides
   ========================================================================== */

.dark .blog-article pre {
  background: #0d1117;
  border-color: #21262d;
}

.dark .blog-article code {
  background: hsl(var(--muted));
  color: #f472b6;
}

.dark .callout code {
  background: rgba(255, 255, 255, 0.08);
}

.dark .callout-tip {
  background: hsl(142 76% 36% / 0.12);
}

.dark .callout-warning {
  background: hsl(45 93% 47% / 0.12);
}

.dark .callout-note {
  background: hsl(217 91% 60% / 0.12);
}

.dark .callout-info {
  background: hsl(258 90% 66% / 0.12);
}

.dark .callout-danger {
  background: hsl(0 72% 51% / 0.12);
}

.dark .tldr-box {
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1) 0%, hsl(var(--primary) / 0.15) 100%);
  border-color: hsl(var(--primary) / 0.3);
}

.dark .table-responsive {
  border-color: hsl(var(--border));
}

.dark .comparison-table {
  border-color: hsl(var(--border));
}

.dark .blog-article blockquote {
  background: hsl(var(--primary) / 0.05);
}

.dark .blog-article kbd {
  background: hsl(var(--muted));
  border-color: hsl(var(--border));
  box-shadow: 0 1px 0 hsl(var(--border));
}

.dark .highlight[data-lang]::before {
  background: #161b22;
  border-color: #21262d;
  color: #8b949e;
}

.dark .code-copy-btn {
  background: #161b22;
  border-color: #21262d;
  color: #8b949e;
}

.dark .code-copy-btn:hover {
  background: #21262d;
  color: #e6edf3;
}


/* ==========================================================================
   32. Responsive (Mobile)
   ========================================================================== */

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

  .blog-article h2 {
    margin-top: 2.25rem;
  }

  .blog-article h3 {
    margin-top: 1.75rem;
  }

  .callout,
  .tldr-box {
    padding: 1rem;
    margin: 1.5rem 0;
  }

  .blog-article pre {
    padding: 1rem;
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .tool-cta-box {
    padding: 0.875rem 1rem;
  }

  .article-author {
    flex-direction: column;
    text-align: center;
  }

  .article-cta-banner {
    padding: 2rem 1.25rem;
  }

  .learn-card-body {
    padding: 1rem;
  }
}


/* ==========================================================================
   33. Print Styles
   ========================================================================== */

@media print {
  .article-toc,
  .mobile-toc,
  .reading-progress,
  .back-to-top,
  .related-tools-section,
  .related-articles-section,
  .article-nav,
  .article-share,
  .article-cta-banner,
  .code-copy-btn {
    display: none !important;
  }

  .blog-article {
    font-size: 11pt;
    line-height: 1.6;
    color: #000;
  }

  .blog-article a {
    color: #000;
    text-decoration: underline;
  }

  .blog-article a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }

  .blog-article pre {
    background: #f5f5f5 !important;
    color: #333 !important;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  .callout,
  .tldr-box {
    page-break-inside: avoid;
    border: 1px solid #ccc;
  }
}


/* ==========================================================================
   34. Accessibility
   ========================================================================== */

.blog-article a:focus-visible,
.tool-card-link:focus-visible,
.article-card-link:focus-visible,
.article-nav-link:focus-visible,
.learn-card a:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.article-share-btn:focus-visible,
.back-to-top:focus-visible,
.mobile-toc-toggle:focus-visible,
.code-copy-btn:focus-visible,
.category-pill:focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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


/* ==========================================================================
   35. Animations
   ========================================================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-header .article-title {
  animation: fadeInUp 0.4s ease-out;
}

.article-header .article-info {
  animation: fadeInUp 0.4s ease-out 0.1s backwards;
}

.tldr-box {
  animation: fadeInUp 0.4s ease-out 0.15s backwards;
}
