/* Modern Blog Posts Block - Shopify-Inspired Design */

/* Force block title size - highly specific */
#block-martis-externalblogposts h2.block-title,
.block-myyarn-blog-aggregator h2.block-title {
  font-size: 26px !important;
}

.myyarn-blog-posts {
  margin: 0;
}

.blog-posts-list {
  display: grid;
  gap: 5px;
}

/* Scrollable mode */
/* Scrollable mode - apply to all blog posts by default */
.myyarn-blog-posts .blog-posts-list {
  max-height: 250px;  /* Shows ~5 posts */
  overflow-y: auto;
  padding-right: 8px;
}

.myyarn-blog-posts--scrollable .blog-posts-list::-webkit-scrollbar {
  width: 8px;
}

.myyarn-blog-posts--scrollable .blog-posts-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.myyarn-blog-posts--scrollable .blog-posts-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.myyarn-blog-posts--scrollable .blog-posts-list::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Post item */
.blog-post-item {
  background: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  position: relative;
}

.blog-post-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.blog-post-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  border: 2px solid transparent;
  transition: border-color 0.3s ease;
  pointer-events: none;
}

.blog-post-item:hover::after {
  border-color: rgba(0, 0, 0, 0.05);
}

.blog-post-link {
  display: flex;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 8px;
  align-items: center;
}

/* Image container */
.blog-post-image {
  width: 80px;
  height: 80px;
  min-width: 80px; /* Prevent shrinking */
  max-width: 80px; /* Prevent growing */
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ebf0 100%);
  flex-shrink: 0;
  position: relative;
}

.blog-post-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.blog-post-item:hover .blog-post-image::before {
  opacity: 1;
}

.blog-post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-post-item:hover .blog-post-image img {
  transform: scale(1.05);
}

/* Content area */
.blog-post-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1; /* Take remaining space */
  min-width: 0; /* For text truncation */
  text-align: right; /* RTL alignment */
}

.blog-post-title {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  color: #1a1a1a;
  transition: color 0.2s ease;
  
  /* Limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blog-post-item:hover .blog-post-title {
  color: #0066cc;
}

/* Meta information */
.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
  flex-wrap: wrap;
}

.blog-name {
  font-weight: 500;
  color: #374151;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.blog-name::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 3px;
  background: #3b82f6;
  border-radius: 50%;
}

.blog-date {
  color: #9ca3af;
  font-size: 11px;
}

.blog-date::before {
  content: '•';
  margin-right: 6px;
  color: #d1d5db;
}

/* Empty state */
.no-posts {
  padding: 48px 24px;
  text-align: center;
  color: #6b7280;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 12px;
  font-size: 14px;
  border: 1px dashed #d1d5db;
}

/* RTL Support - Force for Hebrew content */
.blog-post-link {
  grid-template-columns: 1fr 80px; /* Image on RIGHT by default */
}

.blog-post-meta {
  flex-direction: row-reverse;
}

.blog-name::before {
  order: 2;
}

.blog-date::before {
  content: '•';
  margin-right: 0;
  margin-left: 6px;
}

.myyarn-blog-posts .blog-posts-list {
  padding-right: 0;
  padding-left: 8px;
}

@media (max-width: 768px) {
  .blog-post-link {
    grid-template-columns: 1fr 70px; /* Keep image on right */
    gap: 8px;
    padding: 8px;
  }
  
  .blog-post-image {
    width: 50px;
    height: 50px;
    min-width: 50px;
    max-width: 50px;
  }
  
  .blog-post-title {
    font-size: 13px;
  }
  
  .blog-post-meta {
    font-size: 11px;
  }
  
  .myyarn-blog-posts .blog-posts-list {
    max-height: 500px;
  }
  
  #block-martis-externalblogposts h2.block-title,
  .block-myyarn-blog-aggregator h2.block-title {
  font-size: 20px !important;
}
}



/* Loading animation for images */
@keyframes shimmer {
  0% {
    background-position: -468px 0;
  }
  100% {
    background-position: 468px 0;
  }
}

.blog-post-image:empty::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f0f0f0 0px, #f8f8f8 40px, #f0f0f0 80px);
  background-size: 600px;
  animation: shimmer 1.5s infinite;
}

/* Accessibility improvements */
.blog-post-link:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.blog-post-link:focus:not(:focus-visible) {
  outline: none;
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .blog-post-item {
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  }
  
  .blog-post-title {
    color: #f9fafb;
  }
  
  .blog-post-item:hover .blog-post-title {
    color: #60a5fa;
  }
  
  .blog-name {
    color: #e5e7eb;
  }
  
  .blog-post-meta {
    color: #9ca3af;
  }
  
  .no-posts {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #9ca3af;
    border-color: #374151;
  }
}

.blog-post-pinned {
  font-size: 0.8rem;
  margin-left: 4px;
  margin-right: 4px;
  vertical-align: middle;
}