.theme-toggle {
  background: none;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.theme-toggle:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.theme-toggle-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-info {
  flex-shrink: 0;
}

.site-info h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.site-info h1 a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-info h1 a:hover {
  color: var(--accent-hover);
}

.site-info p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.outline-wrapper {
  flex: 1;
  min-height: 0;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.outline h3 {
  margin: 0 0 0.8rem 0;
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
}

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

.outline li {
  margin-bottom: 0.3rem;
}

.outline-empty {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.outline a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.5;
  display: block;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
}

.outline a:hover {
  color: var(--accent-color);
  background: var(--bg-secondary);
}

.outline a.active {
  color: var(--accent-color);
  background: var(--bg-secondary);
  border-left-color: var(--accent-color);
  font-weight: 500;
}

.post-meta {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--divider-color);
}

.post-meta strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.post-meta-date {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.post-content {
  line-height: 1.75;
  color: var(--text-primary);
}

.post-content h2 {
  scroll-margin-top: 30px;
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--divider-color);
}

.post-content h2:first-child {
  margin-top: 0.5rem;
}

.post-content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.post-content p:last-child {
  margin-bottom: 0;
}

.post-content a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
  word-wrap: break-word;
}

.post-content a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.post-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--accent-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.post-content code {
  background: var(--bg-secondary);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
  font-size: 0.9em;
}

.post-content pre {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  /* Prevent click-through issues */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.back-to-top:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.back-to-top:active {
  transform: translateY(0);
}

.back-to-top:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  bottom: 64px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  z-index: 1000;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  /* Prevent click-through issues */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-menu-toggle:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mobile-menu-toggle:hover .hamburger-icon,
.mobile-menu-toggle:hover .hamburger-icon::before,
.mobile-menu-toggle:hover .hamburger-icon::after {
  background: white;
}

.mobile-menu-toggle:active {
  transform: translateY(0);
}

/* Hamburger Icon */
.hamburger-icon {
  display: block;
  position: relative;
  width: 14px;
  height: 1.5px;
  background: var(--text-secondary);
  transition: all 0.2s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 14px;
  height: 1.5px;
  background: var(--text-secondary);
  transition: all 0.2s ease;
}

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

.hamburger-icon::after {
  top: 4px;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon {
  background: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1100;
  pointer-events: none;
}

.mobile-nav-drawer.active {
  pointer-events: auto;
}

.mobile-nav-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-nav-drawer.active .mobile-nav-overlay {
  opacity: 1;
}

.mobile-nav-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--bg-primary);
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.mobile-nav-drawer.active .mobile-nav-panel {
  transform: translateX(0);
}

.mobile-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.mobile-nav-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-nav-close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.mobile-nav-close:hover {
  color: var(--accent-color);
}

.mobile-nav-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.mobile-nav-content ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-nav-content li {
  margin: 0;
  padding: 0 0.75rem;
}

.mobile-nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  margin: 0.15rem 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  border-radius: 4px;
}

.mobile-nav-link:hover {
  background: var(--bg-secondary);
  color: var(--accent-color);
}

.mobile-nav-link.active {
  background: var(--bg-secondary);
  color: var(--accent-color);
  border-left-color: var(--accent-color);
  font-weight: 500;
}

@media (max-width: 768px) {
  .site-info h1 {
    font-size: 1.25rem;
  }

  .outline-wrapper {
    position: static;
    max-height: none;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-nav-drawer {
    display: block;
  }

  .post-meta strong {
    font-size: 1.15rem;
  }

  .post-content h2 {
    font-size: 1.05rem;
    margin-top: 1.5rem;
    scroll-margin-top: 80px;
  }

  .post-content p {
    font-size: 0.9rem;
  }
}
