/* blog.css — Blog System Styles
   All styles use existing design tokens from style.css
   Dark and light mode compatible
*/

/* ============================================================
   READING PROGRESS BAR
   ============================================================ */

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--color-primary);
  z-index: 200;
  transition: width 80ms linear;
  box-shadow: 0 0 8px oklch(from var(--color-primary) l c h / 0.4);
  pointer-events: none;
}

/* ============================================================
   BLOG VIEW WRAPPER
   ============================================================ */

.blog-view {
  min-height: 100dvh;
  padding-top: 72px; /* header height */
  background: var(--color-bg);
}

.blog-view-active .site-footer {
  display: block; /* ensure footer shows in blog views */
}

/* ============================================================
   HOME INSIGHTS ENHANCEMENTS
   ============================================================ */

.insight-category-tag {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border: 1px solid oklch(from var(--color-primary) l c h / 0.2);
  display: inline-block;
}

.insight-category-tag--design-thinking {
  background: oklch(from var(--color-amber) l c h / 0.12);
  color: var(--color-amber);
  border-color: oklch(from var(--color-amber) l c h / 0.25);
}

.insight-category-tag--industry {
  background: oklch(from var(--color-success) l c h / 0.12);
  color: var(--color-success);
  border-color: oklch(from var(--color-success) l c h / 0.25);
}

.insight-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* View all posts button */
.view-all-posts {
  margin-top: var(--space-10);
  text-align: center;
}

.view-all-btn {
  min-height: 44px;
}

/* ============================================================
   BLOG LISTING VIEW
   ============================================================ */

.blog-listing-content {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-6);
  padding-block: var(--space-12) var(--space-24);
}

.blog-listing-header {
  margin-bottom: var(--space-12);
}

.blog-listing-hero {
  margin-top: var(--space-8);
}

.blog-listing-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--color-text);
  margin-top: var(--space-4);
  max-width: 22ch;
}

/* Back link */
.blog-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-2) 0;
  min-height: 44px;
  transition: color var(--transition-interactive);
}

.blog-back-link:hover {
  color: var(--color-primary);
}

/* Blog controls: filters + search */
.blog-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

/* Filter pills */
.blog-filter-pills {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--space-1);
}

.blog-filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  min-height: 36px;
  white-space: nowrap;
  transition:
    background var(--transition-interactive),
    color var(--transition-interactive),
    border-color var(--transition-interactive);
}

.filter-pill:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: oklch(from var(--color-text) l c h / 0.2);
}

.filter-pill--active {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border-color: oklch(from var(--color-primary) l c h / 0.4);
}

.filter-pill--active:hover {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

/* Search */
.blog-search-wrap {
  position: relative;
  flex-shrink: 0;
  width: min(280px, 100%);
}

.blog-search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}

.blog-search-input {
  padding-left: calc(var(--space-3) + 16px + var(--space-2));
  min-height: 40px;
  font-size: var(--text-sm);
}

/* Post grid */
.blog-post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 1023px) {
  .blog-post-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 639px) {
  .blog-post-grid {
    grid-template-columns: 1fr;
  }
}

/* Blog card */
.blog-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition:
    box-shadow var(--transition-interactive),
    border-color var(--transition-interactive),
    transform var(--transition-interactive);
}

.blog-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: oklch(from var(--color-primary) l c h / 0.25);
  transform: translateY(-3px);
}

.blog-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--space-6);
  text-decoration: none;
  color: inherit;
  gap: var(--space-3);
}

.blog-card-link:hover {
  color: inherit;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.blog-card-category {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border: 1px solid oklch(from var(--color-primary) l c h / 0.2);
  display: inline-block;
}

.blog-card-category--design-thinking {
  background: oklch(from var(--color-amber) l c h / 0.12);
  color: var(--color-amber);
  border-color: oklch(from var(--color-amber) l c h / 0.25);
}

.blog-card-category--industry {
  background: oklch(from var(--color-success) l c h / 0.12);
  color: var(--color-success);
  border-color: oklch(from var(--color-success) l c h / 0.25);
}

.blog-card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--color-text);
  transition: color var(--transition-interactive);
}

.blog-card:hover .blog-card-title {
  color: var(--color-primary);
}

.blog-card-excerpt {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-muted);
  flex: 1;
}

.blog-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

.blog-card-date,
.blog-card-readtime {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* Empty state */
.blog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
}

/* ============================================================
   BLOG POST VIEW
   ============================================================ */

.blog-post-wrap {
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
  padding-block: var(--space-12) var(--space-24);
}

.blog-post-container {
  max-width: 720px;
  margin-inline: auto;
}

.blog-post-nav {
  margin-bottom: var(--space-8);
}

/* Post header */
.blog-post-header {
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-divider);
}

.blog-post-category {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border: 1px solid oklch(from var(--color-primary) l c h / 0.3);
  display: inline-block;
  margin-bottom: var(--space-4);
  text-transform: uppercase;
}

.blog-post-category--design-thinking {
  background: oklch(from var(--color-amber) l c h / 0.12);
  color: var(--color-amber);
  border-color: oklch(from var(--color-amber) l c h / 0.3);
}

.blog-post-category--industry {
  background: oklch(from var(--color-success) l c h / 0.12);
  color: var(--color-success);
  border-color: oklch(from var(--color-success) l c h / 0.3);
}

.blog-post-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

/* Post body — reading-optimized */
.blog-post-body {
  /* constrain prose to 65-75ch */
}

.blog-body-p {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  max-width: 68ch;
}

/* Override base.css max-width for post body specifically */
.blog-post-body p,
.blog-post-body li {
  max-width: 68ch;
}

.blog-body-h {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  letter-spacing: -0.015em;
}

.blog-body-h2 {
  font-size: var(--text-lg);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
}

.blog-body-h3 {
  font-size: var(--text-base);
  font-weight: 600;
}

/* Pull quote */
.blog-body-quote {
  margin: var(--space-8) 0;
  padding: var(--space-5) var(--space-6);
  border-left: 3px solid var(--color-primary);
  background: var(--color-surface);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.blog-body-quote p {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-style: italic;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text);
  margin-bottom: 0;
  max-width: 60ch;
}

.blog-body-cite {
  display: block;
  margin-top: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-style: normal;
  color: var(--color-text-faint);
}

/* Lists */
.blog-body-list {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--color-text-muted);
  padding-left: var(--space-6);
  margin-bottom: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.blog-body-list li {
  max-width: 62ch;
}

.blog-body-list li::marker {
  color: var(--color-primary);
}

/* Inline images */
.blog-body-figure {
  margin: var(--space-8) 0;
}

.blog-body-img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.blog-body-caption {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-align: center;
  margin-top: var(--space-2);
  font-style: italic;
}

/* Share section */
.blog-post-share {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-10);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
  flex-wrap: wrap;
}

.blog-post-share-label {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
}

.blog-share-btn {
  min-height: 40px;
  font-size: var(--text-sm);
}

/* Related posts */
.blog-related {
  margin-top: var(--space-12);
  padding-top: var(--space-10);
  border-top: 1px solid var(--color-divider);
}

.blog-related-heading {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin-bottom: var(--space-6);
}

.blog-related-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.blog-related-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition:
    box-shadow var(--transition-interactive),
    border-color var(--transition-interactive),
    transform var(--transition-interactive);
}

.blog-related-card:hover {
  box-shadow: var(--shadow-md);
  border-color: oklch(from var(--color-primary) l c h / 0.25);
  transform: translateY(-2px);
}

.blog-related-link {
  display: block;
  padding: var(--space-5);
  text-decoration: none;
  color: inherit;
}

.blog-related-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
  line-height: 1.3;
  margin: var(--space-2) 0 var(--space-3);
  transition: color var(--transition-interactive);
}

.blog-related-card:hover .blog-related-title {
  color: var(--color-primary);
}

/* Subscribe in post */
.blog-post-subscribe {
  margin-top: var(--space-12);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 767px) {
  .blog-listing-content {
    padding-inline: var(--space-4);
    padding-block: var(--space-8) var(--space-16);
  }

  .blog-listing-title {
    font-size: var(--text-xl);
  }

  .blog-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .blog-filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }

  .blog-search-wrap {
    width: 100%;
  }

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

  .blog-post-wrap {
    padding-inline: var(--space-4);
    padding-block: var(--space-8) var(--space-16);
  }

  .blog-post-title {
    font-size: var(--text-xl);
  }

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

  .blog-body-quote p {
    font-size: var(--text-base);
  }
}

@media (max-width: 639px) {
  .blog-card-link {
    padding: var(--space-5);
  }
}
