/* StoryDesk Connect — Frontend Widget Styles
 * Minimal, theme-inheriting. Designed to blend with any WordPress theme.
 */

/* ---- Base container ---- */
.sd-widget {
  position: relative;
  margin: 1em 0;
  line-height: inherit;
  font-family: inherit;
  color: inherit;
}

/* ---- Content Block ---- */
.sd-content-block {
  max-width: 100%;
}
.sd-content-block img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* ---- Blog Snippets Carousel ---- */
.sd-blog-snippets {
  overflow: hidden;
}
.sd-blog-snippets .sd-snippet-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
}
.sd-blog-snippets .sd-snippet-item {
  min-width: 100%;
  box-sizing: border-box;
  padding: 0 8px;
}
.sd-blog-snippets .sd-snippet-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
}
.sd-blog-snippets .sd-snippet-item h3 {
  margin: 0 0 4px;
  font-size: 1.1em;
}
.sd-blog-snippets .sd-snippet-item p {
  margin: 0 0 8px;
  font-size: 0.9em;
  opacity: 0.8;
}
.sd-blog-snippets .sd-snippet-item a {
  font-size: 0.85em;
  font-weight: 600;
}

/* ---- Blog Posts Grid / List ---- */
.sd-blog-posts .sd-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.sd-blog-posts .sd-post-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s;
}
.sd-blog-posts .sd-post-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.sd-blog-posts .sd-post-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.sd-blog-posts .sd-post-card-body {
  padding: 16px;
}
.sd-blog-posts .sd-post-card h3 {
  margin: 0 0 6px;
  font-size: 1.05em;
}
.sd-blog-posts .sd-post-card .sd-post-date {
  font-size: 0.8em;
  opacity: 0.6;
  margin-bottom: 6px;
}
.sd-blog-posts .sd-post-card .sd-post-excerpt {
  font-size: 0.9em;
  opacity: 0.8;
}

/* List layout override */
.sd-blog-posts[data-sd-layout="list"] .sd-posts-grid {
  grid-template-columns: 1fr;
}
.sd-blog-posts[data-sd-layout="list"] .sd-post-card {
  display: flex;
}
.sd-blog-posts[data-sd-layout="list"] .sd-post-card img {
  width: 200px;
  min-height: 100%;
  height: auto;
}

/* ---- Loading skeleton ---- */
.sd-widget-loading .sd-skeleton {
  height: 120px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: sd-shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes sd-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Dark mode ---- */
@media (prefers-color-scheme: dark) {
  .sd-blog-posts .sd-post-card {
    background: #1e1e1e;
    border-color: #333;
  }
  .sd-widget-loading .sd-skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: sd-shimmer 1.5s infinite;
  }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .sd-blog-posts .sd-posts-grid {
    grid-template-columns: 1fr;
  }
  .sd-blog-posts[data-sd-layout="list"] .sd-post-card {
    flex-direction: column;
  }
  .sd-blog-posts[data-sd-layout="list"] .sd-post-card img {
    width: 100%;
    height: 180px;
  }
}
