@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&family=Merriweather:wght@300;400;700&display=swap");

:root {
  --primary: #dc3232;
  --primary-hover: #ba1f1f;
  --text: #f9f9f7;
  --text-secondary: #dbdbdb;
  --bg: #000;
  --surface: #111;
  --surface-light: #222;
  --gap: 2rem;
  --radius: 0.5rem;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --content-width: 740px;
  --content-padding: 2rem;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header styles */
.blog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: #000; /* Force black background for header */
  border-bottom: 1px solid var(--surface-light);
}

.logo {
  height: 40px;
  width: auto;
}

/* Hide mobile logo by default */
.logo-mobile {
  display: none;
}

/* Show mobile logo on screens smaller than 768px */
@media (max-width: 767px) {
  .logo-desktop {
    display: none;
  }

  .logo-mobile {
    display: inline;
  }
}


.logo-white {
  display: none;
}

.logo-black {
  display: inline;
}

/* On mobile: show white logo, hide black logo */
@media (max-width: 768px) {
  .logo-white {
    display: inline;
  }

  .logo-black {
    display: none;
  }
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff; /* Force white color for menu toggle */
  font-size: 1.5rem;
  cursor: pointer;
}

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

.desktop-nav a {
  color: #fff; /* Force white color for nav links */
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.desktop-nav a:hover {
  color: var(--primary);
}

/* Blog Container */
.blog-container {
  overflow-x: hidden; 
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

/* Blog Post */
.blog-post {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

/* Post Header */
.post-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--surface-light);
}

.post-header h1 {
  font-size: 2.5rem;
  line-height: 1.3;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.post-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Mobile Navigation */
 .bars { 
    display: none;
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    cursor: pointer;
}

.fa-bars {
    font-size: 2rem;
    color: var(--text);
    opacity: .8;
}

/* Mobile Menu (Initially hidden) */
#mobile-links {
    display: none;
    position: fixed;
    text-align: right;
    background-color: var(--bg);
    width: 100vw; 
    height: 100vh; 
    z-index: 15;
}

.mobile-links-container {
    margin: 0 auto;
    padding: 1rem;
}mobile-links-container {
    margin: 0 auto;
    padding: 1rem;
}

.mobile {
    font-size: 1.5rem;
    line-height: 3;
}

.mobile a {
    color: var(--text);
    display: block;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}

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

/* Hide desktop links and show hamburger on mobile */
@media only screen and (max-width: 850px) {
    .bars {
        display: block;
    }
    
    .linksB {
        display: none;
    }
}

/* Additional responsive adjustments */
@media only screen and (max-width: 640px) {
    .blog-header {
        padding: 1rem;
    }
    
    .logo {
        height: 30px;
    }
}

/* Share section styles */
.share-section {
  margin: 2rem 0;
  text-align: center;
}

.share-section h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

#share-buttons {
  display: flex;
  justify-content: center;
  gap: 8rem; /* Increased from 4rem to 8rem */
}


.share-button {
  color: #000; /* Black icons on desktop */
  font-size: 1.5rem; /* Increased from 1.25rem */
  transition: transform 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
}

.share-button:hover {
  transform: translateY(-3px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .share-button {
    color: #fff; /* White icons on mobile */
  }
}

/* Table of Contents */
.table-of-contents {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0 3rem;
  border-left: 4px solid var(--primary);
}

.table-of-contents h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.table-of-contents ul {
  list-style: none;
}

.table-of-contents li {
  margin-bottom: 0.5rem;
}

.table-of-contents a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
  display: block;
  padding: 0.3rem 0;
}

.table-of-contents a:hover {
  color: var(--primary);
}

/* Post Content */
.post-content {
  margin-bottom: 4rem;
}

.content-wrapper {
  max-width: 100% !important;
  padding: 0 1rem;
}

.post-content h2 {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--surface-light);
}

.post-content h3 {
  font-size: 1.4rem;
  margin: 2rem 0 1rem;
}

 p {
    text-align: justify;
    hyphens: auto;
  }

  code:not(.code-block) {
    word-break: break-word;
    white-space: pre-wrap;
  }

.post-content p {
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.lead-paragraph {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  color: var(--text);
}

/* Lists */
.feature-list {
  margin: 1.5rem 0 2rem 1.5rem;
}

.feature-list li {
  margin-bottom: 0.8rem;
  position: relative;
  padding-left: 1.5rem;
}

.feature-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
}

/* Code Blocks */
.code-container {
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
  border: 1px solid #333;
}

.code-header {
  padding: 12px 20px;
  background: #252525;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #333;
}

.code-filename {
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

.code-block {
  padding: 1.5rem;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  line-height: 1.5;
  font-size: 0.9rem;
  background: #1a1a1a;
  margin: 0;
}

.code-explanation {
  padding: 1.5rem;
  background: #252525;
  border-top: 1px solid #333;
}

.copy-button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
  font-size: 0.8rem;
}

.copy-button:hover {
  opacity: 0.9;
}

/* Syntax Highlighting */
.hl-keyword {
  color: #569cd6;
}

.hl-function {
  color: #dcdcaa;
}

.hl-comment {
  color: #6a9955;
}

.hl-error {
  color: #f14c4c;
}

/* Quotes */
.funny-quote {
  font-size: 1.3rem;
  line-height: 1.6;
  border-left: 4px solid var(--primary);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
}

.highlight-quote {
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  font-size: 1.4rem;
  line-height: 1.6;
  text-align: center;
  margin: 3rem 0;
  font-style: italic;
  position: relative;
}

.highlight-quote::before,
.highlight-quote::after {
  content: '"';
  font-size: 3rem;
  color: var(--primary);
  position: absolute;
  opacity: 0.3;
}

.highlight-quote::before {
  top: 0;
  left: 10px;
}

.highlight-quote::after {
  bottom: -20px;
  right: 10px;
}

/* Images */
.content-image {
  margin: 2rem 0;
}

.full-width-image {
  max-width: 100%;
  height: auto;
}

figcaption {
  text-align: center;
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Info Box */
.info-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
  border-left: 4px solid #4a9eff;
}

.info-box h3 {
  color: #4a9eff;
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Two Column Layout */
.two-column-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

.column h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Lesson Cards */
.lesson-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 2rem 0;
}

.lesson-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  height: 100%;
}

.lesson-card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* CTA Section */
.cta-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  margin: 3rem 0;
}

.cta-section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  border-bottom: none;
}

.cta-button {
  margin-top: 2rem;
}

.cta-button button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 50px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

.cta-button button:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
}

.disclaimer {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 1rem;
}

/* Post Footer */
.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--surface-light);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.tag {
  background: var(--surface);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.9rem;
}

.author-bio {
  display: flex;
  gap: 1.5rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

.author-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.author-info h3 {
  margin-top: 0;
  margin-bottom: 0.8rem;
}

.post-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
}

.prev-post,
.next-post {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.prev-post:hover,
.next-post:hover {
  color: var(--primary);
}

/* Footer styles */
.blog-footer {
  padding: 3rem 1.5rem;
  text-align: center;
  border-top: 1px solid var(--surface-light);
  margin-top: 4rem;
  background-color: var(--bg);
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.footer-nav a {
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.social-links a {
  color: #333; /* Black icons on desktop (light mode) */
  font-size: 1.25rem;
  transition: transform 0.2s;
}

.social-links a:hover {
  transform: translateY(-3px);
}

.copyright {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Container for centering content */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .blog-header {
    padding: 1rem;
  }
  
  .desktop-nav {
    display: none;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .post-header h1 {
    font-size: 1.8rem;
  }
  
  .post-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .share-button, .social-links a {
    color: #fff; /* White icons on mobile (dark mode) */
  }
  
  .footer-nav {
    gap: 1.5rem;
  }
  
  .blog-post {
    max-width: 100%;
    padding: 1rem;
  }
  
  .code-block {
    font-size: 0.8rem;
    padding: 1rem;
  }
  
  .two-column-layout,
  .stats-grid,
  .lesson-list {
    grid-template-columns: 1fr;
  }
  
  .author-bio {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .post-navigation {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

 body {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .code-block {
    white-space: pre-wrap;
    word-break: break-all;
  }

  p, li, td {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
  }

  .code-filename {
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
  .share-button, .social-links a {
    color: #fff; /* White icons in dark mode */
  }
}

/* Light Mode Support */
@media (prefers-color-scheme: light) {
  :root {
    --text: #333;
    --text-secondary: #666;
    --bg: #fff;
    --surface: #f5f5f5;
    --surface-light: #eaeaea;
  }

  .code-container {
    margin-left: -1rem;
    margin-right: -1rem;
    border-radius: 0;
    width: calc(100% + 2rem); 
  }

  .code-header {
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
  }

  .code-block {
    background: #f8f8f8;
    color: #333;
  }

  .code-explanation {
    background: #f0f0f0;
    border-top: 1px solid #ddd;
  }

  /* Syntax Highlighting for Light Mode */
  .hl-keyword {
    color: #0000ff;
  }

  .hl-function {
    color: #795e26;
  }

  .hl-comment {
    color: #008000;
  }

  .hl-error {
    color: #ff0000;
  }
  
  /* Keep share and social icons black in light mode on desktop */
  .share-button, .social-links a {
    color: #333;
  }
  
  /* But make them white on mobile even in light mode */
  @media (max-width: 768px) {
    .share-button, .social-links a {
      color: #fff;
    }
  }
}

/* Mobile Optimization */
@media (max-width: 768px) {
  .blog-header {
    padding: 0.75rem 1rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
  }

  .blog-container {
    margin-top: 5rem;
    padding: 0 1rem;
  }

  .post-header h1 {
    font-size: 1.8rem;
    line-height: 1.25;
    margin-bottom: 1rem;
  }

  .post-meta {
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
  }

  #share-buttons {
    gap: 1.5rem; /* Reduced from 8rem to 1.5rem */
    flex-wrap: wrap;
    padding: 0 1rem; /* Added some padding */
  }

  .table-of-contents {
    margin: 1.5rem 0;
    padding: 1rem;
  }

  .stats-grid,
  .lesson-list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .two-column-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .code-block {
    font-size: 0.8rem;
    padding: 1rem;
  }

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

  .author-image {
    margin-bottom: 1rem;
  }

  .post-navigation {
    flex-direction: column;
    gap: 1rem;
  }

  .footer-nav {
    flex-direction: column;
    gap: 1rem;
  }

#mobile-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 99;
    padding-top: 5rem;
    text-align: center;
}

  .mobile a {
    font-size: 1.25rem;
    line-height: 2;
    padding: 0.5rem 0;
  }

  .cta-section {
   padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .post-header h1 {
    font-size: 1.6rem;
  }

  .mobile a {
    font-size: 1.1rem;
  }

  .share-button {
    min-width: 2rem; /* Slightly smaller tap targets */
    min-height: 2rem;
    font-size: 1.25rem; /* Slightly smaller icons */
    margin: 0.25rem; /* Small margin between buttons */
  }

  .code-block {
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
    .bars {
        display: block;
    }
    
    .linksB {
        display: none;
    }
    
    .blog-header {
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 1000;
        padding: 0.75rem 1rem;
    }
    
    .blog-container {
        margin-top: 5rem;
    }
    
    .mobile {
        font-size: 1.3rem;
        line-height: 2.5;
    }
}

/* Add these rules to your CSS file */
/* ================================================ */
/* Global Overflow Prevention */
*, *::before, *::after {
  box-sizing: border-box;
  max-width: 100%;
}

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

/* Mobile-Specific Fixes */
@media (max-width: 768px) {
  /* Force all elements to stay within viewport */
  html, body {
    width: 100vw;
    overflow-x: hidden;
  }
  
  /* Code Block Scrolling */
  .code-container {
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
    border-radius: 0;
  }

  .code-block {
    white-space: pre;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    word-break: keep-all;
    padding: 1rem;
    font-size: 0.8rem;
  }

  /* Text Content Handling */
  .post-content {
    p, li, td {
      overflow-wrap: anywhere;
      hyphens: auto;
      word-break: break-word;
    }

    pre, code {
      overflow-x: auto;
      white-space: pre;
    }
  }

  /* Special Cases */
  .two-column-layout,
  .stats-grid,
  .lesson-list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Code Block Styling */
.code-container {
  background: #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  margin: 2rem 0;
}

.code-block {
  display: block;
  font-family: 'Courier New', monospace;
  line-height: 1.5;
  padding: 1.5rem;
  overflow-x: auto;
}

/* Horizontal Scrollbar Styling */
.code-block::-webkit-scrollbar {
  height: 8px;
  background: #252525;
}

.code-block::-webkit-scrollbar-thumb {
  background: #dc3232;
  border-radius: 4px;
}

/* Text Content Safety */
.post-content {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;

  p {
    max-width: 100%;
    overflow-wrap: break-word;
  }
}


/* Desktop Header Styles - ONLY these changes are needed */
@media (min-width: 851px) {
  .blog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background-color: #fff; /* White background for desktop header */
    border-bottom: none;
  }

  .header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .logo {
    height: 40px;
    width: auto;
  }

  /* Show black logo on desktop */
  .logo-white {
    display: none;
  }

  .logo-black {
    display: inline;
  }

  /* Desktop navigation styling */
  .linksB {
    display: flex;
    list-style: none;
    gap: 2rem;
  }

  .linksB li a {
    color: #333; /* Dark text for links */
    text-decoration: none;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
    transition: color 0.2s;
  }

  .linksB li a:hover {
    color: var(--primary);
  }
}
/* ================================================ */
