/* =========================================================
   FOUNDER.CSS – Đợt 4c
   1) Founder Mode: callout "Góc nhà sáng lập" chèn inline sau mỗi mục.
      QUAN TRỌNG: chữ câu hỏi + nhãn nút hiển thị qua CSS content (attr)
      nên phần tử chèn KHÔNG có text node -> không lệch offset của marks/TTS.
   2) Timeline mục lục: thanh chấm dọc nổi bên phải + tô sáng sidebar.
   3) Nhật ký tư duy: modal viết rộng + danh sách trong hub.
   ========================================================= */

/* ===================== 1) FOUNDER CALLOUT ===================== */
.rd-founder-q { display: none; }
body.rd-founder-on .rd-founder-q {
  display: block; position: relative; margin: 20px 0;
  padding: 13px 15px; font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--brand-soft), var(--paper));
  border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: 0 12px 12px 0;
}
.rd-founder-q::before {
  content: "💡 Góc nhà sáng lập"; display: block;
  font-size: 11.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  color: var(--brand); margin-bottom: 6px;
}
.rd-founder-q__q { display: block; }
.rd-founder-q__q::before {
  content: attr(data-q); display: block;
  font-family: var(--font-serif); font-size: 15px; line-height: 1.55; font-style: italic; color: var(--ink);
}
.rd-founder-nb {
  margin-top: 11px; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  border-radius: 8px; padding: 6px 12px; font-family: var(--font-sans); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.rd-founder-nb::after { content: "Ghi vào nhật ký"; }   /* nhãn qua CSS -> không tạo text node */
.rd-founder-nb svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rd-founder-nb:hover { background: var(--brand-2); }
.rd-founder-nb:active { transform: scale(.97); }

/* ===================== 2) TIMELINE RAIL ===================== */
.rd-timeline {
  position: fixed; right: 12px; top: 50%; transform: translateY(-50%); z-index: 60;
  display: flex; flex-direction: column; align-items: flex-end; gap: 9px;
  max-height: 80vh; overflow-y: auto; padding: 6px 4px; scrollbar-width: none;
}
.rd-timeline::-webkit-scrollbar { display: none; }
.rd-timeline__dot {
  position: relative; width: 11px; height: 11px; padding: 0; flex: 0 0 auto;
  border-radius: 50%; border: 1.5px solid var(--brand); background: var(--paper);
  cursor: pointer; opacity: .5; transition: opacity .15s, transform .15s, box-shadow .15s;
}
.rd-timeline__dot.s3 { width: 8px; height: 8px; opacity: .38; }
.rd-timeline__dot:hover { opacity: 1; }
.rd-timeline__dot.is-active { opacity: 1; background: var(--brand); transform: scale(1.35); box-shadow: 0 0 0 4px var(--brand-soft); }
.rd-timeline__dot::after {
  content: attr(data-label); position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
  background: var(--ink); color: var(--paper); font-family: var(--font-sans); font-size: 12px;
  padding: 4px 9px; border-radius: 7px; opacity: 0; pointer-events: none; transition: opacity .15s; box-shadow: var(--shadow-sm);
}
.rd-timeline__dot:hover::after { opacity: .96; }
@media (max-width: 1200px) { .rd-timeline { display: none; } }
@media print { .rd-timeline, .rd-founder-q { display: none !important; } }

/* tô sáng mục đang đọc trong sidebar (theme-safe: dùng màu brand + vạch trái) */
.sidebar .nav-subs a.rd-toc-active { color: var(--brand); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }

/* ===================== 3) NHẬT KÝ – modal viết ===================== */
.rd-jr-ov { position: fixed; inset: 0; background: rgba(40, 30, 10, .5); z-index: 130; display: none; }
.rd-jr-ov.show { display: block; }
.rd-jr-modal {
  position: fixed; z-index: 131; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(900px, 96vw); height: min(90vh, 880px); display: none; flex-direction: column;
  background: var(--paper); color: var(--ink); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.rd-jr-modal.show { display: flex; }
.rd-jr-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.rd-jr-modal__head h3 { margin: 0; font-size: 17px; color: var(--brand); font-family: var(--font-sans); }
.rd-jr-modal__body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; overflow: auto; }
.rd-jr-prompt { font-family: var(--font-serif); font-style: italic; font-size: 14.5px; line-height: 1.5; color: var(--ink); background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 0 9px 9px 0; padding: 10px 12px; }
.rd-jr-meta { font-size: 12px; color: var(--ink-soft); font-family: var(--font-sans); }
.rd-jr-modal textarea { flex: 1; min-height: 200px; resize: none; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 15px; line-height: 1.6; background: var(--paper); color: var(--ink); }
.rd-jr-modal textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.rd-jr-modal__foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); }
.rd-jr-modal__foot .rd-grow { flex: 1; }

/* ===================== NHẬT KÝ – danh sách trong hub ===================== */
.rd-jr-new { width: 100%; justify-content: center; margin-bottom: 12px; }
.rd-jr-list { display: flex; flex-direction: column; gap: 8px; }
.rd-jr-item { border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; background: var(--bg-2); cursor: pointer; transition: background .12s; }
.rd-jr-item:hover { background: var(--brand-soft); }
.rd-jr-item__top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--ink-soft); margin-bottom: 4px; }
.rd-jr-item__prompt { font-size: 12px; font-style: italic; color: var(--brand); margin-bottom: 3px; line-height: 1.4; }
.rd-jr-item__text { font-size: 13.5px; line-height: 1.5; color: var(--ink); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ===================== CÔNG TẮC Founder Mode (trong hub) ===================== */
.rd-founder-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
.rd-founder-switch.is-on { border-color: var(--brand); background: linear-gradient(135deg, var(--brand-soft), var(--paper)); }
.rd-founder-switch__t { font-family: var(--font-sans); }
.rd-founder-switch__t b { display: block; font-size: 13.5px; color: var(--ink); }
.rd-founder-switch__t span { font-size: 11.5px; color: var(--ink-soft); }
.rd-switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; border: 0; border-radius: 999px; background: var(--border); cursor: pointer; transition: background .2s; }
.rd-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .2s; }
.rd-switch.is-on { background: var(--brand); }
.rd-switch.is-on::after { left: 23px; }
