/* =====================================================================
   KIỂU HIỂN THỊ NHẬT KÝ LILY — DÙNG CHUNG cho 2 nơi:
     • mục "Nhật ký" trên trang chủ (landing.html) — chỉ khoe vài bài mới nhất
     • trang nhật ký đầy đủ (/nhat-ky)
   Sửa ở ĐÂY là cả hai nơi đổi theo, khỏi lo lệch nhau.
   Mọi luật đều gói trong #nhat-ky để không đụng phần còn lại của trang chủ.
   ===================================================================== */

/* Khối nhật ký trên trang chủ dùng lớp nền xen kẽ `cross`, mà lớp đó ép tiêu đề căn TRÁI
   (nó vốn dành cho khối 2 cột) -> tiêu đề lệch giữa 2 dòng căn giữa. Kéo về giữa. */
#nhat-ky .sec-title { text-align: center; }

#nhat-ky .nk-dong { position: relative; margin-top: 30px; }
#nhat-ky .nk-dong::before {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(180deg, var(--brand-3), var(--line));
}

/* Mỗi bài là một KHUNG riêng, có DÂY NỐI từ chấm trên đường thời gian chạy vào khung. */
#nhat-ky .bai {
  position: relative; width: calc(50% - 30px); margin-bottom: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px 14px; box-shadow: var(--shadow-sm);
}
#nhat-ky .bai.trai { margin-right: auto; text-align: right; }
#nhat-ky .bai.phai { margin-left: auto; }

/* chấm tròn nằm ĐÚNG trên đường giữa (13px + viền 3px mỗi bên = 19px) */
#nhat-ky .bai::before {
  content: ""; position: absolute; top: 14px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--card); border: 3px solid var(--brand-3); z-index: 3;
}
#nhat-ky .bai.trai::before { right: -39px; }
#nhat-ky .bai.phai::before { left: -39px; }

/* dây nối: từ mép khung chạy ra tới chấm */
#nhat-ky .bai::after {
  content: ""; position: absolute; top: 22px; height: 2px; width: 22px;
  background: var(--brand-3); z-index: 1;
}
#nhat-ky .bai.trai::after { right: -22px; }
#nhat-ky .bai.phai::after { left: -22px; }
#nhat-ky .bai:first-child::before { border-color: var(--brand); box-shadow: 0 0 0 4px var(--tint); }
#nhat-ky .bai:first-child::after { background: var(--brand); }

#nhat-ky .nk-meta {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--mut); margin-bottom: 3px;
}
#nhat-ky .bai.trai .nk-meta { justify-content: flex-end; }
#nhat-ky .nk-meta .the {
  padding: 2px 8px; border-radius: var(--pill); background: var(--tint);
  color: var(--brand-2); font-weight: 700;
}
#nhat-ky .bai h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.3; letter-spacing: -.2px; }
#nhat-ky .bai .tom { margin: 0 0 8px; color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }

/* Khung bài nền trắng -> khung hội thoại phải nền nhạt mới nổi lên được. */
#nhat-ky .dt {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 9px 9px; text-align: left;
}
#nhat-ky .dt .thanh {
  display: flex; align-items: center; gap: 6px; padding-bottom: 5px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line); font-size: 11px; color: var(--mut);
}
#nhat-ky .dt .thanh .cham { width: 6px; height: 6px; border-radius: 50%; background: #16a34a; }
#nhat-ky .bong {
  max-width: 90%; padding: 5px 10px; border-radius: 12px; margin-bottom: 2px;
  font-size: 12.5px; line-height: 1.4;
}
#nhat-ky .bong.lily { background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
#nhat-ky .bong.chu {
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  margin-left: auto; border-bottom-right-radius: 4px;
}
#nhat-ky .ten { font-size: 10.5px; color: var(--mut); margin: 5px 0 1px 3px; font-weight: 600; }
#nhat-ky .ten:first-child { margin-top: 0; }
#nhat-ky .ten.p { text-align: right; margin-right: 3px; }

#nhat-ky .hoc {
  display: flex; gap: 7px; margin-top: 7px; padding: 7px 10px; background: var(--tint);
  border-radius: var(--radius-sm); font-size: 12.5px; line-height: 1.45;
  color: var(--ink-2); text-align: left;
}

/* Màn hẹp: một cột, đường thời gian dọc bên trái, khung lùi vào để chấm + dây nối
   nằm NGOÀI khung (không đè lên chữ). */
@media (max-width: 720px) {
  #nhat-ky .nk-dong::before { left: 7px; transform: none; }
  #nhat-ky .bai, #nhat-ky .bai.trai, #nhat-ky .bai.phai {
    width: auto; margin-left: 30px; margin-right: 0; text-align: left; margin-bottom: 14px;
  }
  #nhat-ky .bai.trai::before, #nhat-ky .bai.phai::before { left: -31px; right: auto; }
  #nhat-ky .bai.trai::after, #nhat-ky .bai.phai::after { left: -13px; right: auto; width: 13px; }
  #nhat-ky .bai.trai .nk-meta { justify-content: flex-start; }
  #nhat-ky .bai.trai h3, #nhat-ky .bai.trai .tom { text-align: left; }
}
