/* ============================================================
   BLOG STYLES
   ============================================================ */

/* Blog Container & Layout */
.blog-container {
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
}

.blog-section {
  padding: 80px 0;
  border-bottom: 1px solid var(--line);
}

.blog-header {
  margin-bottom: 60px;
  text-align: center;
}

.blog-header h1 {
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 600;
  line-height: 1.2;
  margin: 16px 0 20px;
  letter-spacing: -0.02em;
}

.blog-intro {
  font-size: 18px;
  color: var(--fog);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Language Filter */
.language-filter {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 40px 0;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.filter-btn:hover {
  border-color: var(--ember);
  background: rgba(var(--ember-rgb), 0.04);
}

.filter-btn.active {
  background: var(--ember);
  color: white;
  border-color: var(--ember);
}

/* Posts Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.post-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
  background: rgba(var(--fg-rgb), 0.02);
}

.post-card:hover {
  border-color: var(--ember);
  background: rgba(var(--ember-rgb), 0.04);
  transform: translateY(-2px);
}

.post-card-content {
  flex: 1;
  min-width: 0;
}

.post-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.post-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--fg);
  flex: 1;
}

.language-badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(var(--ember-rgb), 0.1);
  color: var(--ember);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-excerpt {
  font-size: 15px;
  line-height: 1.6;
  color: var(--fog);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.post-tag {
  display: inline-block;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(var(--fg-rgb), 0.06);
  color: var(--paper-2);
  font-weight: 500;
}

.post-tag-more {
  font-size: 12px;
  color: var(--paper-2);
  padding: 4px 2px;
}

.post-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--fog);
}

.post-meta time {
  font-variant-numeric: tabular-nums;
  color: var(--paper-2);
}

.post-author {
  color: var(--ember);
  font-weight: 500;
}

.post-arrow {
  color: var(--ember);
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
  flex-shrink: 0;
}

.post-card:hover .post-arrow {
  opacity: 1;
}

/* Post View */
.blog-post-view {
  padding: 60px 0;
}

.back-link {
  background: none;
  border: none;
  color: var(--ember);
  font-size: 14px;
  padding: 8px 0;
  cursor: pointer;
  transition: opacity 0.2s;
  font-weight: 500;
}

.back-link:hover {
  opacity: 0.7;
}

.post-header {
  margin-bottom: 60px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line);
}

.post-meta-top {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--fog);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.post-meta-top time {
  color: var(--paper-2);
}

.post-language {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(var(--ember-rgb), 0.1);
  color: var(--ember);
  font-weight: 500;
}

.post-metadata {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.metadata-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--fog);
}

.metadata-label {
  font-weight: 600;
  color: var(--fg-2);
  flex-shrink: 0;
}

.metadata-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.post-title-large {
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.post-excerpt-large {
  font-size: 18px;
  color: var(--fog);
  line-height: 1.6;
  margin: 0;
}

/* Post Content */
.post-content {
  max-width: 720px;
  margin: 0;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 40px 0 20px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.post-content h1 {
  font-size: clamp(28px, 6vw, 36px);
  margin-top: 60px;
}

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

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

.post-content h4 {
  font-size: 16px;
}

.post-content p {
  font-size: 16px;
  line-height: 1.8;
  margin: 0 0 24px;
  color: var(--fg);
}

.post-content a {
  color: var(--ember);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: opacity 0.2s;
}

.post-content a:hover {
  opacity: 0.7;
}

.post-content ul,
.post-content ol {
  margin: 0 0 24px 20px;
  padding-left: 0;
}

.post-content li {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 12px;
  color: var(--fg);
}

.post-content blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 4px solid var(--ember);
  background: rgba(var(--ember-rgb), 0.08);
  font-style: italic;
  color: var(--ash);
  line-height: 1.6;
}

.post-content code {
  font-family: 'Geist Mono', 'Courier New', monospace;
  font-size: 14px;
  background: rgba(var(--fg-rgb), 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--coal);
}

.post-content pre {
  background: rgba(var(--fg-rgb), 0.04);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin: 32px 0;
  font-size: 13px;
  line-height: 1.6;
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--coal);
}

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

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

  .blog-section {
    padding: 60px 0;
  }

  .blog-header {
    margin-bottom: 40px;
  }

  .language-filter {
    margin: 30px -16px;
    padding: 0 16px;
    gap: 10px;
  }

  .filter-btn {
    font-size: 13px;
    padding: 7px 12px;
  }

  .post-card {
    flex-direction: column;
    padding: 20px;
  }

  .post-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .language-badge {
    align-self: flex-start;
  }

  .post-arrow {
    opacity: 1;
    justify-self: end;
  }

  .blog-post-view {
    padding: 40px 0;
  }

  .post-header {
    margin-bottom: 40px;
    padding-bottom: 30px;
  }

  .post-meta-top {
    flex-wrap: wrap;
  }

  .post-content h1 {
    margin-top: 40px;
  }

  .metadata-item {
    flex-direction: column;
    gap: 8px;
  }

  .metadata-label {
    display: block;
  }
}

/* Utility: Scroll Reveal */
.blog-section .reveal,
.blog-post-view .reveal {
  opacity: 0;
}

.blog-section .reveal[data-rv="1"],
.blog-post-view .reveal[data-rv="1"] {
  opacity: 1;
  animation: revealup 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
