/* ═══════════════════════════════════════════════
   Blog Page - Clean & Simple Redesign
   ═══════════════════════════════════════════════ */

/* ─────────────────────────
   Header Section
───────────────────────── */

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

.page-title {
  margin: 0 0 8px 0;
  font-size: 34px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
}

/* ─────────────────────────
   Search Bar
───────────────────────── */

.blog-search-container {
  margin-bottom: 28px;
}

.blog-search {
  display: flex;
  gap: 10px;
  align-items: stretch;
  max-width: 600px;
}

.blog-search input {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.blog-search input:focus {
  border-color: rgba(109, 71, 21, 0.3);
  box-shadow: 0 0 0 3px rgba(109, 71, 21, 0.08);
}

.blog-search input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.search-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: all 180ms ease;
}

.search-btn:hover {
  background: var(--panel-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 71, 21, 0.1);
}

.search-btn:active {
  transform: translateY(0);
}

/* ─────────────────────────
   Filter Info
───────────────────────── */

.filter-info {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.filter-info .tag-highlight {
  font-family: ui-monospace, monospace;
  color: var(--text);
  font-weight: 600;
  background: rgba(109, 71, 21, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

/* ─────────────────────────
   Blog Post List
───────────────────────── */

.blog-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.blog-item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  transition: all 200ms ease;
  box-shadow: 0 2px 8px rgba(109, 71, 21, 0.04);
  height: 100%;
}

.blog-item:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--line) 55%, var(--accent));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
}

.blog-item:active {
  transform: translateY(0);
}

/* Thumbnail */
.blog-item-thumbnail {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  display: block;
}

/* Content wrapper for padding */
.blog-item-content {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Post Title */
.blog-item-title {
  margin: 0 0 6px 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}

/* Post Excerpt */
.blog-item-excerpt {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Post Meta (tags + date) */
.blog-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

/* Tags */
.blog-item-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.blog-tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  text-transform: capitalize;
  font-weight: 500;
  transition: all 150ms ease;
}

.blog-tag:hover {
  background: rgba(109, 71, 21, 0.12);
  transform: translateY(-1px);
}

.blog-tag.is-active {
  background: rgba(109, 71, 21, 0.14);
  border-color: rgba(109, 71, 21, 0.3);
  font-weight: 600;
}

/* Tag color variations */
.blog-tag[data-tag="python"] { border-color: rgba(76, 175, 80, 0.4); }
.blog-tag[data-tag="javascript"] { border-color: rgba(250, 204, 21, 0.4); }
.blog-tag[data-tag="rust"] { border-color: rgba(239, 68, 68, 0.4); }
.blog-tag[data-tag="html"] { border-color: rgba(255, 255, 255, 0.4); }
.blog-tag[data-tag="css"] { border-color: rgba(139, 92, 246, 0.4); }
.blog-tag[data-tag="docker"] { border-color: rgba(59, 130, 246, 0.4); }
.blog-tag[data-tag="api"] { border-color: rgba(109, 71, 21, 0.3); }

/* Date */
.blog-item-date {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  opacity: 0.8;
  white-space: nowrap;
}

/* Like counter in cards */
.blog-card-likes {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(109, 71, 21, 0.08);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* ─────────────────────────
   Empty State
───────────────────────── */

.blog-empty {
  text-align: center;
  padding: 60px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.blog-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.blog-empty-text {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
}

/* ═══════════════════════════════════════════════
   Individual Blog Post Page
   ═══════════════════════════════════════════════ */

.blog-post-container {
  max-width: 820px;
}

.blog-post {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 4px 16px rgba(109, 71, 21, 0.08);
  padding: 32px 36px;
}

/* Post Header */
.blog-post-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.blog-post-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.blog-post-title-section {
  flex: 1;
  min-width: 0;
}

.blog-post h1 {
  margin: 0 0 12px 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.blog-post-date {
  color: var(--muted);
  font-size: 14px;
  font-family: ui-monospace, monospace;
}

/* Cover Image */
.blog-cover {
  margin: 24px 0;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.blog-cover img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
}

/* Post Content */
.blog-content {
  line-height: 1.8;
  color: var(--text);
  font-size: 16px;
}

.blog-content p {
  margin: 0 0 18px 0;
}

.blog-content h2 {
  margin: 32px 0 16px 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.blog-content h3 {
  margin: 28px 0 14px 0;
  font-size: 20px;
  font-weight: 600;
}

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

.blog-content li {
  margin-bottom: 8px;
}

.blog-content pre {
  overflow: auto;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(109, 71, 21, 0.04);
  margin: 18px 0;
}

.blog-content code {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  border-radius: 6px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  background: rgba(109, 71, 21, 0.06);
}

.blog-content pre code {
  border: 0;
  padding: 0;
  background: transparent;
}

.blog-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(109, 71, 21, 0.3);
  text-underline-offset: 2px;
}

.blog-content a:hover {
  text-decoration-color: var(--accent);
}

.blog-content blockquote {
  margin: 18px 0;
  padding-left: 18px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  font-style: italic;
}

/* Image Gallery */
.blog-gallery {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.blog-gallery-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(109, 71, 21, 0.02);
}

.blog-gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* Post Actions */
.blog-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.blog-action-btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--panel);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: all 180ms ease;
  white-space: nowrap;
}

.blog-action-btn:hover {
  background: var(--panel-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 71, 21, 0.1);
}

.blog-action-btn.is-liked {
  background: rgba(109, 71, 21, 0.12);
  border-color: rgba(109, 71, 21, 0.25);
}

.blog-like-count {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* Copy toast notification */
.copy-toast {
  position: fixed;
  background: white;
  color: #2c3e50;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Comments Section */
.blog-comments {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding-top: 32px;
}

.blog-comments-header {
  margin: 0 0 20px 0;
  font-size: 22px;
  font-weight: 600;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.comment-form input,
.comment-form textarea {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: rgba(109, 71, 21, 0.3);
  box-shadow: 0 0 0 3px rgba(109, 71, 21, 0.08);
}

.comment-form textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.comment-form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.comment-form button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: all 180ms ease;
}

.comment-form button:hover {
  background: var(--panel-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(109, 71, 21, 0.1);
}

.comment-error {
  font-size: 13px;
  color: #ef4444;
  margin: 0;
}

/* Comment Items */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(109, 71, 21, 0.02);
}

.comment-header {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.comment-author {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.comment-date {
  color: var(--muted);
  font-size: 13px;
  font-family: ui-monospace, monospace;
}

.comment-text {
  color: var(--text);
  line-height: 1.7;
  font-size: 15px;
  margin: 0;
}

.comment-empty {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

/* ─────────────────────────
   Responsive Design
───────────────────────── */

@media (max-width: 768px) {
  .blog-list {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .blog-post {
    padding: 24px 20px;
  }

  .blog-post h1 {
    font-size: 28px;
  }

  .blog-post-header-top {
    flex-direction: column;
    gap: 16px;
  }

  .blog-actions {
    flex-direction: row;
    align-items: center;
    align-self: flex-start;
  }

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

  .blog-content h2 {
    font-size: 22px;
  }

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

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

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

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

  .blog-search {
    flex-direction: column;
  }

  .search-btn {
    width: 100%;
  }

  .blog-item-content {
    padding: 14px 16px;
  }

  .blog-item-title {
    font-size: 17px;
  }

  .blog-item-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .blog-item-date {
    width: 100%;
  }
}