/* Global font */
body {
  font-family: 'Courier New', Courier, monospace;
}

/* Tree Navigation Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background-color: #f8f9fa;
  border-right: 1px solid #dee2e6;
  padding: 20px 0;
  overflow-y: auto;
  z-index: 1000;
}

.main-content {
  margin-left: max(240px, calc(240px + (100vw - 940px)/2));
  padding: 20px;
  max-width: 700px;
}

/* Code blocks */
.main-content pre {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 400px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.875rem;
  line-height: 1.3;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  position: relative;
}

.main-content pre::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.main-content pre::-webkit-scrollbar-track {
  background: #2d2d2d;
  border-radius: 4px;
}

.main-content pre::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 4px;
}

.main-content pre::-webkit-scrollbar-thumb:hover {
  background: #4b5563;
}

.main-content code {
  font-family: 'Courier New', Courier, monospace;
  background: #f3f4f6;
  padding: 0 0.3rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: #6366f1;
  border: 1px solid #e5e7eb;
  line-height: 1.2;
}

.main-content pre code {
  background: none;
  padding: 0;
  color: #2d2d2d;;
  border: none;
}

/* Blog post listing */
.blog-posts {
  margin-top: 2rem;
  border: 1px solid #d1d5db;
}

.blog-post-row {
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 0.2s ease;
}

.blog-post-row:last-child {
  border-bottom: none;
}

.blog-post-row.odd {
  background-color: #ffffff;
}

.blog-post-row.even {
  background-color: #f9fafb;
}

.blog-post-row:hover {
  background-color: #f3f4f6 !important;
}

.blog-post-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  text-decoration: none;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}

.blog-post-title {
  font-weight: 500;
  font-size: 1rem;
  color: #1f2937;
  flex: 1;
  margin-right: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blog-post-date {
  font-size: 0.8rem;
  color: #6b7280;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 400;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  white-space: nowrap;
}

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

.nav-tree li {
  margin: 0;
}

/* Hidden navigation targets */
.nav-target {
  position: absolute;
  top: -9999px;
  left: -9999px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  color: #495057;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background-color: #e9ecef;
  color: #212529;
}

/* Style for current page */
.nav-item[href]:target,
.nav-item.current {
  background-color: #007bff;
  color: white;
}

.nav-icon {
  margin-right: 4px;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: transform 0.3s ease;
}

/* Hide icon for leaf items */
.nav-icon.no-children {
  opacity: 0;
}

/* Default state - show expand button, hide collapse button and subsections */
.nav-expand {
  display: flex;
}

.nav-collapse {
  display: none;
}

.nav-subsections {
  max-height: 0;
}

/* When blog-expanded is targeted - show collapse button and subsections, hide expand button */
#blog-expanded:target ~ .sidebar .nav-expand {
  display: none;
}

#blog-expanded:target ~ .sidebar .nav-collapse {
  display: flex;
}

#blog-expanded:target ~ .sidebar .nav-subsections {
  max-height: 500px;
}

/* Rotate expand arrow to point right */
.nav-expand .nav-icon {
  transform: rotate(-90deg);
}

/* Collapse arrow points down (no rotation needed) */

.nav-subsections {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.nav-section {
  position: relative;
}

.nav-header {
  position: relative;
  z-index: 2;
}

.nav-link {
  position: relative;
  z-index: 3;
}

.nav-subsections .nav-item {
  padding-left: 44px;
  font-size: 13px;
  background-color: #f8f9fa;
}

.nav-subsections .nav-item:hover {
  background-color: #e9ecef;
}

/* Navigation link styling */
.nav-link {
  display: flex;
  align-items: center;
}

.site-title {
  padding: 0 20px 15px 20px;
  font-size: 20px;
  font-weight: 700;
  color: #00ff41;
  font-family: 'Courier New', Courier, monospace;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: block;
}

.site-title:hover {
  transform: scale(1.05);
}

.social-links {
  display: flex;
  gap: 12px;
  padding: 0 20px 10px 20px;
  align-items: center;
}

.social-icon {
  color: #6c757d;
  text-decoration: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
}

.social-icon:hover {
  color: #00ff41;
}

.social-icon svg {
  width: 16px;
  height: 16px;
}

.build-time {
  padding: 0 20px 20px 20px;
  font-size: 11px;
  color: #6c757d;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 20px;
}

/* Mobile navigation toggle */
.mobile-nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mobile-toggle-label {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1002;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  display: none;
  width: 28px;
  height: 28px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(4px);
}

.mobile-toggle-label span {
  display: block;
  width: 16px;
  height: 2px;
  background-color: #333;
  transition: all 0.3s ease;
  position: relative;
}

.mobile-toggle-label span::before,
.mobile-toggle-label span::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 2px;
  background-color: #333;
  transition: all 0.3s ease;
}

.mobile-toggle-label span::before {
  top: -5px;
}

.mobile-toggle-label span::after {
  top: 5px;
}

/* Transform rules are now in the media query below */

/* Responsive design */
@media (max-width: 768px) {
  .mobile-toggle-label {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .mobile-nav-toggle:checked ~ .sidebar {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    margin-right: 0;
    padding-top: 70px;
    max-width: none;
  }

  /* Ensure proper title spacing on mobile */
  .main-content .title {
    margin-top: 0;
  }

  /* Transform hamburger to X when checked */
  .mobile-nav-toggle:checked ~ .mobile-toggle-label span {
    background-color: transparent;
  }

  .mobile-nav-toggle:checked ~ .mobile-toggle-label span::before {
    transform: rotate(45deg);
    top: 0;
  }

  .mobile-nav-toggle:checked ~ .mobile-toggle-label span::after {
    transform: rotate(-45deg);
    top: 0;
  }

  /* Mobile code block adjustments */
  .main-content pre {
    font-size: 0.75rem;
    line-height: 1.2;
    padding: 0.5rem;
  }

  .main-content code {
    font-size: 0.75em;
  }
}
