/* Theme primitives for Tailwind CDN usage (no @apply here) */
[data-theme="light"] {
  color-scheme: light;
}
[data-theme="dark"] {
  color-scheme: dark;
}

.container {
  max-width: 1100px;
}

/* Mobile Navigation Styles */
.mobile-menu {
  display: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.mobile-menu.active {
  display: block;
  max-height: 500px;
  transition: max-height 0.3s ease-in;
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 24px;
  height: 3px;
  background-color: #374151;
  margin: 2px 0;
  transition: 0.3s;
  border-radius: 2px;
}

[data-theme="dark"] .hamburger span {
  background-color: #e5e7eb;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(45deg) translate(-5px, -6px);
}

/* Responsive Navigation */
@media (max-width: 768px) {
  .desktop-nav {
    display: none !important;
  }

  .hamburger {
    display: flex;
  }

  .mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }

  .mobile-menu.active {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
  }

  [data-theme="dark"] .mobile-menu {
    background: #0f172a;
    border-color: #334155;
  }

  .mobile-menu-content {
    padding: 1rem;
  }

  .mobile-menu-item {
    display: block;
    padding: 0.75rem 0;
    color: #374151;
    text-decoration: none;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 500;
  }

  .mobile-menu-item:hover {
    color: #2563eb;
  }

  [data-theme="dark"] .mobile-menu-item {
    color: #e5e7eb;
    border-color: #334155;
  }

  [data-theme="dark"] .mobile-menu-item:hover {
    color: #60a5fa;
  }

  .mobile-submenu {
    padding-left: 1rem;
    background: #f8fafc;
    margin: 0.5rem 0;
    border-radius: 0.375rem;
  }

  [data-theme="dark"] .mobile-submenu {
    background: #1e293b;
  }

  .mobile-submenu-item {
    display: block;
    padding: 0.5rem 0;
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
  }

  .mobile-submenu-item:hover {
    color: #2563eb;
  }

  [data-theme="dark"] .mobile-submenu-item {
    color: #94a3b8;
  }

  [data-theme="dark"] .mobile-submenu-item:hover {
    color: #60a5fa;
  }
}

/* Tablet Navigation - Show desktop nav but ensure it fits */
@media (min-width: 769px) and (max-width: 1024px) {
  .hamburger {
    display: none;
  }

  .mobile-menu {
    display: none;
  }

  .desktop-nav {
    gap: 1rem; /* Reduce gap on tablets */
  }

  .desktop-nav a,
  .desktop-nav button {
    font-size: 0.875rem; /* Smaller text on tablets */
  }
}

/* Desktop Navigation */
@media (min-width: 1025px) {
  .hamburger {
    display: none;
  }

  .mobile-menu {
    display: none;
  }
}

/* Improved Navigation Link Contrast */
.nav-link {
  color: #374151;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #2563eb;
}

[data-theme="dark"] .nav-link {
  color: #e5e7eb;
}

[data-theme="dark"] .nav-link:hover {
  color: #60a5fa;
}

/* Prose tweaks */
/* Minimal, framework-free typography system to emulate Tailwind Typography */
.prose {
  max-width: 80ch;
  margin-left: auto;
  margin-right: auto;
  color: #0f172a; /* slate-900 */
}
[data-theme="dark"] .prose {
  color: #e2e8f0; /* slate-200 */
}

.prose a {
  color: #2563eb; /* blue-600 */
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prose a:hover {
  color: #1d4ed8;
}
[data-theme="dark"] .prose a {
  color: #60a5fa;
}
[data-theme="dark"] .prose a:hover {
  color: #93c5fd;
}

.prose p {
  line-height: 1.8;
  margin: 1.1em 0;
}
.prose strong {
  color: #0f172a;
  font-weight: 700;
}
[data-theme="dark"] .prose strong {
  color: #f8fafc;
}
.prose em {
  font-style: italic;
}
.prose hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 2.5rem 0;
}
[data-theme="dark"] .prose hr {
  border-color: #334155;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  font-weight: 800;
  line-height: 1.25;
  color: #0f172a;
  margin: 2rem 0 0.75rem 0;
}
[data-theme="dark"] .prose h1,
[data-theme="dark"] .prose h2,
[data-theme="dark"] .prose h3,
[data-theme="dark"] .prose h4,
[data-theme="dark"] .prose h5,
[data-theme="dark"] .prose h6 {
  color: #f1f5f9;
}
.prose h1 {
  font-size: 2rem;
}
.prose h2 {
  font-size: 1.5rem;
}
.prose h3 {
  font-size: 1.25rem;
}
.prose h4 {
  font-size: 1.125rem;
}
@media (min-width: 768px) {
  .prose h1 {
    font-size: 2.75rem;
  }
  .prose h2 {
    font-size: 1.875rem;
  }
  .prose h3 {
    font-size: 1.5rem;
  }
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
  margin: 1.1em 0;
}
.prose ul {
  list-style: disc;
}
.prose ol {
  list-style: decimal;
}
.prose li {
  margin: 0.3em 0;
}

.prose blockquote {
  margin: 1.6rem 0;
  padding-left: 1rem;
  border-left: 4px solid #e2e8f0;
  color: #334155;
  font-style: italic;
}
[data-theme="dark"] .prose blockquote {
  border-color: #334155;
  color: #94a3b8;
}

.prose img,
.prose video,
.prose figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}
.prose figure {
  margin: 1.6rem 0;
}
.prose figcaption {
  text-align: center;
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.5rem;
}
[data-theme="dark"] .prose figcaption {
  color: #94a3b8;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  background: #f1f5f9;
  color: #0f172a;
  padding: 0.15rem 0.4rem;
  border-radius: 0.375rem;
  font-size: 0.95em;
}
[data-theme="dark"] .prose code {
  background: #0f172a;
  color: #e2e8f0;
}

.prose pre {
  background: #0b1220; /* near slate-950 */
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow: auto;
  line-height: 1.7;
}
[data-theme="dark"] .prose pre {
  background: #0b1220;
  color: #e2e8f0;
}
.prose pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6rem 0;
  font-size: 0.95rem;
}
.prose th,
.prose td {
  border: 1px solid #e2e8f0;
  padding: 0.75rem 0.875rem;
  text-align: left;
}
.prose thead th {
  background: #f8fafc;
  font-weight: 700;
}
[data-theme="dark"] .prose th,
[data-theme="dark"] .prose td {
  border-color: #334155;
}
[data-theme="dark"] .prose thead th {
  background: #0f172a;
}

/* Blog-specific helpers */
.blog-article-header {
  margin-bottom: 1.75rem;
}
.blog-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  color: #64748b;
  font-size: 0.9rem;
}
[data-theme="dark"] .blog-meta {
  color: #94a3b8;
}
.blog-hero {
  margin: 1.25rem 0 2rem;
}
.blog-hero img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
}

/* Responsive blog layout with sticky sidebar */
.blog-layout {
  display: grid;
  gap: 2rem;
}
@media (min-width: 1024px) {
  .blog-layout {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
}
.blog-sidebar {
  position: sticky;
  top: 6rem;
  align-self: start;
}
.blog-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem;
}
[data-theme="dark"] .blog-card {
  background: #0b1220;
  border-color: #334155;
}
.toc h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #334155;
}
[data-theme="dark"] .toc h3 {
  color: #cbd5e1;
}
.toc ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.toc li {
  margin: 0.35rem 0;
}
.toc a {
  text-decoration: none;
  color: #475569;
}
.toc a:hover {
  color: #2563eb;
}
[data-theme="dark"] .toc a {
  color: #94a3b8;
}
[data-theme="dark"] .toc a:hover {
  color: #93c5fd;
}
