/* Modern Blog Theme */

/* Global width configuration */
:root {
  --max-width: 1200px;
  --content-width: 900px;
  --sidebar-width: 250px;
}

/* Base styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #fafafa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: #374151;
  margin: 0;
  padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
  margin: 0;
}

p {
  margin: 0 0 1rem 0;
  color: #4b5563;
}

a {
  color: #3b82f6;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #2563eb;
}

/* Modern card styles */
.modern-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.modern-card:hover {
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  border-color: #d1d5db;
}

/* Button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #e5e7eb;
  color: #111827;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Tag styles */
.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: #f3f4f6;
  color: #4b5563;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid #e5e7eb;
  text-decoration: none;
}

.tag:hover {
  background: #e5e7eb;
  color: #374151;
  transform: translateY(-1px);
}

/* Header blur effect */
.header-blur {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Focus styles */
*:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Selection styles */
::selection {
  background: #dbeafe;
  color: #1e40af;
}

/* Container utilities */
.container-max {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.container-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header height fix */
header {
  height: 64px !important;
  min-height: 64px !important;
  position: relative;
}

header nav {
  height: 64px !important;
  min-height: 64px !important;
}

header nav .container-max {
  height: 100%;
}

/* Mobile menu positioning */
#mobile-menu {
  z-index: 1000;
}

/* Footer height fix */
footer {
  min-height: 64px !important;
  display: flex;
  align-items: center;
}

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

/* Layout for detail pages with sidebar */
.layout-with-sidebar {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 2rem;
  padding: 2rem 1rem 4rem;
  min-height: calc(100vh - 8rem);
}

.layout-with-sidebar .sidebar {
  position: sticky;
  top: 5rem;
  height: fit-content;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.layout-with-sidebar .main-content {
  max-width: var(--content-width);
}

/* Layout for detail pages with sidebar on right */
.layout-with-sidebar-right {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr var(--sidebar-width);
  gap: 2rem;
  padding: 2rem 1rem 4rem;
  min-height: calc(100vh - 8rem);
}

.layout-with-sidebar-right .sidebar {
  position: sticky;
  top: 5rem;
  height: fit-content;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

.layout-with-sidebar-right .main-content {
  max-width: var(--content-width);
}

/* Prose styles */
.prose {
  max-width: none;
  color: #374151;
  line-height: 1.7;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: #111827;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.prose h1 {
  font-size: 2.25rem;
  line-height: 1.2;
}

.prose h2 {
  font-size: 1.875rem;
  line-height: 1.3;
}

.prose h3 {
  font-size: 1.5rem;
  line-height: 1.4;
}

.prose p {
  margin-bottom: 1.5rem;
  color: #4b5563;
}

.prose a {
  color: #3b82f6;
  font-weight: 500;
}

.prose a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.prose blockquote {
  border-left: 4px solid #e5e7eb;
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #6b7280;
}

.prose code {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
  padding: 0.2rem 0.4rem !important;
  border-radius: 6px !important;
  font-size: 0.875em !important;
  color: #92400e !important;
  font-family: 'Fira Code', 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
  font-weight: 500 !important;
  border: 1px solid rgba(251, 191, 36, 0.3) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.prose pre {
  background: #1f2937;
  color: #f9fafb;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.prose pre code {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

.prose ul,
.prose ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.prose li {
  margin: 0.5rem 0;
}

/* 修复列表样式，避免重复标记 */
.prose ol,
.prose ul {
  margin: 1rem 0;
  padding-left: 1.5rem;
  list-style: none;
  counter-reset: list-counter;
}

.prose ol {
  list-style: decimal;
  counter-reset: item;
}

.prose ol > li {
  display: list-item;
  list-style-type: decimal;
  list-style-position: outside;
  margin: 0.5rem 0;
}

.prose ul {
  list-style: disc;
}

.prose ul > li {
  display: list-item;
  list-style-type: disc;
  list-style-position: outside;
  margin: 0.5rem 0;
}

/* 嵌套列表样式 */
.prose ol ol,
.prose ul ul,
.prose ol ul,
.prose ul ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.prose ol ol {
  list-style-type: lower-alpha;
}

.prose ol ol ol {
  list-style-type: lower-roman;
}

.prose ul ul {
  list-style-type: circle;
}

.prose ul ul ul {
  list-style-type: square;
}

.prose img {
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

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

.prose th {
  background: #f9fafb;
  font-weight: 600;
}

/* Utility classes */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Animation utilities */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in-right {
  animation: slideInRight 0.4s ease-out;
}

/* Responsive design */
@media (max-width: 1024px) {
  .layout-with-sidebar,
  .layout-with-sidebar-right {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .layout-with-sidebar .sidebar,
  .layout-with-sidebar-right .sidebar {
    position: static;
    order: 2;
  }
  
  .layout-with-sidebar .main-content,
  .layout-with-sidebar-right .main-content {
    order: 1;
  }
}

@media (max-width: 768px) {
  :root {
    --max-width: 100%;
    --content-width: 100%;
  }
  
  .container-max,
  .container-content {
    padding: 0 0.75rem;
  }
}

@media (max-width: 640px) {
  .modern-card {
    border-radius: 12px;
    margin: 0.5rem 0;
  }
  
  .prose {
    font-size: 0.9rem;
  }
  
  .prose h1 {
    font-size: 1.75rem;
  }
  
  .prose h2 {
    font-size: 1.5rem;
  }
  
  .prose h3 {
    font-size: 1.25rem;
  }
  
  .container-max,
  .container-content {
    padding: 0 0.5rem;
  }
}

/* Dark mode support */
.dark body {
  background: #111827;
  color: #d1d5db;
}

.dark .modern-card {
  background: #1f2937;
  border-color: #374151;
}

.dark .modern-card:hover {
  border-color: #4b5563;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.dark .tag {
  background: #374151;
  color: #d1d5db;
  border-color: #4b5563;
}

.dark .tag:hover {
  background: #4b5563;
  color: #f9fafb;
}

.dark .prose {
  color: #d1d5db;
}

.dark .prose h1,
.dark .prose h2,
.dark .prose h3,
.dark .prose h4,
.dark .prose h5,
.dark .prose h6 {
  color: #f9fafb;
}

.dark .prose p {
  color: #d1d5db;
}

.dark .prose a {
  color: #60a5fa;
}

.dark .prose a:hover {
  color: #93c5fd;
}

.dark .prose blockquote {
  border-left-color: #4b5563;
  color: #9ca3af;
}

.dark .prose code {
  background: linear-gradient(135deg, #374151 0%, #4b5563 100%) !important;
  color: #fbbf24 !important;
  border: 1px solid rgba(75, 85, 99, 0.5) !important;
}

.dark .prose pre {
  background: #0d1117;
  border: 1px solid #30363d;
}

.dark .prose th {
  background: #374151;
  color: #f9fafb;
}

.dark .prose th,
.dark .prose td {
  border-color: #4b5563;
}

.dark .prose td {
  color: #d1d5db;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  .container-max,
  .container-content {
    padding: 0 1rem;
  }
  
  .modern-card {
    margin: 0.75rem 0;
    border-radius: 12px;
  }
  
  .prose {
    font-size: 0.95rem;
    line-height: 1.6;
  }
  
  .prose h1 {
    font-size: 1.75rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
  }
  
  .prose h2 {
    font-size: 1.5rem;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
  }
  
  .prose h3 {
    font-size: 1.25rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
  }
  
  .prose p {
    margin-bottom: 1rem;
  }
  
  .prose pre {
    margin: 1rem -1rem;
    border-radius: 0;
    padding: 0.75rem 1rem;
  }
  
  .prose code {
    font-size: 0.8rem !important;
    padding: 0.15rem 0.3rem !important;
  }
}

/* Tablet optimizations */
@media (min-width: 641px) and (max-width: 1024px) {
  .container-max {
    padding: 0 1.5rem;
  }
  
  .prose {
    font-size: 1rem;
  }
  
  .prose h1 {
    font-size: 2rem;
  }
  
  .prose h2 {
    font-size: 1.75rem;
  }
}

/* Print styles */
@media print {
  .modern-card {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  
  .tag {
    background: #f3f4f6 !important;
    color: #374151 !important;
  }
}