/* ===========================================================
   Dòng Thời Gian Lịch Sử Việt Nam
   Khung + header/footer bao quanh TimelineJS (KnightLab).
   Tông đỏ–vàng (cờ VN).
   =========================================================== */
:root {
  --red: #b91c1c;
  --red-dark: #7f1212;
  --gold: #f4b400;
  --ink: #1f2430;
  --ink-soft: #55607a;
  --line: #e4dccb;
  --bg: #fbf7ef;
  --card: #ffffff;
  --shadow: 0 6px 20px rgba(60, 40, 20, .10);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--red); }

/* ===================== HEADER ===================== */
.site-header {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  flex: 0 0 auto;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  margin: 0;
  font-weight: 800;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-flag { color: var(--gold); font-size: 1.3em; line-height: 1; }
.header-nav { display: flex; gap: 8px; }
.nav-link {
  color: #fff;
  text-decoration: none;
  font-size: .9rem;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  transition: background .15s;
}
.nav-link:hover { background: rgba(255,255,255,.16); }

/* ===================== KHUNG TIMELINEJS ===================== */
.timeline-embed {
  flex: 1 1 auto;
  width: 100%;
  /* Chiều cao trừ header (~58) và footer (~64) */
  height: calc(100vh - 122px);
  min-height: 460px;
}

/* Một số tùy biến nhẹ cho nội dung slide do ta tự dựng */
.tl-articles-label {
  font-weight: 700;
  margin: 12px 0 4px;
}
ul.tl-articles {
  margin: 0;
  padding-left: 18px;
}
ul.tl-articles li { margin: 3px 0; }
.tl-tags {
  color: var(--ink-soft);
  font-size: .9em;
  margin: 6px 0;
}

/* Bộ sưu tập ảnh bổ sung */
.tl-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}
.tl-gallery a {
  display: block;
  width: 96px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f3efe6;
}
.tl-gallery a:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.tl-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s;
}
.tl-gallery a:hover img { transform: scale(1.06); }

/* Video YouTube */
/* Bảng thông tin triều đại */
.tl-dynasty-info {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 6px 0 10px;
  padding: 10px 12px;
  background: #fff8e6;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  font-size: .92em;
}
.tl-dynasty-info dt { font-weight: 700; color: var(--red-dark); }
.tl-dynasty-info dd { margin: 0; }
.tl-dynasty-tag {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 10px;
  font-size: .85em;
  background: #fff8e6;
  border: 1px solid var(--gold);
  border-radius: 999px;
}
@media (max-width: 600px) {
  .tl-dynasty-info { grid-template-columns: 1fr; }
}

ul.tl-videos a { text-decoration: none; }
ul.tl-videos a:hover { text-decoration: underline; }

/* Link trực quan dạng chip */
.tl-links { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tl-link-chip {
  display: inline-block;
  font-size: .85em;
  padding: 3px 10px;
  border: 1px solid var(--red);
  border-radius: 999px;
  text-decoration: none;
  color: var(--red);
  background: #fff;
}
.tl-link-chip:hover, .tl-link-chip:focus-visible { background: var(--red); color: #fff; }

/* Màu nhấn của TimelineJS theo tông đỏ (ghi đè nhẹ) */
.tl-timemarker.tl-timemarker-active .tl-timemarker-content-container,
.tl-timemarker.tl-timemarker-active .tl-timemarker-timespan-content {
  background-color: var(--red) !important;
}
.tl-timeaxis-tick .tl-timeaxis-tick-text { color: var(--ink-soft); }

/* ===================== LỖI TẢI ===================== */
.load-error {
  flex: 0 0 auto;
  margin: 0;
  padding: 16px 18px;
  text-align: center;
  color: var(--red-dark);
  background: #fdecec;
  border-top: 1px solid #f3c3c3;
  border-bottom: 1px solid #f3c3c3;
}

/* ===================== FOOTER ===================== */
.site-footer {
  flex: 0 0 auto;
  text-align: center;
  padding: 16px;
  color: var(--ink-soft);
  font-size: .82rem;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.footer-copy { margin-top: 3px; opacity: .8; }

@media (max-width: 720px) {
  .timeline-embed { height: calc(100vh - 140px); min-height: 420px; }
}
