/* Reset + basics */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Poppins:wght@500;600;700&display=swap');

:root {
  --max-width: 1200px;
  --container-padding: 1rem;
  --header-height: 70px;
  --transition-speed: 0.3s;

  /* Color Variables */
  --primary-color: #0066cc;
  --primary-hover: #004c99;
  --light-bg: #f8f9fa;
  --dark-bg: #121212;
  --text-light: #212529;
  --text-gray: #495057;
  --border-color: #dee2e6;

  /* Font Stack */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-body);
  background-color: var(--light-bg);
  color: var(--text-light);
  line-height: 1.6;
  font-size: clamp(16px, 1vw + 14px, 18px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Main content */
main {
  flex: 1;
  width: 100%;
  padding: 3rem 0;
}

main .container {
  max-width: 1000px;
}

/* Wider container for specific layouts */
main .container.wide {
  max-width: var(--max-width);
}

/* Links */
a {
  color: #0066cc;
  text-decoration: none;
  transition: color var(--transition-speed);
}

a:hover {
  color: #004c99;
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #ffffff;
  border-bottom: 1px solid #dee2e6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-speed);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding-top: 1rem;
  padding-bottom: 1rem;
  gap: 1rem;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #212529;
  white-space: nowrap;
  flex-shrink: 0;
}

.site-title:hover {
  text-decoration: none;
  color: #0066cc;
}

/* Header controls wrapper */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* Dark mode toggle */
.dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  color: #212529;
  transition: color var(--transition-speed), transform var(--transition-speed);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: 0.25rem;
}

.dark-mode-toggle:hover {
  transform: scale(1.1);
}

.dark-mode-toggle:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
}

.dark-mode-toggle svg {
  width: 20px;
  height: 20px;
}

/* Navigation */
.main-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.main-nav a {
  color: #495057;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  transition: color var(--transition-speed);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.main-nav a:hover {
  color: #0066cc;
  text-decoration: none;
}

.main-nav a.active {
  color: #0066cc;
  font-weight: 600;
}

/* Hamburger menu */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  z-index: 1001;
  flex-shrink: 0;
}

.hamburger:focus-visible {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
  border-radius: 4px;
}

.hamburger-icon,
.hamburger-icon::before,
.hamburger-icon::after {
  display: block;
  width: 25px;
  height: 3px;
  background-color: #212529;
  border-radius: 3px;
  transition: all var(--transition-speed);
}

.hamburger-icon {
  position: relative;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger-icon::before {
  top: -8px;
}

.hamburger-icon::after {
  bottom: -8px;
}

.hamburger.active .hamburger-icon {
  background-color: transparent;
}

.hamburger.active .hamburger-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.hamburger.active .hamburger-icon::after {
  bottom: 0;
  transform: rotate(-45deg);
}

/* Footer */
.footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 2rem 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.footer-links a {
  color: #495057;
  font-size: 0.9rem;
  padding: 0.25rem 0.5rem;
}

.footer-links a:hover {
  color: #0066cc;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.75em;
  font-weight: 600;
  letter-spacing: -0.5px;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin-top: 0;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  margin-top: 2.5em;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-top: 2em;
}

p, ul, ol {
  margin-bottom: 1.5rem;
  max-width: 70ch;
}

ul, ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Article/Post content wrapper */
article {
  margin-bottom: 2rem;
}

.post-content,
.blog-post-content {
  line-height: 1.75;
}

/* Content elements */
blockquote {
  border-left: 4px solid #0066cc;
  padding: 1.25rem 1.75rem;
  margin: 2rem 0;
  background-color: #f8f9fa;
  color: #495057;
  font-style: italic;
  max-width: 70ch;
}

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

pre {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 1.25rem;
  overflow-x: auto;
  margin: 2rem 0;
  font-size: 0.9em;
  line-height: 1.5;
}

code {
  background-color: #f8f9fa;
  padding: 0.2em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

pre code {
  background: none;
  padding: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2.5rem auto;
  border-radius: 8px;
}

hr {
  border: none;
  border-top: 2px solid #dee2e6;
  margin: 3rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  overflow-x: auto;
  display: block;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border: 1px solid #dee2e6;
}

th {
  background-color: #f8f9fa;
  font-weight: 600;
}

tbody tr:hover {
  background-color: #f8f9fa;
}

/* Home page styles */
.home-section {
  margin-bottom: 3rem;
}

.home-section h1 {
  margin-bottom: 1rem;
}

.home-section > p {
  font-size: 1.1rem;
  color: #495057;
  margin-bottom: 2rem;
  max-width: 60ch;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.tool-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  transition: all var(--transition-speed);
  text-decoration: none;
}

.tool-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  text-decoration: none;
  border-color: #0066cc;
}

.tool-card h2 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem 0;
  color: #212529;
}

.tool-card p {
  font-size: 0.95rem;
  color: #6c757d;
  margin: 0;
  max-width: none;
}

/* Breadcrumbs */
.breadcrumbs {
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

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

.breadcrumbs li {
  display: flex;
  align-items: center;
  margin: 0;
}

.breadcrumbs li + li::before {
  content: '›';
  margin: 0 0.5rem;
  color: #6c757d;
  font-size: 1.1rem;
}

.breadcrumbs a {
  color: #6c757d;
  text-decoration: none;
  transition: color var(--transition-speed);
}

.breadcrumbs a:hover {
  color: #0066cc;
  text-decoration: none;
}

.breadcrumbs li[aria-current="page"] {
  color: #495057;
  font-weight: 500;
}

/* Category and Tag Badges */
.category-badge,
.tag-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 4px;
  text-decoration: none;
  transition: all var(--transition-speed);
  white-space: nowrap;
}

.category-badge {
  background-color: #0066cc;
  color: #ffffff;
}

.category-badge:hover {
  background-color: #004c99;
  color: #ffffff;
  text-decoration: none;
  transform: translateY(-1px);
}

.tag-badge {
  background-color: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
}

.tag-badge:hover {
  background-color: #e9ecef;
  color: #212529;
  border-color: #0066cc;
  text-decoration: none;
  transform: translateY(-1px);
}

/* Post Meta */
.post-meta,
.post-meta-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 1rem;
}

.post-meta-preview {
  margin-top: 0.5rem;
}

.meta-separator {
  color: #dee2e6;
  margin: 0 0.25rem;
}

.post-categories,
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.post-taxonomies {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #dee2e6;
}

/* Post list styles */
.post-list article {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #dee2e6;
}

.post-list article:last-child {
  border-bottom: none;
}

.post-title-preview {
  margin: 0.5rem 0 0.5rem 0;
  font-size: 1.5rem;
}

.post-title-preview a {
  color: #212529;
  text-decoration: none;
}

.post-title-preview a:hover {
  color: #0066cc;
  text-decoration: none;
}

.post-thumbnail {
  width: 100%;
  max-width: 300px;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.read-more {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 500;
  color: #0066cc;
  text-decoration: none;
}

.read-more:hover {
  color: #004c99;
  text-decoration: underline;
}

.year-section {
  font-size: 1.5rem;
  margin: 2rem 0 1.5rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #dee2e6;
}

/* Blog Layout (Main + Sidebar) */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  align-items: start;
}

.blog-main {
  min-width: 0;
}

/* Blog Sidebar */
.blog-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
}

.sidebar-widget {
  margin-bottom: 2rem;
}

.sidebar-widget:last-child {
  margin-bottom: 0;
}

.sidebar-title {
  font-size: 1.1rem;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #dee2e6;
  color: #212529;
}

.recent-posts-list,
.categories-list,
.archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-posts-list li,
.categories-list li,
.archive-list li {
  margin-bottom: 0.75rem;
}

.recent-posts-list a,
.categories-list a,
.archive-list a {
  color: #495057;
  text-decoration: none;
  transition: color var(--transition-speed);
}

.recent-posts-list a:hover,
.categories-list a:hover,
.archive-list a:hover {
  color: #0066cc;
  text-decoration: none;
}

.recent-posts-list small {
  display: block;
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.25rem;
}

.sidebar-widget .count {
  color: #6c757d;
  font-size: 0.85rem;
}

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

.tags-cloud .tag-badge {
  margin: 0;
}

/* Smooth scrollbar for sidebar */
.blog-sidebar::-webkit-scrollbar {
  width: 6px;
}

.blog-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.blog-sidebar::-webkit-scrollbar-thumb {
  background: #dee2e6;
  border-radius: 3px;
}

.blog-sidebar::-webkit-scrollbar-thumb:hover {
  background: #adb5bd;
}

/* Table of Contents */
.table-of-contents {
  padding: 1rem 0;
  margin: 2rem 0;
  position: relative;
}

.table-of-contents h2 {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: #495057;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.toc-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: #495057;
  font-size: 1.25rem;
  transition: transform var(--transition-speed);
  min-width: 32px;
  min-height: 32px;
}

.toc-toggle:hover {
  color: #212529;
}

.toc-toggle.collapsed {
  transform: rotate(-90deg);
}

.table-of-contents nav {
  transition: max-height var(--transition-speed), opacity var(--transition-speed);
  overflow: hidden;
}

.table-of-contents.collapsed nav {
  max-height: 0;
  opacity: 0;
}

.table-of-contents ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

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

.table-of-contents li ul {
  padding-left: 1.25rem;
  margin-top: 0.25rem;
}

.table-of-contents a {
  color: #0066cc;
  text-decoration: none;
  display: inline-block;
  padding: 0.25rem 0;
  transition: all var(--transition-speed);
  border-left: 2px solid transparent;
  padding-left: 0.5rem;
  margin-left: -0.5rem;
}

.table-of-contents a:hover {
  color: #004c99;
  border-left-color: #0066cc;
}

.table-of-contents a.active {
  color: #004c99;
  border-left-color: #0066cc;
  font-weight: 600;
}

body.dark-mode {
  background-color: #121212;
  color: #f8f9fa;
}

body.dark-mode a {
  color: #8ab4f8;
}

body.dark-mode a:hover {
  color: #adc6ff;
}

body.dark-mode a:focus-visible {
  outline-color: #8ab4f8;
}

body.dark-mode .header {
  border-color: #343a40;
  background-color: #1a1a1a;
}

body.dark-mode .site-title {
  color: #f8f9fa;
}

body.dark-mode .site-title:hover {
  color: #8ab4f8;
}

body.dark-mode .dark-mode-toggle {
  color: #f8f9fa;
}

body.dark-mode .main-nav a {
  color: #adb5bd;
}

body.dark-mode .main-nav a:hover,
body.dark-mode .main-nav a.active {
  color: #8ab4f8;
}

body.dark-mode .hamburger-icon,
body.dark-mode .hamburger-icon::before,
body.dark-mode .hamburger-icon::after {
  background-color: #f8f9fa;
}

body.dark-mode .footer {
  background-color: #1a1a1a;
  border-top-color: #343a40;
}

body.dark-mode .footer-links a {
  color: #adb5bd;
}

body.dark-mode .footer-links a:hover {
  color: #8ab4f8;
}

body.dark-mode blockquote {
  border-left-color: #8ab4f8;
  background-color: #1a1a1a;
  color: #adb5bd;
}

body.dark-mode pre {
  background-color: #212529;
  border-color: #495057;
  color: #f8f9fa;
}

body.dark-mode code {
  background-color: #212529;
  color: #f8f9fa;
}

body.dark-mode th, body.dark-mode td {
  border-color: #495057;
}

body.dark-mode .blog-post-nav {
  border-top-color: #343a40;
}

body.dark-mode .table-of-contents h2 {
  color: #adb5bd;
}
body.dark-mode .table-of-contents li a {
  color: #8ab4f8; /* Lighter blue for dark mode */
}

body.dark-mode .summary {
  color: #adb5bd;
}

body.dark-mode .blog-post .post-meta {
  color: #adb5bd;
}

body.dark-mode .blog-post .blog-post-nav {
  border-top-color: #343a40;
}

body.dark-mode .blog-post .related-posts {
  border-top-color: #343a40;
}

body.dark-mode .year-section {
  border-bottom-color: #343a40;
}

body.dark-mode .post-list article small {
  color: #adb5bd;
}

body.dark-mode .toc-toggle {
  color: #adb5bd;
}

body.dark-mode .toc-toggle:hover {
  color: #f8f9fa;
}

body.dark-mode hr {
  border-top-color: #495057;
}

body.dark-mode table {
  border-color: #495057;
}

body.dark-mode th {
  background-color: #212529;
  border-color: #495057;
}

body.dark-mode tbody tr:hover {
  background-color: #1a1a1a;
}

body.dark-mode .home-section > p {
  color: #adb5bd;
}

body.dark-mode .tool-card {
  border-color: #495057;
  background-color: #1a1a1a;
}

body.dark-mode .tool-card:hover {
  border-color: #8ab4f8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .tool-card h2 {
  color: #f8f9fa;
}

body.dark-mode .tool-card p {
  color: #adb5bd;
}

body.dark-mode .post-list article {
  border-bottom-color: #495057;
}

body.dark-mode .year-section {
  border-bottom-color: #495057;
}

body.dark-mode .breadcrumbs a {
  color: #adb5bd;
}

body.dark-mode .breadcrumbs a:hover {
  color: #8ab4f8;
}

body.dark-mode .breadcrumbs li[aria-current="page"] {
  color: #f8f9fa;
}

body.dark-mode .category-badge {
  background-color: #8ab4f8;
  color: #121212;
}

body.dark-mode .category-badge:hover {
  background-color: #adc6ff;
}

body.dark-mode .tag-badge {
  background-color: #212529;
  color: #adb5bd;
  border-color: #495057;
}

body.dark-mode .tag-badge:hover {
  background-color: #343a40;
  color: #f8f9fa;
  border-color: #8ab4f8;
}

body.dark-mode .post-meta,
body.dark-mode .post-meta-preview {
  color: #adb5bd;
}

body.dark-mode .post-taxonomies {
  border-bottom-color: #495057;
}

body.dark-mode .post-title-preview a {
  color: #f8f9fa;
}

body.dark-mode .post-title-preview a:hover {
  color: #8ab4f8;
}

body.dark-mode .read-more {
  color: #8ab4f8;
}

body.dark-mode .read-more:hover {
  color: #adc6ff;
}

body.dark-mode .blog-sidebar {
  background-color: #1a1a1a;
  border: 1px solid #343a40;
}

body.dark-mode .sidebar-title {
  color: #f8f9fa;
  border-bottom-color: #495057;
}

body.dark-mode .recent-posts-list a,
body.dark-mode .categories-list a,
body.dark-mode .archive-list a {
  color: #adb5bd;
}

body.dark-mode .recent-posts-list a:hover,
body.dark-mode .categories-list a:hover,
body.dark-mode .archive-list a:hover {
  color: #8ab4f8;
}

body.dark-mode .blog-sidebar::-webkit-scrollbar-thumb {
  background: #495057;
}

body.dark-mode .blog-sidebar::-webkit-scrollbar-thumb:hover {
  background: #6c757d;
}

/* Auto dark mode based on system preference */
@media (prefers-color-scheme: dark) {
  body:not(.light-mode) {
    background-color: #121212;
    color: #f8f9fa;
  }

  body:not(.light-mode) .header {
    border-color: #343a40;
    background-color: #1a1a1a;
  }

  body:not(.light-mode) .hamburger-icon,
  body:not(.light-mode) .hamburger-icon::before,
  body:not(.light-mode) .hamburger-icon::after {
    background-color: #f8f9fa;
  }

  body:not(.light-mode) blockquote {
    border-left-color: #8ab4f8;
    color: #adb5bd;
  }

  body:not(.light-mode) pre, body:not(.light-mode) code {
    background-color: #212529;
    color: #f8f9fa;
  }

  body:not(.light-mode) th, body:not(.light-mode) td {
    border-color: #495057;
  }

  body:not(.light-mode) .blog-post-nav {
    border-top-color: #343a40;
  }

  body:not(.light-mode) .table-of-contents h2 {
    color: #adb5bd;
  }
  body:not(.light-mode) .table-of-contents li a {
    color: #8ab4f8; /* Lighter blue for dark mode */
  }

  body:not(.light-mode) .summary {
    color: #adb5bd;
  }

  body:not(.light-mode) .blog-post .post-meta {
    color: #adb5bd;
  }

  body:not(.light-mode) .blog-post .blog-post-nav {
    border-top-color: #343a40;
  }

  body:not(.light-mode) .blog-post .related-posts {
    border-top-color: #343a40;
  }

  body:not(.light-mode) .year-section {
    border-bottom-color: #343a40;
  }

  body:not(.light-mode) .post-list article small {
    color: #adb5bd;
  }
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */

/* Extra small devices (under 480px) */
@media (max-width: 480px) {
  :root {
    --container-padding: 1rem;
  }

  body {
    font-size: 15px;
  }

  .site-title {
    font-size: 1.1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  h3 {
    font-size: 1.1rem;
  }

  .tools-grid {
    gap: 0.75rem;
  }

  .tool-card {
    padding: 1rem;
  }

  .header-controls {
    gap: 0.25rem;
  }

  .main-nav a {
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
  }

  table {
    font-size: 0.8em;
  }

  th, td {
    padding: 0.4rem 0.5rem;
  }
}

/* Mobile styles (up to 768px) */
@media (max-width: 768px) {
  :root {
    --container-padding: 1.25rem;
    --header-height: 60px;
  }

  html {
    font-size: 16px;
  }

  body {
    font-size: 16px;
    overflow-x: hidden;
  }

  /* Mobile content spacing */
  main {
    padding: 1.5rem 0;
  }

  main .container {
    max-width: 100%;
  }

  /* Mobile header */
  .header {
    z-index: 100;
  }

  .header .container {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    gap: 0.75rem;
  }

  .site-title {
    font-size: 1.2rem;
    font-weight: 700;
  }

  /* Header controls on mobile */
  .header-controls {
    gap: 0.5rem;
  }

  /* Show hamburger menu on mobile */
  .hamburger {
    display: flex;
    order: 3;
  }

  /* Dark mode toggle order */
  .dark-mode-toggle {
    order: 2;
    padding: 0.5rem;
    margin-left: 0;
    min-width: 44px;
    min-height: 44px;
  }

  .dark-mode-toggle svg {
    width: 22px;
    height: 22px;
  }

  /* Hide navigation by default on mobile */
  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height var(--transition-speed), opacity var(--transition-speed);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 999;
    order: 1;
  }

  body.dark-mode .main-nav {
    background-color: #1a1a1a;
    border-bottom-color: #343a40;
  }

  .main-nav.active {
    max-height: 300px;
    opacity: 1;
  }

  .main-nav a {
    width: 100%;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f8f9fa;
    text-align: left;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  body.dark-mode .main-nav a {
    border-bottom-color: #343a40;
  }

  .main-nav a:last-child {
    border-bottom: none;
  }

  /* Mobile table of contents */
  .table-of-contents {
    padding: 0.5rem 0;
    margin: 1.5rem 0;
  }

  .toc-toggle {
    display: block;
  }

  .table-of-contents nav {
    max-height: 500px;
  }

  .table-of-contents h2 {
    font-size: 1.1rem;
    cursor: pointer;
  }

  /* Mobile typography */
  h1 {
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
    margin-top: 0;
  }

  h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
  }

  h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
  }

  p, ul, ol {
    margin-bottom: 1.25rem;
    max-width: 100%;
  }

  ul, ol {
    padding-left: 1.75rem;
  }

  li {
    margin-bottom: 0.75rem;
  }

  /* Mobile content elements */
  blockquote {
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    max-width: 100%;
  }

  pre {
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    font-size: 0.85em;
  }

  img {
    margin: 2rem auto;
    border-radius: 6px;
  }

  hr {
    margin: 2rem 0;
  }

  table {
    font-size: 0.9em;
  }

  th, td {
    padding: 0.5rem 0.75rem;
  }

  /* Mobile home page */
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .tool-card {
    padding: 1.25rem;
  }

  .post-list article {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }

  /* Mobile blog layout */
  .blog-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .blog-sidebar {
    display: none;
  }

  .post-thumbnail {
    max-width: 100%;
  }

  .post-meta-preview {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

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

  .breadcrumbs li + li::before {
    margin: 0 0.35rem;
  }

  /* Mobile footer */
  .footer {
    padding: 2rem 0;
  }

  .footer-content {
    font-size: 0.9rem;
  }

  .footer-links {
    gap: 0.75rem;
  }

  /* Ensure touch targets are large enough */
  button, a {
    min-height: 48px;
    min-width: 48px;
  }

  .main-nav a {
    min-height: 48px;
    padding: 0.75rem 1rem;
  }

  .footer-links a {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
  }

  .dark-mode-toggle {
    min-width: 48px;
    min-height: 48px;
  }

  .hamburger {
    min-width: 48px;
    min-height: 48px;
  }

  /* Improved spacing for better mobile UX */
  .tool-card {
    padding: 1.5rem;
    margin-bottom: 1rem;
  }

  .category-badge,
  .tag-badge {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
  }
}

/* Tablet styles (768px to 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  :root {
    --container-padding: 2rem;
  }

  body {
    font-size: 16px;
  }

  main {
    padding: 2.5rem 0;
  }

  main .container {
    max-width: 750px;
  }

  .site-title {
    font-size: 1.4rem;
    font-weight: 700;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.65rem;
  }

  h3 {
    font-size: 1.35rem;
  }

  /* Hide hamburger on tablet, show desktop nav */
  .hamburger {
    display: none !important;
  }

  /* Desktop-style navigation on tablet */
  .main-nav {
    position: static;
    flex-direction: row;
    max-height: none;
    opacity: 1;
    overflow: visible;
    padding: 0;
    border: none;
    box-shadow: none;
    background: none;
    gap: 1.5rem;
  }

  .main-nav a {
    width: auto;
    padding: 0.5rem 0.75rem;
    border: none;
    min-height: auto;
    display: flex;
    align-items: center;
    font-weight: 500;
  }

  .dark-mode-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  .table-of-contents {
    max-width: 100%;
  }

  /* Tablet blog layout - hide sidebar */
  .blog-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .blog-sidebar {
    display: none;
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* Desktop styles (1024px and up) */
@media (min-width: 1024px) {
  :root {
    --container-padding: 2rem;
  }

  /* Ensure hamburger is hidden on desktop */
  .hamburger {
    display: none !important;
  }

  /* Desktop navigation - always visible */
  .main-nav {
    position: static;
    flex-direction: row;
    max-height: none;
    opacity: 1;
    overflow: visible;
    padding: 0;
    border: none;
    box-shadow: none;
    background: none;
  }

  .main-nav a {
    width: auto;
    padding: 0.5rem 0.75rem;
    border: none;
    min-height: auto;
    display: flex;
    align-items: center;
  }

  .dark-mode-toggle {
    min-width: 40px;
    min-height: 40px;
  }

  .header-controls {
    gap: 0.5rem;
  }

  /* Desktop blog layout - show sidebar */
  .blog-layout {
    grid-template-columns: 1fr 300px;
    gap: 3rem;
  }

  .blog-sidebar {
    display: block;
  }

  /* Sticky TOC on desktop for blog posts */
  .blog-post-content {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 2rem;
    align-items: start;
  }

  .blog-post-content .table-of-contents {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
    max-height: calc(100vh - var(--header-height) - 4rem);
    overflow-y: auto;
    margin: 0;
  }

  /* Smooth scrollbar for TOC */
  .blog-post-content .table-of-contents::-webkit-scrollbar {
    width: 6px;
  }

  .blog-post-content .table-of-contents::-webkit-scrollbar-track {
    background: transparent;
  }

  .blog-post-content .table-of-contents::-webkit-scrollbar-thumb {
    background: #dee2e6;
    border-radius: 3px;
  }

  body.dark-mode .blog-post-content .table-of-contents::-webkit-scrollbar-thumb {
    background: #495057;
  }

  .footer-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
}

/* Large desktop (1440px and up) */
@media (min-width: 1440px) {
  :root {
    --max-width: 1400px;
  }
}