/*
 * Blog CSS
 * 記事一覧ページ用スタイル
 * archive.php と page-blog.php と single.php で使用
 */

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 0 0;
}

/* Page Title */
.page-title {
  font-size: 40px;
  color: #375946;
  margin-bottom: 8px;
  font-weight: 700;
}

.page-subtitle {
  color: #666;
  font-size: 16px;
  margin-bottom: 48px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

/* Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 32px;
  margin-bottom: 48px;
}

/* Post Card */
.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: white;
  transition: all 0.3s ease;
  border: 1px solid #ebebeb;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(55, 89, 70, 0.15);
}

.post-link {
  position: absolute;
  inset: 0;
  /* top:0 right:0 bottom:0 left:0 の省略 */
  z-index: 1;
}

.post-thumbnail {
  width: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, #375946 0%, #4a7359 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 19px;
  position: relative;
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-thumbnail .no-image {
  font-size: 19px;
}

.post-content {
  padding: 24px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.post-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #666;
  flex-wrap: wrap;
}

.post-category {
  background-color: #f5f5f5;
  color: #375946;
  padding: 2px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.post-category:hover {
  opacity: 0.8;
}

.post-date {
  display: flex;
  align-items: center;
  gap: 5px;
}

.post-title {
  font-size: 20px;
  margin-bottom: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.post-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

.post-title a:hover {
  color: #4a7359;
}

.post-excerpt {
  color: #555;
  margin-bottom: 24px;
  line-height: 1.7;
  flex-grow: 1;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #375946;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.read-more:hover {
  gap: 12px;
  color: #4a7359;
}

.read-more::after {
  content: "→";
  font-size: 19px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 45px;
  height: 45px;
  padding: 0 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pagination a {
  background-color: white;
  color: #375946;
  border: 2px solid #e0e0e0;
}

.pagination a:hover {
  background-color: #375946;
  color: white;
  border-color: #375946;
}

.pagination .current {
  background-color: #375946;
  color: white;
  border: 2px solid #375946;
}

.pagination .dots {
  background: none;
  border: none;
  color: #666;
}

/* No Posts Message */
.no-posts {
  text-align: center;
  padding: 64px 32px;
  color: #666;
}

.no-posts h2 {
  color: #375946;
  margin-bottom: 16px;
}

/* ========================================
   Single Post Page Styles
   ======================================== */

/* Single Post Layout with Sidebar */
.single-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 0 0;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
}

/* Single Post Container */
.single-container {
  min-width: 0;
}

/* Single Post Header */
.single-header {
  margin-bottom: 40px;
}

.single-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
  align-items: center;
}

.single-category {
  background-color: #f5f5f5;
  color: #375946;
  padding: 2px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.single-category:hover {
  opacity: 0.8;
}

.single-date {
  color: #666;
  font-size: 15px;
}

.single-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
}

.single-thumbnail {
  margin-bottom: 40px;
  border-radius: 12px;
  overflow: hidden;
}

.single-thumbnail img {
  width: 100%;
  height: auto;
  display: block;
}

/* Single Post Content */
.single-content {
  font-size: 16px;
  line-height: 1.8;
  color: #333;
  margin-bottom: 48px;
}

.single-content h2 {
  font-size: 24px;
  color: #375946;
  margin-top: 48px;
  margin-bottom: 24px;
  font-weight: bold;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.single-content h3 {
  font-size: 20px;
  color: #375946;
  margin-top: 40px;
  margin-bottom: 20px;
  font-weight: bold;
}

.single-content h4 {
  font-size: 18px;
  margin-top: 32px;
  margin-bottom: 16px;
  font-weight: bold;
}

.single-content p {
  margin-bottom: 24px;
}

.single-content ul,
.single-content ol {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
  padding: 24px;
  border-radius: 8px;
  background-color: #f5f5f5;
}

.single-content li {
  position: relative;
  padding-left: .8em;
  font-weight: 500;

  &::before {
    content: "●";
    position: absolute;
    left: 0;
    top: 45%;
    transform: translateY(-50%);
    font-size: 0.7em;
    color: #3a5c49;
  }

}

.single-content a {
  color: #375946;
  text-decoration: underline;
  transition: color 0.3s ease;
}

.single-content a:hover {
  color: #4a7359;
}

.single-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 32px 0;
}

.single-content blockquote {
  border-left: 4px solid #FAE823;
  padding-left: 24px;
  margin: 32px 0;
  color: #555;
  font-style: italic;
}

.single-content code {
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 14px;
}

.single-content pre {
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 32px 0;
}

.single-content pre code {
  background: none;
  padding: 0;
}

/* Single Post Tags */
.single-tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 24px 0;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 48px;
}

.tags-label {
  font-weight: 600;
  color: #375946;
  font-size: 15px;
}

.single-tag {
  background-color: #f5f5f5;
  color: #666;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.single-tag:hover {
  background-color: #FAE823;
  color: #375946;
}

/* Post Navigation */
.post-navigation {
  display: flex;
  gap: 24px;
  margin-bottom: 64px;
}

.nav-previous,
.nav-next {
  flex: 1;
}

/* 片方しかない場合の調整 */
.post-navigation .nav-previous:only-child,
.post-navigation .nav-next:only-child {
  max-width: 50%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
  height: 100%;
}

.nav-link:hover {
  background: #375946;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(55, 89, 70, 0.2);
}

.nav-link:hover .nav-label,
.nav-link:hover .nav-title,
.nav-link:hover .nav-arrow {
  color: white;
}

.nav-arrow {
  font-size: 24px;
  color: #375946;
  transition: color 0.3s ease;
}

.nav-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-label {
  font-size: 13px;
  color: #666;
  font-weight: 600;
  transition: color 0.3s ease;
}

.nav-title {
  font-size: 15px;
  color: #333;
  font-weight: 600;
  line-height: 1.4;
  transition: color 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav-next .nav-link {
  justify-content: flex-end;
}

.nav-next .nav-content {
  text-align: right;
}

/* Related Posts */
.related-posts {
  margin-top: 64px;
}

.related-title {
  font-size: 20px;
  color: #375946;
  font-weight: 700;
  margin-bottom: 32px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.related-card {
  position: relative;
  background: white;
  border-radius: 12px;
  border: 1px solid #ebebeb;
  overflow: hidden;
  transition: all 0.3s ease;
}

.related-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(55, 89, 70, 0.15);
}

.related-thumbnail {
  display: block;
  width: 100%;
  height: 160px;
  overflow: hidden;
}

.related-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.related-card:hover .related-thumbnail img {
  transform: scale(1.05);
}

.related-no-image {
  background: linear-gradient(135deg, #375946 0%, #4a7359 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
}

.related-content {
  padding: 20px;
}

.related-post-title {
  font-size: 16px;
  margin-bottom: 8px;
}

.related-post-title a {
  text-decoration: none;
  font-weight: 600;
  line-height: 1.4;
  transition: color 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-post-title a:hover {
  color: #4a7359;
}

.related-date {
  font-size: 13px;
  color: #999;
}

/* ========================================
   Sidebar Styles
   ======================================== */

.single-sidebar {
  position: relative;
}

.sidebar-sticky {
  position: sticky;
  top: 100px;
}

/* Sidebar Widget */
.sidebar-widget {
  background: white;
  border-radius: 12px;
  margin-bottom: 24px;
}

.widget-title {
  font-size: 20px;
  color: #375946;
  font-weight: 700;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

/* Popular Posts Widget */
.popular-posts-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.popular-post-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.popular-rank {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: #FAE823;
  color: #375946;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.popular-post-content {
  flex: 1;
  display: flex;
  gap: 20px;
}

.popular-thumbnail {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  display: block;
}

.popular-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.popular-post-item:hover .popular-thumbnail img {
  transform: scale(1.1);
}

.popular-post-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.popular-post-title {
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}

.popular-post-title a {
  color: #333;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.popular-post-title a:hover {
  color: #375946;
}

.popular-post-date {
  font-size: 12px;
  color: #999;
}

.no-popular-posts {
  text-align: center;
  color: #999;
  padding: 20px 0;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .page-title {
    font-size: 32px;
  }

  .container {
    padding: 80px 16px;
  }

  /* Single Post Responsive */
  .single-layout {
    grid-template-columns: 1fr;
    padding: 32px 16px 0;
  }

  .single-container {
    order: 1;
  }

  .single-sidebar {
    display: none;
    /*order: 2;*/
  }

  .sidebar-sticky {
    position: static;
  }


  .single-title {
    font-size: 28px;
  }

  .single-content {
    font-size: 15px;
  }

  .single-content h2 {
    font-size: 24px;
  }

  .single-content h3 {
    font-size: 20px;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 450px) {
  .container {
    padding: 48px 16px;
  }

  .page-title {
    font-size: 28px;
  }

  .single-layout {
    padding: 24px 16px 0;
  }

  .single-title {
    font-size: 24px;
  }

  .single-content h2 {
    font-size: 20px;
  }

  .single-content h3 {
    font-size: 18px;
  }

  .single-content h4 {
    font-size: 18px;
  }
}