/* Custom CSS for PhucQuan Blog */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Thu nhỏ title trong masthead */
.masthead__inner-wrap {
  padding: 0.3em 0.5em;
}

.site-title {
  font-size: 0.85rem !important;
  padding: 0.3em 0;
  margin-right: 1em !important;
}

@media (min-width: 80em) {
  .site-title {
    font-size: 0.95rem !important;
  }
}

/* Tối ưu navigation menu */
.greedy-nav {
  font-size: 0.85rem;
}

.greedy-nav a {
  padding: 0.4rem 0.6rem;
}

.greedy-nav .visible-links {
  display: flex;
  flex-wrap: nowrap;
}

/* Thu nhỏ hamburger button nếu cần */
.greedy-nav__toggle {
  padding: 0.5rem;
}

/* Căn giữa nội dung bài viết */
.page__content {
  max-width: 900px;
  margin: 0 auto !important;
  padding: 0 20px;
  font-size: 1rem;
  line-height: 1.8;
}

/* Căn giữa page wrapper */
.page {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  padding: 0 !important;
  float: none !important;
}

.page__inner-wrap {
  max-width: 1200px;
  margin: 0 auto !important;
  padding: 0 20px;
}

@media (min-width: 64em) {
  .page {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    float: none !important;
  }

  .page__inner-wrap {
    max-width: 1200px;
    margin: 0 auto !important;
  }
}

/* Tối ưu tiêu đề */
.page__title {
  text-align: center;
  margin-bottom: 1em;
}

/* Tối ưu meta info */
.page__meta {
  text-align: center;
  margin-bottom: 2em;
}

/* Tối ưu heading trong bài viết */
.page__content h1,
.page__content h2,
.page__content h3,
.page__content h4 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  margin-top: 2em;
  margin-bottom: 0.8em;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.3;
}

.page__content h2 {
  font-size: 1.8em;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.3em;
  margin-top: 2.5em;
}

.page__content h3 {
  font-size: 1.5em;
  color: #2d3748;
}

.page__content h4 {
  font-size: 1.2em;
  color: #4a5568;
}

/* Tối ưu đoạn văn */
.page__content p {
  margin-bottom: 1.5em;
  line-height: 1.8;
  color: #333;
}

/* Tối ưu list */
.page__content ul,
.page__content ol {
  margin-bottom: 1.3em;
  padding-left: 2em;
}

/* Tối ưu code blocks */
.page__content pre {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
  font-size: 0.9em;
  line-height: 1.6;
  margin: 2em 0;
  border-radius: 8px;
  background: #1a1b26 !important;
  /* Tokyo Night Dark */
  padding: 45px 1.5em 1.5em !important;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  overflow-x: auto;
}

/* MacOS style dots */
.page__content pre::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 15px;
  width: 12px;
  height: 12px;
  background: #ff5f56;
  border-radius: 50%;
  box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
  z-index: 10;
}

/* Custom scrollbar for pre */
.page__content pre::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.page__content pre::-webkit-scrollbar-track {
  background: #1a1b26;
  border-radius: 0 0 8px 8px;
}

.page__content pre::-webkit-scrollbar-thumb {
  background: #414868;
  border-radius: 8px;
}

.page__content code {
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
  font-size: 0.9em;
}

/* Tối ưu hình ảnh trong bài viết */
.page__content img {
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  display: block;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Tối ưu blockquote */
.page__content blockquote {
  margin: 1.5em 0;
  padding: 1em 1.5em;
  border-left: 4px solid #0066cc;
  background-color: #f8f9fa;
}

/* Sidebar cho pages */
.sidebar {
  width: 200px !important;
}

@media (min-width: 80em) {
  .sidebar {
    width: 250px !important;
  }
}

/* Thu nhỏ avatar trong sidebar */
.author__avatar img {
  max-width: 100px !important;
  border-radius: 50%;
}

/* Thu nhỏ font size trong sidebar navigation */
.sidebar .nav__title {
  font-size: 0.9rem !important;
}

.sidebar .nav__list {
  font-size: 0.85rem !important;
}

/* Tối ưu table */
.page__content table {
  margin: 1.5em auto;
  width: 100%;
  max-width: 800px;
}

/* Responsive */
@media (max-width: 768px) {
  .page__content {
    padding: 0 15px;
  }

  .page__content p {
    text-align: left;
  }
}

/* Đảm bảo content không bị lệch */
.layout--single .page__inner-wrap {
  max-width: 1200px;
  margin: 0 auto !important;
}

/* Loại bỏ float cho page content */
.page__content {
  float: none !important;
  width: 100% !important;
}

/* Cải thiện spacing cho list items */
.page__content li {
  margin-bottom: 0.5em;
}

/* Cải thiện code inline */
.page__content p code,
.page__content li code {
  color: #e06c75;
  background-color: #f1f3f5;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 500;
  border: 1px solid #e9ecef;
}

/* Đảm bảo hình ảnh luôn căn giữa */
.page__content p img,
.page__content img {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Card layout cho danh sách bài viết - Horizontal style */
.entries-list .list__item {
  margin-bottom: 1.5em;
}

.archive__item {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1.5em;
  background: #fff;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column; /* Sửa từ row thành column */
  gap: 0.5em; /* Giảm gap giữa các thành phần */
  min-height: 120px;
}

.archive__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border-color: #3498db;
}

.archive__item-teaser {
  width: 100%;
  max-height: 250px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  margin-bottom: 0.5em;
}

.archive__item-teaser img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.archive__item-title {
  font-size: 1.4em !important;
  margin-bottom: 0.2em;
  line-height: 1.4;
}

.archive__item-title a {
  color: #2c3e50 !important;
  text-decoration: none;
  display: inline;
}

.archive__item-title a:hover {
  color: #3498db !important;
}

.archive__item-excerpt {
  color: #666;
  font-size: 0.95em;
  line-height: 1.6;
  margin-bottom: 0;
}

.page__meta {
  font-size: 0.85em;
  color: #999;
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}

.page__meta i {
  margin-right: 0.3em;
}

/* Grid layout cho category pages - List style giống writeups */
.entries-list {
  border-left: 2px solid #3d4144;
  padding-left: 20px;
  margin: 2em 0;
  list-style: none;
}

.entry-item {
  margin-bottom: 30px;
  position: relative;
  padding: 1em;
  border-radius: 8px;
  transition: background 0.2s;
}

.entry-item:hover {
  background: #f8f9fa;
}

.entry-item::before {
  content: '';
  position: absolute;
  left: -26px;
  top: 1.5em;
  width: 10px;
  height: 10px;
  background: #3498db;
  border-radius: 50%;
}

.entry-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5em;
}

.entry-date {
  font-size: 0.85em;
  color: #999;
  font-weight: 500;
  margin-bottom: 0.3em;
}

.entry-title {
  margin: 0 !important;
  font-size: 1.4em !important;
  line-height: 1.3;
}

.entry-title a {
  text-decoration: none;
  color: #2c3e50;
}

.entry-title a:hover {
  color: #3498db;
}

.entry-excerpt {
  color: #666;
  font-size: 0.95em;
  line-height: 1.6;
  margin: 0.5em 0;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-top: 0.5em;
}

.tag-badge {
  font-size: 0.8em;
  background: #f0f0f0;
  padding: 0.3em 0.8em;
  border-radius: 12px;
  color: #666;
  border: 1px solid #e0e0e0;
}

@media (max-width: 768px) {
  .entries-list {
    padding-left: 15px;
  }

  .entry-item::before {
    left: -21px;
  }
}

/* Tags styling */
.archive__item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-top: 0.5em;
}

.archive__item-tags a {
  background: #f0f0f0;
  padding: 0.3em 0.8em;
  border-radius: 15px;
  font-size: 0.8em;
  color: #666;
  text-decoration: none;
  transition: all 0.2s;
}

.archive__item-tags a:hover {
  background: #3498db;
  color: #fff;
}

/* Category badge */
.archive__item-category {
  display: inline-block;
  background: #e8f4f8;
  color: #3498db;
  padding: 0.3em 0.8em;
  border-radius: 5px;
  font-size: 0.85em;
  font-weight: 600;
  margin-bottom: 0.5em;
}

/* Style cho Recent Posts ở trang Home */
.page__content .archive__subtitle {
  font-size: 1.5em !important;
  font-weight: 600;
  margin-top: 2em;
  margin-bottom: 1em;
  border-bottom: 2px solid #3498db;
  padding-bottom: 0.3em;
}

/* Style cho list items trong Recent Posts */
.page__content .list__item {
  margin-bottom: 1.5em;
  padding: 1em;
  border-left: 3px solid #3498db;
  background: #f8f9fa;
  border-radius: 0 8px 8px 0;
  transition: all 0.2s;
}

.page__content .list__item:hover {
  background: #e9ecef;
  border-left-width: 5px;
}

.page__content .archive__item-title {
  font-size: 1.2em !important;
  margin-bottom: 0.3em;
}

.page__content .archive__item-excerpt {
  font-size: 0.9em;
  color: #666;
  line-height: 1.5;
  margin-top: 0.5em;
}

.page__content .page__meta {
  font-size: 0.85em;
  color: #999;
  margin-top: 0.3em;
}

/* Hiển thị teaser image trên danh sách bài viết */
.page__content .archive__item-teaser {
  display: block;
  margin-bottom: 1em;
}
.page__content .archive__item-teaser img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}
