/* ===== Blog (blog.html) ===== */

/* Search box above the feed grid: a calm dark field like the review
   inputs, with an outline submit button. */
.blog-search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
}

.blog-search__input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: inherit;
  font: inherit;
}

.blog-search__input:focus {
  outline: none;
  border-color: var(--accent);
}

.blog-search__btn {
  flex: none;
}

.blog-search__count {
  margin: -8px 0 18px;
  color: #aab2c0;
  font-size: 14px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  /* The whole card is one link: a click anywhere opens the article. */
  text-decoration: none;
  color: inherit;
}

.blog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.blog-card__img {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.blog-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Dashed placeholder box shown when a post has no preview image. */
.blog-card__img--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aab2c0;
  font-size: 14px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.25);
}

.blog-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.blog-card__body h3 {
  color: #fff;
  font-size: 19px;
  transition: color 0.2s;
}

.blog-card:hover .blog-card__body h3 {
  color: var(--accent);
}

.blog-card__body p {
  color: #aab2c0;
  font-size: 14px;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card__foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.blog-card__date {
  color: #aab2c0;
  font-size: 13px;
}

/* ===== Article (blog/<id>/) ===== */

.blog-post {
  max-width: 780px;
  margin: 0 auto;
}

/* Date, tags, votes and the comments button share one row; wraps on
   narrow screens. The votes push right, the comments button sits
   right next to them. */
.blog-post__top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 30px;
}

.blog-post__date {
  color: #aab2c0;
  font-size: 14px;
}

/* Compact pill opening the comment popup: same look as the vote
   buttons so the row reads as one unit. */
.blog-comments-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  color: #aab2c0;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.blog-comments-btn:hover {
  border-color: var(--accent);
  color: #fff;
}

.blog-comments-btn__icon {
  width: 14px;
  height: 14px;
}

/* Article hero: the title as a large plain headline (like the landing
   hero) without the frosted plate; the post photo backdrop gets a bit
   more darkening than the stock hero (brightness 0.7 = -30%). The
   headline is pinned to the bottom-left corner. The hero keeps the
   stock height, so the photo extends behind the header as usual. */
.page-hero--post .page-hero__inner {
  align-items: flex-start;
  justify-content: flex-end;
  text-align: left;
  padding: 64px 20px 26px;
}

.page-hero--post .page-hero__title {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-family: "Dela Gothic One", "IBM Plex Sans", sans-serif;
  font-weight: 400;
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.25;
  letter-spacing: 0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
}

.page-hero--post .hero__bg > img {
  filter: blur(4px) brightness(0.7);
}

.blog-tag {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #aab2c0;
  font-size: 12px;
}

/* ===== Rendered markdown (inside .blog-post__content) ===== */

.blog-post__content {
  color: #dfe3ea;
  font-size: 17px;
  line-height: 1.75;
}

.blog-post__content h2 {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin: 36px 0 12px;
}

.blog-post__content h3 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 28px 0 10px;
}

.blog-post__content p {
  margin: 0 0 16px;
}

.blog-post__content a {
  color: var(--accent);
}

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

.blog-post__content li {
  margin-bottom: 6px;
}

.blog-post__content img {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  margin: 20px 0;
}

.blog-post__content blockquote {
  margin: 0 0 16px;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 12px 12px 0;
  color: #c7cdd8;
}

.blog-post__content blockquote p {
  margin: 0;
}

.blog-post__content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.blog-post__content pre {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  margin: 0 0 16px;
}

.blog-post__content pre code {
  background: none;
  padding: 0;
}

/* ===== Ad block under the article ===== */

.blog-ad {
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 24px 28px;
}

.blog-ad p {
  margin: 0;
  font-size: 17px;
}

/* ===== Post votes (right end of the article top row) ===== */

.blog-post__votes {
  margin: 0 0 0 auto;
}

/* The feed and article views are server-rendered; the unused sibling
   (empty feed on the article page and vice versa) collapses. */
.blog-feed:empty,
.blog-post:empty {
  display: none;
}

/* ===== Comments: Reddit-style tree ===== */

.blog-comments {
  margin-top: 44px;
}

.blog-comments__title {
  color: #fff;
  font-size: 20px;
  margin-bottom: 22px;
}

/* Nested lists indent each reply level; --flat stops the indent for
   very deep threads (the server caps nesting at 8 levels). */
.blog-comments__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blog-comments__list .blog-comments__list {
  margin-left: 34px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  padding-left: 18px;
}

.blog-comment--flat .blog-comments__list {
  margin-left: 0;
  border-left: 0;
  padding-left: 0;
}

.blog-comment {
  padding: 16px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.blog-comments__list > .blog-comment:last-child {
  border-bottom: 0;
}

.blog-comment__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.blog-comment__author {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}

.blog-comment__date {
  color: #8a93a5;
  font-size: 13px;
}

.blog-comment__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.blog-comment__actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 10px;
}

.blog-comment__votes {
  margin: 0;
}

.blog-comment__reply {
  background: none;
  border: 0;
  padding: 0;
  color: #aab2c0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.blog-comment__reply:hover {
  color: var(--accent);
}

/* Icon-only buttons (the captions are dropped when the icon file is
   filled in); the svg is an empty placeholder right now. */
.blog-comment__edit,
.blog-comment__delete {
  background: none;
  border: 0;
  padding: 4px;
  color: #aab2c0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.blog-comment__edit:hover {
  color: var(--accent);
}

.blog-comment__delete:hover {
  color: #ff7b6b;
}

.blog-comment__icon {
  display: block;
  width: 13px;
  height: 13px;
  flex: none;
}

/* Deleted comments: the author and text are greyed placeholders; no
   actions, no votes are rendered at all. */
.blog-comment--deleted .blog-comment__author,
.blog-comment--deleted .blog-comment__text {
  color: #7c8594;
  font-style: italic;
}

/* Inline edit form: same box as the reply form, with a button row
   instead of the captcha slider (the owner is already proven). */
.blog-comment__edit-form {
  margin: 14px 0 6px 34px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.blog-comment-form__row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

/* ===== Comment form =====

   The top form starts collapsed to just the text area; focusing it
   reveals the author field and the slider (the extra block slides
   open via .blog-comment-form__extra--open, added by js/blog.js).
   The slider sends the comment - there is no submit button. */

.blog-comment-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* The form itself is class="review-form" (see css/reviews.css): the
   fields and labels are styled there, exactly like the review page. */

.blog-comment-form__extra {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.3s ease;
}

.blog-comment-form__extra--open {
  max-height: 260px;
  opacity: 1;
  transform: translateY(0);
}

/* ===== Inline reply form (under the comment, YouTube-style) =====
   The clone is class="review-form blog-comment__reply-form": the
   review styles cover the fields, this rule only adds the box. */

.blog-comment__reply-form {
  margin: 14px 0 6px 34px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

/* ===== Comments popup =====
   Modal with the comment tree and the form, opened from the comments
   button next to the post votes (js/blog.js). Mirrors the contact
   popup shell (components.css). */

.blog-comments-popup {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.blog-comments-popup[hidden] {
  display: none;
}

.blog-comments-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 20, 0.72);
}

.blog-comments-popup__dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 26px 28px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.blog-comments-popup__close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: 0;
  color: #aab2c0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
}

.blog-comments-popup__close:hover {
  color: #fff;
}

.blog-comments-popup__title {
  color: #fff;
  font-size: 20px;
  margin: 0 0 20px;
}

.blog-comments-popup__count {
  color: #8a93a5;
  font-size: 15px;
  font-weight: 400;
}

.blog-comments-popup__empty {
  color: #aab2c0;
  font-size: 15px;
  margin: 0 0 8px;
}

/* Inside the popup the form sits directly under the title; the tree
   (or the empty state) follows below a separator line. */
.blog-comments-popup .blog-comments {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.blog-comments-popup__empty {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.blog-comment-form .blog-comments__title {
  margin-bottom: 0;
}