/* Focused refinements for the reading view: a quiet header and a compact related-posts card. */
.header,
.navbar {
  background-color: #ffffff;
}

.header {
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.site-mono {
  color: #1d1d1f;
}

.site-logo > a { display: inline-flex; align-items: center; gap: 10px; }
.site-mark { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; }
.header-search { width: min(360px, 34vw); }
.header-search-form { display: flex; align-items: center; overflow: hidden; border: 1px solid #d7dbe0; border-radius: 9px; background: #f5f5f7; }
.header-search-form:focus-within { border-color: #007aff; background: #fff; box-shadow: 0 0 0 3px rgba(0,122,255,.12); }
.header-search-form input { min-width: 0; flex: 1; height: 36px; padding: 0 12px; border: 0; outline: 0; background: transparent; color: #1d1d1f; }
.header-search-form button { display: grid; width: 38px; height: 36px; place-items: center; border: 0; border-left: 1px solid #d7dbe0; background: transparent; color: #6e6e73; cursor: pointer; }
.header-search-form button:hover { color: #007aff; background: #eff6ff; }

.site-logo .site-title:hover .site-mono {
  color: #007aff;
}

.navbar {
  border-top-color: #f1f3f5;
}

.navbar .nav li a {
  color: #4b5563;
}

.navbar .nav li a:hover,
.navbar .nav li a:focus,
.navbar .nav li.current-menu-item > a,
.navbar .nav li.current_page_item > a {
  color: #007aff;
  background: #eff6ff;
}

.navbar .nav > li > ul {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: 0;
}

.navbar .nav > li > ul > li > a {
  color: #4b5563;
}

.navbar .nav > li > ul > li > a:hover {
  color: #007aff;
  background: #eff6ff;
}

/* The original floating layout leaves unused vertical space when related posts are fewer than four. */
.related_posts {
  padding: 22px 28px 20px;
}

.related_posts .related_img {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
}

.related_posts .related_box {
  float: none;
  width: auto;
  min-width: 0;
  padding: 0;
}

.related_posts .related_box a {
  display: block;
  color: var(--color-text);
}

.related_posts .related_box img {
  aspect-ratio: 16 / 9;
  margin: 0;
}

.related_posts .related_box .r_title {
  display: -webkit-box;
  min-height: 40px;
  padding: 9px 2px 0;
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.related_posts .relates {
  clear: both;
  margin-top: 18px;
  padding-top: 16px;
}

.related_posts .related-list-title { margin: 0 0 9px; color: var(--color-text); font-size: 14px; font-weight: 700; }
.related_posts .relates ul {
  display: block;
  margin: 0;
}

.related_posts .relates li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  min-width: 0;
  border-bottom: 1px solid var(--color-border);
  line-height: 1.4;
}

.related_posts .relates li:last-child { border-bottom: 0; }
.related_posts .relates li .fa { color: var(--color-accent); font-size: 10px; }
.related_posts .relates li a {
  overflow: hidden;
  color: var(--color-text-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related_posts .relates li a:hover {
  color: #007aff;
}

.related_posts .relates time { color: #8e8e93; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.widget_meta ul { padding: 16px 22px 22px; }
.widget_meta li { margin: 0 0 11px; line-height: 1.7; }
.widget_meta li:last-child { margin-bottom: 0; }

.auth-span { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 20px; }
.auth-span .muted { margin-right: 0; white-space: nowrap; }
.auth-span .muted .fa { margin-right: 7px; }
/* Keep counts legible without making the compact metadata row feel loose. */
.auth-span .meta-count { display: inline-block; margin-right: 4px; font-variant-numeric: tabular-nums; }

@media (max-width: 767px) {
  .related_posts {
    padding: 20px;
  }

  .related_posts .related_img {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .related_posts .related_box .r_title {
    min-height: 0;
  }

  .header-search { width: min(220px, 42vw); }
  .site-mark { width: 30px; height: 30px; }
  .related_posts .relates li { grid-template-columns: 10px minmax(0,1fr); padding: 8px 0; }
  .related_posts .relates time { grid-column: 2; }
}
