/* DÒNG SỬ VIỆT — giao diện kiểu phòng trưng bày: nền giấy kem, chữ serif, điểm đỏ son và xanh chàm */
:root {
  --bg: #f5f1e8;
  --bg-2: #ece6d8;
  --card: #fffdf8;
  --line: #d8cfbd;
  --text: #22292d;
  --muted: #6d6a62;
  --gold: #a43b30;      /* màu nhấn chính: đỏ son */
  --red: #a43b30;
  --ink: #253c49;       /* xanh chàm: nút, chữ đậm */
  --c1: #8b6b3d; --c2: #5e7150; --c3: #a43b30; --c4: #b5762e; --c5: #3b6178; --c6: #7a4a63;
  --serif: "Noto Serif", Georgia, serif;
  --sans: "Be Vietnam Pro", system-ui, sans-serif;
  --hand: "Patrick Hand", "Noto Serif", cursive;
  --r: 4px;
  --w: 1240px;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 400; line-height: 1.18; margin: 0 0 .4em; letter-spacing: -.005em; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
::selection { background: #e7c9a8; }

/* ---------- hiệu ứng ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
main > * { animation: rise .6s var(--ease) both; }
main > *:nth-child(2) { animation-delay: .06s; } main > *:nth-child(3) { animation-delay: .12s; }
main > *:nth-child(4) { animation-delay: .18s; } main > *:nth-child(n+5) { animation-delay: .24s; }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
::view-transition-group(gmedia) { animation-duration: .45s; animation-timing-function: var(--ease); }

/* ---------- đầu trang ---------- */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 28px;
  padding: 14px max(24px, calc((100vw - var(--w)) / 2)); background: rgba(245,241,232,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 400 21px var(--serif); color: var(--text); white-space: nowrap; }
.brand-mark { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--ink); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--red); }
.top nav { display: flex; gap: 22px; margin-left: auto; }
.top nav a { text-decoration: none; padding: 4px 0; color: var(--text); font-size: 14px; border-bottom: 1.5px solid transparent; transition: border-color .2s, color .2s; }
.top nav a:hover { color: var(--red); }
.top nav a[aria-current] { color: var(--red); border-color: var(--red); }
.search input {
  width: 200px; padding: 7px 12px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: 13px var(--sans); transition: width .3s var(--ease), border-color .2s;
}
.search input:focus { border-color: var(--ink); outline: none; width: 260px; }

main { max-width: var(--w); margin: 0 auto; padding: 0 24px 96px; min-height: 70vh; }
.foot { border-top: 1px solid var(--line); padding: 36px max(24px, calc((100vw - var(--w)) / 2)); color: var(--muted); font-size: 13px; display: grid; gap: 6px; }
.foot strong { font: 400 18px var(--serif); color: var(--text); }

/* ---------- trang chủ: hero + trình chiếu ---------- */
.hero { display: grid; grid-template-columns: .8fr 1.6fr; gap: 56px; align-items: center; padding: 56px 0 48px; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(44px, 6vw, 84px); line-height: 1.04; }
.hero .sub { font: italic 21px var(--serif); color: var(--muted); margin: 6px 0 26px; }
.hero .facts { font-size: 13px; color: var(--muted); margin-top: 22px; line-height: 1.9; }
.hero .facts b { color: var(--text); font-weight: 600; }
.btns { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 2px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; text-decoration: none; font-weight: 500; font-size: 14px; transition: background .2s, transform .2s; }
.btn:hover { background: #1a2d38; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }

.slides { position: relative; }
.slide-stage { position: relative; aspect-ratio: 16/10; overflow: hidden; background: #e9e2d2; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; display: grid; grid-template-columns: 1fr 1.25fr; }
.slide.on { opacity: 1; }
.slide.on .slide-figs > * { animation: rise .8s var(--ease) both; }
.slide.on .slide-figs > *:nth-child(2) { animation-delay: .12s; } .slide.on .slide-figs > *:nth-child(3) { animation-delay: .24s; }
.slide.on .slide-bg { animation: kenburns 9s linear both; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.08); } }
.slide-bg { position: absolute; inset: 0; background: radial-gradient(120% 90% at 70% 40%, var(--sc) 0%, color-mix(in srgb, var(--sc) 55%, #1c1a17) 100%); }
.slide-bg img { width: 100%; height: 100%; object-fit: cover; }
.slide-text { position: relative; z-index: 1; padding: 34px 30px; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(90deg, rgba(0,0,0,.35), transparent); }
.slide-text small { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.slide-text h3 { font-size: 30px; margin: 6px 0 4px; }
.slide-text p { margin: 0; font-size: 14px; opacity: .9; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.slide-figs { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2%; padding: 6% 4% 0; }
.slide-figs .fig { width: 31%; aspect-ratio: 3/4; background: rgba(255,253,248,.92); box-shadow: 0 18px 40px rgba(0,0,0,.25); }
.slide-figs .fig svg, .slide-figs .fig img { width: 100%; height: 100%; object-fit: contain; }
.slide-figs .fig:nth-child(2) { transform: translateY(-6%); }
.slide-bar { height: 3px; background: var(--line); position: relative; overflow: hidden; }
.slide-bar i { position: absolute; inset: 0; background: var(--red); transform-origin: left; transform: scaleX(0); }
.slide-bar i.run { animation: grow var(--dur, 7s) linear both; }
.slide-bar i.paused { animation-play-state: paused; }
.slide-ctl { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.slide-ctl a { font: 400 19px var(--serif); text-decoration: underline; text-underline-offset: 4px; }
.slide-ctl .ctl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.slide-ctl button { border: 1px solid var(--line); background: var(--card); width: 32px; height: 30px; border-radius: 2px; color: var(--text); }
.slide-ctl button.wide { width: auto; padding: 0 12px; }
.slide-ctl button:hover { border-color: var(--ink); }

.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 64px 0 18px; }
.section-h h2 { font-size: 34px; margin: 0; }
.section-h p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- dòng thời gian uốn khúc ---------- */
.snake { position: relative; padding: 8px 28px 0 28px; --node-y: 188px; }
.s-row { position: relative; padding-bottom: 56px; }
.s-row::before { /* đường chỉ đỏ ngang */
  content: ""; position: absolute; left: 0; right: 0; top: var(--node-y); height: 2px; background: var(--red);
  transform-origin: left; transform: scaleX(0); transition: transform 1.1s var(--ease);
}
.s-row.in::before { transform: scaleX(1); }
.s-row:nth-child(even)::before { transform-origin: right; }
.s-row:not(:last-child)::after { /* khúc cua nối sang chương sau */
  content: ""; position: absolute; top: var(--node-y); height: 100%; width: 56px; border: 2px solid var(--red); opacity: 0; transition: opacity .6s .9s;
}
.s-row.in::after { opacity: 1; }
.s-row:nth-child(odd):not(:last-child)::after { right: -28px; border-left: 0; border-radius: 0 60px 60px 0; }
.s-row:nth-child(even):not(:last-child)::after { left: -28px; border-right: 0; border-radius: 60px 0 0 60px; }
.s-head { display: flex; gap: 16px; align-items: flex-start; height: 128px; }
.s-num { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font: 400 15px var(--serif); }
.s-head h3 { font-size: 24px; margin: 0; }
.s-head p { margin: 0; font-size: 13px; color: var(--muted); }
.s-head .s-links { margin-top: 6px; display: flex; gap: 14px; font-size: 13px; }
.s-head .s-links a { color: var(--ink); text-underline-offset: 3px; }
.s-track { display: flex; justify-content: space-around; gap: 8px; position: relative; z-index: 1; }
.s-row:nth-child(even) .s-track { flex-direction: row-reverse; }
.node { width: 128px; flex: none; text-align: center; text-decoration: none; background: none; border: 0; padding: 0; color: inherit; position: relative; }
.node .av { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; transition: transform .3s var(--ease), box-shadow .3s; }
.node .av svg, .node .av img { width: 150%; height: 150%; object-fit: cover; margin-top: 30%; }
.node .av.empty { background: transparent; border-style: dashed; }
.node .yr { display: inline-block; font-size: 11px; font-weight: 600; color: #fff; background: var(--nc); padding: 2px 7px; border-radius: 2px; white-space: nowrap; }
.node .dot { width: 14px; height: 14px; margin: 9px auto 9px; border-radius: 50%; background: var(--nc); border: 3px solid var(--bg); box-shadow: 0 0 0 1.5px var(--nc); transition: transform .3s var(--ease); }
.node .dot.hollow { background: var(--bg); }
.node b { display: block; font: 400 15px/1.25 var(--serif); }
.node small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.node:hover .av { transform: translateY(-4px) scale(1.06); box-shadow: 0 10px 20px rgba(0,0,0,.12); }
.node:hover .dot { transform: scale(1.35); }
.node:hover b { color: var(--red); }
.node .lane { position: absolute; top: -2px; right: 18px; font-size: 10px; background: var(--ink); color: #fff; padding: 1px 5px; border-radius: 2px; }
.s-row .node { opacity: 0; transform: translateY(10px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.s-row.in .node { opacity: 1; transform: none; }
.s-row.in .node:nth-child(2) { transition-delay: .08s; } .s-row.in .node:nth-child(3) { transition-delay: .16s; }
.s-row.in .node:nth-child(4) { transition-delay: .24s; } .s-row.in .node:nth-child(5) { transition-delay: .32s; }
.s-row.in .node:nth-child(n+6) { transition-delay: .4s; }

/* dải thời gian song song (SVG) */
details.overview { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 14px; }
details.overview summary { cursor: pointer; font: 400 20px var(--serif); list-style: none; }
details.overview summary::before { content: "＋ "; color: var(--red); }
details[open].overview summary::before { content: "－ "; }
.ov-scroll { overflow-x: auto; cursor: grab; margin-top: 12px; background: var(--card); border: 1px solid var(--line); }
.ov-scroll.drag { cursor: grabbing; }
.ov-scroll svg { display: block; }
.ov-scroll .bar { cursor: pointer; transition: opacity .15s; }
.ov-scroll .bar:hover { opacity: .8; }
.ov-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 0 4px; font-size: 12px; color: var(--muted); }
.ov-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

/* ---------- panel trượt (bấm một mốc) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(30,28,24,.28); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .35s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 94vw); background: var(--bg); z-index: 41; border-left: 1px solid var(--line);
  transform: translateX(102%); transition: transform .45s var(--ease); overflow-y: auto; padding: 28px 28px 40px; box-shadow: -20px 0 40px rgba(0,0,0,.08); }
.drawer.on { transform: none; }
.drawer .x { position: absolute; top: 14px; right: 14px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); }
.drawer .x:hover { color: var(--red); }
.drawer h2 { font-size: 32px; margin-top: 6px; }
.drawer .kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.drawer .era-yr { margin-bottom: 12px; }
.drawer .events { margin-top: 14px; }
.drawer .d-garments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 22px; }
.drawer .d-garments a { text-decoration: none; font-size: 12px; line-height: 1.3; }
.drawer .d-garments .g-media { margin-bottom: 4px; }
.drawer .lf-map { height: 220px; margin: 12px 0; }
.drawer h4 { font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 22px 0 6px; }

/* ---------- trang thời kỳ ---------- */
.crumb { margin: 30px 0 14px; font-size: 13px; color: var(--muted); }
.crumb a { text-decoration: none; color: var(--ink); }
.crumb a:hover { color: var(--red); }
.era-head { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: start; }
.era-head h1 { font-size: clamp(36px, 4.8vw, 60px); }
.era-yr { font: italic 18px var(--serif); color: var(--muted); margin-bottom: 16px; }
.era-yr a { color: var(--ink); }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 18px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }
.era-summary { font: 17px/1.75 var(--serif); }
.thumb { position: relative; overflow: hidden; background: var(--tint, #bbb); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.ph::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 140%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: repeating-radial-gradient(circle, rgba(255,255,255,.14) 0 2px, transparent 2px 14px);
  -webkit-mask: radial-gradient(circle, #000 60%, transparent 61%); mask: radial-gradient(circle, #000 60%, transparent 61%);
}
.thumb.ph::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: rgba(255,255,255,.3);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.thumb .ph-label { position: absolute; right: 12px; bottom: 10px; font: italic 13px var(--serif); color: rgba(255,255,255,.85); }
.era-head .thumb { aspect-ratio: 4/5; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; margin-top: 48px; }
.block { margin-bottom: 40px; }
.block h2 { font-size: 26px; border-top: 1px solid var(--text); padding-top: 12px; }
.events { list-style: none; margin: 0; padding: 0; position: relative; }
.events::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1.5px; background: var(--red); opacity: .5; }
.events li { position: relative; padding: 0 0 16px 30px; }
.events li::before { content: ""; position: absolute; left: 0; top: 6px; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--red); background: var(--bg); }
.events b { display: block; color: var(--red); font-size: 13px; font-weight: 600; }
.people { display: grid; gap: 8px; }
.person { display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); text-decoration: none; transition: border-color .2s, transform .2s; }
.person:hover { border-color: var(--ink); transform: translateX(3px); }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font: 400 17px var(--serif); color: #fff; }
.person small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.note { border-left: 2px solid var(--red); padding: 4px 0 4px 14px; margin-bottom: 16px; }
.note b { display: block; font-size: 11px; color: var(--red); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 2px; }
.prompt { background: var(--card); border: 1px dashed var(--line); padding: 14px; font: 12.5px/1.6 ui-monospace, Consolas, monospace; color: #4b4a45; }
.prompt-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.small-btn { padding: 6px 12px; border-radius: 2px; border: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 12px; }
.small-btn:hover { background: var(--ink); color: #fff; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; border-top: 1px solid var(--line); padding-top: 18px; }
.pager a { display: block; padding: 6px 0; text-decoration: none; }
.pager a:hover span { color: var(--red); }
.pager a.next { text-align: right; }
.pager small { color: var(--muted); display: block; font-size: 12px; }
.pager span { font: 400 20px var(--serif); transition: color .2s; }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border: 1px solid var(--text); color: var(--text); }

/* ---------- bộ sưu tập ---------- */
.g-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 48px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.g-head h1 { font-size: clamp(38px, 5vw, 60px); margin: 0; }
.g-kinds { display: flex; gap: 26px; flex-wrap: wrap; }
.g-kinds a { text-decoration: none; font: 400 19px var(--serif); color: var(--text); padding-bottom: 4px; border-bottom: 1.5px solid transparent; transition: color .2s, border-color .2s; }
.g-kinds a:hover { color: var(--red); }
.g-kinds a[aria-current] { color: var(--red); border-color: var(--red); }
.g-filter { display: flex; gap: 6px 20px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.g-filter a { text-decoration: none; color: var(--text); padding: 2px 0; border-bottom: 1.5px solid transparent; }
.g-filter a i { font-style: normal; font-family: var(--serif); color: var(--muted); margin-right: 3px; }
.g-filter a:hover { color: var(--red); }
.g-filter a[aria-current] { color: var(--red); border-color: var(--red); }
.g-sub { font-size: 12px; }
.g-count { color: var(--muted); font-size: 12px; margin: 16px 0; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 36px 22px; }
.g-card { display: block; text-decoration: none; border-top: 2px solid var(--ch, var(--red)); }
.g-media { aspect-ratio: 3/4; background: #fff; display: grid; place-items: center; overflow: hidden; }
.g-media img, .g-media svg { width: 100%; height: 100%; object-fit: contain; }
.g-card .g-media img, .g-card .g-media svg { transition: transform .5s var(--ease); }
.g-card:hover .g-media img, .g-card:hover .g-media svg { transform: scale(1.04); }
.g-info { padding: 10px 0 0; border-top: 1px solid var(--line); }
.g-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.g-row b { font: 400 15px/1.3 var(--serif); }
.g-card:hover .g-row b { color: var(--red); }
.g-row span { font-size: 11px; color: var(--muted); text-align: right; flex: none; max-width: 45%; line-height: 1.3; }
.g-info small { color: var(--red); font-size: 11px; }

.g-detail { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: start; }
.g-stage { position: relative; border-top: 2px solid var(--ch, var(--red)); }
.g-stage .g-media { aspect-ratio: auto; height: min(80vh, 780px); view-transition-name: gmedia; }
.g-ph-note { position: absolute; left: 12px; bottom: 10px; font-size: 11px; color: #9a9384; }
.g-side h1 { font-size: clamp(36px, 4.6vw, 58px); }
.g-side .era-yr { margin-bottom: 6px; }
.g-sub-line { color: var(--muted); margin-bottom: 12px; }
.g-side .tag { margin-top: 6px; }
.seg { display: flex; border: 1px solid var(--text); margin: 22px 0 6px; width: max-content; }
.seg a, .seg span { padding: 8px 18px; font-size: 13px; text-decoration: none; color: var(--text); border-right: 1px solid var(--text); }
.seg > :last-child { border-right: 0; }
.seg a[aria-current] { background: var(--red); color: #fff; }
.seg .off { opacity: .4; cursor: not-allowed; }
.pair { display: block; margin: 12px 0 0; font-size: 13px; color: var(--muted); text-decoration: none; }
.pair:hover { color: var(--red); }
.pair b { color: var(--ink); font-weight: 600; }
.g-h3 { font: 600 12px var(--sans); margin: 28px 0 10px; color: var(--text); text-transform: uppercase; letter-spacing: .1em; }
.g-details { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.g-details figure { margin: 0; border: 1px solid var(--line); background: var(--card); overflow: hidden; }
.g-details img { aspect-ratio: 4/3; object-fit: cover; width: 100%; background: #fff; }
.g-dph { aspect-ratio: 4/3; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--t) 22%, #fff) 0 10px, color-mix(in srgb, var(--t) 34%, #fff) 10px 20px); }
.g-details figcaption { padding: 6px 10px; font-size: 12px; border-top: 1px solid var(--line); }
.g-lead { font: italic 17px var(--serif); }
.g-parts { display: grid; grid-template-columns: 140px 1fr; margin: 0; }
.g-parts dt, .g-parts dd { padding: 12px 0; border-top: 1px solid var(--line); margin: 0; }
.g-parts dt { font-weight: 600; font-size: 13px; color: var(--ink); padding-right: 14px; }
.g-parts dd { font: 15px/1.7 var(--serif); }
.g-ai { background: var(--bg-2); padding: 12px 14px; font-size: 13px; color: var(--muted); margin-top: 16px; }
.g-ai b { color: var(--text); }
.g-desc h4 { margin: 20px 0 6px; font: 600 13px var(--sans); }
.g-src { margin: 0; padding-left: 18px; font-size: 12px; color: var(--muted); }

/* ô cận cảnh cắt từ ảnh chính, hộp phóng to, toàn bảng */
.crop { position: relative; overflow: hidden; background: #fff; aspect-ratio: 4/3; max-height: 220px; width: 100%; }
.crop img { position: absolute; max-width: none; object-fit: cover; }
.crop img.own { position: static; width: 100%; height: 100%; }
.g-details figure { cursor: zoom-in; transition: border-color .2s, transform .2s; }
.g-details figure:hover { border-color: var(--ink); transform: translateY(-2px); }
.g-details .crop { aspect-ratio: auto; height: 150px; max-height: none; }
.g-details .crop img { transition: transform .5s var(--ease); }
.g-details figure:hover .crop img { transform: scale(1.06); }
.g-h3 small { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.zoomable { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(28,26,22,.86); display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .3s; cursor: zoom-out; padding: 24px; }
.lightbox.on { opacity: 1; pointer-events: auto; }
.lightbox figure { margin: 0; max-width: min(1000px, 94vw); transform: scale(.96); transition: transform .35s var(--ease); }
.lightbox.on figure { transform: none; }
.lightbox .crop { height: min(78vh, 760px); width: auto; max-height: none; margin: 0 auto; }
.lightbox .lb-full img { max-height: 84vh; width: auto; margin: 0 auto; background: #fff; }
.lightbox figcaption { color: #fff; text-align: center; margin-top: 12px; font: 400 18px var(--serif); }
.lightbox figcaption span { font: 12px var(--sans); opacity: .6; }
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: #fff; border: 1px solid var(--line); min-height: min(80vh, 780px); }
.board-main .g-media { height: 100%; aspect-ratio: auto; }
.board-side { padding: 22px 20px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; position: relative; }
.board-side small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.board-side h3 { font-size: 26px; margin: 0; }
.board-crops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.board-crops figure { margin: 0; border: 1px solid var(--line); }
.board-crops .crop { aspect-ratio: auto; height: 110px; }
.board-crops figcaption { font-size: 11px; padding: 4px 6px; }
.board-notes { margin: 4px 0 0; padding-left: 16px; font: 13px/1.55 var(--serif); }
.board-notes li { margin-bottom: 6px; }
.board-brand { margin-top: auto; align-self: flex-end; font: italic 13px var(--serif); color: var(--red); }

/* cờ */
.flags { display: grid; gap: 14px; }
.flag { margin: 0; display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.flag img { width: 96px; aspect-ratio: 3/2; object-fit: cover; border: 1px solid var(--line); }
.flag b { display: block; font: 400 16px var(--serif); }
.flag small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.flag span { display: block; font-size: 13px; line-height: 1.55; }
.flag a { font-size: 11px; color: var(--muted); }

/* ---------- bản đồ, đối chiếu ---------- */
.lf-map { height: 300px; border: 1px solid var(--line); background: var(--bg-2); z-index: 1; }
.lf-big { height: 64vh; margin-top: 16px; }
.lf-map .leaflet-tile-pane { filter: sepia(.5) saturate(.7) brightness(1.02); }
.map-note { font-size: 12px; color: var(--muted); }
.map-note a { color: var(--ink); }
.leaflet-popup-content a { color: var(--red); }
.map-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-top: 26px; font-size: 13px; }
.map-list a { color: var(--ink); text-decoration: none; }
.map-list a:hover { color: var(--red); }
.map-list span { color: var(--muted); font-size: 11px; }
.map-list ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.cmp-col { border-top: 2px solid var(--ch); padding-top: 14px; }
.cmp-col select { width: 100%; padding: 9px 12px; background: var(--card); color: var(--text); border: 1px solid var(--line); font: 13px var(--sans); margin-bottom: 14px; }
.cmp-media .g-media { aspect-ratio: 3/4; max-height: 540px; margin: 0 auto 14px; }
.cmp-col h2 { font-size: 30px; margin-bottom: 2px; }
.cmp-col h2 a { text-decoration: none; }

/* ---------- lãnh thổ qua các thời kỳ ---------- */
.t-sub { color: var(--muted); margin: 4px 0 0; font-size: 13px; max-width: 46em; }
.terr { display: grid; grid-template-columns: 1fr 380px; gap: 44px; align-items: start; }
.terr-map { position: relative; height: min(74vh, 720px); border: 1px solid var(--line); background: #a7b4b8; z-index: 1; }
.terr-map .leaflet-tile-pane { filter: sepia(.35) saturate(.8); }
.t-year { position: absolute; right: 18px; bottom: 12px; z-index: 500; font: 400 44px var(--hand); color: #1f2a30; text-shadow: 0 0 6px rgba(255,255,255,.8); pointer-events: none; }
.leaflet-tooltip.t-lbl { background: transparent; border: 0; box-shadow: none; font: 600 13px var(--serif); color: #1f2a30; text-transform: uppercase; letter-spacing: .06em; text-shadow: 0 0 4px #fff, 0 0 8px #fff; padding: 0; }
.leaflet-tooltip.t-lbl::before { display: none; }
.leaflet-tooltip.t-lbl.small { font-size: 11px; text-transform: none; letter-spacing: 0; }
.leaflet-interactive { transition: fill .6s ease, fill-opacity .6s ease; }
.t-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; margin-top: 10px; }
.t-legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.2); }
.t-note { font-size: 11px; color: var(--muted); margin: 6px 0 10px; }
.t-ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.t-ctl button { border: 1px solid var(--text); background: var(--card); padding: 6px 14px; border-radius: 99px; font-size: 13px; color: var(--text); }
.t-ctl button.pri { background: var(--red); border-color: var(--red); color: #fff; }
.t-ctl #t-pos { font-size: 13px; color: var(--muted); }
.t-ctl #t-pos b { color: var(--red); font: 400 18px var(--hand); }
.t-ctl input[type=range] { flex: 1; min-width: 160px; accent-color: var(--red); }
.t-card { margin-top: 16px; background: #f1e6da; border-left: 3px solid var(--red); padding: 16px 20px; animation: rise .45s var(--ease); }
.t-card small { color: var(--red); font: 20px var(--hand); }
.t-card h3 { font-size: 24px; margin: 2px 0 6px; }
.t-card p { font: 15px/1.75 var(--serif); margin: 0 0 12px; max-width: 46em; }
.t-list { list-style: none; margin: 0; padding: 4px 6px 4px 0; max-height: min(92vh, 900px); overflow-y: auto; position: sticky; top: 80px; }
.t-list li { position: relative; padding-left: 34px; }
.t-list li::after { content: ""; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px; background: var(--red); opacity: .55; }
.t-list li:first-child::after { top: 16px; } .t-list li:last-child::after { bottom: calc(100% - 16px); }
.t-list li::before { content: ""; position: absolute; left: 7px; top: 11px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--red); background: var(--bg); z-index: 1; box-sizing: border-box; }
.t-list button { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: baseline; width: 100%; text-align: left; border: 0; background: none; padding: 7px 12px; font: 400 14px/1.4 var(--serif); color: var(--text); border-radius: 3px; transition: background .2s; }
.t-list button span { color: var(--red); font: 16px var(--hand); }
.t-list button:hover { background: var(--bg-2); }
.t-list button.on { background: #f1e1d6; }
.t-list li:has(button.on)::before { background: var(--red); }
@media (max-width: 900px) { .terr { grid-template-columns: 1fr; } .t-list { position: static; max-height: 320px; } .terr-map { height: 60vh; } }

/* ---------- nhân vật / tìm kiếm / khác ---------- */
.filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.chip { padding: 5px 12px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 12px; border-radius: 2px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.results { padding-left: 18px; }
.results li { margin-bottom: 14px; }
.results a { color: var(--ink); }
mark { background: #f0d9b5; color: inherit; padding: 0 2px; }
.prose { max-width: 760px; }
.prose p, .prose li { font: 16px/1.8 var(--serif); }
.prose h2 { margin-top: 36px; font-size: 26px; }
.empty { color: var(--muted); padding: 40px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; font-size: 13px; z-index: 60; animation: rise .3s var(--ease); }

/* ---------- điện thoại ---------- */
@media (max-width: 900px) {
  .top { flex-wrap: wrap; gap: 10px 18px; }
  .top nav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
  .search { margin-left: auto; }
  .search input, .search input:focus { width: 150px; }
  .hero, .era-head, .grid2, .g-detail, .cmp, .board { grid-template-columns: 1fr; }
  .board-side { border-left: 0; border-top: 1px solid var(--line); }
  .hero { padding-top: 32px; gap: 28px; }
  .slide { grid-template-columns: 1fr; }
  .slide-text { order: 2; padding: 18px; background: linear-gradient(0deg, rgba(0,0,0,.55), transparent); position: absolute; inset: auto 0 0 0; }
  .slide-figs { padding-top: 4%; align-items: flex-start; }
  .slide-stage { aspect-ratio: 4/5; }
  .snake { padding: 0; --node-y: 168px; }
  .s-row::after, .s-row::before { display: none; }
  .s-track { position: relative; }
  .s-track::before { content: ""; position: absolute; left: 0; right: 0; top: 103px; height: 2px; background: var(--red); min-width: 100%; }
  .s-head { height: auto; min-height: 96px; }
  .s-track { overflow-x: auto; justify-content: flex-start; padding-bottom: 6px; }
  .s-row:nth-child(even) .s-track { flex-direction: row; }
  .node { width: 108px; }
  .era-head .thumb { aspect-ratio: 16/10; }
  .g-stage .g-media { height: 64vh; }
  .g-grid { grid-template-columns: repeat(2, 1fr); gap: 24px 12px; }
  .g-parts { grid-template-columns: 1fr; }
  .g-parts dd { border-top: 0; padding-top: 0; }
  .pager { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal, .s-row .node { opacity: 1; transform: none; }
  .s-row::before { transform: none; }
}

.foot-note { font: italic 14px/1.7 var(--serif); color: var(--text); max-width: 60em; border-left: 2px solid var(--red); padding-left: 12px; margin: 6px 0; }
.foot-credit { font: 15px/1.7 var(--serif); color: var(--muted); margin: 8px 0 0; }
.foot-credit b { color: var(--red); font-weight: 600; }
.foot-credit { display: flex; align-items: center; gap: 12px; }
.foot-logo { width: 40px; height: auto; flex: none; }
.flag em { display: inline-block; font-style: normal; font-size: 11px; padding: 1px 7px; margin-bottom: 4px; border-radius: 2px; }
.flag em.recon { background: #f3e3c2; color: #8a5a1a; }
.flag em.doc { background: #dfe9dc; color: #3a6a3a; }
