/* ========================================
   Premium Blog Theme - A Dev Writes
   ======================================== */

/* ========================================
   CSS Variables - Design Tokens
   ======================================== */

:root {
  /* Colors */
  --bg-primary: #0a0f1a;
  --bg-secondary: #111827;
  --bg-card: #1a1f2e;
  --bg-elevated: #242b3d;

  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --accent-primary: #3b82f6;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

  --border-color: #1f2937;
  --border-subtle: rgba(255, 255, 255, 0.06);

  --code-bg: #1e293b;
  --code-text: #e879f9;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --content-width: 720px;
  --wrapper-width: 1100px;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* ========================================
   Base Styles
   ======================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Progress Bar
   ======================================== */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: var(--accent-gradient);
  width: 0%;
  z-index: 9999;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5), 0 0 20px rgba(139, 92, 246, 0.3);
}

/* ========================================
   Header
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  background: rgba(10, 15, 26, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.header-wrapper {
  max-width: var(--wrapper-width);
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  gap: 2rem;
}

.site-nav .nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-nav .nav-link:hover {
  color: var(--text-primary);
}

/* ========================================
   Main Content / Wrapper
   ======================================== */

.page-content {
  min-height: calc(100vh - 200px);
}

.wrapper {
  max-width: var(--wrapper-width);
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* ========================================
   Hero Section (Home)
   ======================================== */

.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border-subtle);
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  margin: 0 0 1rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0;
  max-width: 500px;
  margin: 0 auto;
}

/* ========================================
   Section Titles
   ======================================== */

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.title-icon {
  font-size: 1.25rem;
}

/* ========================================
   Featured Post
   ======================================== */

.featured-section {
  margin-bottom: 4rem;
}

.featured-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-post:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}

.featured-image-link {
  display: block;
  overflow: hidden;
}

.featured-image {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.featured-post:hover .featured-image {
  transform: scale(1.05);
}

.featured-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.featured-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 1rem;
  line-height: 1.3;
}

.featured-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.featured-title a:hover {
  color: var(--accent-primary);
}

.featured-excerpt {
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 1.5rem;
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: fit-content;
}

.read-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.read-more-btn span {
  transition: transform 0.2s ease;
}

.read-more-btn:hover span {
  transform: translateX(4px);
}

/* ========================================
   Series Carousel
   ======================================== */

.series-section {
  margin-bottom: 4rem;
}

.series-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.series-carousel {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.5rem 0;
}

.series-carousel::-webkit-scrollbar {
  display: none;
}

.carousel-btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.carousel-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.series-card {
  flex-shrink: 0;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  scroll-snap-align: start;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.series-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.series-card-number {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--accent-gradient);
  color: white;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 10;
}

.series-card-image {
  height: 140px;
  overflow: hidden;
}

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

.series-card:hover .series-card-image img {
  transform: scale(1.1);
}

.series-card-content {
  padding: 1rem;
}

.series-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
}

.series-card-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.series-card-title a:hover {
  color: var(--accent-primary);
}

/* ========================================
   Tag Cloud
   ======================================== */

.tags-section {
  margin-bottom: 4rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tag-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.tag-link:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.tag-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
}

.tag-link:hover .tag-count {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================
   Post Grid (Home)
   ======================================== */

.posts-section {
  margin-bottom: 4rem;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.post-card {
  background: rgba(26, 31, 46, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.post-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 0 0 1px rgba(59, 130, 246, 0.2),
    0 20px 50px rgba(0, 0, 0, 0.4),
    0 0 60px rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
}

.post-card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

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

.post-card:hover .post-card-image img {
  transform: scale(1.05);
}

.post-card-content {
  padding: 1.5rem 2rem 2rem;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.post-card-meta .category {
  background: var(--accent-primary);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.post-card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

.post-card-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card-title a:hover {
  color: var(--accent-primary);
}

.post-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin: 0 0 1rem;
  line-height: 1.6;
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ========================================
   Tags
   ======================================== */

.tag {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ========================================
   Post Page
   ======================================== */

.post {
  max-width: var(--content-width);
  margin: 0 auto;
}

.post-header {
  margin-bottom: 3rem;
}

.hero-image-container {
  margin: 1.5rem -2rem 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  display: block;
}

.post-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1.5rem;
  letter-spacing: -0.02em;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1rem;
}

.author-details {
  display: flex;
  flex-direction: column;
}

.author-name {
  font-weight: 600;
  color: var(--text-primary);
}

.author-details time {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ========================================
   Post Content Typography
   ======================================== */

.post-content {
  font-size: 1.1rem;
  line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.post-content h2 {
  font-size: 1.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.post-content h3 {
  font-size: 1.35rem;
  color: var(--accent-primary);
}

.post-content p {
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
}

.post-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.post-content em {
  color: var(--text-secondary);
}

.post-content a {
  color: var(--accent-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.post-content a:hover {
  border-bottom-color: var(--accent-primary);
}

/* ========================================
   Code Blocks
   ======================================== */

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  color: var(--text-secondary);
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Syntax Highlighting */
.highlight .k,
.highlight .kd,
.highlight .kn {
  color: #f472b6;
}

.highlight .s,
.highlight .s1,
.highlight .s2 {
  color: #a5f3fc;
}

.highlight .c,
.highlight .c1,
.highlight .cm {
  color: #6b7280;
  font-style: italic;
}

.highlight .nf,
.highlight .nb,
.highlight .nx {
  color: #c4b5fd;
}

.highlight .nc,
.highlight .nn {
  color: #fbbf24;
}

.highlight .n,
.highlight .nv,
.highlight .na {
  color: #cbd5e1;
}

.highlight .o,
.highlight .p {
  color: #94a3b8;
}

.highlight .mi,
.highlight .mf {
  color: #f472b6;
}

/* ========================================
   Tables
   ======================================== */

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.post-content th {
  background: var(--accent-primary);
  color: white;
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
}

.post-content td {
  padding: 0.875rem 1rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.post-content tr:nth-child(even) td {
  background: var(--bg-secondary);
}

/* ========================================
   Blockquotes
   ======================================== */

.post-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.post-content blockquote p {
  margin: 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* ========================================
   Lists
   ======================================== */

.post-content ul,
.post-content ol {
  color: var(--text-secondary);
  padding-left: 1.5rem;
  margin: 1rem 0 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content li::marker {
  color: var(--accent-primary);
}

/* ========================================
   Images - Enhanced with Glow Effects
   ======================================== */

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 2.5rem 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 40px rgba(59, 130, 246, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-content img:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 35px 60px -15px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(59, 130, 246, 0.2),
    0 0 60px rgba(59, 130, 246, 0.2);
}

/* Hero image special styling */
.hero-image-container {
  margin: 1.5rem -2rem 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.7);
}

.hero-image {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  display: block;
}

/* ========================================
   Horizontal Rule
   ======================================== */

.post-content hr {
  border: none;
  height: 1px;
  background: var(--border-subtle);
  margin: 3rem 0;
}

/* ========================================
   Post Footer / Navigation
   ======================================== */

.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.nav-link {
  flex: 1;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

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

.nav-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.nav-title {
  color: var(--text-primary);
  font-weight: 500;
}

/* ========================================
   Footer
   ======================================== */

.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-wrapper {
  max-width: var(--wrapper-width);
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
}

.site-footer p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
  .header-wrapper {
    padding: 1rem;
  }

  .wrapper {
    padding: 2rem 1rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .post-title {
    font-size: 1.75rem;
  }

  .post-content {
    font-size: 1rem;
  }

  .post-meta {
    flex-direction: column;
  }

  .hero-image-container {
    margin: 1rem -1rem 1.5rem;
    border-radius: 0;
  }

  .post-nav {
    flex-direction: column;
  }

  .nav-link.next {
    text-align: left;
  }
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   Selection
   ======================================== */

::selection {
  background: var(--accent-primary);
  color: white;
}

/* ========================================
   Footer Social Links
   ======================================== */

.footer-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--accent-primary);
}

/* ========================================
   Tags Page Styling
   ======================================== */

.tags-header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.all-tags-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 4rem;
}

.tag-link.large {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag-link.large:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.tag-link.large .tag-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.8rem;
}

.divider {
  border: 0;
  height: 1px;
  background: var(--border-subtle);
  margin: 4rem 0;
}

.tag-group {
  margin-bottom: 4rem;
  scroll-margin-top: 100px;
  /* For sticky header clearance */
}

.tag-group-title {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hashtag {
  color: var(--accent-primary);
  opacity: 0.7;
}

.tag-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.mini-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mini-post-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.mini-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}

.mini-title {
  font-size: 1.1rem;
  margin: 0;
  line-height: 1.4;
  font-weight: 600;
}

.mini-title a {
  color: var(--text-primary);
  text-decoration: none;
}

.mini-title a:hover {
  color: var(--accent-primary);
}

/* ========================================
   Mini Card Image Styling
   ======================================== */

.mini-post-card {
  padding: 0;
  /* Reset padding to allow full-width image */
  overflow: hidden;
}

.mini-card-image {
  height: 160px;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

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

.mini-post-card:hover .mini-card-image img {
  transform: scale(1.05);
}

.mini-content {
  padding: 1.5rem;
}

/* ========================================
   Hero Banner Design
   ======================================== */

.hero-featured {
  position: relative;
  width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4rem;
  overflow: hidden;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 1;
  transition: transform 10s ease;
}

.hero-featured:hover .hero-background {
  transform: scale(1.05);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom,
      rgba(10, 15, 26, 0.4) 0%,
      rgba(10, 15, 26, 0.8) 60%,
      rgba(10, 15, 26, 1) 100%);
  z-index: 2;
  backdrop-filter: blur(2px);
}

.hero-content-wrapper {
  position: relative;
  z-index: 3;
  text-align: center;
  max-width: 800px;
  padding: 2rem;
  animation: fadeIn 1s ease-out;
}

.hero-badge {
  display: inline-block;
  background: var(--accent-gradient);
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.hero-post-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.hero-post-title a {
  color: white;
  text-decoration: none;
  transition: color 0.3s ease;
}

.hero-post-title a:hover {
  color: var(--accent-secondary);
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

.separator {
  color: rgba(255, 255, 255, 0.4);
}

.hero-excerpt {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  color: var(--bg-primary);
  padding: 1rem 2rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.hero-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
  background: var(--accent-secondary);
  color: white;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .hero-post-title {
    font-size: 2rem;
  }
}

/* ========================================
   DSA Layout (LeetCode Style)
   ======================================== */

.dsa-layout-container {
  display: flex;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
  align-items: flex-start;
}

/* Sidebar */
.dsa-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.dsa-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.dsa-sidebar-header a {
  color: var(--text-primary);
  text-decoration: none;
}

.dsa-module {
  border-bottom: 1px solid var(--border-subtle);
}

.dsa-module-title {
  padding: 0.75rem 1rem;
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
}

.dsa-problem-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dsa-problem-list li {
  border-bottom: 1px solid var(--border-subtle);
}

.dsa-problem-list li a {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s;
}

.dsa-problem-list li.active a {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  border-left: 3px solid var(--accent-primary);
}

.dsa-problem-list li a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.problem-order {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Main Content */
.dsa-main-content {
  flex-grow: 1;
  min-width: 0;
  /* Prevents overflow */
  background: var(--bg-primary);
  /* Or card if preferred */
}

/* Breadcrumbs */
.dsa-breadcrumbs ol {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE/Edge */
  white-space: nowrap;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dsa-breadcrumbs ol::-webkit-scrollbar {
  display: none;
  /* Chrome/Safari */
}

/* truncate intermediate items if they get too long */
.dsa-breadcrumbs li:not(:last-child) {
  /* Flex shrink wrapper */
  flex-shrink: 0;
  display: flex;
  align-items: center;
  /* Ensure parent doesn't clip the pseudo-element */
  overflow: visible;
}

.dsa-breadcrumbs li:not(:last-child) a {
  display: block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dsa-breadcrumbs li::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.dsa-breadcrumbs li:last-child::after {
  content: "";
  display: none;
}

.dsa-breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

.dsa-breadcrumbs li[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 500;
}

/* DSA Header */
.dsa-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.5rem;
}

.dsa-title {
  margin: 0 0 1rem;
  font-size: 2.25rem;
}

.dsa-meta {
  display: flex;
  gap: 1rem;
}

.dsa-chip {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.dsa-chip.category {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.difficulty-beginner {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.difficulty-intermediate {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.difficulty-advanced {
  background: rgba(139, 92, 246, 0.2);
  color: #8b5cf6;
}

.difficulty-staff {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

/* Sidebar Specific Pill Styles */
.dsa-problem-list .difficulty-pill {
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 4px;
  margin-left: 8px;
  text-transform: uppercase;
  font-weight: 700;
}

.difficulty-hard {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.dsa-body {
  font-size: 1.05rem;
}

/* Footer Nav */
.dsa-footer-nav {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
}

.dsa-nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.dsa-nav-btn:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .dsa-layout-container {
    flex-direction: column;
    padding: 1rem;
  }

  .dsa-sidebar {
    width: 100%;
    position: relative;
    top: 0;
    max-height: 300px;
  }
}

/* ========================================
   DSA Layout Refinements (Iter. 2)
   ======================================== */

/* Optimize Width */
.dsa-layout-container {
  max-width: 95vw;
  /* Use more screen width */
  padding: 1.5rem;
  gap: 1.5rem;
}

/* Sidebar Collapsible */
.dsa-module {
  border-bottom: 1px solid var(--border-subtle);
}

.dsa-module summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
  list-style: none;
  /* Hide default triangle in some browsers */
}

.dsa-module summary::-webkit-details-marker {
  display: none;
}

.dsa-module summary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.dsa-module summary::after {
  content: '+';
  font-size: 1.1em;
  font-weight: 400;
}

.dsa-module[open] summary::after {
  content: '−';
}

.dsa-module-count {
  font-size: 0.75rem;
  opacity: 0.6;
  background: var(--bg-primary);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
}

/* Improved Problem List Items */
.dsa-problem-list li a {
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  /* Indent slightly */
  font-size: 0.9rem;
  position: relative;
  display: block;
  /* ensure block for hit area */
}

.problem-status {
  position: absolute;
  left: 1rem;
  font-size: 0.8em;
  color: var(--text-muted);
}

.dsa-problem-list li.active .problem-status,
.dsa-problem-list li.active a {
  color: var(--accent-primary);
}

/* Breadcrumbs Refinement */
.dsa-breadcrumbs ol {
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
}


/* ========================================
   DSA Visual Polish (LeetCode Style)
   ======================================== */

/* Sidebar Polish */
.dsa-sidebar {
  background: var(--bg-secondary);
  /* Slightly darker/distinct from main */
  border: none;
  border-right: 1px solid var(--border-color);
  border-radius: 0;
  /* Full height look usually */
}

.dsa-sidebar-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1.25rem 1rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.dsa-module {
  border-bottom: 1px solid var(--border-subtle);
}

.dsa-module summary {
  background: transparent;
  padding: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0.9;
}

.dsa-module summary:hover {
  background: rgba(255, 255, 255, 0.03);
}

.dsa-problem-list li a {
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  font-size: 0.9rem;
  border-left: 2px solid transparent;
}

.dsa-problem-list li.active a {
  background: rgba(59, 130, 246, 0.08);
  /* Very subtle blue tint */
  border-left-color: var(--accent-primary);
  color: var(--text-primary);
  font-weight: 500;
}

/* Status Icon (Circle) */
.problem-status {
  font-size: 0.6rem;
  /* Smaller, cleaner dot */
  top: 50%;
  transform: translateY(-50%);
  left: 1.2rem;
}

.dsa-problem-list li.active .problem-status {
  color: var(--accent-primary);
}


/* Main Content Card */
.dsa-main-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  max-width: 1000px;
  /* Readability text width */
  margin: 0 auto;
  /* Center if space allows */
}


/* Breadcrumbs - Top & Clean */
.dsa-breadcrumbs ol {
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
  padding: 0;
  margin-bottom: 1.5rem;
  border-bottom: none;
  font-family: var(--font-sans);
}

.dsa-breadcrumbs a {
  color: var(--text-secondary);
  font-weight: 500;
}

.dsa-breadcrumbs li[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 600;
}


/* Content "Boxes" (Cards inside content) */

/* Example Code Blocks */
.post-content pre {
  background: #1e1e1e;
  /* VS Code-like Dark */
  border: 1px solid #333;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

/* Example Sections separated */
.post-content h3 {
  /* "Example 1:" headers */
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 2rem;
  border-bottom: none;
}

/* Constraints Box */
.post-content ul {
  background: rgba(255, 255, 255, 0.03);
  padding: 1.5rem 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
}

/* Solution Header Divider */
.post-content h1 {
  /* "Solution" Header */
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 3px solid var(--border-color);
  font-size: 1.75rem;
}


/* ========================================
   DSA Layout Refinements (Full Width)
   ======================================== */

.dsa-layout-container {
  max-width: 100%;
  /* Full browser width */
  padding: 1rem 2rem;
  /* reduced vertical padding */
  box-sizing: border-box;
}

.dsa-main-content {
  max-width: none;
  /* Allow infinite stretch */
  width: 100%;
  /* Fill flex container */
  margin: 0;
  /* Reset auto margins */
}

/* Make code blocks stretch too */
.post-content pre {
  max-width: 100%;
}

/* ========================================
   DSA Refinements (Iter. 3 - Structure)
   ======================================== */

/* Top Bar Breadcrumbs */
.dsa-top-bar {
  background: var(--bg-card);
  /* Darker than main bg usually */
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 2rem;
  width: 100%;
}

.dsa-breadcrumbs ol {
  margin: 0;
  padding: 0;
  border-bottom: none;
  /* Removed previous style */
  font-size: 0.9rem;
}

/* Sidebar Fixes */
.dsa-sidebar {
  top: 0;
  /* Reset sticky top calc if header is gone or different */
  height: calc(100vh - 60px);
  /* Adjust based on top bar height approx */
  overflow-y: auto;
  min-width: 260px;
  /* Ensure sidebar doesn't shrink too much */
}

/* Main Container Adjustments */
.dsa-layout-container {
  display: flex;
  width: 100%;
  max-width: 100%;
  padding: 0;
  /* Remove padding to flush with edges like LeetCode */
  margin: 0;
  gap: 0;
  /* Split view style */
}

/* Sidebar inside container */
.dsa-sidebar {
  border-right: 1px solid var(--border-color);
  background: var(--bg-elevated);
  /* Slightly distinct */
}

/* Main Content Area */
.dsa-main-content {
  flex: 1;
  /* Grow to fill space */
  padding: 2rem 4rem;
  /* Content padding inside the split view */
  border: none;
  /* Remove card border since it's full view now */
  box-shadow: none;
  /* Remove card shadow */
  border-radius: 0;
  background: var(--bg-primary);
  /* Main writing area */
}

/* Constrain ONLY the text width for readability, but let container stretch */
.post-content,
.dsa-header {
  max-width: 1200px;
  margin: 0 auto;
}


/* ========================================
   DSA Refinements (Iter. 4 - Fixes)
   ======================================== */

/* Sticky Top Bar */
.dsa-top-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 0 var(--border-color);
  /* Separator when scrolled */
}

/* Fix Sidebar Scrolling with Sticky Header */
.dsa-sidebar {
  position: sticky;
  top: 60px;
  /* approximates top bar height */
  height: calc(100vh - 60px);
}

/* Sidebar Styling Updates */
/* Ensure the summary (Course Overview) implies collapsibility if implemented, 
   or just cleaner if not. User asked for "Overview bar" collapsible. 
   If we wrap the whole content in a details, we need structure. 
*/


/* ========================================
   DSA Refinements (Iter. 5 - Final Polish)
   ======================================== */

/* Sidebar "Course Overview" Toggle */
.dsa-sidebar-header {
  list-style: none;
  /* Hide default marker */
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  user-select: none;
}

.dsa-sidebar-header::-webkit-details-marker {
  display: none;
}

.dsa-sidebar-header::after {
  content: '−';
  margin-left: auto;
}

details:not([open])>.dsa-sidebar-header::after {
  content: '+';
}

/* Ensure sticky works */
.dsa-top-bar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  /* Opaque background needed */
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
}


/* ========================================
   DSA Refinements (Iter. 6 - Padding & Sticky)
   ======================================== */

/* Remove Top Bar from Body Flow to fix fixed/sticky issues */
/* We want the body to handle scroll or the content? 
   Let's make top bar FIXED and content scrollable underneath. */

.dsa-top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  /* Fixed height for calculations */
  padding: 0 1.5rem;
  /* Match sidebar/content padding horizontally */
  display: flex;
  align-items: center;
  background: var(--bg-card);
  /* Ensure no transparency */
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
}

/* Push container down by top bar height */
/* Push container down by top bar height */
.dsa-layout-container {
  margin-top: 50px;
  height: calc(100vh - 50px);
  /* Full viewport height minus top bar */
  overflow: hidden;
  /* Prevent body scroll */
  display: flex;
  align-items: stretch;
  /* Ensure children stretch to full height */
}

/* Sidebar independently scrollable */
.dsa-sidebar {
  /* Use flex-basis for width control */
  flex: 0 0 280px;
  height: 100%;
  /* Fill container */
  overflow-y: auto;
  background: var(--bg-elevated);
  /* Ensure background fills area */
  border-right: 1px solid var(--border-color);
}

/* Main content independently scrollable */
.dsa-main-content {
  height: 100%;
  overflow-y: auto;
  padding: 2rem 4rem;
}

/* ZERO PADDING on side of container if preferred? */
/* User complained about padding. Let's make it tight but readable. */
.dsa-layout-container {
  padding: 0;
}

/* Fix default Jekyll Header interference */
/* DSA layout is now standalone, so we don't need to hide site-header */

/* We don't have a body class easily. 
   BUT dsa-layout-container exists only on DSA pages. 
   We can style: body:has(.dsa-layout-container) .site-header { display: none; } 
   Support might vary. 
   Better: Add CSS to hide .site-header inside default layout conditional? No.
   
   Let's make dsa-top-bar z-index higher and overlapping?
   Or just accept site header is above dsa-top-bar?
   User said "breadcrumb is going away". 
   If site header scrolls, sticky top bar might be stuck to top of *window*.
   
   If we use fixed positioning for top bar, it stays. 
*/


/* ========================================
   DSA Refinements (Iter. 7 - Reset Default Layout)
   ======================================== */

.dsa-page {
  overflow: hidden;
  /* Important for fixed layout */
  height: 100vh;
}

.dsa-logo {
  font-weight: 700;
  margin-right: 2rem;
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.dsa-logo a {
  color: var(--accent-primary);
  text-decoration: none;
}


/* ========================================
   DSA Refinements (Iter. 8 - Toggle & Links)
   ======================================== */

/* Sidebar Toggle Button */
.dsa-sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  margin-right: 1rem;
  display: flex;
  align-items: center;
  border-radius: 4px;
}

.dsa-sidebar-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* Sidebar Collapsed State */
.dsa-layout-container.sidebar-collapsed .dsa-sidebar {
  display: none;
  /* Simplest collapse */
}

/* Sidebar Module Title Link/Toggle Split */
.dsa-module-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  /* Remove default list-style from summary if we use custom icon. 
     But we want standard arrow behavior for the toggle part? 
     Let's keep standard marker for the toggle part. */
}

.dsa-module-link {
  color: var(--text-primary);
  text-decoration: none;
  flex: 1;
  /* Make link click area large but not over the arrow if possible */
  padding: 0.25rem 0;
  transition: color 0.2s;
  font-weight: 600;
}

.dsa-module-link:hover {
  color: var(--accent-primary);
}

/* Hide default marker to replace with custom or just position properly?
   The user wants "All clicks register collapse", meaning the whole row is the SUMMARY.
   We put a link INSIDE. We must stop propagation on the link click.
   CSS can't do that, inline onclick is needed (added in HTML).
*/

.dsa-module-title::marker,
.dsa-module-title::-webkit-details-marker {
  /* Keep default marker or customize? 
     User said "Array section cannot be clicked".
     Let's keep the marker as the visual visual cue for expanding.
  */
}


/* Sidebar Link Clickability Fix */
.dsa-module-title a {
  pointer-events: auto;
  /* Ensure clickable */
  position: relative;
  z-index: 10;
}

/* Ensure the summary itself doesn't steal the click if possible (default behavior is fine usually) */
/* The 'onclick="event.stopPropagation()"' in HTML handles the logic. 
   We just need visually distinct hover states. */

.dsa-module-link:hover {
  text-decoration: underline;
}

/* Fix Collapsed Sidebar Transition */
.dsa-layout-container {
  transition: all 0.3s ease;
}

/* When collapsed, main content should take full width */
.dsa-layout-container.sidebar-collapsed .dsa-main-content {
  padding-left: 4rem;
  /* Keep some padding from edge */
  max-width: 100%;
  /* Ensure it fills */
}

/* Adjust button visual */
.dsa-sidebar-toggle svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   DSA Promo Button
   ======================================== */

.dsa-promo-btn {
  background: var(--accent-gradient);
  color: white !important;
  /* Override default nav link color */
  padding: 0.4rem 1rem !important;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600 !important;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dsa-promo-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
  text-decoration: none;
}

.dsa-badge {
  background: #ffffff;
  color: #3b82f6;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Module List Styling for Course Pages */
.dsa-module-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.dsa-module-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-elevated);
  padding: 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  transition: transform 0.2s, background 0.2s;
  border: 1px solid var(--border-color);
}

.dsa-module-item:hover {
  transform: translateX(4px);
  background: var(--bg-card);
  border-color: var(--accent-primary);
  text-decoration: none;
}

.dsa-item-order {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-tertiary);
  min-width: 40px;
}

.dsa-item-content {
  flex: 1;
}

.dsa-item-content h3 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.dsa-item-content p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.dsa-item-arrow {
  color: var(--accent-primary);
  font-weight: bold;
}

/* ========================================
   DSA Refinements (Iter. 9 - Sidebar Full Height)
   ======================================== */

/* Ensure proper flexbox layout for full height sidebar */
.dsa-layout-container {
  display: flex !important;
  /* Force flex */
  align-items: stretch;
  /* Stretch children to full height */
}

/* Ensure sidebar has background color covering the full height */
.dsa-sidebar {
  background: var(--bg-elevated);
  /* Match the darker theme */
  flex-shrink: 0;
  /* Prevent shrinking */
  height: 100% !important;
  /* Force height */
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
}

/* Ensure main content takes remaining space */
.dsa-main-content {
  flex-grow: 1;
  background: var(--bg-primary);
  /* Ensure distinct background */
}

/* Force overrides for Sidebar Height if previous rules failed */
.dsa-sidebar {
  min-height: 100% !important;
  box-sizing: border-box;
}

/* Ensure no other rule is overriding the background */
aside.dsa-sidebar {
  background-color: var(--bg-elevated) !important;
}

/* ========================================
   Mobile Responsive Optimizations
   ======================================== */

/* --- Mobile Breakpoints ---
   - Small phones: max-width 480px
   - Regular phones: max-width 768px
   - Tablets: max-width 1024px
   ======================================== */

/* --- Mobile Sidebar Overlay (Off-canvas Drawer) --- */
@media (max-width: 768px) {

  /* Hide sidebar by default on mobile, show as overlay when toggled */
  .dsa-sidebar {
    position: fixed !important;
    top: 60px;
    /* Below the top nav bar */
    left: 0;
    width: 85vw;
    max-width: 320px;
    height: calc(100vh - 60px);
    max-height: none;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    border-radius: 0;
    border-right: 1px solid var(--border-color);
  }

  /* Show sidebar when container has active class */
  .dsa-layout-container.sidebar-open .dsa-sidebar {
    transform: translateX(0);
  }

  /* Overlay backdrop when sidebar is open */
  .dsa-layout-container.sidebar-open::before {
    content: '';
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(2px);
  }

  /* Main content takes full width */
  .dsa-main-content {
    width: 100% !important;
    padding: 1rem !important;
    margin: 0 !important;
  }

  /* Make hamburger button always visible */
  .dsa-sidebar-toggle {
    display: flex !important;
  }
}

/* Ensure toggle button styling on mobile */
@media (max-width: 768px) {
  .dsa-top-bar {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .dsa-logo {
    font-size: 0.9rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .breadcrumb-nav {
    display: none;
    /* Hide breadcrumbs on mobile - too cramped */
  }
}

/* --- Touch-friendly Tap Targets (44px minimum) --- */
@media (max-width: 768px) {
  .dsa-problem-list li a {
    padding: 1rem 1.25rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .dsa-module summary {
    padding: 1rem 1.25rem;
    min-height: 48px;
  }

  .dsa-nav-btn {
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    min-height: 48px;
  }

  .nav-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .dsa-nav-btn {
    text-align: center;
    justify-content: center;
  }

  .tag-link,
  .tag {
    padding: 0.6rem 1rem;
    min-height: 40px;
  }

  /* Site navigation */
  .site-nav {
    gap: 1rem;
  }

  .site-nav .nav-link {
    padding: 0.5rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* --- Responsive Typography --- */
@media (max-width: 768px) {
  .dsa-title {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .dsa-body h1,
  .post-content h1 {
    font-size: 1.5rem;
  }

  .dsa-body h2,
  .post-content h2 {
    font-size: 1.25rem;
    padding-bottom: 0.3rem;
  }

  .dsa-body h3,
  .post-content h3 {
    font-size: 1.1rem;
  }

  .dsa-body,
  .post-content {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .dsa-body p,
  .post-content p {
    margin-bottom: 1.25rem;
  }
}

/* --- Responsive Code Blocks --- */
@media (max-width: 768px) {

  .post-content pre,
  .dsa-body pre {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    padding: 1rem;
    font-size: 0.8rem;
  }

  .post-content pre code,
  .dsa-body pre code {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  /* Allow horizontal scroll for long code lines */
  .post-content pre,
  .dsa-body pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Inline code */
  .post-content code,
  .dsa-body code {
    font-size: 0.85em;
    padding: 0.15rem 0.4rem;
    word-break: break-word;
  }
}

/* --- Featured Post Mobile --- */
@media (max-width: 768px) {
  .featured-post {
    grid-template-columns: 1fr;
  }

  .featured-image {
    min-height: 200px;
  }

  .featured-content {
    padding: 1.5rem;
  }

  .featured-title {
    font-size: 1.35rem;
  }
}

/* --- Post Grid Mobile --- */
@media (max-width: 768px) {
  .post-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .post-card-content {
    padding: 1.25rem 1.5rem 1.5rem;
  }

  .post-card-title {
    font-size: 1.25rem;
  }

  .post-card-image {
    height: 180px;
  }
}

/* --- Series Carousel Mobile --- */
@media (max-width: 768px) {
  .series-card {
    width: 240px;
  }

  .carousel-btn {
    display: none;
    /* Hide arrows on mobile, rely on swipe */
  }

  .series-carousel {
    padding: 0 1rem;
    margin: 0 -1rem;
  }
}

/* --- DSA Chips Mobile --- */
@media (max-width: 768px) {
  .dsa-meta {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .dsa-chip {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
  }
}

/* --- Article Images Mobile --- */
@media (max-width: 768px) {

  .post-content img,
  .dsa-body img {
    max-width: calc(100% + 2rem);
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
    border-radius: 0;
  }

  /* Keep alt text / captions readable */
  .post-content img+em,
  .dsa-body img+em {
    display: block;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding: 0 1rem;
  }
}

/* --- Footer Mobile --- */
@media (max-width: 768px) {
  .footer-wrapper {
    flex-direction: column;
    text-align: center;
  }

  .social-links {
    justify-content: center;
  }
}

/* --- Very Small Phones (max-width 480px) --- */
@media (max-width: 480px) {
  .site-title {
    font-size: 1rem;
  }

  .site-nav {
    gap: 0.75rem;
  }

  .site-nav .nav-link {
    font-size: 0.8rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .wrapper {
    padding: 1.5rem 0.75rem;
  }

  .dsa-sidebar {
    width: 90vw;
  }

  .post-content pre,
  .dsa-body pre {
    font-size: 0.75rem;
  }
}

/* --- Landscape Phone Adjustments --- */
@media (max-height: 500px) and (orientation: landscape) {
  .dsa-sidebar {
    top: 50px;
    height: calc(100vh - 50px);
  }

  .dsa-top-bar {
    padding: 0.5rem 1rem;
  }
}

/* --- Print Styles --- */
@media print {

  .dsa-sidebar,
  .dsa-top-bar,
  .dsa-footer-nav,
  .site-nav,
  .dsa-sidebar-toggle {
    display: none !important;
  }

  .dsa-main-content {
    width: 100% !important;
    padding: 0 !important;
  }

  .post-content pre,
  .dsa-body pre {
    white-space: pre-wrap;
    word-wrap: break-word;
  }
}

/* --- Mobile Sidebar Display Fix --- */
@media (max-width: 768px) {
  .dsa-sidebar {
    display: block !important;
    /* Ensure sidebar is not hidden on mobile */
  }
}

/* ========================================
   Mobile Header & Breadcrumb Refinements
   ======================================== */

/* --- Mobile Top Bar and Breadcrumbs --- */
@media (max-width: 768px) {

  /* Clean top bar layout */
  .dsa-top-bar {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
  }

  /* Toggle button styling */
  .dsa-sidebar-toggle {
    flex-shrink: 0;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
  }

  /* Logo - hide most of it on mobile */
  .dsa-logo {
    font-size: 0.85rem;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Hide "A Dev Writes /" on mobile, just show course name */
  .dsa-logo a:first-child {
    display: none;
  }

  /* Breadcrumbs - make them wrap better or hide some parts */
  .dsa-breadcrumbs {
    width: 100%;
    order: 10;
    /* Move to bottom of top bar */
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: 0.25rem;
  }

  .dsa-breadcrumbs ol {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    font-size: 0.75rem;
    gap: 0.25rem;
    padding-bottom: 0.25rem;
  }

  .dsa-breadcrumbs ol::-webkit-scrollbar {
    display: none;
  }

  .dsa-breadcrumbs ol li {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Hide "Home" breadcrumb on mobile - it's implied */
  .dsa-breadcrumbs ol li:first-child {
    display: none;
  }

  /* Hide the second breadcrumb (course name) on mobile - already in logo */
  .dsa-breadcrumbs ol li:nth-child(2) {
    display: none;
  }

  /* Separator styling */
  .dsa-breadcrumbs ol li:not(:last-child)::after {
    margin: 0 0.25rem;
    font-size: 0.65rem;
  }

  /* Current page (last item) styling */
  .dsa-breadcrumbs ol li[aria-current="page"] {
    color: var(--text-primary);
    font-weight: 500;
  }
}

/* --- Very Small Phones (480px and below) --- */
/* --- Very Small Phones (480px and below) --- */
@media (max-width: 480px) {
  .dsa-top-bar {
    padding: 0.5rem;
  }

  /* Reduce typography scaling for small screens */
  .dsa-logo {
    font-size: 0.8rem;
  }

  /* Make the page title more prominent */
  .dsa-title {
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
  }

  .dsa-meta {
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }
}

/* --- Alternative: Collapsed Breadcrumb Style --- */
/* For larger phones (481-768px), show abbreviated breadcrumbs */
@media (min-width: 481px) and (max-width: 768px) {

  /* Show only Module + Current page */
  .dsa-breadcrumbs ol li {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dsa-breadcrumbs ol li[aria-current="page"] {
    max-width: none;
    font-weight: 600;
  }
}

/* ========================================
   Fix: Mobile Top Bar Height & Content Clearance
   ======================================== */

@media (max-width: 768px) {

  /* Make top bar height auto to accommodate wrapped breadcrumbs */
  .dsa-top-bar {
    height: auto !important;
    position: sticky !important;
    top: 0;
    z-index: 100;
  }

  /* Add padding to main content to prevent overlap */
  .dsa-layout-container {
    padding-top: 0 !important;
  }

  .dsa-main-content {
    padding-top: 1.5rem !important;
  }

  /* Better breadcrumb styling for mobile - single line with horizontal scroll */
  .dsa-breadcrumbs {
    width: 100%;
    order: 10;
    padding: 0.5rem 0 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dsa-breadcrumbs ol {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    white-space: nowrap;
    padding: 0;
    margin: 0;
  }
}

/* --- Final Mobile Overrides --- */
@media (max-width: 768px) {

  /* Reduce content padding to give more room for text */
  .dsa-main-content {
    padding: 1rem;
  }

  /* Stack footer buttons vertically so "Next" is always visible and easy to tap */
  .nav-buttons {
    flex-direction: column;
    gap: 1rem;
  }

  .dsa-nav-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    /* Ensure padding doesn't overflow width */
  }

  /* Full bleed footer on mobile DSA pages */
  .dsa-main-content .promo-footer {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* ========================================
   Promo Footer
   ======================================== */
.promo-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  margin-top: 4rem;
}

/* Specific Override for DSA Course Layout:
   Make footer full-width (bleed across padding) to touch sidebar */
.dsa-main-content .promo-footer {
  margin-left: -4rem;
  margin-right: -4rem;
  padding-left: 4rem;
  padding-right: 4rem;
  width: auto;
  border-radius: 0;
}

.promo-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
}

.promo-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.promo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.promo-list li {
  margin-bottom: 0.75rem;
}

.promo-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.promo-list a:hover {
  color: var(--accent-primary);
}

.promo-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  background: var(--accent-subtle);
  color: var(--accent-primary);
  border-radius: 12px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-tag {
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
}

.footer-tag:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--bg-card);
}

.promo-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.promo-link-arrow {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.promo-link-arrow:hover {
  text-decoration: underline;
}

/* Fix mobile padding in promo footer */
@media (max-width: 768px) {
  .promo-footer {
    padding: 2rem 0;
  }

  .promo-wrapper {
    gap: 2rem;
  }
}
/* ========================================
   Tooltip (Glossary Terms)
   ======================================== */

.term-tooltip {
  cursor: help;
  border-bottom: 1px dotted var(--accent-primary);
  color: var(--accent-primary);
  position: relative;
  display: inline-block;
  font-weight: 500;
}

.term-tooltip:hover,
.term-tooltip:focus {
  text-decoration: none;
}

/* Tooltip Box (Definition) */
.term-tooltip::before {
  content: attr(data-definition);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  line-height: 1.5;
  width: max-content;
  max-width: 280px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  white-space: normal;
  text-align: center;
}

/* Tooltip Arrow */
.term-tooltip::after {
  content: '';
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  border-width: 6px;
  border-style: solid;
  border-color: var(--bg-elevated) transparent transparent transparent;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

/* Reveal on Hover or Focus (Tap on mobile) */
.term-tooltip:hover::before,
.term-tooltip:focus::before,
.term-tooltip:hover::after,
.term-tooltip:focus::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Ensure focus outline is distinct or suppressed if styling handles it */
.term-tooltip:focus {
  outline: none;
  background: rgba(59, 130, 246, 0.1);
  border-radius: var(--radius-sm);
}

/* ========================================
   Standardized Flashcard CSS - Fixes Overflow Issues
   ======================================== */
.flashcard-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 1.5rem !important;
    margin: 2rem 0 !important;
}

.flashcard {
    background-color: transparent !important;
    width: 100% !important;
    /* Height is determined by content */
    perspective: 1000px !important;
    cursor: pointer !important;
}

.flashcard-inner {
    position: relative !important;
    width: 100% !important;
    /* Use Grid for stacking faces to allow auto-height */
    display: grid !important;
    grid-template-areas: "stack" !important;

    transition: transform 0.6s !important;
    transform-style: preserve-3d !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3) !important;
    border-radius: 12px !important;
}

.flashcard-front, .flashcard-back {
    grid-area: stack !important;
    position: relative !important; /* Changed from absolute to relative for auto-sizing */
    width: 100% !important;

    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
    border-radius: 12px !important;
    padding: 1.5rem !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
}

.flashcard-front {
    background-color: #1f2937 !important;
    color: #60a5fa !important;
    border: 1px solid #374151 !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    /* Ensure front doesn't collapse if empty, though unlikely */
    min-height: 220px !important;
}

.flashcard-back {
    background-color: #111827 !important;
    color: #e5e7eb !important;
    border: 1px solid #374151 !important;
    transform: rotateY(180deg) !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
    min-height: 220px !important;
}
