/* =========================================================
   blog.css — post list (category legend, date column, highlighted titles)
   ========================================================= */

.blog {
  padding: 3.2rem 1.25rem 0;
}

.blog-layout {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  max-width: 940px;
  margin: 0 auto;
}

/* ---------- Category legend ---------- */

.category-legend {
  position: sticky;
  top: 8.2rem;
  flex: 0 0 118px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.2rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.42rem 0.55rem;
  border-radius: 2px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: left;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.legend-item:hover {
  color: var(--text);
  background: var(--rule-soft);
}

.legend-item[aria-pressed='true'] {
  color: var(--text);
  background: var(--rule-soft);
}

.legend-color {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  background: rgba(var(--c), 0.3);
  border: 1px solid rgba(var(--c), 0.45);
  transition: transform 0.25s ease;
}

.legend-item[aria-pressed='true'] .legend-color { transform: scale(1.12); }

/* ---------- List ---------- */

.blog-list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: 0.5rem;
}

.blog-entry {
  display: flex;
  align-items: flex-start;
  padding: 0.32rem 0.35rem;
  color: inherit;
  border-bottom: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.blog-entry:hover { border-bottom: 0; }

.blog-entry[data-cat] {
  --c: var(--cat-color);
}

.blog-entry.technical { --cat-color: 59, 130, 246; }
.blog-entry.reflection { --cat-color: 245, 158, 11; }
.blog-entry.article { --cat-color: 139, 92, 246; }

.blog-date {
  flex: 0 0 96px;
  padding-top: 0.34rem;
  font-size: 0.82rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.blog-title {
  font-size: 1.02rem;
  line-height: 1.55;
  padding: 0.2rem 0.55rem 0.26rem;
  margin-left: 1.4rem;
  background: rgba(var(--cat-color), var(--cat-alpha));
  transition: background-color 0.28s ease;
}

.blog-entry:hover .blog-title,
.blog-entry:focus-visible .blog-title {
  background: rgba(var(--cat-color), calc(var(--cat-alpha) * 1.9));
}

.blog-entry:hover { transform: translateY(3px); }

.blog-entry.is-hidden { display: none; }

.blog-empty {
  padding: 2rem 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

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

/* ---------- Hover preview + branch curve ---------- */

.branch-svg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 59;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.branch-svg.is-visible { opacity: 1; }

.branch-path {
  fill: none;
  stroke: url(#branch-fade);
  stroke-width: 1;
  stroke-linecap: round;
}

.branch-dot {
  fill: var(--muted);
  opacity: 0;
  transition: opacity 0.4s ease 0.12s;
}

.branch-svg.is-visible .branch-dot { opacity: 0.7; }

.hover-preview {
  position: fixed;
  width: 280px;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 60;
  transform: translate(12px, -50%);
  transition: opacity 0.32s ease 0.08s, visibility 0.32s,
    transform 0.46s cubic-bezier(0.22, 1, 0.36, 1);
}

.hover-preview.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(0, -50%);
}

.preview-subtitle {
  margin: 0;
  font-size: 0.9rem;
  font-style: italic;
  font-weight: 300;
  line-height: 1.75;
  color: var(--muted);
}

/* ---------- Mobile ---------- */

@media (max-width: 900px) {
  .branch-svg,
  .hover-preview { display: none; }
}

@media (max-width: 768px) {
  .blog { padding-top: 2rem; }

  .blog-layout {
    flex-direction: column;
    gap: 1.6rem;
    padding: 0;
  }

  .category-legend {
    position: static;
    flex: none;
    flex-direction: row;
    align-items: center;
    align-self: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    padding: 0;
  }

  .legend-item {
    width: auto;
    padding: 0.35rem 0.6rem;
    font-size: 0.76rem;
  }

  .legend-color { width: 11px; height: 11px; flex-basis: 11px; }

  .blog-list { width: 100%; }

  .blog-date {
    flex-basis: 74px;
    font-size: 0.72rem;
    padding-top: 0.28rem;
  }

  .blog-title {
    font-size: 0.92rem;
    margin-left: 0.5rem;
    padding: 0.18rem 0.45rem;
  }
}

@media (max-width: 480px) {
  .blog-date { flex-basis: 64px; }
  .blog-title { font-size: 0.9rem; margin-left: 0.35rem; }
}