/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Avenir, Montserrat, Corbel, "URW Gothic", source-sans-pro, sans-serif;
  font-weight: normal;
  line-height: 1.6;
  color: #333;
  background-color: #fff;
}

/* Layout */
header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #333;
}

main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  min-height: calc(100vh - 200px);
}

footer {
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: #666;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  margin-top: 1rem;
}

h2 {
  font-size: 2rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Improve button and interactive element touch targets */
button, input, select, textarea {
  min-height: 44px;
}

/* Better touch targets for interactive links */
.nav-links a,
.tag,
.post-list-item h2 a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

blockquote {
  border-left: 4px solid #e9ecef;
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #666;
}

/* Post Styles */
.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e9ecef;
}

.post-header h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-meta {
  color: #666;
  font-size: 0.9rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.category {
  background-color: #e9ecef;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.category a {
  color: #666;
  text-decoration: none;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag {
  background-color: #f1f3f5;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #495057;
  text-decoration: none;
  transition: background-color 0.2s;
  /* Better touch target */
  min-height: 36px;
}

.tag:hover {
  background-color: #e9ecef;
  text-decoration: none;
}

.post-content {
  line-height: 1.8;
}

.post-content ul,
.post-content ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content ul ul,
.post-content ol ol,
.post-content ul ol,
.post-content ol ul {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.post-content p {
  margin-bottom: 1rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
}

.post-content code {
  background-color: #f8f9fa;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
}

.post-content pre {
  background-color: #f8f9fa;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

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

/* Post List */
.post-list {
  list-style: none;
}

.post-list-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e9ecef;
}

.post-list-item:last-child {
  border-bottom: none;
}

.post-list-item h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-list-item h2 a {
  color: #333;
  text-decoration: none;
}

.post-list-item h2 a:hover {
  color: #0066cc;
}

.post-excerpt {
  color: #666;
  margin-bottom: 0.5rem;
}

.post-excerpt ul,
.post-excerpt ol {
  margin-left: 2rem;
  margin-bottom: 0.5rem;
}

.post-excerpt li {
  margin-bottom: 0.25rem;
}

.post-excerpt ul ul,
.post-excerpt ol ol,
.post-excerpt ul ol,
.post-excerpt ol ul {
  margin-left: 1.5rem;
  margin-top: 0.25rem;
}

/* Post Navigation */
.post-navigation {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e9ecef;
}

.nav-links {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.nav-links a {
  flex: 1;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 6px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s;
}

.nav-links a:hover {
  background-color: #e9ecef;
}

.nav-links a.prev {
  text-align: left;
}

.nav-links a.next {
  text-align: right;
}

/* Tag and Category Pages */
.tag-list, .category-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.tag-list-item, .category-list-item {
  background-color: #f8f9fa;
  padding: 0.5rem 1rem;
  border-radius: 6px;
}

.tag-list-item a, .category-list-item a {
  color: #333;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag-list-item .count, .category-list-item .count {
  background-color: #e9ecef;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #666;
}

/* Search */
.search-container {
  margin-bottom: 2rem;
}

#search-input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-family: inherit;
}

#search-input:focus {
  outline: none;
  border-color: #0066cc;
}

#search-results {
  margin-top: 1rem;
}

.search-result-item {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.search-result-item h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.search-result-item h3 a {
  color: #333;
}

.search-highlight {
  background-color: #ffeb3b;
  padding: 0.1rem 0.2rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  position: relative;
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background-color: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Responsive */
@media (max-width: 768px) {
  /* Mobile Navigation */
  .mobile-menu-toggle {
    display: flex;
  }

  nav {
    position: relative;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #f8f9fa;
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin-top: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
  }

  .nav-links.active {
    max-height: 400px;
    opacity: 1;
    padding: 0.5rem 0;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 0.75rem 1rem;
    color: #333;
    transition: background-color 0.2s;
  }

  .nav-links a:hover {
    background-color: #e9ecef;
    color: #0066cc;
  }

  /* Typography */
  body {
    font-size: 16px;
  }

  h1 {
    font-size: 1.75rem;
    margin-top: 0.5rem;
  }

  h2 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
    margin-top: 1rem;
  }

  /* Layout */
  main {
    margin: 1rem auto;
    padding: 0 1rem;
  }

  header {
    padding: 0.75rem 0;
  }

  footer {
    padding: 1.5rem 0;
    margin-top: 3rem;
  }

  /* Post Meta */
  .post-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Post Navigation */
  .post-navigation .nav-links {
    position: static;
    flex-direction: column;
    max-height: none;
    opacity: 1;
    padding: 0;
    margin: 0;
    box-shadow: none;
    background-color: transparent;
  }

  .post-navigation .nav-links a {
    padding: 1rem;
    background-color: #f8f9fa;
  }

  /* Tag and Category Lists */
  .tag-list, .category-list {
    gap: 0.5rem;
  }

  .tag-list-item, .category-list-item {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }

  /* Code blocks */
  .post-content pre {
    padding: 0.75rem;
    font-size: 0.85rem;
    margin: 1rem -1rem;
    border-radius: 0;
  }

  /* Lists */
  .post-content ul,
  .post-content ol {
    margin-left: 1.5rem;
  }

  /* Search */
  #search-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .logo {
    font-size: 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .post-list-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .tag, .category {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }
}
