*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  display: flex;
  max-width: 850px;
  margin: 0 auto;
  flex: 1;
  gap: 2rem;
  padding: 2.5rem;
}

.sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

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

.avatar {
  width: 100%;
  margin-bottom: 10px;
  margin-top: 10px;
  border-radius: 8px;
}

.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 0 1.5rem 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.sidebar-footer {
  margin-top: auto;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.sidebar-footer .avatar {
  display: none;
}

.sidebar-footer a {
  color: var(--accent-color);
  text-decoration: none;
}

.sidebar-footer a:hover {
  text-decoration: underline;
}

.content {
  flex: 1;
  min-width: 0;
}

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  z-index: 1000;
  flex-direction: column;
  align-items: center;
}

.mobile-header a {
  text-decoration: none;
}

.mobile-header .mobile-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 0.25rem;
}

.mobile-header .mobile-tagline {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.site-footer {
  display: none;
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--divider-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

.site-footer a {
  color: var(--accent-color);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Post list styles for homepage */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  scroll-margin-top: 80px;
}

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

.post-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.post-link {
  color: var(--text-primary);
  text-decoration: none;
  display: block;
}

.post-link h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-color);
  transition: color 0.2s ease;
}

.post-link:hover h2 {
  color: var(--accent-hover);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.toggle-titles {
  background: none;
  border: none;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

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

.toggle-icon {
  transition: transform 0.3s ease;
  display: inline-block;
}

.toggle-titles[aria-expanded="true"] .toggle-icon {
  transform: rotate(-180deg);
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Post titles styling */
.post-titles {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 9999px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.post-titles.collapsed {
  max-height: 0;
}

.article-title {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 0.3rem 0;
  transition: color 0.2s ease;
  display: block;
}

.article-title:hover {
  color: var(--accent-color);
  cursor: pointer;
}

/* Pagination controls */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 1rem 0;
}

.pagination-controls a {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  /* Prevent click-through issues */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pagination-controls a:hover:not(.disabled) {
  color: var(--accent-color);
}

.pagination-controls a.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-tertiary);
  pointer-events: none;
}

.pagination-controls a:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.pagination-info {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.pagination-info #current-page,
.pagination-info #total-pages {
  color: var(--accent-color);
  font-weight: 600;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

hr {
  border: none;
  height: 20px;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .site-footer {
    display: block;
  }

  .container {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
    padding-top: 4.5rem;
    padding-bottom: 3rem;
    max-width: 100%;
    width: 100%;
  }

  .sidebar {
    display: flex;
    width: 100%;
  }

  .sidebar .site-info,
  .sidebar .sidebar-footer {
    display: none;
  }

  .content {
    width: 100%;
    max-width: 100%;
  }

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

  .post-link h2 {
    font-size: 1rem;
  }

  .post-excerpt {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
  }

  .article-title {
    font-size: 0.85rem;
  }

  .pagination-controls {
    flex-direction: row;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .pagination-controls a {
    font-size: 0.85rem;
  }

  .pagination-info {
    font-size: 0.9rem;
  }

  hr {
    border: none;
    height: 10px;
  }

  .site-footer .avatar {
    display: flex;
  }
}
