/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary-color: #ec4899;
  --text-dark: #1f2937;
  --text-medium: #4b5563;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: linear-gradient(to bottom, #ffffff 0%, var(--bg-light) 100%);
  min-height: 100vh;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
header {
  background: var(--bg-white);
  padding: 1.5rem 2rem;
  margin: -20px -20px 40px -20px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: transform 0.3s ease;
}

.logo:hover {
  transform: scale(1.05);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 2rem;
}

nav a {
  text-decoration: none;
  color: var(--text-medium);
  transition: all 0.3s ease;
  font-weight: 500;
  position: relative;
}

nav a:hover {
  color: var(--primary-color);
}

nav ul a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -5px;
  left: 50%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

nav ul a:hover::after {
  width: 100%;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 80px 20px;
  margin: 0 -20px 40px -20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(30px, -30px) rotate(120deg); }
  66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 20px;
  color: var(--text-dark);
  font-weight: 800;
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.3rem;
  color: var(--text-medium);
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
}

/* Tags Section */
.tags-section {
  margin: 40px 0;
  padding: 30px;
  background: var(--bg-white);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.tags-section h2 {
  margin-bottom: 24px;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 1.5rem;
}

.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.tag-cloud-item {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 0.95rem;
  color: var(--primary-color);
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-cloud-item:hover {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.tag-cloud-item:hover .tag-count {
  color: rgba(255, 255, 255, 0.9);
}

.tag-count {
  font-size: 0.85em;
  color: var(--text-light);
  font-weight: 500;
}

/* Posts */
.recent-posts,
.posts {
  margin-top: 40px;
}

.recent-posts h2,
.blog-header h1 {
  margin-bottom: 30px;
  color: var(--text-dark);
  font-weight: 700;
  font-size: 2rem;
}

.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-list article {
  background: var(--bg-white);
  padding: 28px;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.post-list article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.post-list article:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}

.post-list article:hover::before {
  transform: scaleY(1);
}

.post-list h2,
.post-list h3 {
  margin-bottom: 10px;
  font-weight: 700;
}

.post-list h2 a,
.post-list h3 a {
  text-decoration: none;
  color: var(--text-dark);
  transition: color 0.3s ease;
  position: relative;
}

.post-list h2 a:hover,
.post-list h3 a:hover {
  color: var(--primary-color);
}

.post-list time {
  color: var(--text-light);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 500;
}

.post-list time::before {
  content: '📅';
  margin-right: 6px;
}

.post-list p {
  color: var(--text-medium);
  margin-top: 10px;
  line-height: 1.7;
}

/* Post layout with sidebar */
.post-layout {
  display: flex;
  gap: 40px;
  margin-top: 40px;
  align-items: flex-start;
  position: relative;
}

/* Post sidebar - removed width/position to allow Tailwind classes to control */
.post-sidebar {
  background: var(--bg-white);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.sidebar-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-color);
}

.sidebar-header h3 {
  font-size: 1.1rem;
  color: var(--text-dark);
  font-weight: 700;
  margin: 0;
}

/* File tree */
.file-tree {
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tree-node {
  margin: 4px 0;
  display: block;
  width: 100%;
}

.tree-folder {
  margin-bottom: 8px;
}

.tree-node-header {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.tree-node-header:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
}

.tree-icon {
  margin-right: 8px;
  font-size: 1rem;
  flex-shrink: 0;
}

.tree-label {
  flex: 1;
  color: var(--text-medium);
  font-weight: 500;
}

.tree-toggle {
  margin-left: 8px;
  font-size: 0.7rem;
  color: var(--text-light);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.tree-folder.expanded > .tree-node-header .tree-toggle {
  transform: rotate(90deg);
}

.tree-children {
  margin-left: 20px;
  padding-left: 12px;
  border-left: 1px solid var(--border-color);
  display: none;
}

.tree-folder.expanded > .tree-children {
  display: block;
}

.tree-node-link {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s ease;
  color: var(--text-medium);
}

.tree-node-link:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
  color: var(--primary-color);
}

.tree-node-link.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  font-weight: 600;
}

.tree-node-link.active .tree-icon {
  filter: brightness(0) invert(1);
}

/* Post page */
.post {
  flex: 1;
  min-width: 0;
  max-width: 900px;
  margin-top: 0;
  /* Removed order: 1 to allow natural HTML order (article left, sidebar right) */
}

.post-header {
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.post-header h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--text-dark);
  font-weight: 800;
  line-height: 1.2;
}

.post-header time {
  color: var(--text-light);
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

.post-header time::before {
  content: '📅';
  margin-right: 6px;
}

.post-content {
  line-height: 1.8;
  font-size: 1.05rem;
}

.post-content h2 {
  margin-top: 40px;
  margin-bottom: 20px;
  color: var(--text-dark);
  font-weight: 700;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary-color);
}

.post-content h3 {
  margin-top: 30px;
  margin-bottom: 15px;
  color: var(--text-medium);
  font-weight: 600;
}

.post-content p {
  margin-bottom: 20px;
  color: var(--text-medium);
}

.post-content code {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: var(--primary-color);
  font-weight: 600;
}

.post-content pre {
  background: var(--text-dark);
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.post-content pre code {
  background: none;
  padding: 0;
  color: #e2e8f0;
  font-weight: normal;
}

.post-content ul,
.post-content ol {
  margin-left: 30px;
  margin-bottom: 20px;
}

.post-content li {
  margin-bottom: 10px;
}

/* Tags */
.tags {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tag {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--primary-color);
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.2);
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.tag:hover {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Footer */
footer {
  margin-top: 80px;
  padding: 40px 20px;
  background: var(--bg-white);
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

footer p {
  margin-top: 10px;
}

/* Blog header */
.blog-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
  border-radius: 16px;
}

.blog-header h1 {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.blog-header p {
  color: var(--text-medium);
  font-size: 1.1rem;
  margin-top: 10px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero, .recent-posts, .blog-header {
  animation: fadeIn 0.8s ease-out;
}

.post-list li {
  animation: fadeIn 0.6s ease-out backwards;
}

.post-list li:nth-child(1) { animation-delay: 0.1s; }
.post-list li:nth-child(2) { animation-delay: 0.2s; }
.post-list li:nth-child(3) { animation-delay: 0.3s; }
.post-list li:nth-child(4) { animation-delay: 0.4s; }
.post-list li:nth-child(5) { animation-delay: 0.5s; }

/* Responsive - removed post-sidebar overrides to allow Tailwind responsive classes */
@media (max-width: 1024px) {
  main {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  header {
    padding: 1rem 1.5rem;
  }

  nav ul {
    gap: 1rem;
  }

  .post-list article {
    padding: 20px;
  }

  .post-sidebar {
    padding: 16px;
  }

  .tree-children {
    margin-left: 12px;
    padding-left: 8px;
  }
}
